Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 private static function GetRandomTitle()
 {
     $title = DB::World()->selectRow("SELECT `title_en` AS `originalTitle`%s FROM `DBPREFIX_site_titles` ORDER BY RAND() LIMIT 1", WoW_Locale::GetLocaleID() == LOCALE_EN ? null : sprintf(', `title_%s` AS `localizedTitle`', WoW_Locale::GetLocale()));
     if (!$title) {
         return false;
     }
     if (isset($title['localizedTitle']) && $title['localizedTitle'] != '') {
         return $title['localizedTitle'];
     }
     return $title['originalTitle'];
 }
 public static function PerformItemsSearch($limit = 0)
 {
     if (!self::$searchQuery) {
         return false;
     }
     $ph = '%%%s%%';
     if (WoW_Locale::GetLocaleID() > 0) {
         $sql_query = sprintf("SELECT\n            `item_template`.`entry`,\n            `item_template`.`ItemLevel`,\n            `item_template`.`class`,\n            `item_template`.`subclass`,\n            `item_template`.`InventoryType`,\n            `item_template`.`Quality`,\n            `item_template`.`displayid`,\n            `item_template`.`RequiredLevel`,\n            `item_template`.`SellPrice`,\n            `item_template`.`bonding`,\n            `locales_item`.`name_loc%d` AS `name`,\n            `locales_item`.`description_loc%d` AS `description`\n            FROM `item_template`\n            JOIN `locales_item` ON `locales_item`.`entry` = `item_template`.`entry`\n            WHERE\n            (\n                `locales_item`.`name_loc%d` LIKE '%s'\n                OR\n                `locales_item`.`description_loc%d` LIKE '%s'\n            )\n            ORDER BY `item_template`.`Quality` DESC, `item_template`.`ItemLevel` DESC\n            %s", WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID(), $ph, WoW_Locale::GetLocaleID(), $ph, $limit > 0 ? ' LIMIT ' . $limit : null);
     } else {
         $sql_query = "SELECT `entry`, `name`, `ItemLevel`, `class`, `subclass`, `InventoryType`, `Quality`, `displayid`, `RequiredLevel`, `SellPrice`, `bonding`, `description`\n            FROM `item_template`\n            WHERE\n            (\n                `name` LIKE '%%%s%%'\n                OR\n                `description` LIKE '%%%s%%'\n            )\n            ORDER BY `Quality` DESC, `ItemLevel` DESC";
         if ($limit > 0) {
             $sql_query .= ' LIMIT ' . $limit;
         }
     }
     $results = DB::World()->select($sql_query, self::GetSearchQuery(), self::GetSearchQuery());
     return self::SetSearchResults('wowitem', $results);
 }
 private function GetItemSourceFromdDB($item_entry)
 {
     if ($item_entry <= 0) {
         WoW_Log::WriteError('%s : entry must be > than 0 (%d given)!', __METHOD__, $item_entry);
         return false;
     }
     $source_info = DB::WoW()->selectRow("SELECT `source`, `areaKey`, `areaUrl`, `isHeroic` FROM `DBPREFIX_source` WHERE `item` = %d", $item_entry);
     if (!$source_info) {
         WoW_Log::WriteError('%s : item #%d was not found in DBPREFIX_source table!', __METHOD__, $item_entry);
         return false;
     }
     // Parse
     switch ($source_info['source']) {
         default:
             return;
         case 'sourceType.dungeon':
             if ($source_info['areaKey'] == '') {
                 return false;
             }
             $boss_entry = DB::World()->selectCell("SELECT `entry` FROM `creature_loot_template` WHERE `item` = %d", $item_entry);
             if ($boss_entry > 0) {
                 $name = DB::World()->selectCell("SELECT `name` FROM `creature_template` WHERE `entry` = %d", $boss_entry);
                 if (WoW_Locale::GetLocale() != LOCALE_EN) {
                     $name_loc = DB::World()->selectCell("SELECT `name_loc%d` FROM `locales_creature` WHERE `entry` = %d", WoW_Locale::GetLocaleID(), $boss_entry);
                     return $name_loc ? $name_loc : $name;
                 }
                 return $name;
             }
             break;
     }
     return false;
 }
Exemplo n.º 5
0
 public function LoadItem($item_entry, $itemGuid = 0, $ownerGuid = 0)
 {
     $item_row = DB::World()->selectRow("SELECT * FROM `item_template` WHERE `entry` = '%d' LIMIT 1", $item_entry);
     if (!$item_row) {
         WoW_Log::WriteError('%s : item #%d (GUID: %d) was not found in `item_template` table.', __METHOD__, $item_entry, $itemGuid);
         return false;
     }
     // FlagsExtra check
     if (isset($item_row['FlagsExtra'])) {
         $item_row['Flags2'] = $item_row['FlagsExtra'];
         unset($item_row['FlagsExtra']);
         // For compatibility
     }
     // Assign variables
     foreach ($item_row as $field => $value) {
         $this->{$field} = $value;
     }
     // Create arrays
     // Item mods
     for ($i = 0; $i < MAX_ITEM_PROTO_STATS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'stat_type' . $key})) {
             $this->ItemStat[$i] = array('type' => $this->{'stat_type' . $key}, 'value' => $this->{'stat_value' . $key});
         }
     }
     // Item damages
     for ($i = 0; $i < MAX_ITEM_PROTO_DAMAGES + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'dmg_type' . $key})) {
             $this->Damage[$i] = array('type' => $this->{'dmg_type' . $key}, 'min' => $this->{'dmg_min' . $key}, 'max' => $this->{'dmg_max' . $key});
         }
     }
     // Item spells
     for ($i = 0; $i < MAX_ITEM_PROTO_SPELLS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'spellid_' . $key})) {
             $this->Spells[$i] = array('spellid' => $this->{'spellid_' . $key}, 'trigger' => $this->{'spelltrigger_' . $key}, 'charges' => $this->{'spellcharges_' . $key}, 'ppmRate' => $this->{'spellppmRate_' . $key}, 'cooldown' => $this->{'spellcooldown_' . $key}, 'category' => $this->{'spellcategory_' . $key}, 'categorycooldown' => $this->{'spellcategorycooldown_' . $key});
         }
     }
     // Item sockets
     for ($i = 0; $i < MAX_ITEM_PROTO_SOCKETS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'socketColor_' . $key})) {
             $this->Socket[$i] = array('color' => $this->{'socketColor_' . $key}, 'content' => $this->{'socketContent_' . $key});
         }
     }
     $this->icon = DB::Wow()->selectCell("SELECT `icon` FROM `DBPREFIX_icons` WHERE `displayid` = %d LIMIT 1", $this->displayid);
     if (WoW_Locale::GetLocale() != 'en') {
         $newname = DB::World()->selectRow("SELECT `name_loc%d` AS `name`, `description_loc%d` AS `desc` FROM `locales_item` WHERE `entry` = %d", WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID(), $this->entry);
         if ($newname) {
             $this->name = $newname['name'];
             $this->description = $newname['desc'];
         }
     }
     $itemsublcass = DB::Wow()->selectRow("SELECT `subclass_name_%s` AS `subclass`, `class_name_%s` AS `class` FROM `DBPREFIX_item_subclass` WHERE `subclass` = %d AND `class` = %d LIMIT 1", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $this->subclass, $this->class);
     $this->subclass_name = $itemsublcass['subclass'];
     $this->class_name = $itemsublcass['class'];
     $this->m_guid = $itemGuid;
     // Can be NULL.
     $this->m_owner = $ownerGuid;
     // Can be NULL.
     $this->loaded = true;
     return true;
 }
 public static function AchievementCategory($category)
 {
     $achievement_category = array();
     $achievements = DB::WoW()->select("SELECT `id`, `name_%s` AS `name`, `description_%s` AS `desc`, `categoryId`, `points`, `iconname`, `titleReward_%s` AS `titleReward` FROM `DBPREFIX_achievement` WHERE `categoryId` = %d AND `factionFlag` <> %d", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $category, WoW_Characters::GetFactionID());
     if (!$achievements) {
         WoW_Log::WriteError('%s : unable to find any achievement in %d category!', __METHOD__, $category);
         return false;
     }
     $current_category = $category;
     $skip = array();
     foreach ($achievements as $ach) {
         $skip = array_merge($skip, self::IsAchievementHasChildAchievementCompleted($ach['id'], $current_category));
         if (self::IsAchievementCompleted($ach['id'], $current_category)) {
             $ach['dateCompleted'] = self::GetAchievementDate($ach['id']);
         }
         // Find criterias
         $ach['criterias'] = self::BuildCriteriasList($ach['id']);
         // If we have reward...
         if ($ach['titleReward'] != null) {
             // ... let's check if it's an item
             $reward_item = DB::World()->selectCell("SELECT `item` FROM `achievement_reward` WHERE `entry` = %d", $ach['id']);
             if ($reward_item > 0) {
                 // Find item
                 if (WoW_Locale::GetLocaleID() > 0) {
                     $item = DB::World()->selectRow("SELECT `item_template`.`entry`,  `item_template`.`Quality`, `locales_item`.`name_loc%d` AS `name` FROM `item_template` JOIN `locales_item` ON `locales_item`.`entry` = `item_template`.`entry` WHERE `item_template`.`entry` = %d LIMIT 1", WoW_Locale::GetLocaleID(), $reward_item);
                 } else {
                     $item = DB::World()->selectRow("SELECT `entry`, `name`, `Quality` FROM `item_template` WHERE `entry` = %d LIMIT 1", $reward_item);
                 }
                 if (is_array($item)) {
                     // Assign data
                     $ach['reward_item'] = $item;
                 }
             }
         }
         $achievement_category[] = $ach;
     }
     // Sort all categories (completed - up, incompleted - down)
     $tmp_compl = array();
     $tmp_incompl = array();
     $last_compl = 0;
     $last_incompl = 0;
     foreach ($achievement_category as $ach) {
         if (isset($ach['dateCompleted'])) {
             $tmp_compl[$last_compl] = $ach;
             $last_compl++;
         } else {
             $tmp_incompl[$last_incompl] = $ach;
             $last_incompl++;
         }
         for ($i = 0; $i < $last_compl; $i++) {
             $date = $tmp_compl[$i]['dateCompleted'];
             for ($j = 0; $j < $last_compl; $j++) {
                 if ($tmp_compl[$j]['dateCompleted'] < $date) {
                     $tmpach = $tmp_compl[$i];
                     $tmp_compl[$i] = $tmp_compl[$j];
                     $tmp_compl[$j] = $tmpach;
                 }
             }
         }
     }
     $achievement_category = $category == 81 ? $tmp_compl : array_merge($tmp_compl, $tmp_incompl);
     $count = count($achievement_category);
     for ($i = 0; $i < $count; ++$i) {
         $id = $achievement_category[$i]['id'];
         if (in_array($id, $skip)) {
             if (self::IsAchievementCompleted($id)) {
                 $chain = self::GenerateAchievementChain($id, $category);
                 if (is_array($chain)) {
                     $points = 0;
                     $count_chain = count($chain);
                     $changed = false;
                     $last_id = 0;
                     for ($j = 0; $j < $count_chain; ++$j) {
                         if ($chain[$j]['completed'] == 1) {
                             $points += $chain[$j]['points'];
                             $last_id = $chain[$j]['current'];
                         } else {
                             if (isset($chain[$j - 1]) && $chain[$j - 1]['completed'] == 1) {
                                 $changed = self::AssignNewDataToAchievementsInCategory($points, $chain[$j - 1]['current'], $achievement_category, $chain);
                             }
                         }
                     }
                     if (!$changed) {
                         self::AssignNewDataToAchievementsInCategory($points, $last_id, $achievement_category, $chain);
                     }
                 }
             }
             unset($achievement_category[$i]);
         }
     }
     return $achievement_category;
 }
 /**
  * Class constructor, defines locale and inits storage
  **/
 public function __construct()
 {
     $this->m_locale = WoW_Locale::GetLocale();
     $this->m_dbLocale = WoW_Locale::GetLocaleID();
     $this->InitStorage();
     return true;
 }
Exemplo n.º 8
0
 public function LoadItem($item_entry, $itemGuid = 0, $ownerGuid = 0)
 {
     $item_row = DB::World()->selectRow("\n        SELECT\n        `a`.*,\n        %s\n        `b`.`icon`,\n        `d`.`patch`\n        FROM `item_template` AS `a`\n        LEFT JOIN `DBPREFIX_icons` AS `b` ON `b`.`displayid` = `a`.`displayid`\n        LEFT JOIN `locales_item` AS `c` ON `c`.`entry` = `a`.`entry`\n        LEFT JOIN `DBPREFIX_item_version` AS `d` ON `d`.`entry` = `a`.`entry`\n        WHERE `a`.`entry` = %d LIMIT 1", WoW_Locale::GetLocaleID() > 0 ? sprintf('`c`.`name_loc%d` AS `name_loc`, `c`.`description_loc%d` AS `desc_loc`,', WoW_Locale::GetLocaleID(), WoW_Locale::GetLocaleID()) : null, $item_entry);
     if (!$item_row) {
         WoW_Log::WriteError('%s : item #%d (GUID: %d) was not found in `item_template` table.', __METHOD__, $item_entry, $itemGuid);
         return false;
     }
     // FlagsExtra check
     if (isset($item_row['FlagsExtra'])) {
         $item_row['Flags2'] = $item_row['FlagsExtra'];
         unset($item_row['FlagsExtra']);
         // For compatibility
     }
     // Assign variables
     foreach ($item_row as $field => $value) {
         $this->{$field} = $value;
     }
     // Create arrays
     // Item mods
     for ($i = 0; $i < MAX_ITEM_PROTO_STATS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'stat_type' . $key})) {
             $this->ItemStat[$i] = array('type' => $this->{'stat_type' . $key}, 'value' => $this->{'stat_value' . $key});
         }
     }
     // Item damages
     for ($i = 0; $i < MAX_ITEM_PROTO_DAMAGES + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'dmg_type' . $key})) {
             $this->Damage[$i] = array('type' => $this->{'dmg_type' . $key}, 'min' => $this->{'dmg_min' . $key}, 'max' => $this->{'dmg_max' . $key});
         }
     }
     // Item spells
     for ($i = 0; $i < MAX_ITEM_PROTO_SPELLS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'spellid_' . $key})) {
             $this->Spells[$i] = array('spellid' => $this->{'spellid_' . $key}, 'trigger' => $this->{'spelltrigger_' . $key}, 'charges' => $this->{'spellcharges_' . $key}, 'ppmRate' => $this->{'spellppmRate_' . $key}, 'cooldown' => $this->{'spellcooldown_' . $key}, 'category' => $this->{'spellcategory_' . $key}, 'categorycooldown' => $this->{'spellcategorycooldown_' . $key});
         }
     }
     // Item sockets
     for ($i = 0; $i < MAX_ITEM_PROTO_SOCKETS + 1; $i++) {
         $key = $i + 1;
         if (isset($this->{'socketColor_' . $key})) {
             $this->Socket[$i] = array('color' => $this->{'socketColor_' . $key}, 'content' => $this->{'socketContent_' . $key}, 'filter' => 0, 'name' => '');
             switch ($this->Socket[$i]['color']) {
                 case 1:
                     $this->Socket[$i]['filter'] = $this->Socket[$i]['color'];
                     $this->Socket[$i]['name'] = 'meta';
                 case 2:
                     $this->Socket[$i]['filter'] = $this->Socket[$i]['color'];
                     $this->Socket[$i]['name'] = 'red';
                     break;
                 case 4:
                     $this->Socket[$i]['filter'] = 3;
                     $this->Socket[$i]['name'] = 'yellow';
                     break;
                 case 8:
                     $this->Socket[$i]['filter'] = 4;
                     $this->Socket[$i]['name'] = 'blue';
                     break;
             }
         }
     }
     // Set locale
     if (WoW_Locale::GetLocaleID() != LOCALE_EN) {
         $this->name = $this->name_loc != null ? $this->name_loc : $this->name;
         $this->description = $this->desc_loc != null ? $this->desc_loc : $this->description;
     }
     // Data to template class
     WoW_Template::SetPageData('item_name', $this->name);
     // Set class/subclass/inventory type names
     $itemsubclass = DB::World()->selectRow("SELECT `subclass_name_%s` AS `subclass`, `class_name_%s` AS `class` FROM `DBPREFIX_item_subclass` WHERE `subclass` = %d AND `class` = %d LIMIT 1", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $this->subclass, $this->class);
     if (is_array($itemsubclass)) {
         $this->subclass_name = $itemsubclass['subclass'];
         $this->class_name = $itemsubclass['class'];
     }
     if (in_array($this->class, array(ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON))) {
         $this->InventoryType_name = $this->InventoryType > 0 ? WoW_Locale::GetString('template_item_invtype_' . $this->InventoryType) : null;
     }
     // Faction
     if ($this->Flags2 & ITEM_FLAGS2_HORDE_ONLY) {
         $this->faction = FACTION_HORDE;
         $this->faction_convert = DB::World()->selectCell("SELECT `item_alliance` FROM `DBPREFIX_item_equivalents` WHERE `item_horde` = %d", $this->entry);
     } elseif ($this->Flags2 & ITEM_FLAGS2_ALLIANCE_ONLY) {
         $this->faction = FACTION_ALLIANCE;
         $this->faction_convert = DB::World()->selectCell("SELECT `item_horde` FROM `DBPREFIX_item_equivalents` WHERE `item_alliance` = %d", $this->entry);
     }
     // GUIDs
     $this->m_guid = $itemGuid;
     // Can be NULL.
     $this->m_owner = $ownerGuid;
     // Can be NULL.
     $this->loaded = true;
     return true;
 }
<script type="text/javascript">//<![CDATA[
<?php 
if (WoW_Locale::GetLocaleID() > 0) {
    echo sprintf('Locale.set(%d);', WoW_Locale::GetLocaleID());
}
?>

PageTemplate.set({pageName: '<?php 
echo WoW_Template::GetPageIndex();
?>
', activeTab: <?php 
echo WoW_Template::GetPageData('activeTab');
echo WoW_Template::GetPageData('disable_breadcrumb') != true ? ', breadcrumb: [' . WoW_Template::GetPageData('breadcrumb') . ']' : null;
?>
});
PageTemplate.init();
g_captchaType = 1;g_dataKey = '60770694807121612389db4ad8f344000d5cab78';g_host = 'http://www01.wowhead.com';
//]]></script>
Exemplo n.º 10
0
echo WoW_Locale::GetLocale(LOCALE_DOUBLE);
?>
" onclick="WowLanding.regionMenu.hide();">
	<div class="positionWrapper">
		<div class="relative">
			<div class="page">
	<div class="leftColumn">
		<div class="flash-trailer">

			<div id="trailer"></div>
			<script type="text/javascript">

				var params = { allowScriptAccess: "always", wmode: "transparent", allowFullScreen: "true" };
				var atts = { id: "trailer" };
				swfobject.embedSWF('http://www.youtube.com/v/<?php 
echo WoW_Locale::GetLocaleID() == LOCALE_RU ? 'tp-utWVDpIQ' : 'Wq4Y7ztznKc';
?>
?enablejsapi=1&amp;amp;playerapiid=finalunlocked-video&amp;amp;fs=1&amp;amp;hd=1', "trailer", "432", "216", "8", null, null, params, atts);
                
			</script>
			<div class="cataclysm-logo"></div>
		</div>

		<span class="new-age"></span>

        <div class="gameWorld"><!-- --></div>
		<a class="watchCinematic" href="https://eu.battle.net/account/activation/landing.html?product=CAT" onclick="window.open(this.href); return false;">
			<img class="blank" src="/account/images/layout/blank.gif" alt="<?php 
echo WoW_Locale::GetString('template_account_wow_cata_cinematic');
?>
" />
<span class="label-text">
<?php 
echo WoW_Locale::GetString('template_account_creation_select_country');
?>
</span>
<span class="input-required"></span>
</label>
</span>
<span class="input-right">
<span class="input-select input-select-small">
<select name="country" id="country" class="small border-5 glow-shadow-2" tabindex="1">
<?php 
if (isset($_GET['country']) && in_array(strtoupper($_GET['country']), array('GBR', 'USA', 'FRA', 'DEU', 'ESP', 'RUS'))) {
    $selected_country = $_GET['country'];
} else {
    switch (WoW_Locale::GetLocaleID()) {
        case LOCALE_DE:
            $selected_country = 'DEU';
            break;
        case LOCALE_EN:
            $selected_country = 'GBR';
            break;
        case LOCALE_ES:
            $selected_country = 'ESP';
            break;
        case LOCALE_FR:
            $selected_country = 'FRA';
            break;
        case LOCALE_RU:
            $selected_country = 'RUS';
            break;
 private static function HandleChosenTitleInfo()
 {
     if (!self::IsCorrect()) {
         WoW_Log::WriteError('%s : character was not found.', __METHOD__);
         return false;
     }
     $title_data = DB::WoW()->selectRow("SELECT `title_F_%s` AS `titleF`, `title_M_%s` AS `titleM`, `place` FROM `DBPREFIX_titles` WHERE `id`=%d", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), self::$chosenTitle);
     if (!$title_data) {
         WoW_Log::WriteError('%s: character %s (GUID: %d) has wrong chosenTitle ID (%d) or there is no data for %s locale (locId: %d)', __METHOD__, self::$name, self::$guid, self::$chosenTitle, WoW_Locale::GetLocale(), WoW_Locale::GetLocaleID());
         return false;
     }
     self::$title_info['place'] = $title_data['place'];
     switch (self::$gender) {
         case GENDER_MALE:
             self::$title_info['title'] = $title_data['titleM'];
             break;
         case GENDER_FEMALE:
             self::$title_info['title'] = $title_data['titleF'];
             break;
     }
     return true;
 }
Exemplo n.º 13
0
$.extend(true, g_items, _);
_ = g_items;
_[<?php 
echo $proto->entry;
?>
].tooltip_enus = '<?php 
echo $proto->tooltip;
?>
';
<?php 
$vendors = WoW_Items::GetVendorsSource();
if (is_array($vendors)) {
    foreach ($vendors as $vendor) {
        if (isset($vendor['ext_cost_items']) && is_array($vendor['ext_cost_items'])) {
            foreach ($vendor['ext_cost_items'] as $item) {
                echo sprintf('_[%d]={name_enus:\'%d\',icon:[\'%s\',\'%s\']};', $item['entry'], WoW_Locale::GetLocaleID() != LOCALE_EN && isset($item['name_loc']) && $item['name_loc'] != null ? $item['name_loc'] : $item['name'], $item['icon'], $item['icon']);
            }
        }
    }
}
?>
//_[395]={name_enus:'Очки справедливости',icon:['pvecurrency-justice','pvecurrency-justice']};
//_[241]={name_enus:'Печать чемпиона',icon:['ability_paladin_artofwar','ability_paladin_artofwar']};
$.extend(true, g_gatheredcurrencies, _);
<?php 
$achievementsCriteria = WoW_Items::GetAchievementsCriteria();
if (is_array($achievementsCriteria)) {
    echo 'var _ = {};';
    foreach ($achievementsCriteria as $achievement) {
        echo sprintf('_[%d]={name_enus:\'%s\',icon:\'%s\'};', $achievement['id'], str_replace("'", "\\'", $achievement['name']), str_replace("'", "\\'", $achievement['icon']));
    }
Exemplo n.º 14
0
 public static function GetNPCInfo($entry, $type)
 {
     if (!DB::World()->selectCell("SELECT 1 FROM creature_template WHERE entry = %d", $entry)) {
         return false;
     }
     switch ($type) {
         case 'name':
             if (WoW_Locale::GetLocaleID() == LOCALE_EN) {
                 return DB::World()->selectCell("SELECT name FROM creature_template WHERE entry = %d", $entry);
             }
             $data = DB::World()->selectRow("\n                SELECT\n                a.name,\n                b.name_loc%d AS name_loc\n                FROM creature_template AS a\n                LEFT JOIN locales_creature AS b ON b.entry = a.entry\n                WHERE a.entry = %d", WoW_Locale::GetLocaleID(), $entry);
             if (!$data) {
                 return DB::World()->selectCell("SELECT name FROM creature_template WHERE entry = %d", $entry);
             }
             if ($data['name_loc'] != null) {
                 return $data['name_loc'];
             }
             return $data['name'];
             break;
     }
 }
Exemplo n.º 15
0
 private static function InitData()
 {
     WoW_Template::SetPageIndex('data');
     $js_contents = null;
     switch (self::GetPageAction()) {
         case 'spell-scaling':
         case 'item-scaling':
         case 'realms.weight-presets':
         case 'user':
             $js_contents = file_get_contents('data/' . self::GetPageAction() . '.js');
             break;
             // Locale-depended files
         // Locale-depended files
         case 'weight-presets.zones':
         case 'zones':
         case 'glyphs':
             $js_contents = file_get_contents('data/' . self::GetPageAction() . '-' . WoW_Locale::GetLocaleID() . '.js');
             break;
         case 'talents':
             $class_id = isset($_GET['class']) ? (int) $_GET['class'] : 6;
             $js_contents = file_get_contents('data/talents-' . $class_id . '-' . WoW_Locale::GetLocaleID() . '.js');
             break;
     }
     WoW_Template::SetPageData('js-data', $js_contents);
     // Must be freed after using!
 }
Exemplo n.º 16
0
<div class="padded"></div>

<input type="submit" value="Apply filter" /></form><div class="pad"></div></div> 
 
<script type="text/javascript">//<![CDATA[
fi_init('quests');
//]]></script> 
 
<div id="lv-quests" class="listview"></div> 
<script type="text/javascript">//<![CDATA[
var _ = {};
<?php 
$quests = WoW_Quests::GetQuests();
if (isset($quests['items']) && is_array($quests['items'])) {
    foreach ($quests['items'] as $item) {
        echo sprintf('_[%d]={name_enus:\'%s\',quality:%d,icon:\'%s\'};', $item['entry'], addslashes(WoW_Locale::GetLocaleID() != LOCALE_EN && isset($item['name_loc']) && $item['name'] != null ? $item['name_loc'] : $item['name']), $item['quality'], $item['icon']);
    }
}
?>
$.extend(true, g_items, _);
_ = g_items;
new Listview({template: 'quest', id: 'quests', note: $WH.sprintf(LANG.lvnote_questsfound, <?php 
echo WoW_Quests::GetTotalQuestsCount();
?>
, <?php 
echo isset($quests['quests']) ? count($quests['quests']) : 0;
?>
) + LANG.dash + LANG.lvnote_tryfiltering, _truncated: 1, data: [
<?php 
if (isset($quests['quests']) && is_array($quests['quests'])) {
    $count = count($quests['quests']);
Exemplo n.º 17
0
 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'];
 }
Exemplo n.º 18
0
?>
')});
//]]></script>

<?php 
echo WoW_Template::GetJSForPage();
switch (WoW_Template::GetPageIndex()) {
    case 'item':
    case 'items':
        echo sprintf('<script type="text/javascript" src="%sdata=weight-presets.zones"></script>', WoW::GetUrl());
        break;
    case 'talent':
        echo sprintf('<script type="text/javascript" src="%sdata=glyphs"></script>', WoW::GetUrl(), WoW_Locale::GetLocaleID());
        break;
    case 'npc':
        echo sprintf('<script type="text/javascript" src="%sdata=zones"></script>', WoW::GetUrl(), WoW_Locale::GetLocaleID());
        break;
    case 'search':
        echo sprintf('<script type="text/javascript" src="%sdata=realms.weight-presets"></script>', WoW::GetUrl(), WoW_Locale::GetLocaleID());
        break;
}
?>

<script type="text/javascript" src="<?php 
echo WoW::GetUrl();
?>
data=user"></script>

</head>

Exemplo n.º 19
0
 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>&nbsp;</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);
 }