Разделение иконок для нпц, на дающих и принимающих квест...
[cswow.git] / module / show / spell_details.php
blob0588d71cf23d1ee048d0ae7e050b24eb4294882c
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 $number = 0;
313 if ($s = getSpellScriptTarget($spell['id']))
314 foreach ($s as $s1)
316 if ($s1['type']==0) echo '<br><a style="float: right;" href="?object='.$s1['targetEntry'].'">'.getGameobjectName($s1['targetEntry'],0).'</a>';
317 else if ($s1['type']==1) echo '<br><a style="float: right;" href="?npc='.$s1['targetEntry'].'">'.getCreatureName($s1['targetEntry'],0).'</a>';
318 else if ($s1['type']==2) echo '<br><a style="float: right;" href="?npc='.$s1['targetEntry'].'">'.getCreatureName($s1['targetEntry'],0).'</a>';
319 $number++;
324 function showEffectData($spell, $effect)
326 echo '<tr>';
327 echo '<th>Effect '.($effect-1).':</th>';
328 echo '<td colspan=3>';
330 if ($spell['Effect_'.$effect]==0)
332 echo 'No Effect';
333 return;
335 else
337 $eff_id = $spell['Effect_'.$effect];
338 $aura = $spell['EffectApplyAuraName_'.$effect];
339 $itemId = $spell['EffectItemType_'.$effect];
340 $triggerId = $spell['EffectTriggerSpell_'.$effect];
341 $radius = $spell['EffectRadiusIndex_'.$effect];
342 $amount = getBasePointDesc($spell, $effect);
343 if ($aura == 107 OR $aura == 108 OR $aura == 109 OR $aura == 112)
345 $spellFamilyMask = $itemId;
346 $itemId = 0;
349 echo "($eff_id) ".getSpellEffectName($eff_id);
350 if ($aura)
351 showAuraInfo($spell, $effect, $aura);
352 else
353 showEffectInfo($spell, $effect, $eff_id);
355 if ($spell['EffectAmplitude_'.$effect])
356 echo '<br>Interval: '.($spell['EffectAmplitude_'.$effect]/1000).' sec';
357 // Спелл
358 if ($triggerId)
360 $trigger = getSpell($triggerId);
361 if ($trigger)
363 echo '<table class=no_border><tbody><tr>';
364 echo '<td>';
365 show_spell($trigger['id'], $trigger['SpellIconID'], 'spellinfo');
366 echo '</td>';
367 echo '<td><a href="?spell='.$trigger['id'].'">'.$trigger['SpellName'].'</a><br>Value: '.$amount.'</td>';
368 echo '</tr></tbody></table>';
370 else
371 echo '<br>Err trigger spell id '.$triggerId;
373 // Вещь
374 else if ($itemId)
376 $item = getItem($itemId);
377 if ($item)
379 global $Quality;
380 $colorname = $item['Quality'];
381 echo "<table class=no_border><tbody><tr>";
382 echo "<td>";show_item($item['entry'], $item['displayid'], 'spellinfo');echo "</td>";
383 echo "<td><a class=$Quality[$colorname] href=\"?item=$item[entry]\">$item[name]</a>";
384 if ($amount > 1)
385 echo " x".$amount;
386 echo "</td>";
387 echo "</tr></tbody></table>";
389 else
390 echo "<br>Err item id ".$itemId;
392 else
394 if ($radius)
395 echo "<br>Radius: ".getRadiusText($radius);
396 if ($amount != 0)
397 echo "<br>Value: ".$amount;
400 echo "</td>";
401 echo "</tr>";
404 //********************************************************************************
405 // Детальная информация
406 //********************************************************************************
407 function createSpellDetails($spell)
409 global $lang;
410 echo '<table class=details width=600><tbody>';
411 echo '<tr><td colspan=4 class=head>'.$lang['detail_info'].'</td></tr>';
412 echo '<tr><th>Name</th><td colspan=2>'.$spell['SpellName'].'</td><td align=right>'.$spell['Rank'].'</td></tr>';
414 if ($spell['Description'])
415 echo '<tr><th width=60>Info:</th><td colspan=3>'.getSpellDesc($spell).'</td></tr>';
417 if ($spell['ToolTip'])
418 echo '<tr><th>Buff:</th><td colspan=3>'.getSpellBuff($spell).'</td></tr>';
419 // Стоимость и длительность
420 $cost = getSpellCostText($spell);
421 $duration = getSpellDurationText($spell);
422 if ($cost OR $duration)
423 echo '<tr><th>Cost</th><td>'.($cost?$cost:'No Cost').'</td><th>Duration</th><td>'.$duration.'</td></tr>';
425 echo '<tr>';
426 echo '<th width=13%>Level</th>';
427 echo '<td width=37%>Base '.$spell['baseLevel'].', Max '.$spell['maxLevel'].', Spell '.$spell['spellLevel'].'</td>';
428 echo '<th width=20%>Range</th>';
429 echo '<td width=30%>'.getRangeText($spell['rangeIndex']).'</td>';
430 echo '</tr>';
432 // Время квста и школа (выводятся всегда)
433 echo '<tr><th>Cast time</th><td>'.getCastTimeText($spell).'</td><th>School</th><td>'.getSpellSchool($spell['SchoolMask']).'</td></tr>';
435 $skillAbility = getSkillLineAbility($spell['id']);
436 if ($skillAbility OR $spell['Category'])
438 echo '<tr>';
439 echo '<th>Skill</th>';
440 if ($skillAbility)
441 echo '<td>'.getSkillName($skillAbility['skillId']).'</td>';
442 else
443 echo '<td>n/a</td>';
445 echo '<th>Category</th>';
446 if ($spell['Category'])
447 echo '<td>'.getCategoryName($spell['Category']).'</td>';
448 else
449 echo '<td>n/a</td>';
450 echo '</tr>';
452 // Вывод механики и диспелла
453 if ($spell['Mechanic'] OR $spell['Dispel'])
455 echo '<tr>';
456 echo '<th>Mechanic</th><td>'.getMechanicName($spell['Mechanic']).'</td>';
457 echo '<th>Dispel type</th><td>'.getDispelName($spell['Dispel']).'</td>';
458 echo '</tr>';
460 // Вывод кулдаунов
461 $cooldown = getSpellCooldown($spell);
462 if ($cooldown OR $spell['StartRecoveryCategory'] OR $spell['StartRecoveryTime'])
464 echo '<tr>';
465 echo '<th>Cooldown</th>';
466 if ($cooldown)
467 echo '<td>'.getTimeText($cooldown/1000).'</td>';
468 else
469 echo '<td>No cooldown</td>';
471 echo '<th>Global cooldown</th>';
472 if ($spell['StartRecoveryCategory'] OR $spell['StartRecoveryTime'])
474 echo '<td>';
475 echo 'Affected';
476 if ($spell['StartRecoveryTime'])
477 echo ', '.getTimeText($spell['StartRecoveryTime']/1000);
478 else
479 echo ', Not start';
480 echo '</td>';
482 else
483 echo '<td>n/a</td>';
484 echo '</tr>';
486 // Вывод требований форм
487 $stances = $spell['Stances'];
488 $stancesNot = $spell['StancesNot'];
489 if ($stances OR $stancesNot)
491 echo '<tr>';
492 echo '<th>Req form</th>';
493 if ($stances)
494 echo '<td>'.getAllowableForm($stances).'</td>';
495 else
496 echo '<td>n/a</td>';
498 echo '<th>Not in form</th>';
499 if ($stancesNot)
500 echo '<td>'.getAllowableForm($stancesNot).'</td>';
502 else
503 echo '<td>n/a</td>';
504 echo '</tr>';
506 // Вывод требований одетого снаряжения
507 $itemClass = $spell['EquippedItemClass'];
508 $itemSubClass = $spell['EquippedItemSubClassMask'];
509 $inventoryTypeMask = $spell['EquippedItemInventoryTypeMask'];
510 if ($itemClass >= 0 OR $inventoryTypeMask)
512 echo '<tr>';
513 echo '<th>Req item</th>';
514 if ($itemClass >=0)
516 echo '<td>';
517 if ($itemSubClass)
518 echo getClassName($itemClass,0).': '.getSubclassList($itemClass, $itemSubClass);
519 else
520 echo getClassName($itemClass);
521 echo '</td>';
523 else
524 echo '<td>n/a</td>';
525 echo '<th>Inv type</th>';
526 if ($inventoryTypeMask)
527 echo '<td>'.getInventoryTypeList($inventoryTypeMask).'</td>';
528 else
529 echo '<td>n/a</td>';
530 echo '</tr>';
532 // Вывод тотм категорий и спеллфокуса
533 $totem1=$spell['TotemCategory_1'];
534 $totem2=$spell['TotemCategory_2'];
535 $focus =$spell['RequiresSpellFocus'];
536 if ($totem1 OR $totem2 OR $focus)
538 echo '<tr>';
539 echo '<th>Tools</th>';
540 if ($totem1 OR $totem2)
542 echo '<td>';
543 if ($totem1) echo getTotemCategory($totem1);
544 if ($totem2) echo ', '.getTotemCategory($totem2);
545 echo '</td>';
547 else
548 echo '<td>n/a</td>';
549 echo '<th>Spell Focus</th>';
550 if ($focus)
551 echo '<td>'.getSpellFocusName($focus, 2).'</td>';
552 else
553 echo '<td>n/a</td>';
554 echo '</tr>';
556 $area=$spell['AreaGroupId'];
557 if ($area)
559 echo '<tr>';
560 echo '<th>Area</th>';
561 if ($area)
562 echo '<td>'.$area.'</td>';
563 else
564 echo '<td>n/a</td>';
565 echo '</tr>';
567 // Вывод требований целей
568 $targets = $spell['Targets'];
569 $targetCreature = $spell['TargetCreatureType'];
570 if ($targets OR $targetCreature)
572 echo '<tr>';
573 echo '<th>Targets</th>';
574 if ($targets)
575 echo '<td>'.getTargetsList($targets).'</td>';
576 else
577 echo '<td>n/a</td>';
578 echo '<th>Creature type</th>';
579 if ($targetCreature)
580 echo '<td>'.getCreatureTypeList($targetCreature).'</td>';
581 else
582 echo '<td>n/a</td>';
583 echo '</tr>';
585 if ($spell['Reagent_1'] OR $spell['Reagent_2'] OR $spell['Reagent_3'] OR $spell['Reagent_4'] OR
586 $spell['Reagent_5'] OR $spell['Reagent_6'] OR $spell['Reagent_7'] OR $spell['Reagent_8'])
588 echo '<tr>';
589 echo '<th>Reagents</th>';
590 echo '<td colspan=3>'; r_spellReagents($spell); echo '</td>';
591 echo '</tr>';
593 // Вывод эффектов
594 showEffectData($spell, 1);
595 showEffectData($spell, 2);
596 showEffectData($spell, 3);
597 echo '</tbody></table>';