d2lod.inc
Original include source with line numbers.
| 1 | // Diablo II LoD Include File // |
| 2 | #if defined _diablo2LOD_included |
| 3 | #endinput |
| 4 | #endif |
| 5 | #define _diablo2LOD_included |
| 6 | |
| 7 | #define MAX_P_SKILLS 20 |
| 8 | |
| 9 | // Gets the max skills are loaded |
| 10 | native MAX_SKILLS_ACTIVE(); |
| 11 | // Gets the max items are loaded |
| 12 | native MAX_ITEMS_ACTIVE(); |
| 13 | |
| 14 | // Hero class values |
| 15 | enum |
| 16 | { |
| 17 | AMAZON = 0, |
| 18 | ASSASSIN, |
| 19 | NECROMANCER, |
| 20 | BARBARIAN, |
| 21 | PALADIN, |
| 22 | DRUID, |
| 23 | SORCERESS |
| 24 | } |
| 25 | |
| 26 | // Log type values |
| 27 | enum |
| 28 | { |
| 29 | UNLOGGED = 0, |
| 30 | LOGGED |
| 31 | } |
| 32 | |
| 33 | // Display value, while selecting skill 'E' button. |
| 34 | enum |
| 35 | { |
| 36 | NOT_DISPLAY = 0, |
| 37 | DISPLAY |
| 38 | } |
| 39 | |
| 40 | // Item types |
| 41 | enum |
| 42 | { |
| 43 | TYPE_GLOVES = 0, |
| 44 | TYPE_BOOTS, |
| 45 | TYPE_BELT, |
| 46 | TYPE_ARMOR, |
| 47 | TYPE_HELM, |
| 48 | TYPE_SHIELD, |
| 49 | TYPE_WEAPON, |
| 50 | TYPE_RING, |
| 51 | TYPE_AMULET, |
| 52 | TYPE_BOLTS |
| 53 | } |
| 54 | |
| 55 | // Called when you pressed E button and selected the skill. |
| 56 | forward d2_skill_selected(id, skill_id); |
| 57 | |
| 58 | // Called when you fired a skill, bind t +skills. |
| 59 | forward d2_skill_fired(id); |
| 60 | |
| 61 | // Called when player gets damaged, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done. |
| 62 | forward d2_takedamage(victim, attacker, Float:iDamage[1]); |
| 63 | |
| 64 | // Called when player gets damaged by skill, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done. |
| 65 | forward d2_skill_takedamage(victim, attacker, Float:iDamage[1]); |
| 66 | |
| 67 | // Called when player gets damaged by weapon with poison, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done. |
| 68 | forward d2_dagger_poisondamage(victim, attacker, Float:iDamage[1]); |
| 69 | |
| 70 | // Called when player gets damaged by RANGED attack, 1-st parameter is victim, 2-nd is attacker, 3-rd is Array parameter means damage done. |
| 71 | forward d2_ranged_takedamage(victim, attacker, Float:iDamage[1]); |
| 72 | |
| 73 | // Called when player successfully fires arrow, 1-st parameter is playerid, 2-nd is entityid. |
| 74 | forward d2_ranged_actshoot(id, entity); |
| 75 | |
| 76 | // Called when the player is logged/unlogged. |
| 77 | forward d2_logged(id, log_type); |
| 78 | |
| 79 | // Gets the player's current speed. |
| 80 | native Float:get_current_speed(id); |
| 81 | |
| 82 | // if is player logged/unlogged. |
| 83 | native get_player_logged(id); |
| 84 | |
| 85 | // Gets player's max health. |
| 86 | native get_p_maxhealth(id); |
| 87 | |
| 88 | // Sets player's max health. |
| 89 | native set_p_maxhealth(id, value); |
| 90 | |
| 91 | // Sets player xp with X value. |
| 92 | native set_p_xp(id, value); |
| 93 | |
| 94 | // Gets player xp. |
| 95 | native get_p_xp(id); |
| 96 | |
| 97 | // Gets player current hero. |
| 98 | native get_p_hero(id); |
| 99 | |
| 100 | // Gets player level. |
| 101 | native get_p_level(id); |
| 102 | |
| 103 | // Sets player current mana. |
| 104 | native set_p_mana(id, value); |
| 105 | |
| 106 | // Gets player current mana. |
| 107 | native get_p_mana(id); |
| 108 | |
| 109 | // Gets player vitality. |
| 110 | native get_p_vitality(id); |
| 111 | |
| 112 | // Sets player vitality. |
| 113 | native set_p_vitality(id, value); |
| 114 | |
| 115 | // Sets player gold. |
| 116 | native set_p_gold(id, value); |
| 117 | |
| 118 | // Sets player inventory gold. |
| 119 | native set_p_gold_inventory(id, value); |
| 120 | |
| 121 | // Gets player gold. |
| 122 | native get_p_gold(id); |
| 123 | |
| 124 | // Gets player inventory gold. |
| 125 | native get_p_gold_inventory(id); |
| 126 | |
| 127 | // Gets player skill's value. |
| 128 | native get_p_skill(id, skill_id); |
| 129 | |
| 130 | // Resets player model to custom. |
| 131 | native reset_p_model(id); |
| 132 | |
| 133 | // Gets player's current item count. |
| 134 | native get_p_item_count(id, item_id); |
| 135 | |
| 136 | // If is player wear item returns true. |
| 137 | native get_p_item_is_worn(id, item_id); |
| 138 | |
| 139 | // Gets if player wears any item with specified type |
| 140 | native bool:get_p_item_wear_type(id, type); |
| 141 | |
| 142 | // Gets if player wears any item with specified data type |
| 143 | native bool:get_p_item_data(id, data); |
| 144 | |
| 145 | // Gets if player is in safe zone ( Near Akara, Charsi, Inventory ). |
| 146 | native bool:get_p_in_safezone(id); |
| 147 | |
| 148 | // Gets if is player protected, if spawn protection time passed. |
| 149 | native bool:is_p_protected(id); |
| 150 | |
| 151 | // Checks if is a freezetime. |
| 152 | native is_freezetime(); |
| 153 | |
| 154 | // Checks if is player near monster |
| 155 | native bool:IsPlayerNearByMonster(id); |
| 156 | |
| 157 | // Damages a player, 1-st parameter is victim, 2-nd is attacker, 3-rd is damage , 4-th is weapon type string. |
| 158 | native dmg_kill_player(id, attacker, Float:damage, weaponDescription[]) |
| 159 | |
| 160 | // Drops coins from give id/victim with specified classname and gold value stored in entity. |
| 161 | native drop_coins(victim, classname[], goldvalue); |
| 162 | |
| 163 | // Sets user model. |
| 164 | native set_user_model(id, const model[]); |
| 165 | |
| 166 | stock find_itemplugin() |
| 167 | { |
| 168 | for(new i = 0; i < get_pluginsnum(); ++i) |
| 169 | { |
| 170 | new temp[2], name[64] |
| 171 | get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 172 | if(equali(name, "diablo2LOD.amxx")) |
| 173 | { |
| 174 | return i; |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | return -1; |
| 179 | } |
| 180 | |
| 181 | stock find_itemindex() |
| 182 | { |
| 183 | new temp[2], name[64], pluginname[64] |
| 184 | get_plugin(-1, pluginname, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 185 | for (new i = 0; i < get_pluginsnum(); ++i) |
| 186 | { |
| 187 | get_plugin(i, name, 63, temp, 1, temp, 1, temp, 1, temp, 1) |
| 188 | if(equal(name, pluginname)) |
| 189 | { |
| 190 | return i |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | return -1 |
| 195 | } |
| 196 | stock register_d2_skill(skill_name[], skill_desc[], skill_hero, skill_level, skill_display) |
| 197 | { |
| 198 | new SkillId = find_itemindex() |
| 199 | new SkillPlugin = find_itemplugin() |
| 200 | new SkillRegFunc = get_func_id("register_skill", SkillPlugin) |
| 201 | |
| 202 | new temp = callfunc_begin_i(SkillRegFunc, SkillPlugin) |
| 203 | if(temp == -1 || temp == -2) |
| 204 | { |
| 205 | log_amx("Plugin not found or function is not executable!") |
| 206 | return PLUGIN_HANDLED; |
| 207 | } |
| 208 | |
| 209 | callfunc_push_int(SkillId) |
| 210 | callfunc_push_str(skill_name) |
| 211 | callfunc_push_str(skill_desc) |
| 212 | callfunc_push_int(skill_hero) |
| 213 | callfunc_push_int(skill_level) |
| 214 | callfunc_push_int(skill_display) |
| 215 | |
| 216 | temp = callfunc_end() |
| 217 | if(temp == -1 || temp == -2) |
| 218 | { |
| 219 | return PLUGIN_HANDLED; |
| 220 | } |
| 221 | |
| 222 | return temp; |
| 223 | } |
| 224 | stock client_printcolor(const id, const input[], any:...) |
| 225 | { |
| 226 | new count = 1, players[32]; |
| 227 | |
| 228 | static msg[191]; |
| 229 | vformat(msg,190,input,3); |
| 230 | |
| 231 | replace_all(msg,190,"/g","^4");// green txt |
| 232 | replace_all(msg,190,"/y","^1");// orange txt |
| 233 | replace_all(msg,190,"/ctr","^3");// team txt |
| 234 | |
| 235 | if (id) players[0] = id; |
| 236 | else get_players(players,count,"ch"); |
| 237 | |
| 238 | for (new i=0;i<count;i++) |
| 239 | { |
| 240 | if (is_user_connected(players[i])) |
| 241 | { |
| 242 | message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]); |
| 243 | write_byte(players[i]); |
| 244 | write_string(msg); |
| 245 | message_end(); |
| 246 | } |
| 247 | } |
| 248 | } |