private static function PerformItemsSearch() { if (!isset(self::$m_results['items'])) { self::$m_results['items'] = array(); } // Find item IDs $items = DB::World()->select("\n SELECT\n `a`.`entry`\n FROM `%s` AS `a`\n WHERE %s LIKE '%s' LIMIT 200", WoW_Locale::GetLocaleID() != LOCALE_EN ? 'locales_item' : 'item_template', WoW_Locale::GetLocaleID() != LOCALE_EN ? '`a`.`name_loc' . WoW_Locale::GetLocaleID() . '`' : '`a`.`name`', '%' . self::$m_query . '%'); if (!$items) { return; } $item_id = array(); foreach ($items as $item) { // Generate IDs array $item_id[] = $item['entry']; } // Request items self::$m_results['items'] = WoW_Items::GetExtendedItemInfo($item_id); }
<div class="title"> <h2 class="color-q<?php echo $proto->Quality; ?> "><?php echo $proto->name; ?> </h2> </div> <?php WoW_Template::LoadTemplate('page_item_tooltip'); ?> </div> <span class="clear"><!-- --></span> <?php $item_tabs = WoW_Items::GetItemTabsNames($proto->entry); if (is_array($item_tabs)) { echo '<div class="related"><div class="tabs "><ul id="related-tabs">'; foreach ($item_tabs as $tab) { if (!is_array($tab)) { continue; } echo sprintf('<li> <a href="#%s" data-key="%s" id="tab-%s"> <span><span>%s</span></span> </a> </li>', $tab['type'], $tab['type'], $tab['type'], sprintf(WoW_Locale::GetString('template_item_tab_' . $tab['type']), $tab['count'])); } echo '</ul><span class="clear"> </span></div><div id="related-content" class="loading"></div></div>'; } ?>
private static function _ApplyItemBonuses($proto, $slot, $apply, $only_level_scale = false) { if (!$proto) { return false; } $ssd = $proto->ScalingStatDistribution ? DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssd` WHERE `entry` = %d", $proto->ScalingStatDistribution) : null; if ($only_level_scale && !$ssd) { return false; } $ssd_level = WoW_Characters::GetLevel(); if ($ssd && $ssd_level > $ssd['MaxLevel']) { $ssd_level = $ssd['MaxLevel']; } $ssv = $proto->ScalingStatValue ? DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssv` WHERE `id` = %d", $proto->ScalingStatValue) : null; if ($only_level_scale && !$ssv) { return false; } for ($i = 0; $i < MAX_ITEM_PROTO_STATS; ++$i) { $statType = 0; $val = 0; // If set ScalingStatDistribution need get stats and values from it if ($ssd && $ssv) { if ($ssd['StatMod_' . $i] < 0) { continue; } $statType = $ssd['StatMod_' . $i]; $val = WoW_Items::GetSSDMultiplier($ssv, $proto->ScalingStatValue) * $ssd['Modifier_' . $i] / 1000; } else { if ($i >= $proto->StatsCount) { continue; } $statType = $proto->ItemStat[$i]['type']; $val = $proto->ItemStat[$i]['value']; } if ($val == 0) { continue; } switch ($statType) { case ITEM_MOD_MANA: self::HandleStatModifier(UNIT_MOD_MANA, BASE_VALUE, $val, $apply); break; case ITEM_MOD_HEALTH: // modify HP self::HandleStatModifier(UNIT_MOD_HEALTH, BASE_VALUE, $val, $apply); break; case ITEM_MOD_AGILITY: // modify agility self::HandleStatModifier(UNIT_MOD_STAT_AGILITY, BASE_VALUE, $val, $apply); self::ApplyStatBuffMod(STAT_AGILITY, $val, $apply); break; case ITEM_MOD_STRENGTH: //modify strength self::HandleStatModifier(UNIT_MOD_STAT_STRENGTH, BASE_VALUE, $val, $apply); self::ApplyStatBuffMod(STAT_STRENGTH, $val, $apply); break; case ITEM_MOD_INTELLECT: //modify intellect self::HandleStatModifier(UNIT_MOD_STAT_INTELLECT, BASE_VALUE, $val, $apply); self::ApplyStatBuffMod(STAT_INTELLECT, $val, $apply); break; case ITEM_MOD_SPIRIT: //modify spirit self::HandleStatModifier(UNIT_MOD_STAT_SPIRIT, BASE_VALUE, $val, $apply); self::ApplyStatBuffMod(STAT_SPIRIT, $val, $apply); break; case ITEM_MOD_STAMINA: //modify stamina self::HandleStatModifier(UNIT_MOD_STAT_STAMINA, BASE_VALUE, $val, $apply); self::ApplyStatBuffMod(STAT_STAMINA, $val, $apply); break; case ITEM_MOD_DEFENSE_SKILL_RATING: self::ApplyRatingMod(CR_DEFENSE_SKILL, $val, $apply); break; case ITEM_MOD_DODGE_RATING: self::ApplyRatingMod(CR_DODGE, $val, $apply); break; case ITEM_MOD_PARRY_RATING: self::ApplyRatingMod(CR_PARRY, $val, $apply); break; case ITEM_MOD_BLOCK_RATING: self::ApplyRatingMod(CR_BLOCK, $val, $apply); break; case ITEM_MOD_HIT_MELEE_RATING: self::ApplyRatingMod(CR_HIT_MELEE, $val, $apply); break; case ITEM_MOD_HIT_RANGED_RATING: self::ApplyRatingMod(CR_HIT_RANGED, $val, $apply); break; case ITEM_MOD_HIT_SPELL_RATING: self::ApplyRatingMod(CR_HIT_SPELL, $val, $apply); break; case ITEM_MOD_CRIT_MELEE_RATING: self::ApplyRatingMod(CR_CRIT_MELEE, $val, $apply); break; case ITEM_MOD_CRIT_RANGED_RATING: self::ApplyRatingMod(CR_CRIT_RANGED, $val, $apply); break; case ITEM_MOD_CRIT_SPELL_RATING: self::ApplyRatingMod(CR_CRIT_SPELL, $val, $apply); break; case ITEM_MOD_HIT_TAKEN_MELEE_RATING: self::ApplyRatingMod(CR_HIT_TAKEN_MELEE, $val, $apply); break; case ITEM_MOD_HIT_TAKEN_RANGED_RATING: self::ApplyRatingMod(CR_HIT_TAKEN_RANGED, $val, $apply); break; case ITEM_MOD_HIT_TAKEN_SPELL_RATING: self::ApplyRatingMod(CR_HIT_TAKEN_SPELL, $val, $apply); break; case ITEM_MOD_CRIT_TAKEN_MELEE_RATING: self::ApplyRatingMod(CR_CRIT_TAKEN_MELEE, $val, $apply); break; case ITEM_MOD_CRIT_TAKEN_RANGED_RATING: self::ApplyRatingMod(CR_CRIT_TAKEN_RANGED, $val, $apply); break; case ITEM_MOD_CRIT_TAKEN_SPELL_RATING: self::ApplyRatingMod(CR_CRIT_TAKEN_SPELL, $val, $apply); break; case ITEM_MOD_HASTE_MELEE_RATING: self::ApplyRatingMod(CR_HASTE_MELEE, $val, $apply); break; case ITEM_MOD_HASTE_RANGED_RATING: self::ApplyRatingMod(CR_HASTE_RANGED, $val, $apply); break; case ITEM_MOD_HASTE_SPELL_RATING: self::ApplyRatingMod(CR_HASTE_SPELL, $val, $apply); break; case ITEM_MOD_HIT_RATING: self::ApplyRatingMod(CR_HIT_MELEE, $val, $apply); self::ApplyRatingMod(CR_HIT_RANGED, $val, $apply); self::ApplyRatingMod(CR_HIT_SPELL, $val, $apply); break; case ITEM_MOD_CRIT_RATING: self::ApplyRatingMod(CR_CRIT_MELEE, $val, $apply); self::ApplyRatingMod(CR_CRIT_RANGED, $val, $apply); self::ApplyRatingMod(CR_CRIT_SPELL, $val, $apply); break; case ITEM_MOD_HIT_TAKEN_RATING: self::ApplyRatingMod(CR_HIT_TAKEN_MELEE, $val, $apply); self::ApplyRatingMod(CR_HIT_TAKEN_RANGED, $val, $apply); self::ApplyRatingMod(CR_HIT_TAKEN_SPELL, $val, $apply); break; case ITEM_MOD_CRIT_TAKEN_RATING: self::ApplyRatingMod(CR_CRIT_TAKEN_MELEE, $val, $apply); self::ApplyRatingMod(CR_CRIT_TAKEN_RANGED, $val, $apply); self::ApplyRatingMod(CR_CRIT_TAKEN_SPELL, $val, $apply); break; case ITEM_MOD_RESILIENCE_RATING: self::ApplyRatingMod(CR_CRIT_TAKEN_MELEE, $val, $apply); self::ApplyRatingMod(CR_CRIT_TAKEN_RANGED, $val, $apply); self::ApplyRatingMod(CR_CRIT_TAKEN_SPELL, $val, $apply); break; case ITEM_MOD_HASTE_RATING: self::ApplyRatingMod(CR_HASTE_MELEE, $val, $apply); self::ApplyRatingMod(CR_HASTE_RANGED, $val, $apply); self::ApplyRatingMod(CR_HASTE_SPELL, $val, $apply); break; case ITEM_MOD_EXPERTISE_RATING: self::ApplyRatingMod(CR_EXPERTISE, $val, $apply); break; case ITEM_MOD_ATTACK_POWER: self::HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, $val, $apply); self::HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, $val, $apply); break; case ITEM_MOD_RANGED_ATTACK_POWER: self::HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, $val, $apply); break; case ITEM_MOD_MANA_REGENERATION: self::ApplyManaRegenBonus($val, $apply); break; case ITEM_MOD_ARMOR_PENETRATION_RATING: self::ApplyRatingMod(CR_ARMOR_PENETRATION, $val, $apply); break; case ITEM_MOD_SPELL_POWER: self::ApplySpellPowerBonus($val, $apply); break; case ITEM_MOD_SPELL_PENETRATION: self::ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE, -$val, $apply); self::$m_spellPenetrationItemMod += $apply ? $val : -$val; break; case ITEM_MOD_BLOCK_VALUE: self::HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, $val, $apply); break; // deprecated item mods // deprecated item mods case ITEM_MOD_FERAL_ATTACK_POWER: case ITEM_MOD_SPELL_HEALING_DONE: case ITEM_MOD_SPELL_DAMAGE_DONE: break; } } if ($ssv) { if ($spellbonus = WoW_Items::GetSpellBonus($ssv, $proto->ScalingStatValue)) { self::ApplySpellPowerBonus($spellbonus, $apply); } } $armor = $proto->armor; if ($ssv) { if ($ssvarmor = WoW_Items::GetArmorMod($ssv, $proto->ScalingStatValue)) { $armor = $ssvarmor; } } // Add armor bonus from ArmorDamageModifier if > 0 if ($proto->ArmorDamageModifier > 0) { $armor += $proto->ArmorDamageModifier; } if ($armor) { self::HandleStatModifier(UNIT_MOD_ARMOR, BASE_VALUE, $armor, $apply); } if ($proto->block) { self::HandleBaseModValue(SHIELD_BLOCK_VALUE, FLAT_MOD, $proto->block, $apply); } if ($proto->holy_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, $proto->holy_res, $apply); } if ($proto->fire_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_FIRE, BASE_VALUE, $proto->fire_res, $apply); } if ($proto->nature_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_NATURE, BASE_VALUE, $proto->nature_res, $apply); } if ($proto->frost_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_FROST, BASE_VALUE, $proto->frost_res, $apply); } if ($proto->shadow_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_SHADOW, BASE_VALUE, $proto->shadow_res, $apply); } if ($proto->arcane_res) { self::HandleStatModifier(UNIT_MOD_RESISTANCE_ARCANE, BASE_VALUE, $proto->arcane_res, $apply); } $attType = BASE_ATTACK; $damage = 0.0; if ($slot == EQUIPMENT_SLOT_RANGED && in_array($proto->InventoryType, array(INV_TYPE_RANGED, INV_TYPE_THROWN, INV_TYPE_RANGED_RIGHT))) { $attType = RANGED_ATTACK; } elseif ($slot == EQUIPMENT_SLOT_OFFHAND) { $attType = OFF_ATTACK; } $minDamage = $proto->Damage[0]['min']; $maxDamage = $proto->Damage[0]['max']; $extraDPS = 0; if ($ssv) { if ($extraDPS = WoW_Items::GetDPSMod($ssv, $proto->ScalingStatValue)) { $average = $extraDPS * $proto->delay / 1000; $minDamage = 0.7 * $average; $maxDamage = 1.3 * $average; } } if ($minDamage > 0) { $damage = $apply ? $minDamage : BASE_MINDAMAGE; self::SetBaseWeaponDamage($attType, MINDAMAGE, $damage); } if ($maxDamage > 0) { $damage = $apply ? $maxDamage : BASE_MAXDAMAGE; self::SetBaseWeaponDamage($attType, MAXDAMAGE, $damage); } if ($proto->delay) { if ($slot == EQUIPMENT_SLOT_RANGED) { self::SetAttackTime(RANGED_ATTACK, $apply ? $proto->delay : BASE_ATTACK_TIME); } elseif ($slot == EQUIPMENT_SLOT_MAINHAND) { self::SetAttackTime(BASE_ATTACK, $apply ? $proto->delay : BASE_ATTACK_TIME); } elseif ($slot == EQUIPMENT_SLOT_OFFHAND) { self::SetAttackTime(OFF_ATTACK, $apply ? $proto->delay : BASE_ATTACK_TIME); } } if (self::CanModifyStats() && ($damage || $proto->delay)) { self::UpdateDamagePhysical($attType); } }
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 InitItems() { self::AssignTemplatePageIndex(array('items', 'item')); WoW_Template::SetPageData('activeTab', 0); WoW_Items::InitPage(WoW_Template::GetPageIndex(), self::GetPageAction()); }
' . sprintf(WoW_Locale::GetString('template_character_audit_empty_sockets'), $count_empty_sockets, count($audit[AUDIT_TYPE_EMPTY_SOCKET])) . ' </li>', $empty_sockets_slots); } if (isset($audit[AUDIT_TYPE_NONOPTIMAL_ARMOR]) && is_array($audit[AUDIT_TYPE_NONOPTIMAL_ARMOR]) && WoW_Characters::GetLevel() >= 40) { $nonop_armor_slots = ''; $nonop_armor_slots_js_tpl = '"inappropriateArmorItems": {%s},'; $nonop_armor_count = 0; foreach ($audit[AUDIT_TYPE_NONOPTIMAL_ARMOR] as $tmp) { ++$nonop_armor_count; } echo sprintf('<li data-slots="%d"> <span class="tip">%s</span> </li>', $nonop_armor_count, sprintf(WoW_Locale::GetString('template_character_audit_nonop_armor'), $nonop_armor_count, WoW_Utils::GetAppropriateItemClassForClassID(WoW_Characters::GetClassID()))); } if (isset($audit[AUDIT_TYPE_MISSING_BELT_BUCKLE]) && $audit[AUDIT_TYPE_MISSING_BELT_BUCKLE] == true) { echo sprintf('<li data-slots="5">%s</li>', sprintf(WoW_Locale::GetString('template_character_audit_missing_belt_buckle'), BELT_BUCKLE_ID, WoW_Items::GetItemName(BELT_BUCKLE_ID))); } ?> </ul> <?php if (WoW_Characters::IsAuditPassed()) { echo WoW_Locale::GetString('template_character_audit_passed'); } ?> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { new Summary.Audit({ <?php echo $unenchanted_items_js . "\n"; echo ' ' . $empty_sockets_js;
public function main() { WoW_Template::SetTemplateTheme('wow'); WoW_Template::SetPageIndex('item_info'); WoW_Template::SetPageData('page', 'item_info'); WoW_Template::SetMenuIndex('menu-game'); $url_data = WoW::GetUrlData('item'); if (!$url_data) { if (!isset($_GET['t'])) { WoW_Template::ErrorPage(404); } exit; } $item_entry = $url_data['item_entry']; if ($item_entry == 0) { $breadcrumbs = WoW_Items::GetBreadCrumbsForItem($_GET); WoW_Template::SetPageIndex('item_list'); WoW_Template::SetPageData('body_class', 'item-index'); WoW_Template::SetPageData('page', 'item_list'); WoW_Template::SetPageData('breadcrumbs', $breadcrumbs); WoW_Template::SetPageData('last-crumb', is_array($breadcrumbs) ? $breadcrumbs[sizeof($breadcrumbs) - 1]['caption'] : WoW_Locale::GetString('template_menu_items')); WoW_Template::LoadTemplate('page_index'); exit; } // Load proto $proto = new WoW_ItemPrototype(); $proto->LoadItem($item_entry); if (!$proto->IsCorrect()) { if (!isset($_GET['t']) && (!isset($url_data['action0']) || $url_data['action0'] != 'tooltip')) { WoW_Template::ErrorPage(404); } exit; } WoW_Template::SetPageData('item_entry', $item_entry); // SSD and SSV data $ssd = DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssd` WHERE `entry` = %d", $proto->ScalingStatDistribution); $ssd_level = MAX_PLAYER_LEVEL; if (isset($_GET['pl'])) { $ssd_level = (int) $_GET['pl']; if (is_array($ssd) && $ssd_level > $ssd['MaxLevel']) { $ssd_level = $ssd['MaxLevel']; } } $ssv = DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_ssv` WHERE `level` = %d", $ssd_level); if (isset($_GET['t'])) { $url_data['tooltip'] = true; } if ($url_data['tooltip'] == true) { WoW_Template::SetPageIndex('item_tooltip'); WoW_Template::SetPageData('tooltip', true); WoW_Template::SetPageData('page', 'item_tooltip'); WoW_Template::SetPageData('proto', $proto); WoW_Template::SetPageData('ssd', $ssd); WoW_Template::SetPageData('ssd_level', $ssd_level); WoW_Template::SetPageData('ssv', $ssv); WoW_Template::LoadTemplate('page_item_tooltip'); } else { if (isset($url_data['action0']) && $url_data['action0'] != null) { WoW_Template::SetPageData('tab_type', $url_data['action0']); WoW_Template::LoadTemplate('page_item_tab'); exit; } WoW_Template::SetPageIndex('item'); WoW_Template::SetPageData('tooltip', false); WoW_Template::SetPageData('itemName', $proto->name); WoW_Template::SetPageData('page', 'item'); WoW_Template::SetPageData('proto', $proto); WoW_Template::SetPageData('ssd', $ssd); WoW_Template::SetPageData('ssd_level', $ssd_level); WoW_Template::SetPageData('ssv', $ssv); WoW_Template::LoadTemplate('page_index'); } unset($proto); }
/** * @return array **/ public function GetSocketInfo($num, $enchant_id_only = false) { if ($num <= 0 || $num > 4) { return 0; } if (isset($this->m_socketInfo[$num])) { return $enchant_id_only ? $this->m_socketInfo[$num]['enchant_id'] : $this->m_socketInfo[$num]; } $data = array(); switch ($this->m_server) { case SERVER_MANGOS: $socketfield = array(1 => ITEM_FIELD_ENCHANTMENT_3_2, 2 => ITEM_FIELD_ENCHANTMENT_4_2, 3 => ITEM_FIELD_ENCHANTMENT_5_2); $socketInfo = $this->GetUInt32Value($socketfield[$num] - 1); break; case SERVER_TRINITY: $socketfield = array(1 => 6, 2 => 9, 3 => 12); $socketInfo = $this->tc_ench[$socketfield[$num]]; break; default: WoW_Log::WriteError('%s : unknown server type (%d)', __METHOD__, $this->m_server); return false; break; } if ($socketInfo > 0) { if ($enchant_id_only) { return $socketInfo; } $gemData = DB::Wow()->selectRow("SELECT `text_%s` AS `text`, `gem` FROM `DBPREFIX_enchantment` WHERE `id`=%d", WoW_Locale::GetLocale(), $socketInfo); $data['enchant_id'] = $socketInfo; $data['item'] = $gemData['gem']; $data['icon'] = WoW_Items::GetItemIcon($data['item']); $data['enchant'] = $gemData['text']; $data['quality'] = DB::World()->selectCell("SELECT `Quality` FROM `item_template` WHERE `entry` = %d", $data['item']); $data['name'] = WoW_Items::GetItemName($data['item']); $data['color'] = DB::Wow()->selectCell("SELECT `color` FROM `DBPREFIX_gemproperties` WHERE `spellitemenchantement`=%d", $socketInfo); $this->m_socketInfo[$num] = $data; // Is it neccessary? return $data; } return false; }
if (is_array($searchResults)) { $toggleStyle = 2; foreach ($searchResults as $item) { echo sprintf('<tr class="row%d"> <td class="table-link" data-row="1 %s"> <a href="%s/wow/' . WoW_Locale::GetLocale() . '/item/%d" rel="item:%d" class="color-q%d"> <span class="icon-frame frame-18" style=\'background-image: url("http://eu.battle.net/wow-assets/static/images/icons/18/%s.jpg");\'> </span> %s </a> </td> <td class="align-center"> %d </td> <td></td> <td> </td> </tr>', $toggleStyle % 2 ? 1 : 0, $item['name'], WoW::GetWoWPath(), $item['entry'], $item['entry'], $item['Quality'], WoW_Items::GetItemIcon($item['entry'], $item['displayid']), $item['name'], $item['ItemLevel']); ++$toggleStyle; } } ?> </tbody> </table> <script type="text/javascript"> //<![CDATA[ $(function(){ var table = new Table('.table'); }); //]]> </script>
echo sprintf('fi_setCriteria(%s);', $criterias); } ?> fi_extraCols = <?php echo $extraCols ? $extraCols : '[]'; ?> ; //]]></script> <div id="lv-items" class="listview"></div> <?php $items = WoW_Items::GetItems(); $js_names_data = ''; $js_listview_data = ''; $items_count = WoW_Items::GetCount(); if (is_array($items)) { $items_count_current = count($items); $current = 1; foreach ($items as $item) { $js_names_data .= sprintf('_[%d]={name_%s:\'%s\',quality:%d,icon:\'%s\'};', $item['entry'], WoW_Locale::GetLocale(LOCALE_SPLIT), str_replace("'", "\\'", $item['name']), $item['quality'], $item['icon']); $data_count = count($item['js_data']); $i = 1; $current_item = ''; foreach ($item['js_data'] as $data) { $current_item .= sprintf('"%s":%s', $data['key'], $data['data']); if ($i < $data_count) { $current_item .= ','; } } $js_listview_data .= sprintf('{%s}', $current_item);
private static function PerformAudit($rebuild = false) { // Empty glyphs $empty_glyphs = 6; //TODO: check player level switch (self::$m_server) { default: case SERVER_MANGOS: $character_glyphs = DB::Characters()->select("SELECT `slot`, `glyph` FROM `character_glyphs` WHERE `guid` = %d AND `spec` = %d", self::GetGUID(), self::GetActiveSpec()); if (is_array($character_glyphs)) { foreach ($character_glyphs as $glyph) { if ($glyph['slot'] < 6 && $glyph['glyph'] > 0) { --$empty_glyphs; } } } break; case SERVER_TRINITY: $character_glyphs = DB::Characters()->select("SELECT `glyph1`, `glyph2`, `glyph3`, `glyph4`, `glyph5`, `glyph6` FROM `character_glyphs` WHERE `guid` = %d AND `spec` = %d", self::GetGUID(), self::GetActiveSpec()); if (is_array($character_glyphs)) { foreach ($character_glyphs as $glyph) { for ($i = 1; $i < 7; ++$i) { if ($glyph['glyph' . $i] > 0) { --$empty_glyphs; } } } } break; } self::UpdateAudit(AUDIT_TYPE_EMPTY_GLYPH_SLOT, $empty_glyphs); // Unspent talent points. self::UpdateAudit(AUDIT_TYPE_UNSPENT_TALENT_POINTS, self::GetFreeTalentPoints()); if (self::IsInventoryLoaded()) { // Inventory check foreach (self::$m_items as $item) { if (!$item) { continue; } self::UpdateAudit(AUDIT_TYPE_STAT_BONUS, $item->GetItemBonuses()); // Add some stats from ench/gem. // Non optimal armor if (!in_array($item->GetSlot(), array(INV_MAIN_HAND, INV_OFF_HAND, INV_BELT, INV_SHIRT, INV_RANGED_RELIC, INV_TABARD, INV_TRINKET_1, INV_TRINKET_2, INV_NECK, INV_OFF_HAND, INV_RING_1, INV_RING_2, INV_NECK)) && !self::IsOptimalArmorForClass($item->GetEntry())) { self::UpdateAudit(AUDIT_TYPE_NONOPTIMAL_ARMOR, array($item->GetSlot(), $item->GetEntry())); } // Enchant bonus if ($item->GetEnchantmentId() != 0) { //self::UpdateAudit(AUDIT_TYPE_STAT_BONUS, $item->GetEnchantmentId()); } // Unenchanted items if ($item->GetEnchantmentId() == 0 && !in_array($item->GetSlot(), array(INV_BELT, INV_SHIRT, INV_RANGED_RELIC, INV_TABARD, INV_TRINKET_1, INV_TRINKET_2, INV_NECK, INV_OFF_HAND, INV_RING_1, INV_RING_2, INV_NECK))) { self::UpdateAudit(AUDIT_TYPE_UNENCHANTED_ITEM, array($item->GetSlot(), $item->GetEntry())); } // Missing belt buckle if ($item->GetSlot() == INV_BELT && !$item->HasBonusEnchantmentSlot()) { self::UpdateAudit(AUDIT_TYPE_MISSING_BELT_BUCKLE, true); } // Unused profession perks // TODO: add more profession perks (currently only enchanting and blacksmithing are available) switch ($item->GetSlot()) { case INV_RING_1: case INV_RING_2: if (self::HasProfessionSkill(SKILL_ENCHANTING) && self::GetSkillValue(SKILL_ENCHANTING) >= 360 && $item->GetEnchantmentId() == 0) { self::UpdateAudit(AUDIT_TYPE_UNUSED_PROFESSION_PERK, array($item->GetSlot(), $item->GetEntry(), SKILL_ENCHANTING)); } break; case INV_BRACERS: case INV_BELT: if (self::HasProfessionSkill(SKILL_BLACKSMITHING) && self::GetSkillValue(SKILL_BLACKSMITHING) >= 400 && !$item->HasBonusEnchantmentSlot()) { self::UpdateAudit(AUDIT_TYPE_UNUSED_PROFESSION_PERK, array($item->GetSlot(), $item->GetEntry(), SKILL_BLACKSMITHING)); } break; } // Empty sockets $sockets_count = WoW_Items::GetTemplateSocketsCount($item->GetEntry()); if ($item->HasBonusEnchantmentSlot()) { ++$sockets_count; // Include blacksmithing bonus slot } for ($i = 1; $i < 4; ++$i) { if ($item->GetSocketInfo($i, true) == 0) { if ($i <= $sockets_count) { self::UpdateAudit(AUDIT_TYPE_EMPTY_SOCKET, array($item->GetEntry(), $item->GetSlot())); } } else { self::UpdateAudit(AUDIT_TYPE_USED_GEMS, $item->GetSocketInfo($i)); } } } } return true; }
<?php if (is_array($vendors)) { $count = count($vendors); echo 'new Listview({template: \'npc\', id: \'sold-by\', name: LANG.tab_soldby, tabs: tabsRelated, parent: \'lkljbjkb574\', hiddenCols: [\'level\', \'type\'], extraCols: [Listview.extraCols.stock, Listview.extraCols.cost], data: ['; $current = 1; foreach ($vendors as $vendor) { echo sprintf('{"classification":%d,"id":%d,"location":[%d],"maxlevel":%d,"minlevel":%d,"name":"%s","react":[%d,%d],"tag":"%s","type":%d,stock:%d,cost:[0,%s,[]]}', $vendor['rank'], $vendor['entry'], $vendor['areaID'], $vendor['maxlevel'], $vendor['minlevel'], str_replace('"', '\\"', $vendor['name']), $vendor['react_a'] ? 1 : -1, $vendor['react_h'] ? 2 : -1, str_replace('"', '\\"', $vendor['subname']), $vendor['type'], $vendor['maxcount'] == 0 ? -1 : $vendor['maxcount'], $vendor['ext_cost']); if ($current < $count) { echo ','; } ++$current; } echo ']}); '; } $dropCreatures = WoW_Items::GetDropCreaturesSource(); if (is_array($dropCreatures)) { $count = count($dropCreatures['creatures']); echo 'new Listview({template: \'npc\', id: \'dropped-by\', name: LANG.tab_droppedby, tabs: tabsRelated, ' . ($count == 1 ? 'note: LANG.lvnote_itemdrops' . $dropCreatures['dropInfo'] . ',' : null) . ' parent: \'lkljbjkb574\', hiddenCols: [\'type\'], extraCols: [Listview.extraCols.count, Listview.extraCols.percent], sort:[\'-percent\', \'name\'], computeDataFunc: Listview.funcBox.initLootTable, data: ['; $current = 1; foreach ($dropCreatures['creatures'] as $creature) { echo sprintf('{"boss":%d,"classification":%d,"id":%d,"location":[%d],"maxlevel":%d,"minlevel":%d,"name":"%s","react":[%d,%d],"type":%d,count:%d,outof:%d', $creature['rank'] == 3 ? 1 : 0, $creature['rank'], $creature['entry'], $creature['areaID'], $creature['level'] == '??' ? 9999 : $creature['minlevel'], $creature['level'] == '??' ? 9999 : $creature['maxlevel'], str_replace('"', '\\"', $creature['name']), $creature['react_a'] ? 1 : -1, $creature['react_h'] ? 2 : -1, $creature['type'], 20, 100); echo '}'; if ($current < $count) { echo ','; } ++$current; } echo ']}); '; }
// Descrition if ($proto->description) { echo sprintf('<li class="color-tooltip-yellow">%s</li>', $proto->description); } if ($proto->SellPrice > 0) { $sell_price = WoW_Utils::GetMoneyFormat($proto->SellPrice); echo sprintf('<li>%s', WoW_Locale::GetString('template_item_sell_price')); $sMoney = array('gold', 'silver', 'copper'); foreach ($sMoney as $money) { if ($sell_price[$money] > 0) { echo sprintf('<span class="icon-%s">%d</span>', $money, $sell_price[$money]); } } echo '</li>'; } if (WoW_Template::GetPageData('tooltip') == true) { $source = WoW_Items::GetItemSource($proto->entry); if ($source) { switch ($source['type']) { case 'sourceType.creatureDrop': break; case 'sourceType.questReward': echo '<ul class="item-specs"><li><span class="color-tooltip-yellow">Quest:</span> <span data-quest="' . $source['questId'] . '">' . $source['Title'] . '</span></li>' . ($source['questZone'] > 0 ? '<li><span class="color-tooltip-yellow">Zone:</span></li>' . WoW_Utils::GetZoneName($source['questZone']) : null) . '</ul>'; break; } } } ?> </ul> <span class="clear"><!-- --></span> </div>
echo sprintf('<option value="class-%d">%s</option>', $i, WoW_Locale::GetString('character_class_' . $i)); } echo sprintf(' </select> </div> <div class="filter" style="padding-top: 3px;"> <label for="filter-isEquippable-%s"> <input id="filter-isEquippable-%s" type="checkbox" class="input checkbox filter-isEquippable" data-name="isEquippable" data-filter="class" data-value="is-equipment" /> %s </label> </div>', $tab_type, $tab_type, WoW_Locale::GetString('template_item_tab_content_equipment_only')); } } ?> <?php $result_table = WoW_Items::GetItemTabContents($entry, $tab_type, $allowed_item_tabs); if (is_array($result_table)) { echo sprintf('<div class="table-options-top"> <div class="table-options">%s<span class="clear"><!-- --></span> </div> </div><div class="table full-width"> <table> <thead> <tr>', WoW_Locale::GetString('template_guild_roster_results_count')); if (isset($result_table['table_headers']) && is_array($result_table['table_headers'])) { foreach ($result_table['table_headers'] as $header) { echo sprintf('<th> <a href="javascript:;" class="sort%s"><span class="arrow">%s</span></a> </th>', $header['class'], WoW_Locale::GetString('template_item_tab_header_' . $header['type'])); } }
} echo sprintf('<div class="more-results"> <a href="?q=%s&f=wowcharacter" class="more"> Больше результатов по запросу «%s» </a> </div> </div>', WoW_Search::GetSearchQuery(), WoW_Search::GetSearchQuery()); } } if (WoW_Search::GetItemsSearchResultsCount() > 0) { echo sprintf('<div class="result-set"> <h3 class="results-title">%s</h3>', sprintf(WoW_Locale::GetString('template_search_results_wowitem'), WoW_Search::GetSearchQuery())); $items = WoW_Search::GetRightBoxResults('wowitem'); if (is_array($items)) { foreach ($items as $item) { $itemIcon = WoW_Items::GetItemIcon($item['entry'], $item['displayid']); $sellPrice = WoW_Utils::GetMoneyFormat($item['SellPrice']); $classSubClassString = null; switch ($item['class']) { case ITEM_CLASS_ARMOR: case ITEM_CLASS_WEAPON: $classSubClassName = DB::WoW()->selectRow("SELECT `class_name_%s` AS `className`, `subclass_name_%s` AS `subclassName` FROM `DBPREFIX_itemsubclass` WHERE `class` = %d AND `subclass` = %d LIMIT 1", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $item['class'], $item['subclass']); if (is_array($classSubClassName)) { $classSubClassString = sprintf('%s (%s)', $classSubClassName['subclassName'], WoW_Locale::GetString('template_item_invtype_' . $item['InventoryType'])); } break; } echo sprintf('<div class="search-result"> <div class="multi-type"> <div class="result-title"> <div class="type-icon type-wowitem border-q%d" style="background-image:url(http://eu.battle.net/wow-assets/static/images/icons/36/%s.jpg)">
public static function GetExtendedItemInfo($entry) { if (!is_array($entry)) { return false; } $data = DB::World()->select("\n SELECT\n `a`.`entry`,\n `a`.`name`,\n `a`.`displayid`,\n `a`.`Quality` AS `quality`,\n `a`.`SellPrice` AS `sellprice`,\n `a`.`BuyPrice` AS `buyprice`,\n `a`.`class`,\n `a`.`subclass`,\n `a`.`displayid`,\n `a`.`Flags`,\n `a`.`Flags2`,\n `a`.`armor`,\n `a`.`InventoryType` AS `slotbak`,\n `a`.`AllowableClass`,\n `a`.`AllowableRace`,\n `a`.`ItemLevel` AS `level`,\n `a`.`RequiredLevel` AS `reqlevel`,\n `b`.`icon`,\n %s\n FROM `item_template` AS `a`\n LEFT JOIN `DBPREFIX_icons` AS `b` ON `b`.`displayid` = `a`.`displayid`\n %s\n WHERE `a`.`entry` IN (%s)", WoW_Locale::GetLocaleID() != LOCALE_EN ? '`c`.`name_loc' . WoW_Locale::GetLocaleID() . '` AS `name_loc`' : 'NULL', WoW_Locale::GetLocaleID() != LOCALE_EN ? 'LEFT JOIN `locales_item` AS `c` ON `c`.`entry` = `a`.`entry`' : null, $entry); ///$items = array(); foreach ($data as &$item) { $item['id'] = $item['entry']; if (isset($item['name_loc']) && $item['name_loc'] != null) { // GetLocaleID() check is not required here $item['name'] = $item['name_loc']; unset($item['name_loc']); } if ($item['Flags2'] & ITEM_FLAGS2_ALLIANCE_ONLY) { $item['side'] = FACTION_ALLIANCE; } elseif ($item['Flags2'] & ITEM_FLAGS2_HORDE_ONLY) { $item['side'] = FACTION_HORDE; } else { $item['side'] = 3; // Thumb Up, RWJ! } if ($item['Flags'] & ITEM_FLAGS_HEROIC) { $item['heroic'] = 1; } if (is_array(WoW_Items::AllowableClasses($item['AllowableClass']))) { $item['reqclass'] = $item['AllowableClass']; unset($item['AllowableClass']); } if (is_array(WoW_Items::AllowableRaces($item['AllowableRace']))) { $item['reqrace'] = $item['AllowableRace']; unset($item['AllowableRace']); } if ($item['class'] == ITEM_CLASS_MISC && $item['subclass'] == ITEM_SUBCLASS_JUNK_MOUNT) { $item['modelviewer'] = '{"displayid":' . $item['displayid'] . ',"type": 1,"typeid":11147}'; } if (in_array($item['class'], array(ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON))) { $item['slot'] = $item['slotbak']; } else { unset($item['armor']); } $item['classs'] = $item['class']; unset($item['Flags'], $item['Flags2'], $item['AllowableClass'], $item['AllowableRace']); } return $data; }
public static function BBCodesToHTML($post_text) { $matches = array(); if (preg_match_all('/\\[item\\=(.+?)\\/]/x', $post_text, $matches)) { $count = count($matches[0]); // Replace [item] tag for ($i = 0; $i < $count; ++$i) { $info = WoW_Items::GetItemInfo(isset($matches[1][$i]) ? str_replace('"', '', $matches[1][$i]) : 0); if (!$info) { continue; } $post_text = str_replace($matches[0][$i], sprintf('<a href="%s/wow/%s/item/%d" class="bml-link-item color-q%d"><span class="icon-frame frame-10"><img src="http://eu.battle.net/wow-assets/static/images/icons/18/%s.jpg"> </span>%s</a>', WoW::GetWoWPath(), WoW_Locale::GetLocale(), $info['entry'], $info['Quality'], WoW_Items::GetItemIcon(0, $info['displayid']), WoW_Items::GetItemName($info['entry'])), $post_text); } } // Replace [quote] tag $post_text = str_replace('[quote', '<blockquote', $post_text); // Replace other tags $post_text = str_replace(array('[', ']', "\n"), array('<', '>', '<br/>'), $post_text); $post_text = str_replace('"', '\\"', $post_text); return $post_text; }
private static function HandleGuildFeed() { if (!self::IsCorrect()) { WoW_Log::WriteError('%s : guild was not found.', __METHOD__); return false; } if (!self::$guild_feed) { self::LoadGuildFeed(); } $feeds_data = array(); $periods = array(WoW_Locale::GetString('template_feed_sec'), WoW_Locale::GetString('template_feed_min'), WoW_Locale::GetString('template_feed_hour')); $today = date('d.m.Y'); $lengths = array(60, 60, 24); $feed_count = 0; foreach (self::$guild_feed as $event) { if ($feed_count >= 25) { break; } $date_string = date('d.m.Y', $event['date']); if ($date_string == $today) { $diff = time() - $event['date']; for ($i = 0; $diff >= $lengths[$i]; $i++) { $diff /= $lengths[$i]; } $diff = round($diff); $date_string = sprintf('%s %s %s', $diff, $periods[$i], WoW_Locale::GetString('template_feed_ago')); } $feed = array(); switch ($event['type']) { case TYPE_ACHIEVEMENT_FEED: $achievement = WoW_Achievements::GetAchievementInfo($event['data']); if (!$achievement) { WoW_Log::WriteLog('%s : wrong feed data (TYPE_ACHIEVEMENT_FEED, achievement ID: %d), ignore.', __METHOD__, $event['data']); continue; } $feed = array('type' => TYPE_ACHIEVEMENT_FEED, 'date' => $date_string, 'id' => $event['data'], 'points' => $achievement['points'], 'name' => $achievement['name'], 'desc' => $achievement['desc'], 'icon' => $achievement['iconname'], 'category' => $achievement['categoryId'], 'charName' => $event['charName'], 'gender' => $event['gender']); break; case TYPE_ITEM_FEED: $item = WoW_Items::GetItemInfo($event['data']); if (!$item) { WoW_Log::WriteLog('%s : wrong feed data (TYPE_ITEM_FEED, item ID: %d), ignore.', __METHOD__, $event['data']); continue; } $item_icon = WoW_Items::GetItemIcon($item['entry'], $item['displayid']); $data_item = null; $feed = array('type' => TYPE_ITEM_FEED, 'date' => $date_string, 'id' => $event['data'], 'name' => WoW_Locale::GetLocale() == 'en' ? $item['name'] : WoW_Items::GetItemName($item['entry']), 'data-item' => $data_item, 'quality' => $item['Quality'], 'icon' => $item_icon, 'charName' => $event['charName'], 'gender' => $event['gender']); break; case TYPE_BOSS_FEED: // Not supported here. continue; default: WoW_Log::WriteError('%s : unknown feed type (%d)!', __METHOD__, $event['type']); continue; } $feeds_data[] = $feed; $feed_count++; } self::$guild_feed_data = $feeds_data; return true; }
$breadcrumb_nav = ''; if (is_array($breadcrumbs)) { foreach ($breadcrumbs as $crumb) { $breadcrumb_nav .= sprintf('<li%s><a href="%s" rel="np">%s</a></li>', $crumb['last'] ? ' class="last"' : null, $crumb['link'], $crumb['caption']); if ($crumb['last']) { $global_url = $crumb['link']; } } } if (strpos($global_url, '?') == 0) { $global_url .= '?'; } else { $global_url .= '&'; } $page = isset($_GET['page']) ? (int) $_GET['page'] : 1; $items = WoW_Items::GetItemsForTable($page, isset($_GET['classId']) ? $_GET['classId'] : -1, isset($_GET['subClassId']) ? $_GET['subClassId'] : -1, isset($_GET['invType']) ? $_GET['invType'] : -1); $items_count = 0; if (is_array($items)) { $items_count = $items['count']; } ?> <div id="content"> <div class="content-top"> <div class="content-trail"> <?php WoW_Template::NavigationMenu(); ?> <!--<ol class="ui-breadcrumb"> <li> <a href="<?php echo WoW::GetWoWPath();
private static function HandleSellingItems() { if (self::$selling_count <= 0 || !is_array(self::$myitems_storage)) { return false; } $item_ids = array(); $item_ids_guids = array(); $items_data = array(); foreach (self::$myitems_storage as $item) { $item_ids[] = $item['item_template']; $item_ids_guids[$item['itemguid']] = $item['item_template']; $items_data[$item['itemguid']] = $item; } $items = DB::World()->select("SELECT `entry`, `name`, `Quality`, `displayid` FROM `item_template` WHERE `entry` IN (%s)", $item_ids); if (!$items) { return false; } $items_storage = array(); $displayids = array(); foreach ($items as $item) { $items_storage[$item['entry']] = $item; $displayids[] = $item['displayid']; } $icons = DB::WoW()->select("SELECT `displayid`, `icon` FROM `DBPREFIX_icons` WHERE `displayid` IN (%s)", $displayids); if (!$icons) { return false; } $icons_storage = array(); foreach ($icons as $icon) { $icons_storage[$icon['displayid']] = $icon['icon']; } unset($icons); self::$items_storage = array(); self::$buyout_price = 0; foreach ($item_ids_guids as $item_guid => $item_id) { if (isset($items_storage[$item_id])) { $item = new WoW_Item(WoWConfig::$Realms[WoW_Account::GetActiveCharacterInfo('realmId')]['type']); $item->LoadFromDBByEntry($item_guid, $item_id); $auc_time = $items_data[$item_guid]['time']; $now = time(); $auction_time = 0; if ($now - $auc_time <= 48 * IN_HOURS) { $auction_time = 3; } elseif ($now - $auc_time <= 24 * IN_HOURS) { $auction_time = 2; } elseif ($now - $auc_time <= 12 * IN_HOURS) { $auction_time = 1; } self::$items_storage[] = array('auction_id' => $items_data[$item_guid]['id'], 'guid' => $item_guid, 'id' => $items_storage[$item_id]['entry'], 'quality' => $items_storage[$item_id]['Quality'], 'name' => WoW_Locale::GetLocaleId() == LOCALE_EN ? $items_storage[$item_id]['name'] : WoW_Items::GetItemName($item_id), 'icon' => $icons_storage[$items_storage[$item_id]['displayid']], 'price_raw' => $items_data[$item_guid]['startbid'], 'price' => WoW_Utils::GetMoneyFormat($items_data[$item_guid]['startbid']), 'buyout_raw' => $items_data[$item_guid]['buyoutprice'], 'buyout' => WoW_Utils::GetMoneyFormat($items_data[$item_guid]['buyoutprice']), 'lastbid' => $items_data[$item_guid]['lastbid'], 'count' => $item->GetStackCount(), 'time' => $auction_time); self::$buyout_price += $items_data[$item_guid]['buyoutprice']; } } unset($items, $items_storage, $displayids); return true; }
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); }