?> '); __ = $WH.ge('sl<?php echo $proto->entry; ?> '); _.innerHTML = '<table><tr><td>' + ($WH.g_enhanceTooltip.bind(_))(<?php echo $proto->entry; ?> , true, true, __) + '</td><th style="background-position: top right"></th></tr><tr><th style="background-position: bottom left"></th><th style="background-position: bottom right"></th></tr></table>'; $WH.Tooltip.fixSafe(_, 1, 1, __); //]]></script> <?php if ($proto->faction >= FACTION_HORDE) { $current_faction = $proto->faction; $opposite_faction = $proto->faction == FACTION_ALLIANCE ? FACTION_HORDE : FACTION_ALLIANCE; $convert_item = WoW_Items::GetBasicItemInfo($proto->faction_convert); echo sprintf(WoW_Locale::GetString('template_item_faction_conversion'), WoW::GetWoWPath(), $proto->faction_convert, $convert_item['quality'], WoW::GetStaticUrl(), $convert_item['icon'], isset($convert_item['name_loc']) && $convert_item['name_loc'] != null ? $convert_item['name_loc'] : $convert_item['name'], WoW_Locale::GetString('template_faction_string_' . $opposite_faction), WoW_Locale::GetString('faction_' . WoW_Locale::GetString('template_faction_string_' . $opposite_faction))); } ?> <h2 class="clear">Related</h2> </div> <div id="jkbfksdbl4"></div> <div id="lkljbjkb574" class="listview"> </div> <script type="text/javascript">//<![CDATA[ var tabsRelated = new Tabs({parent: $WH.ge('jkbfksdbl4'), trackable: 'Item'}); <?php if (is_array($vendors)) { $count = count($vendors);
private static function HandleAchievement() { if (!is_array(self::$m_achievement)) { return false; } $ach =& self::$m_achievement; $ach['name'] = $ach['name_' . WoW_Locale::GetLocale()]; $ach['desc'] = $ach['desc_' . WoW_Locale::GetLocale()]; $ach['titleReward'] = $ach['titleReward_' . WoW_Locale::GetLocale()]; WoW_Template::SetPageData('db_page_title', $ach['name'] . ' - '); if ($ach['parentCategory'] == 1) { $ach['type'] = 2; } else { $ach['type'] = 1; } // Check titleReward if ($ach['titleReward'] != null) { // Check rewards (item or title) $rewards = DB::World()->selectRow("SELECT * FROM achievement_reward WHERE entry = %d", $ach['id']); if (is_array($rewards)) { // Item? $ach['titleReward'] = array(); if ($rewards['item'] > 0) { $ach['titleReward'][] = array('type' => 'item', 'data' => WoW_Items::GetBasicItemInfo($rewards['item'])); } if ($rewards['title_A'] > 0 || $rewards['title_H'] > 0) { $ach['titleReward'][] = array('type' => 'title', 'data' => DB::World()->select("SELECT id, title_M_%s AS title FROM DBPREFIX_titles WHERE id IN (%s)", WoW_Locale::GetLocale(), array($rewards['title_A'], $rewards['title_H']))); } } } else { $ach['titleReward'] = array(); } WoW_Template::SetPageData('breadcrumb', '0,9,' . $ach['categoryId']); if (is_array($ach['criterias'])) { // CRITERA STRING SHOULD BE GENERATED HERE, NOT IN VIEW! foreach ($ach['criterias'] as &$cr) { $cr['name'] = $cr['name_' . WoW_Locale::GetLocale()]; $cr['criteria_string'] = $cr['name']; switch ($cr['requiredType']) { case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE: $cr['criteria_string'] = '<a href="' . WoW::GetWoWPath() . '/npc=' . $cr['data'] . '">' . WoW_NPCs::GetNPCInfo($cr['data'], 'name') . '</a> ' . WoW_Locale::GetString('template_achievement_slain'); break; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: $cr['criteria_string'] = '<a href="' . WoW::GetWoWPath() . '/achievement=' . $cr['data'] . '">' . self::GetAchievementInfo($cr['data'], 'name') . '</a>'; //$cr['data_achievement'] = self::GetBasicAchievementInfo($cr['data']); break; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: break; case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM: case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM: break; case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL: case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL: break; case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: break; case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: break; case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: break; case ACHIEVEMENT_CRITERIA_TYPE_GAIN_EXALTED_REPUTATION: break; } } } }
private static function HandleQuest() { if (!self::$m_quest) { return false; } $fields_to_locale = array('Title', 'Details', 'Objectives', 'OfferRewardText', 'RequestItemsText', 'EndText', 'CompletedText', 'ObjectiveText1', 'ObjectiveText2', 'ObjectiveText3', 'ObjectiveText4'); // Try to set localized fields foreach ($fields_to_locale as $field) { if (WoW_Locale::GetLocaleID() != LOCALE_EN) { if (isset(self::$m_quest[$field . '_loc']) && self::$m_quest[$field . '_loc'] != null) { self::$m_quest[$field] = self::$m_quest[$field . '_loc']; } } WoW_Utils::GameStringToHTML(self::$m_quest[$field]); } // Zone? $zone_data = array(); if (self::$m_quest['ZoneOrSort'] > 0) { // Find zone $zone_data = DB::World()->selectRow("\n SELECT\n `a`.`id`,\n `a`.`mapID`,\n `a`.`zoneID`,\n `a`.`name_en` AS `name_original`,\n `a`.`name_%s` AS `name_loc`\n FROM `DBPREFIX_areas` AS `a`\n WHERE `a`.`id` = %d", WoW_Locale::GetLocale(), self::$m_quest['ZoneOrSort']); if ($zone_data) { $zone_data = array('id' => $zone_data['id'], 'name' => WoW_Locale::GetLocaleID() != LOCALE_EN ? $zone_data['name_loc'] : $zone_data['name_original']); } } // Find NPC relations (start/end) $quest_relation = array('start' => 'creature_questrelation', 'end' => 'creature_involvedrelation'); foreach ($quest_relation as &$relation) { $table = $relation; $relation = array('npc' => array(), 'zone' => array()); $relation['npc'] = DB::World()->selectRow("\n SELECT\n `a`.`id`,\n `b`.`guid`,\n `b`.`map`,\n `b`.`position_x`,\n `b`.`position_y`,\n `c`.`name`,\n `c`.`faction_A`,\n `c`.`faction_H`,\n %s\n FROM `%s` AS `a`\n LEFT JOIN `creature` AS `b` ON `b`.`id` = `a`.`id`\n LEFT JOIN `creature_template` AS `c` ON `c`.`entry` = `a`.`id`\n %s\n WHERE `a`.`quest` = %d", WoW_Locale::GetLocaleID() != LOCALE_EN ? '`d`.`name_loc' . WoW_Locale::GetLocaleID() . '` AS `name_loc`' : 'NULL', $table, WoW_Locale::GetLocaleID() != LOCALE_EN ? 'LEFT JOIN `locales_creature` AS `d` ON `d`.`entry` = `a`.`id`' : null, self::$m_quest['entry']); if (!$relation['npc']) { $relation = false; continue; } $relation['zone'] = WoW_Utils::GetNpcAreaInfo($relation['npc']['id'], $relation['npc'], true); if (WoW_Locale::GetLocaleID() != LOCALE_EN) { if (isset($relation['npc']['name_loc']) && $relation['npc']['name_loc'] != null) { $relation['npc']['name'] = $relation['npc']['name_loc']; unset($relation['npc']['name_loc']); } if (isset($relation['zone']['zoneName_loc']) && $relation['zone']['zoneName_loc'] != null) { $relation['zone']['zoneName'] = $relation['zone']['zoneName_loc']; unset($relation['zone']['zoneName_loc']); } } } if (!$quest_relation['start'] && !$quest_relation['end']) { $quest_relation = null; } // Objectives $items_to_add = array(); self::$m_quest['ObjectivesText'] = ''; self::$m_quest['ObjectivesTextScript'] = ''; $obj_item_icon = 1; // Kill %d players if (self::$m_quest['PlayersSlain'] > 0) { self::$m_quest['ObjectivesText'] .= '<tr><th><ul><li><var> </var></li></ul></th><td>' . sprintf(WoW_Locale::GetString('template_quest_obj_players_slain'), self::$m_quest['PlayersSlain']) . '</td></tr>'; } // Provided item if (self::$m_quest['SrcItemId'] > 0) { $src_item = WoW_Items::GetBasicItemInfo(self::$m_quest['SrcItemId']); if (is_array($src_item)) { $items_to_add = array_merge($items_to_add, array($src_item)); self::$m_quest['ObjectivesText'] .= sprintf('<tr><th align="right" id="iconlist-icon%d"></th><td><span class="q%d"><a href="%s/item=%d">%s</a></span> %s</td></tr>', $obj_item_icon, $src_item['quality'], WoW::GetWoWPath(), $src_item['entry'], $src_item['name'], WoW_Locale::GetString('template_quest_item_provided')); self::$m_quest['ObjectivesTextScript'] .= '$WH.ge(\'iconlist-icon' . $obj_item_icon . '\').appendChild(g_items.createIcon(' . $src_item['entry'] . ', 0, 1))'; ++$obj_item_icon; } } // Related items $items = array(); $rewardItems = array(); $choiceItems = array(); $rewItemData = array(); $choiceItemData = array(); // Find items for ($i = 1; $i < 7; ++$i) { if ($i < 5) { if (!in_array(self::$m_quest['RewItemId' . $i], $items)) { $items[self::$m_quest['RewItemId' . $i]] = self::$m_quest['RewItemId' . $i]; $rewardItems[] = array('itemId' => self::$m_quest['RewItemId' . $i], 'count' => self::$m_quest['RewItemCount' . $i]); } } if (!in_array(self::$m_quest['RewChoiceItemId' . $i], $items)) { $items[self::$m_quest['RewChoiceItemId' . $i]] = self::$m_quest['RewChoiceItemId' . $i]; $choiceItems[] = array('itemId' => self::$m_quest['RewChoiceItemId' . $i], 'count' => self::$m_quest['RewChoiceItemCount' . $i]); } } // Load basic items info for reward items if (is_array($rewardItems)) { $ids = array(); foreach ($rewardItems as $it) { if (!in_array($it['itemId'], $ids)) { $ids[] = $it['itemId']; } } $rewItemData = WoW_Items::GetBasicItemInfo($ids); } // Load basic items info for choice reward items if (is_array($choiceItems)) { $ids = array(); foreach ($choiceItems as $it) { if (!in_array($it['itemId'], $ids)) { $ids[] = $it['itemId']; } } $choiceItemData = WoW_Items::GetBasicItemInfo($ids); } self::$m_quest['ReceiveRewardText'] = array('text' => '', 'script' => ''); self::$m_quest['ChoiceRewardText'] = array('text' => '', 'script' => ''); $rewMoney = self::$m_quest['RewOrReqMoney'] > 0 ? self::$m_quest['RewOrReqMoney'] : 0; if ($rewMoney > 0) { $isRecieve = true; $money = WoW_Utils::GetMoneyFormat($rewMoney); self::$m_quest['ReceiveRewardText']['text'] .= sprintf('%s%s%s', $money['gold'] > 0 ? sprintf('<span class="moneygold">%d</span> ', $money['gold']) : null, $money['silver'] > 0 ? sprintf('<span class="moneysilver">%d</span> ', $money['silver']) : null, $money['copper'] > 0 ? sprintf('<span class="moneycopper">%d</span> ', $money['copper']) : null); } $item_to_add = array(array('field' => 'ReceiveRewardText', 'var' => $rewItemData), array('field' => 'ChoiceRewardText', 'var' => $choiceItemData)); // Generate rewards text foreach ($item_to_add as $item) { if (is_array($item['var']) && sizeof($item['var']) > 0) { self::$m_quest[$item['field']]['text'] .= '<table class="icontab icontab-box">'; $i = 0; $item_icon = 1; $tr_opened = false; $tr_closed = true; foreach ($item['var'] as $it) { if ($i == 2) { self::$m_quest[$item['field']]['text'] .= '</tr>'; $i = 0; $tr_closed = true; $tr_opened = false; } if ($i == 0) { self::$m_quest[$item['field']]['text'] .= '<tr>'; $tr_closed = false; $tr_opened = true; } self::$m_quest[$item['field']]['text'] .= sprintf('<th id="icontab-icon%d"></th><td><span class="q%d"><a href="%s/item=%d">%s</a></span></td>', $item_icon, $it['quality'], WoW::GetWoWPath(), $it['entry'], WoW_Locale::GetLocaleID() != LOCALE_EN && isset($it['name_loc']) && $it['name_loc'] != null ? $it['name_loc'] : $it['name']); self::$m_quest[$item['field']]['script'] .= sprintf('$WH.ge(\'icontab-icon%d\').appendChild(g_items.createIcon(%d, 1, 1));', $item_icon, $it['entry']); ++$i; ++$item_icon; } if ($tr_opened && !$tr_closed) { self::$m_quest[$item['field']]['text'] .= '</tr>'; } self::$m_quest[$item['field']]['text'] .= '</table>'; } } // Merge items arrays if (is_array($rewItemData) && is_array($choiceItemData)) { $items_info = array_merge($rewItemData, $choiceItemData); // If any item found } elseif (is_array($rewItemData)) { $items_info = $rewItemData; } elseif (is_array($choiceItemData)) { $items_info = $choiceItemData; } if (is_array($items_to_add)) { $items_info = array_merge($items_info, $items_to_add); } // Find quest in achievement criterias $achievements_cr = DB::World()->select("\n SELECT\n `a`.`referredAchievement`,\n `b`.`id`,\n `b`.`factionFlag` AS `side`,\n `b`.`name_en` AS `name_original`,\n `b`.`name_%s` AS `name_loc`,\n `b`.`desc_en` AS `desc_original`,\n `b`.`desc_%s` AS `desc_loc`,\n `b`.`categoryId`,\n `b`.`iconID`,\n `b`.`points`,\n `c`.`icon`,\n `d`.`parentCategory`,\n `d`.`name_en` AS `categoryName_original`,\n `d`.`name_%s` AS `categoryName_loc`\n FROM `DBPREFIX_achievement_criteria` AS `a`\n LEFT JOIN `DBPREFIX_achievement` AS `b` ON `b`.`id` = `a`.`referredAchievement`\n LEFT JOIN `DBPREFIX_spell_icon` AS `c` ON `c`.`id` = `b`.`iconID`\n LEFT JOIN `DBPREFIX_achievement_category` AS `d` ON `d`.`id` = `b`.`categoryId`\n WHERE `a`.`requiredType` = 27 AND `a`.`data` = %d\n ", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), self::GetID()); $achievements = array(); if (is_array($achievements_cr)) { foreach ($achievements_cr as $ach) { $ach['name'] = WoW_Locale::GetLocaleID() != LOCALE_EN && isset($ach['name_loc']) && $ach['name_loc'] != null ? $ach['name_loc'] : $ach['name_original']; $ach['desc'] = WoW_Locale::GetLocaleID() != LOCALE_EN && isset($ach['desc_loc']) && $ach['desc_loc'] != null ? $ach['desc_loc'] : $ach['desc_original']; $ach['categoryName'] = WoW_Locale::GetLocaleID() != LOCALE_EN && isset($ach['categoryName_loc']) && $ach['categoryName_loc'] != null ? $ach['categoryName_loc'] : $ach['categoryName_original']; $achievements[] = array('id' => $ach['id'], 'name' => $ach['name'], 'desc' => $ach['desc'], 'categoryName' => $ach['categoryName'], 'categoryId' => $ach['categoryId'], 'icon' => $ach['icon'], 'points' => $ach['points'], 'side' => $ach['side'], 'parentCategory' => $ach['parentCategory']); } unset($achievements_cr, $ach); } // Set page title WoW_Template::SetPageData('quest_name', self::$m_quest['Title']); $quest = self::$m_quest; self::$m_quest = array('items' => $items_info, 'quest' => $quest, 'achievements' => $achievements, 'zone' => $zone_data, 'relations' => $quest_relation); //echo '<pre>'; //print_r(self::$m_quest); //die; unset($quest, $items, $items_info); }