function noBorderTalentTable($talentTab, $rank) { global $game_text; if ($rank) { $spell = getSpell($talentTab["Rank_{$rank}"]); } else { $spell = getSpell($talentTab["Rank_1"]); } if ($spell) { $maxRank = 0; if ($talentTab["Rank_5"]) { $maxRank = 5; } else { if ($talentTab["Rank_4"]) { $maxRank = 4; } else { if ($talentTab["Rank_3"]) { $maxRank = 3; } else { if ($talentTab["Rank_2"]) { $maxRank = 2; } else { if ($talentTab["Rank_1"]) { $maxRank = 1; } } } } } echo "<table class=spell><tbody>"; $name = $spell['SpellName']; // if ($spell['Rank']) $name .=" ($spell[Rank])"; echo "<tr><td class=Name>" . $name . "</td></tr>"; echo "<tr><td>" . $game_text['talent_rank'] . " {$rank} / {$maxRank}</td></tr>"; echo "<tr><td class=Talent>" . getSpellDesc($spell) . "</td></tr>"; if ($rank != 0 && $rank != $maxRank) { echo "<tr><td><br>" . $game_text['talent_next_rank'] . "</td></tr>"; $spell = getSpell($talentTab["Rank_" . ($rank + 1)]); echo "<tr><td class=Talent>" . getSpellDesc($spell) . "</td></tr>"; } echo "</tbody></table>"; } else { echo "Talent error"; } }
function noBorderSpellTable($spell) { echo "<table class=spell><tbody>"; $name = $spell['SpellName']; if ($spell['Rank']) { echo "<tr><td class=Name>" . $name . "</td><td class=Rank align=right>" . $spell['Rank'] . "</td></tr>"; } else { echo "<tr><td class=Name colspan=2>" . $name . "</td></tr>"; } $cost = getSpellCostText($spell); if ($cost or $spell['rangeIndex'] > 1) { echo "<tr><td>"; if ($cost) { echo $cost . "</td><td align=right>"; } if ($spell['rangeIndex'] > 0 and $range = getRange($spell['rangeIndex']) and $range != 0) { echo $range . " yds range"; } echo "</td></tr>"; } // Заполняем поле времени каста $cast_time = ""; if (($spell['Attributes'] & 0x404) == 0x404) { $cast_time = "Next melee"; } else { if ($spell['AttributesEx'] & 0x44) { $cast_time = "Chanelled"; } else { $cast_time = getCastTimeText($spell); } } // Заполняем поле кулдауна $cooldown = getSpellCooldown($spell); if ($cooldown) { $cooldown = getTimeText($cooldown / 1000) . " cooldown"; } else { $cooldown = ""; } if ($cast_time or $cooldown) { echo "<tr><td>" . $cast_time . "</td><td align=right>" . $cooldown . "</td></tr>"; } // Тотем категория if ($spell['TotemCategory_1'] or $spell['TotemCategory_2']) { echo "<tr><td colspan=2 class=tool> Tools: "; if ($spell['TotemCategory_1']) { echo getTotemCategory($spell['TotemCategory_1']); } if ($spell['TotemCategory_2']) { echo ", " . getTotemCategory($spell['TotemCategory_2']); } echo "</td></tr>"; } $itemClass = $spell['EquippedItemClass']; // Требования мили или рангед оружия if ($spell['Attributes'] & 0x2) { echo "<tr><td colspan=2>Requires Ranged Weapon</td></tr>"; } else { if ($spell['Attributes'] & 0x4) { echo "<tr><td colspan=2>Requires Melee Weapon</td></tr>"; } else { if ($itemClass == 2) { echo "<tr><td colSpan=2 class=req>"; if ($itemSubClass = $spell['EquippedItemSubClassMask']) { echo getSubclassList($itemClass, $itemSubClass); } else { echo getClassName($itemClass); } echo "</td></tr>"; } } } $reqForm = getAllowableForm($spell['Stances'], 0); if ($reqForm) { echo "<tr><td colspan=2>Requires: " . $reqForm . "</td></tr>"; } $notreqForm = getAllowableForm($spell['StancesNot'], 0); if ($notreqForm) { echo "<tr><td class=SpellErr colspan=2>Not cast in: " . $notreqForm . "</td></tr>"; } echo "<tr><td colspan=2 class=SpellDesc><a href=\"?spell={$spell['id']}\">" . getSpellDesc($spell) . "</a></td></tr>"; echo "</tbody></table>"; }
function noBorderEnchantTable($enc) { global $UseorEquip, $game_text; echo "<table class=spell><tbody>"; echo "<tr><td class=Name>" . $enc['description'] . "</td></tr>"; // Вывод требования скила if ($enc['requiredSkill']) { echo '<tr><td class=req>' . sprintf($game_text['req_skill'], getSkillName($enc['requiredSkill']), $enc['requiredSkillRank']) . '</td></tr>'; } for ($i = 1; $i < 4; $i++) { if ($type = $enc['display_type_' . $i]) { $amount = $enc['amount_' . $i]; $spellid = $enc['spellid_' . $i]; switch ($type) { case 1: // ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL if ($spell = getSpell($spellid)) { if ($desc = getSpellDesc($spell)) { $text = $desc; } else { if ($buff = getSpellBuff($spell)) { $text = $buff; } else { $text = $spell['SpellName']; } } echo "<tr><td class=SpellEnch>" . $UseorEquip[2] . " <a href=\"?spell={$spellid}\">" . $text . "</a></td></tr>"; } else { echo "<tr><td class=SpellEnch>" . $UseorEquip[2] . " cast ?? {$spellid}</td></tr>"; } break; case 2: // ITEM_ENCHANTMENT_TYPE_DAMAGE echo "<tr><td class=SpellEnch>+ {$amount} damage</td></tr>"; break; case 3: // ITEM_ENCHANTMENT_TYPE_EQUIP_SPELL if ($spell = getSpell($spellid)) { if ($desc = getSpellDesc($spell)) { $text = $desc; } else { if ($buff = getSpellBuff($spell)) { $text = $buff; } else { $text = $spell['SpellName']; } } echo "<tr><td class=SpellEnch>" . $UseorEquip[1] . " <a href=\"?spell={$spellid}\">" . $text . "</a></td></tr>"; } else { echo "<tr><td class=SpellDesc>" . $UseorEquip[1] . " cast ?? {$spellid}</td></tr>"; } break; case 4: // ITEM_ENCHANTMENT_TYPE_RESISTANCE echo "<tr><td> " . getResistanceText($spellid, $amount) . "</td></tr>"; break; case 5: // ITEM_ENCHANTMENT_TYPE_STAT if ($spellid >= 0 && $spellid < 8) { echo "<tr><td class=SpellEnch> " . getItemBonusText($spellid, $amount) . "</td></tr>"; } else { echo "<tr><td class=SpellEnch> " . getItemBonusText($spellid, $amount) . "</td></tr>"; } break; case 6: // ITEM_ENCHANTMENT_TYPE_TOTEM echo "<tr><td class=SpellEnch>+ {$amount} damage (Rockbiter)</td></tr>"; break; case 7: // On Use if ($spell = getSpell($spellid)) { if ($desc = getSpellDesc($spell)) { $text = $desc; } else { if ($buff = getSpellBuff($spell)) { $text = $buff; } else { $text = $spell['SpellName']; } } echo "<tr><td class=SpellEnch>" . $UseorEquip[0] . " <a href=\"?spell={$spellid}\">" . $text . "</a></td></tr>"; } else { echo "<tr><td class=SpellDesc>" . $UseorEquip[0] . " cast ?? {$spellid}</td></tr>"; } break; case 8: // Add Sockets Enchant echo "<tr><td class=SpellEnch>Add Socket Enchant</td></tr>"; break; default: echo "<tr><td>Err type {$type}</td></tr>"; break; } } } echo "</tbody></table>"; }
function get_spell_details($spell_id) { $spell = getSpell($spell_id); if ($spell) { return getSpellDesc($spell); } return "Spell id - {$spell_id}"; }
function createSpellDetails($spell) { global $lang; echo '<table class=details width=600><tbody>'; echo '<tr><td colspan=4 class=head>' . $lang['detail_info'] . '</td></tr>'; echo '<tr><th>Name</th><td colspan=2>' . $spell['SpellName'] . '</td><td align=right>' . $spell['Rank'] . '</td></tr>'; if ($spell['Description']) { echo '<tr><th width=60>Info:</th><td colspan=3>' . getSpellDesc($spell) . '</td></tr>'; } if ($spell['ToolTip']) { echo '<tr><th>Buff:</th><td colspan=3>' . getSpellBuff($spell) . '</td></tr>'; } // Стоимость и длительность $cost = getSpellCostText($spell); $duration = getSpellDurationText($spell); if ($cost or $duration) { echo '<tr><th>Cost</th><td>' . ($cost ? $cost : 'No Cost') . '</td><th>Duration</th><td>' . $duration . '</td></tr>'; } echo '<tr>'; echo '<th width=13%>Level</th>'; echo '<td width=37%>Base ' . $spell['baseLevel'] . ', Max ' . $spell['maxLevel'] . ', Spell ' . $spell['spellLevel'] . '</td>'; echo '<th width=20%>Range</th>'; echo '<td width=30%>' . getRangeText($spell['rangeIndex']) . '</td>'; echo '</tr>'; // Время квста и школа (выводятся всегда) echo '<tr><th>Cast time</th><td>' . getCastTimeText($spell) . '</td><th>School</th><td>' . getSpellSchool($spell['SchoolMask']) . '</td></tr>'; $skillAbility = getSkillLineAbility($spell['id']); if ($skillAbility or $spell['Category']) { echo '<tr>'; echo '<th>Skill</th>'; if ($skillAbility) { echo '<td>' . getSkillName($skillAbility['skillId']) . '</td>'; } else { echo '<td>n/a</td>'; } echo '<th>Category</th>'; if ($spell['Category']) { echo '<td>' . getCategoryName($spell['Category']) . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } // Вывод механики и диспелла if ($spell['Mechanic'] or $spell['Dispel']) { echo '<tr>'; echo '<th>Mechanic</th><td>' . getMechanicName($spell['Mechanic']) . '</td>'; echo '<th>Dispel type</th><td>' . getDispelName($spell['Dispel']) . '</td>'; echo '</tr>'; } // Вывод кулдаунов $cooldown = getSpellCooldown($spell); if ($cooldown or $spell['StartRecoveryCategory'] or $spell['StartRecoveryTime']) { echo '<tr>'; echo '<th>Cooldown</th>'; if ($cooldown) { echo '<td>' . getTimeText($cooldown / 1000) . '</td>'; } else { echo '<td>No cooldown</td>'; } echo '<th>Global cooldown</th>'; if ($spell['StartRecoveryCategory'] or $spell['StartRecoveryTime']) { echo '<td>'; echo 'Affected'; if ($spell['StartRecoveryTime']) { echo ', ' . getTimeText($spell['StartRecoveryTime'] / 1000); } else { echo ', Not start'; } echo '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } // Вывод требований форм $stances = $spell['Stances']; $stancesNot = $spell['StancesNot']; if ($stances or $stancesNot) { echo '<tr>'; echo '<th>Req form</th>'; if ($stances) { echo '<td>' . getAllowableForm($stances) . '</td>'; } else { echo '<td>n/a</td>'; } echo '<th>Not in form</th>'; if ($stancesNot) { echo '<td>' . getAllowableForm($stancesNot) . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } // Вывод требований одетого снаряжения $itemClass = $spell['EquippedItemClass']; $itemSubClass = $spell['EquippedItemSubClassMask']; $inventoryTypeMask = $spell['EquippedItemInventoryTypeMask']; if ($itemClass >= 0 or $inventoryTypeMask) { echo '<tr>'; echo '<th>Req item</th>'; if ($itemClass >= 0) { echo '<td>'; if ($itemSubClass) { echo getClassName($itemClass, 0) . ': ' . getSubclassList($itemClass, $itemSubClass); } else { echo getClassName($itemClass); } echo '</td>'; } else { echo '<td>n/a</td>'; } echo '<th>Inv type</th>'; if ($inventoryTypeMask) { echo '<td>' . getInventoryTypeList($inventoryTypeMask) . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } // Вывод тотм категорий и спеллфокуса $totem1 = $spell['TotemCategory_1']; $totem2 = $spell['TotemCategory_2']; $focus = $spell['RequiresSpellFocus']; if ($totem1 or $totem2 or $focus) { echo '<tr>'; echo '<th>Tools</th>'; if ($totem1 or $totem2) { echo '<td>'; if ($totem1) { echo getTotemCategory($totem1); } if ($totem2) { echo ', ' . getTotemCategory($totem2); } echo '</td>'; } else { echo '<td>n/a</td>'; } echo '<th>Spell Focus</th>'; if ($focus) { echo '<td>' . getSpellFocusName($focus, 2) . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } $area = $spell['AreaGroupId']; if ($area) { echo '<tr>'; echo '<th>Area</th>'; if ($area) { echo '<td>' . $area . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } // Вывод требований целей $targets = $spell['Targets']; $targetCreature = $spell['TargetCreatureType']; if ($targets or $targetCreature) { echo '<tr>'; echo '<th>Targets</th>'; if ($targets) { echo '<td>' . getTargetsList($targets) . '</td>'; } else { echo '<td>n/a</td>'; } echo '<th>Creature type</th>'; if ($targetCreature) { echo '<td>' . getCreatureTypeList($targetCreature) . '</td>'; } else { echo '<td>n/a</td>'; } echo '</tr>'; } if ($spell['Reagent_1'] or $spell['Reagent_2'] or $spell['Reagent_3'] or $spell['Reagent_4'] or $spell['Reagent_5'] or $spell['Reagent_6'] or $spell['Reagent_7'] or $spell['Reagent_8']) { echo '<tr>'; echo '<th>Reagents</th>'; echo '<td colspan=3>'; r_spellReagents($spell); echo '</td>'; echo '</tr>'; } // Вывод эффектов showEffectData($spell, 1); showEffectData($spell, 2); showEffectData($spell, 3); echo '</tbody></table>'; }
function includeTalentScript($class, $petId, $maxLevel, $header, $ver = "322") { global $wDB, $game_text, $config; $tab_set = 0; // Create tabs list if ($class) { // For players $tab_set = $wDB->selectCol('SELECT `id` FROM `wowd_talent_tab` WHERE `class_mask` & ?d ORDER BY `tab` ', 1 << $class - 1); } else { if ($petId >= 0) { // For pets (need get pet_talent_type from creature_family) $talent_type = $wDB->selectCell('SELECT `pet_talent_type` FROM `wowd_creature_family` WHERE `category` = ?d', $petId); if (isset($talent_type) && $talent_type >= 0) { $tab_set = $wDB->selectCol('SELECT `id` FROM `wowd_talent_tab` WHERE `pet_mask` & ?d ORDER BY `tab`', 1 << $talent_type); } } } if (!$tab_set) { return; } // Создаём кэш для калькулятора (если его нет или устарел) $data_file = "tc_" . $class . $petId . "_" . $config['lang'] . "_" . $ver . ".js"; if (checkUseCacheJs($data_file, 60 * 60 * 24)) { // Подготаливаем данные для скрипта $tab_name = array(); // Имена веток талантов $tid_to_tab = array(); // Преборазователь TalentId => TabId $tabs = array(); // Тут уже будут данные для JS скрипта $spell_desc = array(); // Тут хранятся описания спеллов $t_row = 0; // Максимум строк $t_col = 0; // Максимум колонок // Стрелки зависимосей описаны тут $arrows = array('0_1' => array('img' => 'right', 'x' => -14, 'y' => 12), '0_-1' => array('img' => 'left', 'x' => 40, 'y' => 12), '1_-1' => array('img' => 'down-left', 'x' => 14, 'y' => -40), '1_0' => array('img' => 'down-1', 'x' => 13, 'y' => -12), '2_0' => array('img' => 'down-2', 'x' => 13, 'y' => -70), '2_1' => array('img' => 'down2-right', 'x' => -13, 'y' => -94), '2_-1' => array('img' => 'down2-left', 'x' => 14, 'y' => -94), '3_0' => array('img' => 'down-3', 'x' => 13, 'y' => -128), '4_0' => array('img' => 'down-4', 'x' => 13, 'y' => -188), '1_1' => array('img' => 'down-right', 'x' => -13, 'y' => -40)); // Получаем данные о ветках из базы и переводим их в нужный формат if ($class) { $ppr = 5; $talents = $wDB->select('SELECT `TalentID` AS ARRAY_KEY, `TalentTab`, `Row`, `Col`, `Rank_1`, `Rank_2`, `Rank_3`, `Rank_4`, `Rank_5`, `DependsOn`, `DependsOnRank` FROM `wowd_talents` WHERE `TalentTab` IN (?a)', $tab_set); } else { if ($petId >= 0) { $ppr = 3; $petMask1 = 0; $petMask2 = 0; if ($petId < 32) { $petMask1 = 1 << $petId; } else { $petMask2 = 1 << $petId - 32; } $talents = $wDB->select('SELECT `TalentID` AS ARRAY_KEY, `TalentTab`, `Row`, `Col`, `Rank_1`, `Rank_2`, `Rank_3`, `Rank_4`, `Rank_5`, `DependsOn`, `DependsOnRank` FROM `wowd_talents` WHERE `TalentTab` IN (?a) AND ((`petflag1`=0 AND `petflag2`=0) OR (`petflag1`& ?d) OR (`petflag2`& ?d))', $tab_set, $petMask1, $petMask2); } } // Заполняем преборазователь TalentId => TabId и Имена веток талантов foreach ($tab_set as $id => $tid) { $tid_to_tab[$tid] = $id; $tab_name[$id] = getTalentName($tid); } foreach ($talents as $id => $t) { $tabId = $tid_to_tab[$t['TalentTab']]; $row = $t['Row']; $col = $t['Col']; $spells = array(); $icon = 0; $max = 0; if ($t_row <= $row) { $t_row = $row + 1; } if ($t_col <= $col) { $t_col = $col + 1; } for ($i = 1; $i < 6; $i++) { $spellid = $t['Rank_' . $i]; if ($spellid == 0) { continue; } $max = $i; $spells[$i - 1] = $spellid; $spell = getSpell($spellid); if ($icon == 0) { $icon = getSpellIconName($spell['SpellIconID']); } $name = $spell['SpellName']; $spell_desc[$spellid] = array('name' => $name, 'desc' => getSpellDesc($spell)); } $tabs[$tabId . '_' . $row . '_' . $col] = array('id' => $id, 'spells' => $spells, 'icon' => $icon, 'max' => $max); if ($t['DependsOn'] && isset($talents[$t['DependsOn']])) { $d = $talents[$t['DependsOn']]; $dx = $t['Row'] - $d['Row']; $dy = $t['Col'] - $d['Col']; $a = $arrows[$dx . "_" . $dy]; $tabs[$tabId . '_' . $row . '_' . $col]['depend'] = array('id' => $tid_to_tab[$d['TalentTab']] . "_" . $d['Row'] . "_" . $d['Col'], 'rank' => $t['DependsOnRank'], 'img' => $a['img'], 'x' => intval($a['x']), 'y' => intval($a['y'])); } else { $depend = 0; } } echo ' var tc_showclass ="' . ($class ? $class : $tab_set[0]) . '"; var tc_name = ' . php2js($tab_name) . '; var tc_tabs = ' . count($tab_set) . '; var tc_row = ' . $t_row . '; var tc_col = ' . $t_col . '; var tc_tab = ' . php2js($tabs) . '; var tc_point_per_row = ' . $ppr . '; var tc_spell_desc = ' . php2js($spell_desc) . '; var lang_rank = "' . $game_text['talent_rank'] . '"; var lang_next_rank = "' . $game_text['talent_next_rank'] . '"; var lang_req_points = "' . $game_text['talent_req_points'] . '";'; flushJsCache($data_file); } echo ' <script type="text/javascript" id = "talent_calc"> var tc_maxlevel = ' . $maxLevel . '; var lang_header = \'' . $header . '\'; </script> <script type="text/javascript" src="js/talent_calc_base.js"></script>'; }