public function main() { WoW_Template::SetPageData('body_class', sprintf('%s game-index', WoW_Locale::GetLocale(LOCALE_DOUBLE))); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('game'); if (empty($url_data['action1'])) { WoW_Template::SetPageIndex('game'); WoW_Template::SetPageData('page', 'game'); } elseif ($url_data['action1'] == 'guide') { switch ($url_data['action2']) { case 'getting-started': case 'how-to-play': case 'playing-together': case 'late-game': WoW_Template::SetPageIndex('game_guide_' . str_replace('-', '_', $url_data['action2'])); WoW_Template::SetPageData('body_class', 'game-guide-' . $url_data['action2']); WoW_Template::SetPageData('page', 'game_guide_' . str_replace('-', '_', $url_data['action2'])); break; default: WoW_Template::SetPageIndex('game_guide_what_is_wow'); WoW_Template::SetPageData('body_class', 'game-guide-what-is-wow'); WoW_Template::SetPageData('page', 'game_guide_what_is_wow'); break; } } elseif ($url_data['action1'] == 'race') { $race_id = WoW_Utils::GetRaceIDByKey($url_data['action2']); if ($race_id > 0) { WoW_Game::LoadRace($race_id); WoW_Template::SetPageIndex('game_race'); WoW_Template::SetPageData('body_class', 'race-' . $url_data['action2']); WoW_Template::SetPageData('race', $url_data['action2']); WoW_Template::SetPageData('page', 'game_race'); WoW_Template::SetPageData('raceId', $race_id); } else { WoW_Template::SetPageIndex('game_race_index'); WoW_Template::SetPageData('body_class', 'game-race-index'); WoW_Template::SetPageData('page', 'game_race_index'); } } elseif ($url_data['action1'] == 'class') { $class_id = WoW_Utils::GetClassIDByKey($url_data['action2']); if ($class_id > 0) { WoW_Game::LoadClass($class_id); WoW_Template::SetPageIndex('game_class'); WoW_Template::SetPageData('body_class', 'class-' . $url_data['action2']); WoW_Template::SetPageData('class', $url_data['action2']); WoW_Template::SetPageData('classId', $class_id); WoW_Template::SetPageData('page', 'game_class'); } else { WoW_Template::SetPageIndex('game_class_index'); WoW_Template::SetPageData('body_class', 'game-classes-index'); WoW_Template::SetPageData('page', 'game_class_index'); } } else { WoW_Template::ErrorPage(404); } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
public function main() { WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('guild'); $guild_error = false; if (!$url_data) { WoW_Template::ErrorPage(404); } elseif (!WoW_Guild::LoadGuild($url_data['name'], WoW_Utils::GetRealmIDByName($url_data['realmName']))) { WoW_Template::ErrorPage(404); } else { $primary = WoW_Account::GetActiveCharacter(); WoW_Template::SetPageData('guild-authorized', false); if (is_array($primary) && isset($primary['realmName'])) { if ($primary['realmName'] == WoW_Guild::GetGuildRealmName() && $primary['guildId'] == WoW_Guild::GetGuildID()) { WoW_Template::SetPageData('guild-authorized', true); } } switch ($url_data['action0']) { default: WoW_Template::SetPageData('guild-page', 'summary'); WoW_Template::SetPageIndex('guild_page'); WoW_Template::SetPageData('page', 'guild_page'); break; case 'perk': WoW_Template::SetPageData('guild-page', 'perks'); WoW_Template::SetPageIndex('guild_perks'); WoW_Template::SetPageData('page', 'guild_perks'); break; case 'roster': switch ($url_data['action1']) { default: WoW_Template::SetPageIndex('guild_roster'); WoW_Template::SetPageData('page', 'guild_roster'); break; case 'professions': WoW_Guild::InitProfessions(); WoW_Template::SetPageIndex('guild_professions'); WoW_Template::SetPageData('page', 'guild_professions'); break; } WoW_Template::SetPageData('guild-page', 'roster'); break; } WoW_Template::SetPageData('guildName', $url_data['name']); WoW_Template::SetPageData('realmName', $url_data['realmName']); WoW_Template::SetMenuIndex('menu-game'); } WoW_Template::LoadTemplate('page_index'); }
} $empty_sockets_js = sprintf($empty_sockets_slots_js_tpl, $empty_sockets_slots_js); echo sprintf('<li data-slots="%s"> ' . 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({
<div id="left-results"> <?php $searchResults = WoW_Search::GetSearchResults('wowguild'); if (is_array($searchResults)) { foreach ($searchResults as $guild) { echo sprintf(' <div class="search-result"> <div class=""> <div class="result-title"> <a href="%s/wow/%s/guild/%s/%s/" class="search-title"><%s></a> </div> <div class="search-content"> <div class="info">%s / %s</div> </div> <div class="search-results-url"> /wow/guild/%s/%s/</div> </div> <div class="clear"></div> </div>', WoW::GetWoWPath(), WoW_Locale::GetLocale(), $guild['realmName'], $guild['name'], $guild['name'], $guild['realmName'], WoW_Locale::GetString(WoW_Utils::GetFactionId($guild['raceId']) == FACTION_ALLIANCE ? 'faction_alliance' : 'faction_horde'), $guild['realmName'], $guild['name']); } } ?> </div>
public static function GetNpcSameModel($modelId, $entry) { $creatures = DB::World()->select("\n SELECT\n `a`.`entry`,\n `a`.`name`,\n `a`.`minlevel`,\n `a`.`maxlevel`,\n `a`.`rank`,\n `a`.`type`,\n %s\n FROM `creature_template` AS `a`\n %s\n WHERE\n (`a`.`modelid_1` IN (%s) OR `a`.`modelid_2` IN (%s) OR `a`.`modelid_3` IN (%s) OR `a`.`modelid_4` IN (%s))\n AND\n `a`.`entry` NOT IN (%s)\n LIMIT 200", WoW_Locale::GetLocaleID() != LOCALE_EN ? '`b`.`name_loc' . WoW_Locale::GetLocaleID() . '` AS `name_loc`' : 'NULL', WoW_Locale::GetLocaleID() != LOCALE_EN ? 'LEFT JOIN `locales_creature` AS `b` ON `b`.`entry` = `a`.`entry`' : null, $modelId, $modelId, $modelId, $modelId, $entry); if (!$creatures) { return false; } foreach ($creatures as &$cr) { if (WoW_Locale::GetLocaleID() != LOCALE_EN) { if ($cr['name_loc'] != null) { $cr['name'] = $cr['name_loc']; } } $cr['zone_info'] = WoW_Utils::GetNpcAreaInfo($cr['entry']); } return $creatures; }
} elseif ($class['id'] == CLASS_WARLOCK) { $nextClassId = CLASS_DRUID; } elseif ($class['id'] == CLASS_DRUID) { $nextClassId = CLASS_WARRIOR; $prevClassId = CLASS_WARLOCK; } if (!isset($nextClassId)) { $nextClassId = $class['id'] + 1; } if (!isset($prevClassId)) { $prevClassId = $class['id'] - 1; } ?> <a class="ui-button next-class button1-next" href="<?php echo WoW_Utils::GetClassKeyById($nextClassId); ?> "><span><span><?php echo sprintf(WoW_Locale::GetString('template_game_class_next'), WoW_Locale::GetString('character_class_' . $nextClassId)); ?> </span></span></a> <a class="ui-button previous-class button1-previous" href="<?php echo WoW_Utils::GetClassKeyById($prevClassId); ?> "><span><span><?php echo sprintf(WoW_Locale::GetString('template_game_class_prev'), WoW_Locale::GetString('character_class_' . $nextClassId)); ?> </span></span></a> </div> </div> </div>
/** * Spell Description handler * @author DiSlord aka Chestr * @category Items class * @access public * @param array $spell * @return array **/ public function GetSpellData($spell) { // Basepoints $s1 = abs($spell['EffectBasePoints_1'] + $spell['EffectBaseDice_1']); $s2 = abs($spell['EffectBasePoints_2'] + $spell['EffectBaseDice_2']); $s3 = abs($spell['EffectBasePoints_3'] + $spell['EffectBaseDice_3']); if ($spell['EffectDieSides_1'] > $spell['EffectBaseDice_1'] && $spell['EffectDieSides_1'] - $spell['EffectBaseDice_1'] != 1) { $s1 .= ' - ' . abs($spell['EffectBasePoints_1'] + $spell['EffectDieSides_1']); } if ($spell['EffectDieSides_2'] > $spell['EffectBaseDice_2'] && $spell['EffectDieSides_2'] - $spell['EffectBaseDice_2'] != 1) { $s2 .= ' - ' . abs($spell['EffectBasePoints_2'] + $spell['EffectDieSides_2']); } if ($spell['EffectDieSides_3'] > $spell['EffectBaseDice_3'] && $spell['EffectDieSides_3'] - $spell['EffectBaseDice_3'] != 1) { $s3 .= ' - ' . abs($spell['EffectBasePoints_3'] + $spell['EffectDieSides_3']); } $d = 0; if ($spell['DurationIndex']) { if ($spell_duration = DB::WoW()->selectRow("SELECT * FROM `DBPREFIX_spell_duration` WHERE `id`=%d", $spell['DurationIndex'])) { $d = $spell_duration['duration_1'] / 1000; } } // Tick duration $t1 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_1'] / 1000 : 5; $t2 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_2'] / 1000 : 5; $t3 = $spell['EffectAmplitude_1'] ? $spell['EffectAmplitude_3'] / 1000 : 5; // Points per tick $o1 = @intval($s1 * $d / $t1); $o2 = @intval($s2 * $d / $t2); $o3 = @intval($s3 * $d / $t3); $spellData['t1'] = $t1; $spellData['t2'] = $t2; $spellData['t3'] = $t3; $spellData['o1'] = $o1; $spellData['o2'] = $o2; $spellData['o3'] = $o3; $spellData['s1'] = $s1; $spellData['s2'] = $s2; $spellData['s3'] = $s3; $spellData['m1'] = $s1; $spellData['m2'] = $s2; $spellData['m3'] = $s3; $spellData['x1'] = $spell['EffectChainTarget_1']; $spellData['x2'] = $spell['EffectChainTarget_2']; $spellData['x3'] = $spell['EffectChainTarget_3']; $spellData['i'] = $spell['MaxAffectedTargets']; $spellData['d'] = WoW_Utils::GetTimeText($d); $spellData['d1'] = WoW_Utils::GetTimeText($d); $spellData['d2'] = WoW_Utils::GetTimeText($d); $spellData['d3'] = WoW_Utils::GetTimeText($d); $spellData['v'] = $spell['MaxTargetLevel']; $spellData['u'] = $spell['StackAmount']; $spellData['a1'] = WoW_Utils::GetRadius($spell['EffectRadiusIndex_1']); $spellData['a2'] = WoW_Utils::GetRadius($spell['EffectRadiusIndex_2']); $spellData['a3'] = WoW_Utils::GetRadius($spell['EffectRadiusIndex_3']); $spellData['b1'] = $spell['EffectPointsPerComboPoint_1']; $spellData['b2'] = $spell['EffectPointsPerComboPoint_2']; $spellData['b3'] = $spell['EffectPointsPerComboPoint_3']; $spellData['e'] = $spell['EffectMultipleValue_1']; $spellData['e1'] = $spell['EffectMultipleValue_1']; $spellData['e2'] = $spell['EffectMultipleValue_2']; $spellData['e3'] = $spell['EffectMultipleValue_3']; $spellData['f1'] = $spell['DmgMultiplier_1']; $spellData['f2'] = $spell['DmgMultiplier_2']; $spellData['f3'] = $spell['DmgMultiplier_3']; $spellData['q1'] = $spell['EffectMiscValue_1']; $spellData['q2'] = $spell['EffectMiscValue_2']; $spellData['q3'] = $spell['EffectMiscValue_3']; $spellData['h'] = $spell['procChance']; $spellData['n'] = $spell['procCharges']; $spellData['z'] = "<home>"; return $spellData; }
public static function GetProgressInfo($c = 0) { $progress_info = array(); // We have to request data from DB. $categories = array(ACHIEVEMENTS_CATEGORY_GENERAL, ACHIEVEMENTS_CATEGORY_QUESTS, ACHIEVEMENTS_CATEGORY_EXPLORATION, ACHIEVEMENTS_CATEGORY_PVP, ACHIEVEMENTS_CATEGORY_DUNGEONS, ACHIEVEMENTS_CATEGORY_PROFESSIONS, ACHIEVEMENTS_CATEGORY_REPUTATION, ACHIEVEMENTS_CATEGORY_EVENTS, ACHIEVEMENTS_CATEGORY_FEATS); if ($c > 0) { return array('total' => self::GetCategoryCap($c), 'completed' => self::GetAchievementsCountInCategory($c), 'totalPoints' => self::GetAchievementPointsCategoryCap($c), 'achievedPoints' => self::GetAchievementPointsCountInCategory($c), 'percent' => WoW_Utils::GetPercent(self::GetCategoryCap($c), min(self::GetCategoryCap($c), self::GetAchievementsCountInCategory($c)))); } $progress_info[0] = array('total' => 1058, 'completed' => self::GetAchievementsCount(), 'percent' => WoW_Utils::GetPercent(1058, min(1058, self::GetAchievementsCount())), 'totalPoints' => self::GetAchievementPointsCategoryCap(0), 'achievedPoints' => self::GetAchievementsPoints()); foreach ($categories as $cat) { $points = self::GetAchievementPointsCountInCategory($cat); $categoryCap = self::GetAchievementPointsCategoryCap($cat); $progress_info[$cat] = array('total' => self::GetCategoryCap($cat), 'completed' => self::GetAchievementsCountInCategory($cat), 'totalPoints' => $categoryCap, 'achievedPoints' => $points, 'percent' => WoW_Utils::GetPercent(self::GetCategoryCap($cat), min(self::GetCategoryCap($cat), self::GetAchievementsCountInCategory($cat)))); } return $progress_info; }
private static function CalculateResilience($recalculate = false) { if (!self::IsCorrect()) { WoW_Log::WriteError('%s : character was not found.', __METHOD__); return false; } if (isset(self::$stats_holder['defense']['resilience']) && !$recalculate) { return true; } $melee = self::GetDataField(PLAYER_FIELD_CRIT_TAKEN_MELEE_RATING); $ranged = self::GetDataField(PLAYER_FIELD_CRIT_TAKEN_RANGED_RATING); $spell = self::GetDataField(PLAYER_FIELD_CRIT_TAKEN_SPELL_RATING); $value = min($melee, $ranged, $spell); $damagePercent = $melee / WoW_Utils::GetRatingCoefficient(self::$rating, 15); $hitPercent = $spell / WoW_Utils::GetRatingCoefficient(self::$rating, 17); self::$stats_holder['defense']['resilience'] = array('value' => $value, 'hitPercent' => $hitPercent, 'damagePercent' => $damagePercent); return true; }
// 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>
<?php /** * Copyright (C) 2010-2011 Shadez <https://github.com/Shadez> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA **/ include '../includes/WoW_Loader.php'; echo '<title>Missed locale strings</title> <h1>Missed locale strings:</h1>'; echo WoW_Utils::AnalyzeLocales('ru', 'en', true); echo '<br />Analyze finished.';
if (isset($criteria['progressBar']) && $criteria['progressBar']) { if (!isset($criteria['maxQuantityGold'])) { // Counter $progressBar = sprintf('<div class="bar-contents">%d/ %d (%d%%)</div>', $criteria['quantity'], $criteria['maxQuantity'], round(WoW_Utils::GetPercent($criteria['maxQuantity'], $criteria['quantity']))); } else { // Money $progressBar = sprintf('<div class="bar-contents"> <span class="icon-gold">%d</span> <span class="icon-silver">%d</span> <span class="icon-copper">%d</span> </div>', $criteria['quantityGold'], $criteria['quantitySilver'], $criteria['quantityCopper']); } $criterias_list .= sprintf('<div class="profile-progress border-4%s"> <div class="bar border-4" style="width: %d%%"></div> %s </div>', $criteria['quantity'] >= $criteria['maxQuantity'] ? ' completed' : null, WoW_Utils::GetPercent($criteria['maxQuantity'], $criteria['quantity']), $progressBar); } else { if (!$list_opened) { if (isset($criteria['subAchievement'])) { $criterias_list .= '<ul class="sub-achievements">'; } else { $criterias_list .= '<ul>'; } $list_opened = true; } if (isset($criteria['achievementCriteria'])) { // ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT $criterias_list .= sprintf('<li class="%s linked"> <a href="#%d:a%d" onclick="location.hash = \'%d:a%d\'; dm.openEntry(true)"> <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>
<span class="name">%s</span> </span> </li>', WoW_Locale::GetString('template_profile_no_professions')); } else { echo sprintf('<li><div class="profile-progress border-3" > <div class="bar border-3" style="width: %d%%"></div> <div class="bar-contents"><span class="profession-details"> <span class="icon"> <span class="icon-frame frame-12"> <img src="http://eu.battle.net/wow-assets/static/images/icons/18/%s.jpg" alt="" width="12" height="12" /> </span> </span> <span class="name">%s</span> <span class="value">%d</span> </span> <a href="javascript:;" data-fansite="skill|%d|%s" class="fansite-link fansite-small"> </a> </div> </div></li>', WoW_Utils::GetPercent($professions[$i]['max'], $professions[$i]['value']), $professions[$i]['icon'], $professions[$i]['name'], $professions[$i]['value'], $professions[$i]['id'], $professions[$i]['name']); } } } ?> </ul> </div> <span class="clear"><!-- --></span> </div>
<span class="icon-silver"><?php echo $money['gold'] > 0 ? $money['silver'] : '--'; ?> </span> <span class="icon-copper"><?php echo $money['gold'] > 0 ? $money['copper'] : '--'; ?> </span> </span> <?php echo WoW_Locale::GetString('template_auction_earned'); ?> </li> <li> <span class="float-right"> <?php echo WoW_Auction::GetMailsCount(); ?> /50 (<?php echo WoW_Utils::GetPercent(50, WoW_Auction::GetMailsCount()); ?> %) </span> <?php echo WoW_Locale::GetString('template_auction_mailbox'); ?> </li> </ul> </div> </div>
?> </p> <?php $classes = array('warrior' => CLASS_WARRIOR, 'paladin' => CLASS_PALADIN, 'hunter' => CLASS_HUNTER, 'rogue' => CLASS_ROGUE, 'priest' => CLASS_PRIEST, 'death-knight' => CLASS_DK, 'shaman' => CLASS_SHAMAN, 'mage' => CLASS_MAGE, 'warlock' => CLASS_WARLOCK, 'druid' => CLASS_DRUID); $exp_classes = array('wrath' => array('death-knight')); $i = 0; foreach ($classes as $class_name => $class_id) { if (in_array($class_name, $exp_classes['wrath'])) { $req = sprintf('<em class="class-req wrath">%s</em>', WoW_Locale::GetString('template_zone_expansion_required') . ' ' . WoW_Locale::GetString('template_expansion_2')); } else { $req = ''; } echo sprintf('<div class="flag-card %s"> <div class="wrapper"> <a href="%s"> <span class="class-name">%s</span> <span class="class-type">%s</span>%s <span class="class-desc">%s</span> </a> </div> </div>', $class_name, $class_name, WoW_Locale::GetString('character_class_' . $class_id), WoW_Utils::GetClassRolesInfo(WoW_Game::GetClassRole($class_id)), $req, WoW_Locale::GetString('template_game_class_' . $class_name . '_info')); ++$i; } ?> <span class="clear"> <!-- --> </span> </div> </div> </div>
?> "><?php echo $team_member['personalRating']; ?> </span> </div> <span class="gameswon"><?php echo $team_member['gamesSeason']; ?> </span> – <span class="gameslost"><?php echo $team_member['winsSeason']; ?> </span> <span class="percentwon">(<?php echo WoW_Utils::GetPercent($team_member['gamesSeason'], $team_member['winsSeason']); ?> %)</span> </div> </div> <div class="cell-mid"> <a href="<?php echo $team->GetTeamURL(); ?> "><?php echo $team->GetTeamName(); ?> </a> <div class="rating-rank"> <span class="rating tip" data-tooltip="<?php echo WoW_Locale::GetString('template_character_team_rating');
public function main() { WoW_Template::SetPageData('body_class', WoW_Locale::GetLocale(LOCALE_DOUBLE)); WoW_Template::SetTemplateTheme('wow'); $url_data = WoW::GetUrlData('character'); if (!$url_data) { WoW_Template::SetPageIndex('404'); WoW_Template::SetPageData('page', '404'); WoW_Template::SetPageData('errorProfile', 'template_404'); } else { if ($url_data['action0'] == 'advanced') { // Set "wow.character.summary.view" cookie as "advanced" setcookie('wow.character.summary.view', 'advanced', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/'); } elseif ($url_data['action0'] == null && (isset($url_data['name']) && isset($url_data['realmName']))) { WoW::RedirectToCorrectProfilePage('simple'); //change to WoW::RedirectTo()? } elseif ($url_data['action0'] == 'simple') { // Set "wow.character.summary.view" cookie as "simple" setcookie('wow.character.summary.view', 'simple', strtotime('NEXT YEAR'), '/' . WoW::GetWoWPath() . '/character/'); } $load_result = WoW_Characters::LoadCharacter($url_data['name'], WoW_Utils::GetRealmIDByName($url_data['realmName']), true, true); if (!WoW_Characters::IsCorrect() || $load_result != 3) { if ($url_data['action0'] == 'tooltip') { exit; } if ($load_result == 2) { WoW_Template::SetPageData('errorProfile', 'template_lowlevel'); } else { WoW_Template::SetPageData('errorProfile', 'template_404'); } WoW_Template::SetPageIndex('404'); WoW_Template::SetPageData('page', '404'); } else { WoW_Achievements::Initialize(); WoW_Template::SetPageData('characterName', WoW_Characters::GetName()); WoW_Template::SetPageData('characterRealmName', WoW_Characters::GetRealmName()); switch ($url_data['action0']) { default: WoW_Template::SetPageIndex('character_profile_simple'); WoW_Template::SetPageData('page', 'character_profile'); WoW_Characters::CalculateStats(true); break; case 'advanced': WoW_Template::SetPageIndex('character_profile_advanced'); WoW_Template::SetPageData('page', 'character_profile'); WoW_Characters::CalculateStats(true); break; /* case 'talent': WoW_Template::SetPageIndex('character_talents'); WoW_Template::SetPageData('page', 'character_talents'); WoW_Template::SetPageData('talents', 'primary'); if($url_data['action1'] == 'secondary') { WoW_Template::SetPageData('talents', 'secondary'); } break; */ /* case 'talent': WoW_Template::SetPageIndex('character_talents'); WoW_Template::SetPageData('page', 'character_talents'); WoW_Template::SetPageData('talents', 'primary'); if($url_data['action1'] == 'secondary') { WoW_Template::SetPageData('talents', 'secondary'); } break; */ case 'tooltip': WoW_Template::LoadTemplate('page_character_tooltip'); exit; break; case 'achievement': for ($i = 2; $i > 0; $i--) { if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) { WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]); WoW_Template::LoadTemplate('page_character_achievements'); exit; } } WoW_Template::SetPageIndex('character_achievements'); WoW_Template::SetPageData('page', 'character_achievements'); break; case 'reputation': if (isset($url_data['action1']) && $url_data['action1'] == 'tabular') { WoW_Template::SetPageIndex('character_reputation_tabular'); } else { WoW_Template::SetPageIndex('character_reputation'); } WoW_Template::SetPageData('page', 'character_reputation'); WoW_Reputation::InitReputation(WoW_Characters::GetGUID()); break; case 'pvp': WoW_Template::SetPageIndex('character_pvp'); WoW_Template::SetPageData('page', 'character_pvp'); WoW_Characters::InitPvP(); break; case 'statistic': for ($i = 2; $i > 0; $i--) { if (isset($url_data['action' . $i]) && $url_data['action' . $i] != null) { WoW_Achievements::SetCategoryForTemplate($url_data['action' . $i]); WoW_Template::LoadTemplate('page_character_statistics'); exit; } } WoW_Template::SetPageIndex('character_statistics'); WoW_Template::SetPageData('page', 'character_statistics'); break; case 'feed': WoW_Template::SetPageIndex('character_feed'); WoW_Template::SetPageData('page', 'character_feed'); break; case 'companion': case 'mount': WoW_Template::SetPageIndex('character_companions_mounts'); WoW_Template::SetPageData('page', 'character_companions_mounts'); WoW_Template::SetPageData('category', $url_data['action0']); WoW_Characters::InitMounts(); break; } } } WoW_Template::SetMenuIndex('menu-game'); WoW_Template::LoadTemplate('page_index'); }
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)"> <a href="%s/wow/' . WoW_Locale::GetLocale() . '/item/%d" rel="item:%d">
public function GetFactionBitMaskByFactionId($factionID) { $bitMask = 0; switch ($factionID) { case FACTION_ALLIANCE: $races = array(RACE_HUMAN, RACE_DWARF, RACE_NIGHTELF, RACE_GNOME, RACE_DRAENEI); break; case FACTION_HORDE: $races = array(RACE_ORC, RACE_UNDEAD, RACE_TAUREN, RACE_TROLL, RACE_BLOODELF); break; default: return $bitMask; } foreach ($races as $race) { $bitMask |= WoW_Utils::GetRaceBitMaskByRaceId($race); } return $bitMask; }
private static function LoadFactions() { $factions = DB::WoW()->select("SELECT `id`, `category`, `name_%s` AS `name` FROM `DBPREFIX_faction` WHERE `id` IN (%s) ORDER BY `id` DESC", WoW_Locale::GetLocale(), self::GetFactionsIDs()); if (!$factions) { WoW_Log::WriteError('%s : unable to load factions info for character %d!', __METHOD__, self::$guid); return false; } // Default categories $categories = array(1118 => array(67 => array('order' => 1, 'side' => FACTION_HORDE), 892 => array('order' => 2, 'side' => FACTION_HORDE), 469 => array('order' => 1, 'side' => FACTION_ALLIANCE), 891 => array('order' => 2, 'side' => FACTION_ALLIANCE), 169 => array('order' => 3, 'side' => -1)), 980 => array(936 => array('order' => 1, 'side' => -1)), 1097 => array(1117 => array('order' => 1, 'side' => -1), 1052 => array('order' => 2, 'side' => FACTION_HORDE), 1037 => array('order' => 2, 'side' => FACTION_ALLIANCE)), 0 => array(589 => array('order' => 1, 'side' => FACTION_ALLIANCE), 70 => array('order' => 2, 'side' => -1))); $storage = array(); foreach ($factions as $faction) { // Standing & adjusted values $standing = min(42999, self::$reputation[$faction['id']]['standing']); $type = REP_EXALTED; $rep_cap = 999; $rep_adjusted = $standing - 42000; if ($standing < REPUTATION_VALUE_HATED) { $type = REP_HATED; $rep_cap = 36000; $rep_adjusted = $standing + 42000; } elseif ($standing < REPUTATION_VALUE_HOSTILE) { $type = REP_HOSTILE; $rep_cap = 3000; $rep_adjusted = $standing + 6000; } elseif ($standing < REPUTATION_VALUE_UNFRIENDLY) { $type = REP_UNFRIENDLY; $rep_cap = 3000; $rep_adjusted = $standing + 3000; } elseif ($standing < REPUTATION_VALUE_NEUTRAL) { $type = REP_NEUTRAL; $rep_cap = 3000; $rep_adjusted = $standing; } elseif ($standing < REPUTATION_VALUE_FRIENDLY) { $type = REP_FRIENDLY; $rep_cap = 6000; $rep_adjusted = $standing - 3000; } elseif ($standing < REPUTATION_VALUE_HONORED) { $type = REP_HONORED; $rep_cap = 12000; $rep_adjusted = $standing - 9000; } elseif ($standing < REPUTATION_VALUE_REVERED) { $type = REP_REVERED; $rep_cap = 21000; $rep_adjusted = $standing - 21000; } $faction['standing'] = self::$reputation[$faction['id']]['standing']; $faction['type'] = $type; $faction['cap'] = $rep_cap; $faction['adjusted'] = $rep_adjusted; $faction['percent'] = WoW_Utils::GetPercent($rep_cap, $rep_adjusted); if (isset($categories[$faction['category']])) { if (!isset($storage[$faction['category']])) { $storage[$faction['category']] = array(); } $storage[$faction['category']][] = $faction; } else { foreach ($categories as $catId => $subcat) { if (isset($categories[$catId][$faction['category']])) { if (!isset($categories[$catId][$faction['category']])) { $categories[$catId][$faction['category']] = array(); } $storage[$catId][$faction['category']][] = $faction; } } } } self::$factions = $storage; unset($storage); return true; }
</div> </div> </th> <th><span class="sort-tab"> </span></th> </tr> </thead> <tfoot> <tr> <th colspan="4" class="align-right"><strong><?php echo WoW_Locale::GetString('template_auction_buyout_total'); ?> </strong></th> <th class="price" id="buyout-total"> <?php $total_price = WoW_Auction::GetBuyOutTotalPrice(); $money_format = WoW_Utils::GetMoneyFormat($total_price); echo sprintf('<span class="hide">%d</span><span class="icon-gold">%d</span> <span class="icon-silver">%d</span> <span class="icon-copper">%d</span>', $total_price, $money_format['gold'], $money_format['silver'], $money_format['copper']); ?> </th> <th> </th> </tr> </tfoot> <tbody> <?php $auction_items = WoW_Auction::GetSellingItems(); if (is_array($auction_items)) { $toggleStyle = 2; foreach ($auction_items as $item) {
<td class="align-center season arenateam-gameswonlost" data-raw="%d"> <span class="arenateam-gameswon">%d</span> – <span class="arenateam-gameslost">%d</span> <span class="arenateam-percent">(%d%%)</span> </td> <td class="align-center weekly" style="display:none;"> 0 <span class="arenateam-percent">(0%%)</span> </td> <td class="align-center weekly arenateam-gameswonlost" data-raw="0" style="display:none;"> <span class="arenateam-gameswon">0</span> – <span class="arenateam-gameslost">0</span> <span class="arenateam-percent">(0%%)</span> </td> <td class="align-center"><span class="arenateam-rating">%d</span></td> </tr>', $toggleStyle % 2 ? 2 : 1, $member['name'], $member['url'], $member['url'], $member['class'], WoW::GetWoWPath(), $member['race'], $member['gender'], WoW::GetWoWPath(), $member['class'], $member['name'], $member['guid'] == $team['data']['captain'] ? '<span class="leader" data-tooltip="Капитан команды"></span>' : null, $member['played_season'], round(WoW_Utils::GetPercent($team['data']['games_season'], $member['played_season'])), $member['wons_season'], $member['wons_season'], $member['lost_season'], round(WoW_Utils::GetPercent($member['played_season'], $member['wons_season'])), $member['personal_rating']); ++$toggleStyle; } ?> </tbody> </table> </div> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { new Table('#arena-roster-<?php echo $team['data']['type_text']; ?> ', { column: 3, method: 'numeric', type: 'desc' }); Tooltip.bind('#arena-roster-<?php
private static function LoadGuildMembers() { if (!self::IsCorrect()) { WoW_Log::WriteError('%s : guild was not found.', __METHOD__); return false; } $members = DB::Characters()->select("\n SELECT\n `guild_member`.`guid`,\n `guild_member`.`rank` AS `rankID`,\n `guild_rank`.`rname` AS `rankName`,\n `characters`.`name`,\n `characters`.`race` AS `raceID`,\n `characters`.`class` AS `classID`,\n `characters`.`gender` AS `genderID`,\n `characters`.`level`\n FROM `guild_member` AS `guild_member`\n JOIN `guild_rank` AS `guild_rank` ON `guild_rank`.`rid`=`guild_member`.`rank` AND `guild_rank`.`guildid`=%d\n JOIN `characters` AS `characters` ON `characters`.`guid`=`guild_member`.`guid`\n WHERE `guild_member`.`guildid`=%d\n ", self::GetGuildID(), self::GetGuildID()); if (!$members) { WoW_Log::WriteError('%s : unable to find any member of guild %s (GUILDID: %d). Guild is empty?', __METHOD__, self::GetGuildName(), self::GetGuildID()); return false; } $roster = array(); foreach ($members as $member) { $member['race_text'] = WoW_Locale::GetString('character_race_' . $member['raceID']); $member['class_text'] = WoW_Locale::GetString('character_class_' . $member['classID']); $member['url'] = sprintf('%s/wow/%s/character/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), self::GetGuildRealmName(), $member['name']); $achievement_ids = DB::Characters()->select("SELECT `achievement` FROM `character_achievement` WHERE `guid` = %d", $member['guid']); if (is_array($achievement_ids)) { $ids = array(); foreach ($achievement_ids as $ach) { $ids[] = $ach['achievement']; } if (is_array($ids)) { $member['achievement_points'] = DB::WoW()->selectCell("SELECT SUM(`points`) FROM `DBPREFIX_achievement` WHERE `id` IN (%s)", $ids); } else { $member['achievement_points'] = 0; } } else { $member['achievement_points'] = 0; } $roster[] = $member; } self::$guild_roster = $roster; unset($roster); // Set faction self::$guild_factionID = WoW_Utils::GetFactionId(self::GetMemberInfo(0, 'raceID')); return true; }
</div> <script type="text/javascript"> //<![CDATA[ $(function() { Ladder.maxComps = <?php echo $format; ?> ; Ladder.classes = { 0: '<?php echo WoW_Locale::GetString('template_pvp_ladder_filter_comp_any'); ?> ', <?php $class_specs = WoW_Utils::GetClassSpecs(); $i = 0; while ($i < 30) { echo $class_specs[$i]['class'] . ': ' . '[\'' . $class_specs[$i]['name'] . '\', \'' . $class_specs[$i + 1]['name'] . '\', \'' . $class_specs[$i + 2]['name'] . '\'],'; $i += 3; } ?> }; Ladder.initialize('<?php echo isset($_GET['comp']) ? urldecode($_GET['comp']) : null; ?> '); }); //]]> </script>
/** * Loads all characters from world DBs * * @access public * @static WoW_Account::LoadCharactersFromWorld() * @category Account Manager Class * @return void **/ private static function LoadCharactersFromWorld() { $db = null; $chars_data = array(); self::$characters_data = array(); $index = 0; $account_ids = array(); $count = count(self::$myGamesList); if ($count == 0) { return false; } for ($i = 0; $i < $count; ++$i) { $account_ids[] = self::$myGamesList[$i]['account_id']; } foreach (WoWConfig::$Realms as $realm_info) { $db = DB::ConnectToDB(DB_CHARACTERS, $realm_info['id']); $chars_data = DB::Characters()->select("\n SELECT\n `characters`.`guid`,\n `characters`.`account`,\n `characters`.`name`,\n `characters`.`class`,\n `characters`.`race`,\n `characters`.`gender`,\n `characters`.`level`,\n `guild_member`.`guildid` AS `guildId`,\n `guild`.`name` AS `guildName`\n FROM `characters` AS `characters`\n LEFT JOIN `guild_member` AS `guild_member` ON `guild_member`.`guid`=`characters`.`guid`\n LEFT JOIN `guild` AS `guild` ON `guild`.`guildid`=`guild_member`.`guildid`\n WHERE `account` IN (%s)", $account_ids); if (!$chars_data) { continue; } foreach ($chars_data as $char) { $status = WoW::GetRealmStatus($realm_info['id']); $tmp_char_data = array('account' => $char['account'], 'index' => $index, 'guid' => $char['guid'], 'name' => $char['name'], 'class' => $char['class'], 'class_text' => WoW_Locale::GetString('character_class_' . $char['class'], $char['gender']), 'class_key' => Data_Classes::$classes[$char['class']]['key'], 'race' => $char['race'], 'race_text' => WoW_Locale::GetString('character_race_' . $char['race'], $char['gender']), 'race_key' => Data_Races::$races[$char['race']]['key'], 'gender' => $char['gender'], 'level' => $char['level'], 'realmName' => $realm_info['name'], 'realmId' => $realm_info['id'], 'isActive' => 0, 'faction' => WoW_Utils::GetFactionId($char['race']), 'faction_text' => WoW_Utils::GetFactionId($char['race']) == FACTION_ALLIANCE ? 'alliance' : 'horde', 'guildId' => $char['guildId'], 'guildName' => $char['guildName'], 'guildUrl' => sprintf('%s/wow/%s/guild/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), urlencode($realm_info['name']), urlencode($char['guildName'])), 'url' => sprintf('%s/wow/%s/character/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), urlencode($realm_info['name']), urlencode($char['name'])), 'realmStatus' => isset($status[0], $status[0]['status']) ? $status[0]['status'] : 'down'); self::$characters_data[] = $tmp_char_data; ++$index; } } }
private function LoadTrinity(&$team) { $team = DB::Characters()->selectRow("\n SELECT\n `a`.*,\n `b`.`race`\n FROM `arena_team` AS `a`\n LEFT JOIN `characters` AS `b` ON `b`.`guid` = `a`.`captainguid`\n WHERE `a`.`arenaTeamId` = %d", $this->m_teamId); if (!$team) { WoW_Log::WriteError('%s : team "%s" (%d) was not found in DB!', __METHOD__, $this->m_teamName, $this->m_teamId); return false; } // Fill class field $this->m_teamName = $team['name']; $this->m_teamId = $team['arenaTeamId']; $this->m_teamCaptain = $team['captainGuid']; $this->m_teamEmblem = array('bgColor' => $team['backgroundColor'], 'eStyle' => $team['emblemStyle'], 'eColor' => $team['emblemColor'], 'bStyle' => $team['borderStyle'], 'bColor' => $team['borderColor']); $this->m_teamFaction = WoW_Utils::GetFactionId($team['race']); $this->m_teamStats = array('rating' => $team['rating'], 'games_week' => $team['weekGames'], 'games_season' => $team['seasonGames'], 'wins_week' => $team['weekWins'], 'wins_season' => $team['seasonWins'], 'loses_week' => $team['weekGames'] - $team['weekWins'], 'loses_season' => $team['seasonGames'] - $team['seasonWins'], 'rank' => $team['rank']); $this->m_teamType = $team['type']; // Load member list $members = DB::Characters()->select("\n SELECT\n `a`.`weekGames`,\n `a`.`weekWins`,\n `a`.`seasonGames`,\n `a`.`seasonWins`,\n (`a`.`weekGames` - `a`.`weekWins`) AS `loses_week`,\n (`a`.`seasonGames` - `a`.`seasonWins`) AS `loses_season`,\n `a`.`personalRating`,\n `b`.`guid`,\n `b`.`name`,\n `b`.`class`,\n `b`.`race`,\n `b`.`gender`,\n `b`.`level`\n FROM `arena_team_member` AS `a`\n LEFT JOIN `characters` AS `b` ON `b`.`guid` = `a`.`guid`\n WHERE `a`.`arenateamid` = %d", $this->m_teamId); if (!$members) { WoW_Log::WriteError('%s : team "%s" (%d) has empty member list', __METHOD__, $this->m_teamName, $this->m_teamId); return false; } foreach ($members as $member) { $this->m_teamMembers[] = array('guid' => $member['guid'], 'name' => $member['name'], 'classId' => $member['class'], 'class_text' => WoW_Locale::GetString('character_class_' . $member['class'], $member['gender']), 'raceId' => $member['race'], 'race_text' => WoW_Locale::GetString('character_race_' . $member['race'], $member['gender']), 'factionId' => WoW_Utils::GetFactionId($member['race']), 'faction_text' => WoW_Utils::GetFactionId($member['race']) == FACTION_ALLIANCE ? 'alliance' : 'horde', 'genderId' => $member['gender'], 'level' => $member['level'], 'url' => sprintf('%s/wow/%s/character/%s/%s/', WoW::GetWoWPath(), WoW_Locale::GetLocale(), $this->GetTeamRealmName(), $member['name']), 'gamesWeek' => $member['weekGames'], 'winsWeek' => $member['weekWins'], 'losesWeek' => $member['loses_week'], 'gamesSeason' => $member['seasonGames'], 'winsSeason' => $member['seasonWins'], 'losesSeason' => $member['loses_season'], 'personalRating' => $member['personalRating'], 'teamId' => $this->m_teamId, 'matchMakerRating' => DB::Characters()->selectCell("SELECT `matchMakerRating` FROM `character_arena_stats` WHERE `guid` = %d AND `slot` = %d", $member['guid'], $this->m_teamType)); } unset($members, $member, $team); // Loaded successfully return true; }
} elseif ($race['id'] == RACE_HUMAN) { $prevRaceId = RACE_WORGEN; } if (!isset($prevRaceId)) { $prevRaceId = $race['id'] - 1; } if (!isset($nextRaceId)) { $nextRaceId = $race['id'] + 1; } ?> <a class="ui-button next-race button1-next" href="<?php echo WoW_Utils::GetRaceKeyById($nextRaceId); ?> "><span><span><?php echo sprintf(WoW_Locale::GetString('template_game_race_next'), WoW_Locale::GetString('character_race_' . $nextRaceId)); ?> </span></span></a> <a class="ui-button previous-race button1-previous" href="<?php echo WoW_Utils::GetRaceKeyById($prevRaceId); ?> "><span><span><?php echo sprintf(WoW_Locale::GetString('template_game_race_prev'), WoW_Locale::GetString('character_race_' . $prevRaceId)); ?> </span></span></a> </div> </div> </div> </div>
public function GetVendorsSource($rebuild = false) { if (!self::$m_item) { return false; } if (isset(self::$m_item_source['vendors']) && is_array(self::$m_item_source['vendors']) && !$rebuild) { return self::$m_item_source['vendors']; } $vendors_count = DB::World()->selectCell("SELECT COUNT(*) FROM `npc_vendor` WHERE `item` = %d", self::$m_item->entry); if ($vendors_count == 0) { return false; } $vendors_source = DB::World()->select("\n SELECT\n `a`.*,\n `b`.`name`,\n `b`.`subname`,\n `b`.`faction_A`,\n `b`.`faction_H`,\n `b`.`minlevel`,\n `b`.`maxlevel`,\n `b`.`rank`,\n `b`.`type`,\n `c`.`map`,\n `c`.`position_x`,\n `c`.`position_y`,\n `d`.*,\n %s\n FROM `npc_vendor` AS `a`\n LEFT JOIN `creature_template` AS `b` ON `b`.`entry` = `a`.`entry`\n LEFT JOIN `creature` AS `c` ON `c`.`id` = `a`.`entry`\n LEFT JOIN `DBPREFIX_extended_cost` AS `d` ON `d`.`id` = ABS(`a`.`ExtendedCost`)\n %s\n WHERE `a`.`item` = %d\n LIMIT 200", WoW_Locale::GetLocaleID() != LOCALE_EN ? sprintf('`e`.`name_loc%d` AS `name_loc`, `e`.`subname_loc%d` AS `subname_loc`', WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID()) : 'NULL', WoW_Locale::GetLocaleID() != LOCALE_EN ? 'LEFT JOIN `locales_creature` AS `e` ON `e`.`entry` = `a`.`entry`' : null, self::$m_item->entry); if (!$vendors_source) { return false; } $vendors = array(); $added_vendors = array(); $added_items = array(); foreach ($vendors_source as $vendor) { if (in_array($vendor['entry'], $added_vendors)) { continue; } // Find zone $vendor['areaName'] = null; $vendor['areaID'] = 0; $zone_info = DB::World()->selectRow("\n SELECT\n `a`.`id`,\n `a`.`area`,\n `b`.`name_en` AS `areaName_original`,\n `b`.`name_%s` AS `areaName_locale`\n FROM `DBPREFIX_zones` AS `a`\n JOIN `DBPREFIX_areas` AS `b` ON `b`.`id` = `a`.`area`\n WHERE `a`.`map` = %d AND `a`.`y_min` >= %d AND `a`.`y_max` <= %d AND `a`.`x_min` >= %d AND `a`.`x_max` <= %d\n LIMIT 1", WoW_Locale::GetLocale(), $vendor['map'], $vendor['position_y'], $vendor['position_y'], $vendor['position_x'], $vendor['position_x']); if (is_array($zone_info)) { $vendor['areaID'] = $zone_info['area']; $vendor['areaName'] = WoW_Locale::GetLocaleID() != LOCALE_EN && $zone_info['areaName_locale'] != null ? $zone_info['areaName_locale'] : $zone_info['areaName_original']; } $vendor['react_a'] = WoW_Utils::IsFriendlyForFaction($vendor['faction_A'], FACTION_ALLIANCE); $vendor['react_h'] = WoW_Utils::IsFriendlyForFaction($vendor['faction_H'], FACTION_HORDE); if (isset($vendor['name_loc']) && WoW_Locale::GetLocaleID() != LOCALE_EN && $vendor['name_loc'] != null) { $vendor['name'] = $vendor['name_loc']; $vendor['subname'] = $vendor['subname_loc']; // No check required } $vendor['ext_cost'] = '['; $vendor['ext_cost_items_id'] = array(); for ($i = 1; $i < 6; ++$i) { if ($vendor['item' . $i] > 0 && $vendor['item' . $i . 'count'] > 0) { $vendor['ext_cost'] .= sprintf('[%d, %d],', $vendor['item' . $i], $vendor['item' . $i . 'count']); if (!in_array($vendor['item' . $i], $added_items)) { $vendor['ext_cost_items_id'][] = $vendor['item' . $i]; $added_items[] = $vendor['item' . $i]; } } } if (is_array($vendor['ext_cost_items_id'])) { $vendor['ext_cost_items'] = self::GetBasicItemInfo($vendor['ext_cost_items_id']); } else { $vendor['ext_cost_items'] = array(); } unset($vendor['ext_cost_items_id']); $vendor['ext_cost'] .= ']'; $vendor['ext_cost'] = str_replace(',]', ']', $vendor['ext_cost']); $added_vendors[] = $vendor['entry']; $vendors[] = $vendor; } self::$m_item_source['vendors'] = $vendors; unset($vendors, $vendor); return self::$m_item_source['vendors']; }
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); }