Требование: PHP => 5.3, часть 2
[cswow.git] / include / spell_data.php
blob544c1d6e117c73df7164e161c275499e0955ae4d
1 <?php
2 include_once("functions.php");
4 $gSpellEffect = array(
5 '0'=>'None',
6 '1'=>'Instakill',
7 '2'=>'School damage',
8 '3'=>'Dummy',
9 '4'=>'Portal teleport',
10 '5'=>'Teleport units',
11 '6'=>'Apply aura',
12 '7'=>'Environmental damage',
13 '8'=>'Power drain',
14 '9'=>'Health leech',
15 '10'=>'Heal',
16 '11'=>'Bind',
17 '12'=>'Portal',
18 '13'=>'Ritual base',
19 '14'=>'Ritual specialize',
20 '15'=>'Ritual activate portal',
21 '16'=>'Quest complete',
22 '17'=>'Weapon damage noschool',
23 '18'=>'Resurrect',
24 '19'=>'Add extra attacks',
25 '20'=>'Dodge',
26 '21'=>'Evade',
27 '22'=>'Parry',
28 '23'=>'Block',
29 '24'=>'Create item',
30 '25'=>'Weapon',
31 '26'=>'Defense',
32 '27'=>'Persistent area aura',
33 '28'=>'Summon',
34 '29'=>'Leap',
35 '30'=>'Energize',
36 '31'=>'Weapon percent damage',
37 '32'=>'Trigger missile',
38 '33'=>'Open lock',
39 '34'=>'Summon change item',
40 '35'=>'Apply area aura party',
41 '36'=>'Learn spell',
42 '37'=>'Spell defense',
43 '38'=>'Dispel',
44 '39'=>'Language',
45 '40'=>'Dual wield',
46 '41'=>'Jump',
47 '42'=>'Jump2',
48 '43'=>'Teleport units face caster',
49 '44'=>'Skill step',
50 '45'=>'Add honor',
51 '46'=>'Spawn',
52 '47'=>'Trade skill',
53 '48'=>'Stealth',
54 '49'=>'Detect',
55 '50'=>'Trans door',
56 '51'=>'Force critical hit',
57 '52'=>'Guarantee hit',
58 '53'=>'Enchant item',
59 '54'=>'Enchant item temporary',
60 '55'=>'Tamecreature',
61 '56'=>'Summon pet',
62 '57'=>'Learn pet spell',
63 '58'=>'Weapon damage',
64 '59'=>'Open lock item',
65 '60'=>'Proficiency',
66 '61'=>'Send event',
67 '62'=>'Power burn',
68 '63'=>'Threat',
69 '64'=>'Trigger spell',
70 '65'=>'Apply area aura raid',
71 '66'=>'Create mana gem',
72 '67'=>'Heal max health',
73 '68'=>'Interrupt cast',
74 '69'=>'Distract',
75 '70'=>'Pull',
76 '71'=>'Pickpocket',
77 '72'=>'Add farsight',
78 '73'=>'Untrain talents',
79 '74'=>'Apply glyph',
80 '75'=>'Heal mechanical',
81 '76'=>'Summon object wild',
82 '77'=>'Script effect',
83 '78'=>'Attack',
84 '79'=>'Sanctuary',
85 '80'=>'Add combo points',
86 '81'=>'Create house',
87 '82'=>'Bind sight',
88 '83'=>'Duel',
89 '84'=>'Stuck',
90 '85'=>'Summon player',
91 '86'=>'Activate object',
92 '87'=>'Wmo damage',
93 '88'=>'Wmo repair',
94 '89'=>'Wmo change',
95 '90'=>'Kill credit',
96 '91'=>'Threat all',
97 '92'=>'Enchant held item',
98 '93'=>'Summon phantasm',
99 '94'=>'Self resurrect',
100 '95'=>'Skinning',
101 '96'=>'Charge',
102 '97'=>'Summon all totems',
103 '98'=>'Knock back',
104 '99'=>'Disenchant',
105 '100'=>'Inebriate',
106 '101'=>'Feed pet',
107 '102'=>'Dismiss pet',
108 '103'=>'Reputation',
109 '104'=>'Summon object slot1',
110 '105'=>'Summon object slot2',
111 '106'=>'Summon object slot3',
112 '107'=>'Summon object slot4',
113 '108'=>'Dispel mechanic',
114 '109'=>'Summon dead pet',
115 '110'=>'Destroy all totems',
116 '111'=>'Durability damage',
117 '112'=>'SPELL_EFFECT_112',
118 '113'=>'Resurrect new',
119 '114'=>'Attack me',
120 '115'=>'Durability damage pct',
121 '116'=>'Skin player corpse',
122 '117'=>'Spirit heal',
123 '118'=>'Skill',
124 '119'=>'Apply area aura pet',
125 '120'=>'Teleport graveyard',
126 '121'=>'Normalized weapon dmg',
127 '122'=>'SPELL_EFFECT_122',
128 '123'=>'Send taxi',
129 '124'=>'Player pull',
130 '125'=>'Modify threat percent',
131 '126'=>'Steal beneficial buff',
132 '127'=>'Prospecting',
133 '128'=>'Apply area aura friend',
134 '129'=>'Apply area aura enemy',
135 '130'=>'Redirect threat',
136 '131'=>'Play sound',
137 '132'=>'Play music',
138 '133'=>'Unlearn specialization',
139 '134'=>'Kill credit',
140 '135'=>'Call pet',
141 '136'=>'Heal pct',
142 '137'=>'Energize pct',
143 '138'=>'Leap back',
144 '139'=>'Clear quest',
145 '140'=>'Force cast',
146 '141'=>'Force cast',
147 '142'=>'Trigger spell with value',
148 '143'=>'Apply area aura owner',
149 '144'=>'Knockback from position',
150 '145'=>'Gravity Pull',
151 '146'=>'Activate rune',
152 '147'=>'Quest fail',
153 '148'=>'SPELL_EFFECT_148',
154 '149'=>'Charge 2',
155 '150'=>'Quest offer',
156 '151'=>'Trigger spell 2',
157 '152'=>'SPELL_EFFECT_152',
158 '153'=>'Create pet',
159 '154'=>'Unused',
160 '155'=>'Titan grip',
161 '156'=>'Enchant item prismatic',
162 '157'=>'Create item 2',
163 '158'=>'Milling',
164 '159'=>'Allow rename pet',
165 '160'=>'SPELL_EFFECT_160',
166 '161'=>'Learn a Talent Specialization',
167 '162'=>'Activate Spec',
168 '163'=>'SPELL_EFFECT_163',
169 '164'=>'Cancel aura'
172 $gSpellAuraName = array(
173 '0'=>"None",
174 '1'=>"Bind Sight",
175 '2'=>"Mod Possess",
176 '3'=>"Periodic Damage",
177 '4'=>"Dummy",
178 '5'=>"Confuse",
179 '6'=>"Charm",
180 '7'=>"Fear",
181 '8'=>"Periodic Heal",
182 '9'=>"Mod Attack Speed",
183 '10'=>"Mod Threat",
184 '11'=>"Taunt",
185 '12'=>"Stun",
186 '13'=>"Mod Damage Done",
187 '14'=>"Mod Damage Taken",
188 '15'=>"Damage shield",
189 '16'=>"Stealth",
190 '17'=>"Stealth Detection",
191 '18'=>"Invisibilily",
192 '19'=>"Invisibilily Detection",
193 '20'=>"Periodic Regenerate % of Total Health",
194 '21'=>"Periodic Regenerate % of Total Mana",
195 '22'=>"Mod Resistance",
196 '23'=>"Periodic Trigger Spell",
197 '24'=>"Perioic Energize",
198 '25'=>"Pacify",
199 '26'=>"Root",
200 '27'=>"Silence",
201 '28'=>"Chance to Reflect harmful Spells",
202 '29'=>"Mod Stat",
203 '30'=>"Mod Skill",
204 '31'=>"Increase Speed",
205 '32'=>"Increase Mounted Speed",
206 '33'=>"Decrease Speed",
207 '34'=>"Mod Maximum Health",
208 '35'=>"Mod Maximum Power",
209 '36'=>"Snapeshift",
210 '37'=>"Immune Effect ",
211 '38'=>"Immune State",
212 '39'=>"Immune School",
213 '40'=>"Immune Damage",
214 '41'=>"Immune Dispel",
215 '42'=>"Proc Trigger Spell",
216 '43'=>"Proc Trigger Damage",
217 '44'=>"Track Creatures",
218 '45'=>"Track Resources",
219 '46'=>"Mod Parry Skill",
220 '47'=>"Mod Parry %",
221 '48'=>"Mod Dodge Skill",
222 '49'=>"Mod Dodge %",
223 '50'=>"Mod Block Skill",
224 '51'=>"Mod Block %",
225 '52'=>"Mod Crit %",
226 '53'=>"Periodic Leech",
227 '54'=>"Mod Melee/Ranged Hit Chance",
228 '55'=>"Mod Spell Hit Chance",
229 '56'=>"Transform",
230 '57'=>"Mod Spell Crit Chance",
231 '58'=>"Increase Swim Speed",
232 '59'=>"Mod Melee/Spell Damage Versus",
233 '60'=>"Pacify and Silence",
234 '61'=>"Scale",
235 '62'=>"Periodic Health Funnel",
236 '63'=>"Periodic Power Funnel",
237 '64'=>"Periodic Power Leech",
238 '65'=>"Haste - Spells",
239 '66'=>"Feign Death",
240 '67'=>"Disarm",
241 '68'=>"Stalked",
242 '69'=>"Absorbs Damage for School",
243 '70'=>"EXTRA_ATTACKS",
244 '71'=>"Mod Spell Crit",
245 '72'=>"Mod Power Cost %",
246 '73'=>"Mod Power Cost",
247 '74'=>"Reflect Spells",
248 '75'=>"Laungage",
249 '76'=>"Far Sight",
250 '77'=>"Mechanic Immunity",
251 '78'=>"Mounted",
252 '79'=>"Mod Damage Done %",
253 '80'=>"Mod Stat %",
254 '81'=>"Split Damage %",
255 '82'=>"Underwater Breathing",
256 '83'=>"Mod Base Resistance",
257 '84'=>"Health Regen",
258 '85'=>"Power Regen",
259 '86'=>"Create Item on Victim Death",
260 '87'=>"Mod Damage Taken %",
261 '88'=>"Mod Health Regen %",
262 '89'=>"Periodic Damage % Total Health",
263 '90'=>"Mod Resist Chance",
264 '91'=>"Mod Detect Range",
265 '92'=>"Cannot Flee",
266 '93'=>"Unattackable",
267 '94'=>"INTERRUPT_REGEN",
268 '95'=>"Ghost",
269 '96'=>"Magnet",
270 '97'=>"Mana Shield",
271 '98'=>"Mod Skill",
272 '99'=>"Mod Melee Attack Power",
273 '100'=>"AURAS_VISIBLE",
274 '101'=>"Mod Resistance %",
275 '102'=>"Mod Melee Attack Power Versus",
276 '103'=>"Mod Threat",
277 '104'=>"Water Walk",
278 '105'=>"FEATHER_FALL",
279 '106'=>"Hower",
280 '107'=>"Add Flat Modifier",
281 '108'=>"Add % Modifier",
282 '109'=>"Add Cast on Target Trigger",
283 '110'=>"Mod Power Regeneration %",
284 '111'=>"Redirect % Damage to Caster",
285 '112'=>"Override Class Scripts",
286 '113'=>"Mod Ranged Damage Taken",
287 '114'=>"Mod Ranged Damage Taken %",
288 '115'=>"Mod Healing Taken",
289 '116'=>"Allow % of Health Regeneration to Continue in Combat",
290 '117'=>"Give % Chance to Resist Mechanic",
291 '118'=>"Mod Healing Taken %",
292 '119'=>"SHARE_PET_TRACKING",
293 '120'=>"UNTRACKABLE",
294 '121'=>"EMPATHY",
295 '122'=>"Mod Offhand Damage %",
296 '123'=>"Mod Target Resistance",
297 '124'=>"Mod Ranged Attack Power",
298 '125'=>"Mod Melee Damage Taken",
299 '126'=>"Mod Melee Damage Taken %",
300 '127'=>"Mod Attacker Ranged Attack Power",
301 '128'=>"MOD_POSSESS_PET",
302 '129'=>"MOD_SPEED_ALWAYS",
303 '130'=>"MOD_MOUNTED_SPEED_ALWAYS",
304 '131'=>"Mod Ranged Attack Power Versus",
305 '132'=>"Mod Maximum Energy %",
306 '133'=>"Mod Maximum Health %",
307 '134'=>"MOD_MANA_REGEN_INTERRUPT",
308 '135'=>"Mod Healing Done",
309 '136'=>"Mod Healing Done %",
310 '137'=>"Mod Total Stat %",
311 '138'=>"Haste Melee/Ranged",
312 '139'=>"Force Reaction",
313 '140'=>"Haste Ranged",
314 '141'=>"Haste Ranged (Ammo)",
315 '142'=>"MOD_BASE_RESISTANCE_PCT",
316 '143'=>"MOD_RESISTANCE_EXCLUSIVE",
317 '144'=>"Safe Fall",
318 '145'=>"Charisma",
319 '146'=>"Persuaded",
320 '147'=>"ADD_CREATURE_IMMUNITY",
321 '148'=>"Retain Combo Points",
322 '149'=>"RESIST_PUSHBACK",
323 '150'=>"MOD_SHIELD_BLOCKVALUE_PCT",
324 '151'=>"TRACK_STEALTHED",
325 '152'=>"MOD_DETECTED_RANGE",
326 '153'=>"SPLIT_DAMAGE_FLAT",
327 '154'=>"MOD_STEALTH_LEVEL",
328 '155'=>"MOD_WATER_BREATHING",
329 '156'=>"Mod Reputation Gained %",
330 '157'=>"PET_DAMAGE_MULTI",
331 '158'=>"MOD_SHIELD_BLOCKVALUE",
332 '159'=>"NO_PVP_CREDIT",
333 '160'=>"MOD_AOE_AVOIDANCE",
334 '161'=>"MOD_HEALTH_REGEN_IN_COMBAT",
335 '162'=>"POWER_BURN_MANA",
336 '163'=>"MOD_CRIT_DAMAGE_BONUS_MELEE",
337 '164'=>"164",
338 '165'=>"MELEE_ATTACK_POWER_ATTACKER_BONUS",
339 '166'=>"MOD_ATTACK_POWER_PCT",
340 '167'=>"MOD_RANGED_ATTACK_POWER_PCT",
341 '168'=>"Mod Damage Done Versus %",
342 '169'=>"Mod Crit Damage Versus %",
343 '170'=>"DETECT_AMORE",
344 '171'=>"MOD_SPEED_NOT_STACK",
345 '172'=>"MOD_MOUNTED_SPEED_NOT_STACK",
346 '173'=>"ALLOW_CHAMPION_SPELLS",
347 '174'=>"MOD_SPELL_DAMAGE_OF_STAT_PERCENT",
348 '175'=>"MOD_SPELL_HEALING_OF_STAT_PERCENT",
349 '176'=>"SPIRIT_OF_REDEMPTION",
350 '177'=>"AOE_CHARM",
351 '178'=>"Mod Debuff Resistance %",
352 '179'=>"Mod Attacker Crit Chance %",
353 '180'=>"Mod Spell Damage Versus",
354 '181'=>"Mod Spell Crit Damage Versus",
355 '182'=>"MOD_RESISTANCE_OF_INTELLECT_PERCENT",
356 '183'=>"MOD_CRITICAL_THREAT",
357 '184'=>"MOD_ATTACKER_MELEE_HIT_CHANCE",
358 '185'=>"MOD_ATTACKER_RANGED_HIT_CHANCE",
359 '186'=>"MOD_ATTACKER_SPELL_HIT_CHANCE",
360 '187'=>"MOD_ATTACKER_MELEE_CRIT_CHANCE",
361 '188'=>"MOD_ATTACKER_RANGED_CRIT_CHANCE",
362 '189'=>"Mod Rating",
363 '190'=>"Mod Faction Reputation Gain",
364 '191'=>"Limit Movement Speed",
365 '192'=>"Melee Haste",
366 '193'=>"Melee Slow",
367 '194'=>"MOD_DEPRICATED_1",
368 '195'=>"MOD_DEPRICATED_2",
369 '196'=>"Mod Cooldown",
370 '197'=>"MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE",
371 '198'=>"MOD_ALL_WEAPON_SKILLS",
372 '199'=>"MOD_INCREASES_SPELL_PCT_TO_HIT",
373 '200'=>"Mod Experience Earned %",
374 '201'=>"Fly",
375 '202'=>"IGNORE_COMBAT_RESULT",
376 '203'=>"Mod Melee Critical Damage Taken",
377 '204'=>"Mod Ranged Critical Damage Teken",
378 '205'=>"MOD_ATTACKER_SPELL_CRIT_DAMAGE",
379 '206'=>"MOD_SPEED_MOUNTED",
380 '207'=>"MOD_INCREASE_FLIGHT_SPEED",
381 '208'=>"MOD_SPEED_FLIGHT",
382 '209'=>"MOD_FLIGHT_SPEED_ALWAYS",
383 '210'=>"MOD_FLIGHT_SPEED_NOT_STACKING",
384 '211'=>"MOD_FLIGHT_SPEED_MOUNTED_NOT_STACKING",
385 '212'=>"MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT",
386 '213'=>"Mod Rage from Damage Dealt %",
387 '214'=>"214",
388 '215'=>"ARENA_PREPARATION",
389 '216'=>"Haste Spells",
390 '217'=>"Slow Spells ???",
391 '218'=>"Haste Ranged",
392 '219'=>"MOD_MANA_REGEN_FROM_STAT",
393 '220'=>"MOD_RATING_FROM_STAT",
394 '221'=>"221",
395 '222'=>"222",
396 '223'=>"223",
397 '224'=>"224",
398 '225'=>"DUMMY_3",
399 '226'=>"Peridic Dummy",
400 '227'=>"Periodic Trigger Spell With Value",
401 '228'=>"DETECT_STEALTH",
402 '229'=>"Mod AOE Damage Taken",
403 '230'=>"230",
404 '231'=>"PROC_TRIGGER_SPELL_WITH_VALUE",
405 '232'=>"Mod Mechanic Duration",
406 '233'=>"233",
407 '234'=>"Mod Mechanic Duration not stack",
408 '235'=>"Mod Dispel Resist",
409 '236'=>"Control Vehicle",
410 '237'=>"Mod Spell Damage Percent From Attack Power",
411 '238'=>"Mod Spell Healing Percent From Attack Power",
412 '239'=>"Mod Scale",
413 '240'=>"Mod Expertise",
414 '241'=>"Force Move Forward",
415 '242'=>"242",
416 '243'=>"Faction Override",
417 '244'=>"Comprehend Language",
418 '245'=>"MOD_DURATION_OF_MAGIC_EFFECTS",
419 '246'=>"MOD_DURATION_OF_EFFECTS_BY_DISPEL",
420 '247'=>"Mirror Image",
421 '248'=>"MOD_COMBAT_RESULT_CHANCE",
422 '249'=>"Convert Rune",
423 '250'=>"Mod Increase Health",
424 '251'=>"MOD_ENEMY_DODGE",
425 '252'=>"Mod Combat Speed Pct",
426 '253'=>"MOD_BLOCK_CRIT_CHANCE",
427 '254'=>"Mod Disarm",
428 '255'=>"MOD_MECHANIC_DAMAGE_TAKEN_PERCENT",
429 '256'=>"No Reagent Use Aura",
430 '257'=>"MOD_TARGET_RESIST_BY_SPELL_CLASS",
431 '258'=>"MOD_SPELL_VISUAL",
432 '259'=>"MOD_PERIODIC_HEAL",
433 '260'=>"SCREEN_EFFEC",
434 '261'=>"Phase",
435 '262'=>"262",
436 '263'=>"ALLOW_ONLY_ABILITY",
437 '264'=>"264",
438 '265'=>"265",
439 '266'=>"266",
440 '267'=>"267",
441 '268'=>"Mod Attack Power Of Stat Percent",
442 '269'=>"269",
443 '270'=>"270",
444 '271'=>"271",
445 '272'=>"272",
446 '273'=>"273",
447 '274'=>"274",
448 '275'=>"275",
449 '276'=>"276",
450 '277'=>"277",
451 '278'=>"Mod Disarm",
452 '279'=>"Mirror Name",
453 '280'=>"Mod Target Armor Pct",
454 '281'=>"MOD_HONOR_GAIN",
455 '282'=>"Increase Base Health Percent",
456 '283'=>"MOD_HEALING_RECEIVED",
457 '284'=>"Trigger Linked Aura",
458 '285'=>"Mod Attack Power Of Armor",
459 '286'=>"ABILITY_PERIODIC_CRIT",
460 '287'=>"DEFLECT_SPELLS",
461 '288'=>"MOD_PARRY_FROM_BEHIND_PERCENT",
462 '289'=>"289",
463 '290'=>"Mod All Crit Chance",
464 '291'=>"MOD_QUEST_XP_PCT",
465 '292'=>"Open Stable",
466 '293'=>"Add Mechanic Abilities",
467 '294'=>"Stop Natural Mana Regen",
468 '295'=>"295",
469 '296'=>"Set Vehicle Id",
470 '297'=>"297",
471 '298'=>"298",
472 '299'=>"299",
473 '300'=>"300",
474 '301'=>"HEAL_ABSORB",
475 '302'=>"302",
476 '303'=>"303",
477 '304'=>"Fake Inebriation",
478 '305'=>"Mod Increase Speed",
479 '306'=>"306",
480 '307'=>"307",
481 '308'=>"308",
482 '309'=>"309",
483 '310'=>"MOD_PET_AOE_DAMAGE_AVOIDANCE",
484 '311'=>"311",
485 '312'=>"312",
486 '313'=>"313",
487 '314'=>"Prevent Resurrection",
488 '315'=>"315",
489 '316'=>"316"
492 function getSpellFamilyNames()
494 global $wDB;
495 return $wDB->selectCol('-- CACHE: 1h
496 SELECT `spell_family` AS ARRAY_KEY, `name` FROM `wowd_chr_classes`');
499 function getSpellFamilyName($i)
501 $l = getSpellFamilyNames();
502 return isset($l[$i]) ? $l[$i] : 'Family_'.$i;
505 function getRatingList($mask)
507 global $gRatingNames;
508 return getListFromArray_1($gRatingNames, $mask);
511 function getSpellRange($id)
513 global $wDB;
514 return $wDB->selectRow("-- CACHE: 1h
515 SELECT * FROM `wowd_spell_range` WHERE `id` = ?d", $id);
518 function getRange($index)
520 $range = getSpellRange($index);
521 if ($range == 0)
522 return "Err index $index";
524 if ($range['minRange']==0 OR $range['minRange']==$range['maxRange'])
525 return $range['maxRange'];
526 return $range['minRange'].' - '.$range['maxRange'];
529 function getRangeText($index)
531 $range = getSpellRange($index);
532 if ($range == 0)
533 return "Err index $index";
535 if ($range['minRange']==0 OR $range['minRange']==$range['maxRange'])
536 return $range['maxRange'].' yds ('.$range['name'].')';
537 return $range['minRange'].' - '.$range['maxRange'].' yds ('.$range['name'].')';
540 //*****************************************
541 // Totem Category
542 //*****************************************
543 function getTotemCategory($i, $as_ref=1)
545 global $wDB;
546 $gTotemCategory = $wDB->selectCol('-- CACHE: 1h
547 SELECT `id` AS ARRAY_KEY, `name` FROM `wowd_totem_category`');
549 $name = @$gTotemCategory[$i];
550 if ($name == "")
551 $name = "Category_$i";
552 if ($as_ref)
553 return "<a href=\"?s=i&totem=$i\">".$name."</a>";
554 return $name;
557 function getRuneName($i)
559 global $gRuneName;
560 if (empty($gRuneName[$i]))
561 return "Rune_".$i;
562 return $gRuneName[$i];
565 function getTargetsList($mask)
567 global $gTargetsList;
568 return getListFromArray_1($gTargetsList, $mask);
571 //***************************************
572 // Form functions
573 //***************************************
574 function getFormNames()
576 global $wDB;
577 return $wDB->selectCol('-- CACHE: 1h
578 SELECT `id` AS ARRAY_KEY, `name` FROM `wowd_spell_shapeshift`');
581 function getForm($i, $as_ref=1)
583 $gSpellSnapeshiftForm = getFormNames();
584 $name = @$gSpellSnapeshiftForm[$i];
585 if ($name == "") $name = "Form_$i";
586 if ($as_ref)
587 return "<a href=\"?s=s&form=$i\">".$name."</a>";
588 return $name;
591 function getAllowableForm($mask, $as_ref=1)
593 $gSpellSnapeshiftForm = getFormNames();
594 if ($as_ref)
595 return getListFromArray_1($gSpellSnapeshiftForm, $mask, "?s=s&form=%d");
596 return getListFromArray_1($gSpellSnapeshiftForm, $mask);
599 function getCategoryName($i, $as_ref=1)
601 if ($as_ref)
602 return "<a href=\"?s=s&cat=$i\">".$i."</a>";
603 return "$i";
606 function getPowerTypeName($index)
608 global $gSpellPowerType;
609 if ($index >= 0 && $index < 5)
610 return $gSpellPowerType[$index];
611 return $gSpellPowerType[-1];
614 function getSpellEffectName($i)
616 global $gSpellEffect;
617 return $gSpellEffect[$i];
620 function getSpellAuraName($i)
622 global $gSpellAuraName;
623 return $gSpellAuraName[$i];
626 function getSpellModName($i)
628 global $gSpellModsType;
629 return $gSpellModsType[$i];
632 function getDispelName($i, $as_ref=1)
634 global $wDB;
635 $d = $wDB->selectCol('-- CACHE: 1h
636 SELECT `id` AS ARRAY_KEY, `name` FROM `wowd_spell_dispel_type`');
637 $name = isset($d[$i]) ? $d[$i] : 'Dispell_'.$i;
638 if ($as_ref && $i)
639 return "<a href=\"?s=s&dispel=$i\">$name</a>";
640 return $name;
643 function getMechanicName($i, $as_ref=1)
645 global $gSpellMechanic;
646 $name = @$gSpellMechanic[$i];
647 if (!$name) $name = "Mechanic_$i";
648 if ($as_ref && $i)
649 return "<a href=\"?s=s&mech=$i\">$name</a>";
650 return $name;
653 function getLaungageName($i)
655 global $wDB;
656 $l = $wDB->selectCol('-- CACHE: 1h
657 SELECT `id` AS ARRAY_KEY, `name` FROM `wowd_languages`');
658 return isset($l[$i]) ? $l[$i] : 'Laungage_'.$i;
661 function getSchool($i)
663 global $gSpellSchool;
664 $name = @$gSpellSchool[$i];
665 if ($name == "") $name = "School_$i";
666 return $name;
670 function getSpellSchool($mask)
672 global $gSpellSchool;
673 return getListFromArray_0($gSpellSchool, $mask);
676 function getSpellDamageClass($i)
678 global $gDmgClass;
679 return $gDmgClass[$i];
682 function getSpell($spell_id, $fields="*")
684 global $wDB;
685 return $wDB->selectRow("SELECT ".$fields." FROM `wowd_spell` WHERE `id` = ?d", $spell_id);
688 function getSpellName($spell, $as_ref=1)
690 if ($spell)
692 $name = $spell['SpellName'];
693 if ($as_ref)
694 $name = "<a href=\"?spell=$spell[id]\">".$name."</a>";
695 if ($spell['Rank']!="")
696 $name.="<br><div class=srank>".$spell['Rank']."</div>";
697 return $name;
699 return "No spell";
702 function getSpellNameFromId($spellId, $as_ref=1)
704 if ($spell = getSpell($spellId))
705 return getSpellName($spell, $as_ref);
706 return "Err spell $spellId";
709 function getSpellDurationData($durationIndex)
711 global $wDB;
712 return $wDB->selectRow("-- CACHE: 1h
713 SELECT * FROM `wowd_spell_duration` WHERE `id` = ?d", $durationIndex);
716 function getSpellDuration($spell)
718 if ($spell['DurationIndex'])
719 if ($spell_duration = getSpellDurationData($spell['DurationIndex']))
720 return $spell_duration['duration_1']/1000;
721 return '';
724 function getSpellDurationText($spell)
726 if ($spell['DurationIndex'])
728 if ($spell_duration = getSpellDurationData($spell['DurationIndex']))
730 if ($spell_duration['duration_1'] == -1)
731 return "Unlimited";
732 // if ($spell_duration['duration_1'] == ($spell_duration['duration_3'])
733 // return getTimeText($spell_duration['duration_1']/1000);
734 // TODO fix it
735 return getTimeText($spell_duration['duration_1']/1000);
737 else
738 return "Err index ".$spell['DurationIndex'];
740 return "";
743 function getSpellRadius($id)
745 global $wDB;
746 return $wDB->selectRow("-- CACHE: 1h
747 SELECT * FROM `wowd_spell_radius` WHERE `id` = ?d", $id);
750 function getRadius($index)
752 if ($index==0) return '0';
754 $radius = getSpellRadius($index);
755 if (!$radius)
756 return "Err index $index";
758 if ($radius['radius_1']==0 OR $radius['radius_1']==$radius['radius_3'])
759 return $radius['radius_3'];
760 return $radius['radius_1']." - ".$radius['radius_3'];
763 function getRadiusText($index)
765 return getRadius($index).' yds';
768 function getSpellCooldown($spell)
770 if ($spell['RecoveryTime'] > $spell['CategoryRecoveryTime'])
771 return $spell['RecoveryTime'];
772 else
773 return $spell['CategoryRecoveryTime'];
776 function getSpellCastTime($id)
778 global $wDB;
779 return $wDB->selectRow("-- CACHE: 1h
780 SELECT * FROM `wowd_spell_cast_time` WHERE `id` = ?d", $id);
783 function getCastTimeText($spell)
785 $cast_time = getSpellCastTime($spell['CastingTimeIndex']);
786 $time = @$cast_time['time_1']/1000;
787 if ($time)
788 return $time." sec cast";
789 else
790 return "Instant Cast";
793 function getBasePointDesc($spell, $index)
795 if (empty($spell))
796 return;
797 $s = $spell['EffectBasePoints_'.$index]+1;
798 if ($spell['EffectDieSides_'.$index] > 1)
799 $s.=" - ".abs($spell['EffectBasePoints_'.$index]+$spell['EffectDieSides_'.$index]);
801 if ($spell['EffectRealPointsPerLevel_'.$index])
802 $s.=" + lvl*".$spell['EffectRealPointsPerLevel_'.$index];
803 // Увеличивает только макс рандомное значение
804 // if ($spell['EffectDicePerLevel_'.$index])
805 // $s.=" + lvl*".$spell['EffectDicePerLevel_'.$index];
806 if ($spell['EffectPointsPerComboPoint_'.$index])
807 $s." + combo*".$spell['EffectPointsPerComboPoint_'.$index];
808 return $s;
811 function getSpellData($spell)
813 // Basepoints
814 $s1 = abs($spell['EffectBasePoints_1']+1);
815 $s2 = abs($spell['EffectBasePoints_2']+1);
816 $s3 = abs($spell['EffectBasePoints_3']+1);
817 if ($spell['EffectDieSides_1']>1) $s1.=" - ".abs($spell['EffectBasePoints_1']+$spell['EffectDieSides_1']);
818 if ($spell['EffectDieSides_2']>1) $s2.=" - ".abs($spell['EffectBasePoints_2']+$spell['EffectDieSides_2']);
819 if ($spell['EffectDieSides_3']>1) $s3.=" - ".abs($spell['EffectBasePoints_3']+$spell['EffectDieSides_3']);
821 $d = 0;
822 if ($spell['DurationIndex'])
823 if ($spell_duration = getSpellDurationData($spell['DurationIndex']))
824 $d = $spell_duration['duration_1']/1000;
826 // Tick duration
827 $t1 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_1']/1000 : 5;
828 $t2 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_2']/1000 : 5;
829 $t3 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_3']/1000 : 5;
831 // Points per tick
832 $o1 = @intval($s1*$d/$t1);
833 $o2 = @intval($s2*$d/$t2);
834 $o3 = @intval($s3*$d/$t3);
836 $spellData['t1']=$t1;
837 $spellData['t2']=$t2;
838 $spellData['t3']=$t3;
839 $spellData['o1']=$o1;
840 $spellData['o2']=$o2;
841 $spellData['o3']=$o3;
842 $spellData['s1']=$s1;
843 $spellData['s2']=$s2;
844 $spellData['s3']=$s3;
845 $spellData['m1']=$s1;
846 $spellData['m2']=$s2;
847 $spellData['m3']=$s3;
848 $spellData['x1']= $spell['EffectChainTarget_1'];
849 $spellData['x2']= $spell['EffectChainTarget_2'];
850 $spellData['x3']= $spell['EffectChainTarget_3'];
851 // $spellData['i'] = $spell['MaxAffectedTargets'];
852 $spellData['d'] = getTimeText($d);
853 $spellData['d1']= getTimeText($d);
854 $spellData['d2']= getTimeText($d);
855 $spellData['d3']= getTimeText($d);
856 $spellData['v'] = $spell['AffectedTargetLevel'];
857 $spellData['u'] = $spell['StackAmount'];
858 $spellData['a1']= getRadius($spell['EffectRadiusIndex_1']);
859 $spellData['a2']= getRadius($spell['EffectRadiusIndex_2']);
860 $spellData['a3']= getRadius($spell['EffectRadiusIndex_3']);
861 $spellData['b1']= $spell['EffectPointsPerComboPoint_1'];
862 $spellData['b2']= $spell['EffectPointsPerComboPoint_2'];
863 $spellData['b3']= $spell['EffectPointsPerComboPoint_3'];
864 $spellData['e'] = $spell['EffectMultipleValue_1'];
865 $spellData['e1']= $spell['EffectMultipleValue_1'];
866 $spellData['e2']= $spell['EffectMultipleValue_2'];
867 $spellData['e3']= $spell['EffectMultipleValue_3'];
868 $spellData['f1']= $spell['DmgMultiplier_1'];
869 $spellData['f2']= $spell['DmgMultiplier_2'];
870 $spellData['f3']= $spell['DmgMultiplier_3'];
871 $spellData['q1']= $spell['EffectMiscValue_1'];
872 $spellData['q2']= $spell['EffectMiscValue_2'];
873 $spellData['q3']= $spell['EffectMiscValue_3'];
874 $spellData['h'] = $spell['procChance'];
875 $spellData['n'] = $spell['procCharges'];
876 $spellData['z'] = "<home>";
877 return $spellData;
880 function spellReplace($spell, $text)
882 $letter = array('${','}');
883 $values = array( '[',']');
884 $text = str_replace($letter, $values, $text);
886 $signs = array('+', '-', '/', '*', '%', '^');
887 $data = $text;
888 $pos = 0;
889 $npos = 0;
890 $str = '';
891 $cacheSpellData=array(); // Spell data for spell
892 $lastCount = 1;
893 while (false!==($npos=strpos($data, '$', $pos)))
895 if ($npos!=$pos)
896 $str .= substr($data, $pos, $npos-$pos);
897 $pos = $npos+1;
898 if ('$' == substr($data, $pos, 1))
900 $str .= '$';
901 $pos++;
902 continue;
905 if (!preg_match('/^((([+\-\/*])(\d+);)?(\d*)(?:([lg].*?:.*?);|(\w\d*)))/', substr($data, $pos), $result))
906 continue;
907 $pos += strlen($result[0]);
908 $op = $result[3];
909 $oparg = $result[4];
910 $lookup = $result[5]? $result[5]:$spell['id'];
911 $var = $result[6] ? $result[6]:$result[7];
912 if (!$var)
913 continue;
914 // l - размер последней величины == 1 ? 0 : 1
915 if ($var[0]=='l')
917 $select = explode(':', substr($var, 1));
918 $str.=@$select[$lastCount==1 ? 0:1];
920 // g - пол персонжа
921 else if ($var[0]=='g')
923 $select = explode(':', substr($var, 1));
924 $str.=$select[0];
926 else
928 $spellData = @$cacheSpellData[$lookup];
929 if ($spellData == 0)
931 if ($lookup == $spell['id']) $cacheSpellData[$lookup] = getSpellData($spell);
932 else $cacheSpellData[$lookup] = getSpellData(getSpell($lookup));
933 $spellData = @$cacheSpellData[$lookup];
935 if ($spellData && $base = @$spellData[strtolower($var)])
937 if ($op && is_numeric($oparg) && is_numeric($base))
939 $equation = $base.$op.$oparg;
940 eval("\$base = $equation;");
942 if (is_numeric($base)) $lastCount = $base;
944 else
945 $base = $var;
946 $str.=$base;
949 $str.= substr($data, $pos);
950 $str = @preg_replace_callback("/\[.+[+\-\/*\d]\]/", 'my_relpace', $str);
951 // $letter = array('*','/','+','-');
952 // $values = array(' * ', ' / ',' + ',' - ');
953 // $str = str_replace($letter, $values, $str);
955 return($str);//."<br /><br />".$text;
958 function my_relpace($matches)
960 $text = str_replace( array('[',']'), array('', ''), $matches[0]);
961 eval("\$text = abs(".$text.");");
962 return intval($text);
965 function getSpellDesc($spell)
967 if ($spell['Description']=="") return $spell['SpellName'];
968 return spellReplace($spell, $spell['Description']);
971 function getSpellBuff($spell)
973 if ($spell['ToolTip']=="") return "";
974 return spellReplace($spell, $spell['ToolTip']);
977 function get_spell_details($spell_id)
979 $spell=getSpell($spell_id);
980 if ($spell)
981 return getSpellDesc($spell);
982 return "Spell id - $spell_id";
985 function getSpellCostText($spell)
987 // Заполняем стоимость заклинания
988 $powerType = getPowerTypeName($spell['powerType']);
989 $powerCost = "";
990 if ($spell['AttributesEx'] & 2)
991 $powerCost = "Uses 100% ".$powerType;
992 else
994 if ($spell['ManaCostPercentage'])
995 $powerCost = $spell['ManaCostPercentage']."% of base";
996 else if ($spell['manaCost'])
997 $powerCost = $spell['manaCost'];
998 if ($powerCost)
1000 $powerCost.= " ".$powerType;
1001 if ($spell['manaPerSecond'])
1002 $powerCost.= " plus ".$spell['manaPerSecond']." per sec";
1005 return $powerCost;