Вывод иконки нпц ремонтника в поиске по зоне...
[cswow.git] / module / show / spell_details.php
blob3c4177bb546ab5010da7023d44c92284a8627da4
1 <?php
2 // Create aura info string
3 function showAuraInfo($spell, $effect, $aura)
5 global $gSpellEffect, $gSpellAuraName;
6 if ($aura == 0)
7 return;
8 echo ': '.getSpellAuraName($aura);
9 $misc = $spell['EffectMiscValue_'.$effect];
10 $miscB= $spell['EffectMiscValue2_'.$effect];
11 switch ($aura)
13 // Misc - это школа спеллов
14 case 10: // SPELL_AURA_MOD_THREAT
15 case 13: // SPELL_AURA_MOD_DAMAGE_DONE
16 case 14: // SPELL_AURA_MOD_DAMAGE_TAKEN
17 case 39: // SPELL_AURA_SCHOOL_IMMUNITY
18 case 40: // SPELL_AURA_DAMAGE_IMMUNITY
19 case 69: // SPELL_AURA_SCHOOL_ABSORB
20 case 71: // SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL
21 case 72: // SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT
22 case 73: // SPELL_AURA_MOD_POWER_COST_SCHOOL
23 case 74: // SPELL_AURA_REFLECT_SPELLS_SCHOOL
24 case 79: // SPELL_AURA_MOD_DAMAGE_PERCENT_DONE
25 case 81: // SPELL_AURA_SPLIT_DAMAGE_PCT
26 case 83: // SPELL_AURA_MOD_BASE_RESISTANCE
27 case 87: // SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN
28 case 97: // SPELL_AURA_MANA_SHIELD
29 case 115: // SPELL_AURA_MOD_HEALING
30 case 118: // SPELL_AURA_MOD_HEALING_PCT
31 case 135: // SPELL_AURA_MOD_HEALING_DONE
32 case 136: // SPELL_AURA_MOD_HEALING_DONE_PERCENT
33 case 149: // SPELL_AURA_RESIST_PUSHBACK
34 case 153: // SPELL_AURA_SPLIT_DAMAGE_FLAT
35 case 163: // SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
36 case 174: // SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT
37 case 179: // SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE
38 case 183: // SPELL_AURA_MOD_CRITICAL_THREAT
39 case 186: // SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE
40 case 199: // SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT
41 case 205:
42 case 216: // SPELL_AURA_HASTE_SPELLS
43 case 229:
44 case 237: // SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER
45 case 238: // SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER
46 case 259:
48 if ($misc == 127 || $misc == 0) echo ' (All schools)';
49 else if ($misc == 126) echo ' (All magic)';
50 else if ($misc == 1) echo ' (Physical)';
51 else echo ' (School: '.getSpellSchool($misc).')';
52 break;
54 case 22: // SPELL_AURA_MOD_RESISTANCE
55 case 101: // SPELL_AURA_MOD_RESISTANCE_PCT
56 case 123: // SPELL_AURA_MOD_TARGET_RESISTANCE
57 case 142: // SPELL_AURA_MOD_BASE_RESISTANCE_PCT
58 case 143: // SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE
59 case 182: // SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT
61 if ($misc == 126) echo ' (All magic)';
62 else if ($misc == 1) echo ' (Armor)';
63 else echo ' (School: '.getSpellSchool($misc).')';
64 break;
66 // Misc - тип энергии
67 case 24: // SPELL_AURA_PERIODIC_ENERGIZE
68 case 35: // SPELL_AURA_MOD_INCREASE_ENERGY
69 case 63: // SPELL_AURA_PERIODIC_POWER_FUNNEL
70 case 64: // SPELL_AURA_PERIODIC_POWER_LEECH
71 case 85: // SPELL_AURA_MOD_POWER_REGEN
72 case 110: // SPELL_AURA_MOD_POWER_REGEN_PERCENT
73 case 162: // SPELL_AURA_POWER_BURN_MANA
75 echo ' ('.getPowerTypeName($misc).')';
76 break;
78 // Misc - тип модификатора
79 case 107: // SPELL_AURA_ADD_FLAT_MODIFIER
80 case 108: // SPELL_AURA_ADD_PCT_MODIFIER
82 echo ' ('.getSpellModName($misc).')';
83 break;
85 // Misc - тип юнита
86 case 44: // SPELL_AURA_TRACK_CREATURES
88 echo ' ('.getCreatureType($misc).')';
89 break;
91 // Misc - тип lock
92 case 45: // SPELL_AURA_TRACK_RESOURCES
94 echo ' ('.getLockType($misc, 2).')';
95 break;
97 // Misc - маска типа юнита
98 case 59: // SPELL_AURA_MOD_DAMAGE_DONE_CREATURE
99 case 102: // SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS
100 case 131: // SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS
101 case 168: // SPELL_AURA_MOD_DAMAGE_DONE_VERSUS
102 case 169: // SPELL_AURA_MOD_CRIT_PERCENT_VERSUS
103 case 180: // SPELL_AURA_MOD_SPELL_DAMAGE_VS_UNDEAD
105 echo ' ('.getCreatureTypeList($misc).')';
106 break;
108 // Misc - тип стата
109 case 29: // SPELL_AURA_MOD_STAT
110 case 80: // SPELL_AURA_MOD_PERCENT_STAT
111 case 137: // SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
112 case 175: // SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
113 case 212: // SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT
114 case 219: // SPELL_AURA_MOD_MANA_REGEN_OF_STAT
115 case 268: // SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT
117 echo ' ('.getStatTypeName($misc).')';
118 break;
120 // Misc - тип скила
121 case 30: // SPELL_AURA_MOD_SKILL
122 case 98: // SPELL_AURA_MOD_SKILL_TALENT
124 echo ' ('.getSkillName($misc).')';
125 break;
127 // Misc - тип формы
128 case 36: // SPELL_AURA_MOD_SHAPESHIFT
130 echo ' ('.getForm($misc).')';
131 break;
133 // Misc - тип рейтинга
134 case 189: // SPELL_AURA_MOD_RATING
135 case 220: // SPELL_AURA_MOD_RATING_FROM_STAT
137 echo ' ('.getRatingList($misc).')';
138 break;
140 // Misc - тип эффекта
141 case 37: // SPELL_AURA_EFFECT_IMMUNITY
143 echo ' ('.$gSpellEffect[$misc].')';
144 break;
146 // Misc - тип ауры
147 case 38: // SPELL_AURA_STATE_IMMUNITY
149 echo ' ('.$gSpellAuraName[$misc].')';
150 break;
152 // Misc - тип диспелла
153 case 41: // SPELL_AURA_DISPEL_IMMUNITY
154 case 178: // SPELL_AURA_MOD_DEBUFF_RESISTANCE
156 echo ' ('.getDispelName(abs($misc)).')';
157 break;
159 // Misc - тип механики
160 case 77: // SPELL_AURA_MECHANIC_IMMUNITY
161 case 117: // SPELL_AURA_MOD_MECHANIC_RESISTANCE
162 case 232: // SPELL_AURA_MECHANIC_DURATION_MOD
163 case 234: // SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK
164 case 255: // SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT
166 echo ' ('.getMechanicName($misc).')';
167 break;
169 case 56: // SPELL_AURA_TRANSFORM
170 case 78: // SPELL_AURA_MOUNTED
172 echo ' ('.getCreatureName($misc).')';
173 break;
175 case 190: // SPELL_AURA_MOD_FACTION_REPUTATION_GAIN
177 echo ' ('.getFactionName($misc).')';
178 break;
180 case 249: // SPELL_AURA_CONVERT_RUNE
182 echo ' ('.getRuneName($misc).' => '.getRuneName($miscB).')';
183 break;
185 default:
186 if ($misc || $miscB)
187 echo ' ('.$misc.($miscB ? ', '.$miscB : '').')';
188 break;
192 function showEffectInfo($spell, $effect, $eff_id)
194 global $lang;
195 $misc = $spell['EffectMiscValue_'.$effect];
196 switch ($eff_id)
198 // школа
199 case 2: // SCHOOL_DAMAGE
201 echo ' ('.getSpellSchool($spell['SchoolMask']).')';
202 break;
204 // Misc - тип энергии
205 case 8: // SPELL_EFFECT_POWER_DRAIN
206 case 30: // SPELL_EFFECT_ENERGIZE
207 case 62: // SPELL_EFFECT_POWER_BURN
209 echo ' ('.getPowerTypeName($misc).')';
210 break;
212 case 16: // SPELL_EFFECT_QUEST_COMPLETE
213 case 147: // SPELL_EFFECT_QUEST_FAIL
214 case 139: // SPELL_EFFECT_CLEAR_QUEST
216 echo ' ('.getQuestName($misc).')';
217 break;
219 case 28: // SPELL_EFFECT_SUMMON
220 case 56: // SPELL_EFFECT_SUMMON_PET
221 case 90: // Kill Credit
222 case 134: // Kill Credit
225 echo ' ('.getCreatureName($misc).')';
226 break;
228 case 50: // SPELL_EFFECT_SUMMON_OBJECT
229 case 76: // SPELL_EFFECT_SUMMON_OBJECT_WILD
230 case 104:
231 case 105:
232 case 106:
233 case 107:
235 echo ' ('.getGameobjectName($misc).')';
236 break;
238 case 53: // SPELL_EFFECT_ENCHANT_ITEM
239 case 54: // SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
240 case 92: // SPELL_EFFECT_ENCHANT_HELD_ITEM
242 echo ' ('.getEnchantmentDesc($misc).')';
243 break;
245 case 39: // SPELL_EFFECT_LANGUAGE
247 echo ' ('.getLaungageName($misc).')';
248 break;
250 case 44: // SPELL_EFFECT_SKILL_STEP
251 case 118: // SPELL_EFFECT_SKILL
253 echo ' ('.getSkillName($misc).')';
254 break;
256 // Misc - тип рейтинга
257 case 189: // SPELL_AURA_MOD_RATING
259 echo ' ('.getRatingList($misc).')';
260 break;
262 // Misc - тип диспелла
263 case 38: // SPELL_EFFECT_DISPEL
264 case 126: // SPELL_EFFECT_STEAL_BENEFICIAL_BUFF
266 echo ' ('.getDispelName(abs($misc)).')';
267 break;
269 // Misc - тип механики
270 case 108: // SPELL_EFFECT_DISPEL_MECHANIC
272 echo ' ('.getMechanicName($misc).')';
273 break;
275 case 94: // SPELL_EFFECT_SELF_RESURRECT
276 case 113: // SPELL_EFFECT_RESURRECT_NEW
278 echo ' (Restore '.$misc.' power)';
279 break;
281 case 103: // SPELL_EFFECT_REPUTATION
283 echo ' ('.getFactionName($misc).')';
284 break;
286 case 33: // SPELL_EFFECT_OPEN_LOCK
288 echo ' ('.getLockType($misc, 2).')';
289 break;
291 case 146: // SPELL_EFFECT_ACTIVATE_RUNE
293 echo ' ('.getRuneName($misc).')';
294 break;
296 case 74: // SPELL_EFFECT_APPLY_GLYPH
298 echo ' ('.getGlyphName($misc).')';
299 break;
301 default:
302 if ($misc)
303 echo ' ('.$misc.')';
304 break;
306 if ($effect==1)
308 // Spell target position on map
309 if ($t = getSpellTargetPosition($spell['id']))
310 echo '<a style="float: right;" href="?map&point='.$t['target_map'].':'.$t['target_position_x'].':'.$t['target_position_y'].':'.$t['target_position_z'].'">'.$lang['map'].'</a>';
311 // Spell target
312 if ($s = getSpellScriptTarget($spell['id']))
313 foreach ($s as $s1)
315 if ($s1['type']==0) echo '<br><a style="float: right;" href="?object='.$s1['targetEntry'].'">'.getGameobjectName($s1['targetEntry'],0).'</a>';
316 else if ($s1['type']==1) echo '<br><a style="float: right;" href="?npc='.$s1['targetEntry'].'">'.getCreatureName($s1['targetEntry'],0).'</a>';
317 else if ($s1['type']==2) echo '<br><a style="float: right;" href="?npc='.$s1['targetEntry'].'">'.getCreatureName($s1['targetEntry'],0).'</a>';
322 function showEffectData($spell, $effect)
324 echo '<tr>';
325 echo '<th>Effect '.($effect-1).':</th>';
326 echo '<td colspan=3>';
328 if ($spell['Effect_'.$effect]==0)
330 echo 'No Effect';
331 return;
333 else
335 $eff_id = $spell['Effect_'.$effect];
336 $aura = $spell['EffectApplyAuraName_'.$effect];
337 $itemId = $spell['EffectItemType_'.$effect];
338 $triggerId = $spell['EffectTriggerSpell_'.$effect];
339 $radius = $spell['EffectRadiusIndex_'.$effect];
340 $amount = getBasePointDesc($spell, $effect);
341 if ($aura == 107 OR $aura == 108 OR $aura == 109 OR $aura == 112)
343 $spellFamilyMask = $itemId;
344 $itemId = 0;
347 echo "($eff_id) ".getSpellEffectName($eff_id);
348 if ($aura)
349 showAuraInfo($spell, $effect, $aura);
350 else
351 showEffectInfo($spell, $effect, $eff_id);
353 if ($spell['EffectAmplitude_'.$effect])
354 echo '<br>Interval: '.($spell['EffectAmplitude_'.$effect]/1000).' sec';
355 // Спелл
356 if ($triggerId)
358 $trigger = getSpell($triggerId);
359 if ($trigger)
361 echo '<table class=no_border><tbody><tr>';
362 echo '<td>';
363 show_spell($trigger['id'], $trigger['SpellIconID'], 'spellinfo');
364 echo '</td>';
365 echo '<td><a href="?spell='.$trigger['id'].'">'.$trigger['SpellName'].'</a><br>Value: '.$amount.'</td>';
366 echo '</tr></tbody></table>';
368 else
369 echo '<br>Err trigger spell id '.$triggerId;
371 // Вещь
372 else if ($itemId)
374 $item = getItem($itemId);
375 if ($item)
377 global $Quality;
378 $colorname = $item['Quality'];
379 echo "<table class=no_border><tbody><tr>";
380 echo "<td>";show_item($item['entry'], $item['displayid'], 'spellinfo');echo "</td>";
381 echo "<td><a class=$Quality[$colorname] href=\"?item=$item[entry]\">$item[name]</a>";
382 if ($amount > 1)
383 echo " x".$amount;
384 echo "</td>";
385 echo "</tr></tbody></table>";
387 else
388 echo "<br>Err item id ".$itemId;
390 else
392 if ($radius)
393 echo "<br>Radius: ".getRadiusText($radius);
394 if ($amount != 0)
395 echo "<br>Value: ".$amount;
398 echo "</td>";
399 echo "</tr>";
402 //********************************************************************************
403 // Детальная информация
404 //********************************************************************************
405 function createSpellDetails($spell)
407 global $lang;
408 echo '<table class=details width=600><tbody>';
409 echo '<tr><td colspan=4 class=head>'.$lang['detail_info'].'</td></tr>';
410 echo '<tr><th>Name</th><td colspan=2>'.$spell['SpellName'].'</td><td align=right>'.$spell['Rank'].'</td></tr>';
412 if ($spell['Description'])
413 echo '<tr><th width=60>Info:</th><td colspan=3>'.getSpellDesc($spell).'</td></tr>';
415 if ($spell['ToolTip'])
416 echo '<tr><th>Buff:</th><td colspan=3>'.getSpellBuff($spell).'</td></tr>';
417 // Стоимость и длительность
418 $cost = getSpellCostText($spell);
419 $duration = getSpellDurationText($spell);
420 if ($cost OR $duration)
421 echo '<tr><th>Cost</th><td>'.($cost?$cost:'No Cost').'</td><th>Duration</th><td>'.$duration.'</td></tr>';
423 echo '<tr>';
424 echo '<th width=13%>Level</th>';
425 echo '<td width=37%>Base '.$spell['baseLevel'].', Max '.$spell['maxLevel'].', Spell '.$spell['spellLevel'].'</td>';
426 echo '<th width=20%>Range</th>';
427 echo '<td width=30%>'.getRangeText($spell['rangeIndex']).'</td>';
428 echo '</tr>';
430 // Время квста и школа (выводятся всегда)
431 echo '<tr><th>Cast time</th><td>'.getCastTimeText($spell).'</td><th>School</th><td>'.getSpellSchool($spell['SchoolMask']).'</td></tr>';
433 $skillAbility = getSkillLineAbility($spell['id']);
434 if ($skillAbility OR $spell['Category'])
436 echo '<tr>';
437 echo '<th>Skill</th>';
438 if ($skillAbility)
439 echo '<td>'.getSkillName($skillAbility['skillId']).'</td>';
440 else
441 echo '<td>n/a</td>';
443 echo '<th>Category</th>';
444 if ($spell['Category'])
445 echo '<td>'.getCategoryName($spell['Category']).'</td>';
446 else
447 echo '<td>n/a</td>';
448 echo '</tr>';
450 // Вывод механики и диспелла
451 if ($spell['Mechanic'] OR $spell['Dispel'])
453 echo '<tr>';
454 echo '<th>Mechanic</th><td>'.getMechanicName($spell['Mechanic']).'</td>';
455 echo '<th>Dispel type</th><td>'.getDispelName($spell['Dispel']).'</td>';
456 echo '</tr>';
458 // Вывод кулдаунов
459 $cooldown = getSpellCooldown($spell);
460 if ($cooldown OR $spell['StartRecoveryCategory'] OR $spell['StartRecoveryTime'])
462 echo '<tr>';
463 echo '<th>Cooldown</th>';
464 if ($cooldown)
465 echo '<td>'.getTimeText($cooldown/1000).'</td>';
466 else
467 echo '<td>No cooldown</td>';
469 echo '<th>Global cooldown</th>';
470 if ($spell['StartRecoveryCategory'] OR $spell['StartRecoveryTime'])
472 echo '<td>';
473 echo 'Affected';
474 if ($spell['StartRecoveryTime'])
475 echo ', '.getTimeText($spell['StartRecoveryTime']/1000);
476 else
477 echo ', Not start';
478 echo '</td>';
480 else
481 echo '<td>n/a</td>';
482 echo '</tr>';
484 // Вывод требований форм
485 $stances = $spell['Stances'];
486 $stancesNot = $spell['StancesNot'];
487 if ($stances OR $stancesNot)
489 echo '<tr>';
490 echo '<th>Req form</th>';
491 if ($stances)
492 echo '<td>'.getAllowableForm($stances).'</td>';
493 else
494 echo '<td>n/a</td>';
496 echo '<th>Not in form</th>';
497 if ($stancesNot)
498 echo '<td>'.getAllowableForm($stancesNot).'</td>';
500 else
501 echo '<td>n/a</td>';
502 echo '</tr>';
504 // Вывод требований одетого снаряжения
505 $itemClass = $spell['EquippedItemClass'];
506 $itemSubClass = $spell['EquippedItemSubClassMask'];
507 $inventoryTypeMask = $spell['EquippedItemInventoryTypeMask'];
508 if ($itemClass >= 0 OR $inventoryTypeMask)
510 echo '<tr>';
511 echo '<th>Req item</th>';
512 if ($itemClass >=0)
514 echo '<td>';
515 if ($itemSubClass)
516 echo getClassName($itemClass,0).': '.getSubclassList($itemClass, $itemSubClass);
517 else
518 echo getClassName($itemClass);
519 echo '</td>';
521 else
522 echo '<td>n/a</td>';
523 echo '<th>Inv type</th>';
524 if ($inventoryTypeMask)
525 echo '<td>'.getInventoryTypeList($inventoryTypeMask).'</td>';
526 else
527 echo '<td>n/a</td>';
528 echo '</tr>';
530 // Вывод тотм категорий и спеллфокуса
531 $totem1=$spell['TotemCategory_1'];
532 $totem2=$spell['TotemCategory_2'];
533 $focus =$spell['RequiresSpellFocus'];
534 if ($totem1 OR $totem2 OR $focus)
536 echo '<tr>';
537 echo '<th>Tools</th>';
538 if ($totem1 OR $totem2)
540 echo '<td>';
541 if ($totem1) echo getTotemCategory($totem1);
542 if ($totem2) echo ', '.getTotemCategory($totem2);
543 echo '</td>';
545 else
546 echo '<td>n/a</td>';
547 echo '<th>Spell Focus</th>';
548 if ($focus)
549 echo '<td>'.getSpellFocusName($focus, 2).'</td>';
550 else
551 echo '<td>n/a</td>';
552 echo '</tr>';
554 $area=$spell['AreaGroupId'];
555 if ($area)
557 echo '<tr>';
558 echo '<th>Area</th>';
559 if ($area)
560 echo '<td>'.$area.'</td>';
561 else
562 echo '<td>n/a</td>';
563 echo '</tr>';
565 // Вывод требований целей
566 $targets = $spell['Targets'];
567 $targetCreature = $spell['TargetCreatureType'];
568 if ($targets OR $targetCreature)
570 echo '<tr>';
571 echo '<th>Targets</th>';
572 if ($targets)
573 echo '<td>'.getTargetsList($targets).'</td>';
574 else
575 echo '<td>n/a</td>';
576 echo '<th>Creature type</th>';
577 if ($targetCreature)
578 echo '<td>'.getCreatureTypeList($targetCreature).'</td>';
579 else
580 echo '<td>n/a</td>';
581 echo '</tr>';
583 if ($spell['Reagent_1'] OR $spell['Reagent_2'] OR $spell['Reagent_3'] OR $spell['Reagent_4'] OR
584 $spell['Reagent_5'] OR $spell['Reagent_6'] OR $spell['Reagent_7'] OR $spell['Reagent_8'])
586 echo '<tr>';
587 echo '<th>Reagents</th>';
588 echo '<td colspan=3>'; r_spellReagents($spell); echo '</td>';
589 echo '</tr>';
591 // Вывод эффектов
592 showEffectData($spell, 1);
593 showEffectData($spell, 2);
594 showEffectData($spell, 3);
595 echo '</tbody></table>';