diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php
index 08663de2..2f01b377 100644
--- a/includes/types/achievement.class.php
+++ b/includes/types/achievement.class.php
@@ -16,7 +16,7 @@ class AchievementList extends BaseType
protected $queryBase = 'SELECT `a`.*, `a`.`id` AS ARRAY_KEY FROM ?_achievement a';
protected $queryOpts = array(
'a' => ['o' => 'orderInGroup ASC'],
- 'ac' => ['j' => ['?_achievementcriteria AS `ac` ON `ac`.`refAchievement` = `a`.`id`', true], 'g' => '`a`.`id`']
+ 'ac' => ['j' => ['?_achievementcriteria AS `ac` ON `ac`.`refAchievementId` = `a`.`id`', true], 'g' => '`a`.`id`']
);
public function __construct($conditions = [], $applyFilter = false)
@@ -26,9 +26,6 @@ class AchievementList extends BaseType
// post processing
foreach ($this->iterate() as &$_curTpl)
{
- if (!$_curTpl['iconString'])
- $_curTpl['iconString'] = 'INV_Misc_QuestionMark';
-
//"rewards":[[11,137],[3,138]] [type, typeId]
$_curTpl['rewards'] = [TYPE_ITEM => [], TYPE_TITLE => []];
if (!empty($_curTpl['rewardIds']))
@@ -89,10 +86,10 @@ class AchievementList extends BaseType
$rewards = [];
foreach ($this->curTpl['rewards'] as $type => $rIds)
foreach ($rIds as $rId)
- $rewards[] = '['.$type.','.$rId.']';
+ $rewards[] = [$type, $rId];
if ($rewards)
- $data[$this->id]['rewards'] = '['.implode(',', $rewards).']';
+ $data[$this->id]['rewards'] = json_encode($rewards, JSON_NUMERIC_CHECK);
else if (!empty($this->curTpl['reward']))
$data[$this->id]['reward'] = $this->getField('reward', true);
}
@@ -101,29 +98,23 @@ class AchievementList extends BaseType
}
// only for current template
- public function getCriteria($idx = -1)
+ public function getCriteria()
{
- foreach ($this->iterate() as $__)
- {
- $result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievement` = ? ORDER BY `order` ASC', $this->id);
- if (!$result)
- return [];
-
- if (is_array($result[0]))
- $this->criteria[$this->id] = $result;
- else
- $this->criteria[$this->id][] = $result;
- }
-
- if ($idx < 0)
+ if (isset($this->criteria[$this->id]))
return $this->criteria[$this->id];
- else
- return $this->criteria[$this->id][$idx];
+
+ $result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievementId` = ?d ORDER BY `order` ASC', $this->id);
+ if (!$result)
+ return [];
+
+ $this->criteria[$this->id] = $result;
+
+ return $this->criteria[$this->id];
}
public function renderTooltip()
{
- if (!empty($this->tooltip[$this->id]))
+ if (isset($this->tooltip[$this->id]))
return $this->tooltip[$this->id];
$criteria = $this->getCriteria();
@@ -148,7 +139,7 @@ class AchievementList extends BaseType
foreach ($rows as $crt)
{
// we could show them, but the tooltips are cluttered
- if (($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms <= 0)
+ if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms <= 0)
continue;
$crtName = Util::jsEscape(Util::localizedString($crt, 'name'));
@@ -176,7 +167,7 @@ class AchievementList extends BaseType
break;
}
- if ($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER)
+ if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER)
$criteria .= '- '.htmlspecialchars($crtName).' '.number_format($crt['value2' ] / 10000).'
';
else
$criteria .= '- '.htmlspecialchars($crtName).'
';
diff --git a/includes/types/charclass.class.php b/includes/types/charclass.class.php
index dc920608..3dfb5c51 100644
--- a/includes/types/charclass.class.php
+++ b/includes/types/charclass.class.php
@@ -15,8 +15,7 @@ class CharClassList extends BaseType
parent::__construct($conditions);
foreach ($this->iterate() as $k => &$_curTpl)
- if ($k == 6) // todo (low): grr, move to db
- $_curTpl['hero'] = 1;
+ $_curTpl['skills'] = explode(' ', $_curTpl['skills']);
}
public function getListviewData()
diff --git a/includes/types/creature.class.php b/includes/types/creature.class.php
index 1392c2b7..ff7f56be 100644
--- a/includes/types/creature.class.php
+++ b/includes/types/creature.class.php
@@ -15,7 +15,7 @@ class CreatureList extends BaseType
protected $queryBase = 'SELECT ct.*, ct.id AS ARRAY_KEY FROM ?_creature ct';
protected $queryOpts = array(
'ct' => [['ft']],
- 'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.faction_A', 's' => ', ft.A, ft.H, ft.factionId']
+ 'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.factionA', 's' => ', ft.A, ft.H, ft.factionId']
);
public static function getName($id)
@@ -49,9 +49,9 @@ class CreatureList extends BaseType
$row3 = [Lang::$game['level']];
$fam = $this->curTpl['family'];
// todo (low): rework, when factions are implemented
- $fac = DB::Aowow()->selectRow('SELECT * FROM dbc.faction f JOIN dbc.factionTemplate ft ON f.id = ft.factionId WHERE ft.id = ?d AND NOT f.reputationFlags1 & 0x4 AND f.reputationIndex <> -1', $this->curTpl['faction_A']);
+ $fac = DB::Aowow()->selectRow('SELECT * FROM dbc.faction f JOIN dbc.factionTemplate ft ON f.id = ft.factionId WHERE ft.id = ?d AND NOT f.reputationFlags1 & 0x4 AND f.reputationIndex <> -1', $this->curTpl['factionA']);
- if (!($this->curTpl['type_flags'] & 0x4))
+ if (!($this->curTpl['typeFlags'] & 0x4))
{
$level = $this->curTpl['minlevel'];
if ($level != $this->curTpl['maxlevel'])
@@ -151,7 +151,7 @@ class CreatureList extends BaseType
'minlevel' => $this->curTpl['minlevel'],
'maxlevel' => $this->curTpl['maxlevel'],
'id' => $this->id,
- 'boss' => $this->curTpl['type_flags'] & 0x4 ? 1 : 0,
+ 'boss' => $this->curTpl['typeFlags'] & 0x4 ? 1 : 0,
'rank' => $this->curTpl['rank'], // classification(?)
'location' => $this->getSpawns(SPAWNINFO_ZONES),
'name' => $this->getField('name', true),
diff --git a/includes/types/item.class.php b/includes/types/item.class.php
index e1fa211e..b9b7980e 100644
--- a/includes/types/item.class.php
+++ b/includes/types/item.class.php
@@ -1303,9 +1303,9 @@ class ItemList extends BaseType
// subitems may share enchantmentIds
if (!isset($this->rndEnchIds[$enchId]))
{
- $stats = Util::parseItemEnchantment($enchId, false, $text);
+ $stats = Util::parseItemEnchantment($enchId, false, $misc);
$this->rndEnchIds[$enchId] = array(
- 'text' => $text,
+ 'text' => $misc['name'],
'stats' => $stats
);
}
diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php
index c1c71343..29befa21 100644
--- a/includes/types/quest.class.php
+++ b/includes/types/quest.class.php
@@ -11,10 +11,10 @@ class QuestList extends BaseType
public $requires = [];
public $rewards = [];
- protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM quest_template qt';
+ protected $queryBase = 'SELECT *, qt.id AS ARRAY_KEY FROM quest_template qt';
protected $queryOpts = array(
'qt' => [['lq']],
- 'lq' => ['j' => ['locales_quest lq ON qt.id = lq.entry', true]]
+ 'lq' => ['j' => ['locales_quest lq ON qt.id = lq.id', true]]
);
public function __construct($conditions = [])
diff --git a/includes/types/title.class.php b/includes/types/title.class.php
index 741a5d08..62fcba3f 100644
--- a/includes/types/title.class.php
+++ b/includes/types/title.class.php
@@ -27,6 +27,9 @@ class TitleList extends BaseType
$sources = explode(' ', $this->curTpl['source']);
foreach ($sources as $src)
{
+ if (!$src) // rogue whitespace slipped through
+ continue;
+
$src = explode(':', $src);
$this->sources[$this->id][$src[0]][] = $src[1];
}
diff --git a/includes/types/worldevent.class.php b/includes/types/worldevent.class.php
index c81f6181..c356a7f9 100644
--- a/includes/types/worldevent.class.php
+++ b/includes/types/worldevent.class.php
@@ -148,57 +148,4 @@ class WorldEventList extends BaseType
public function renderTooltip() { }
}
-/*
-
-function event_name($events)
-{
- global $DB;
- if (!$events || !is_array($events) || count($events) == 0)
- return array();
-
- $entries = arraySelectKey($events, 'entry');
-
- $rows = $DB->select('
- SELECT eventEntry AS entry, description AS name
- FROM game_event
- WHERE eventEntry IN (?a)',
- $entries
- );
-
- // Merge original array with new information
- $result = array();
- foreach ($events as $event)
- if (isset($event['entry']))
- $result[$event['entry']] = $event;
-
- if ($rows)
- {
- foreach ($rows as $event)
- $result[$event['entry']] = array_merge($result[$event['entry']], $event);
- }
-
- return $result;
-}
-
-function event_description($entry)
-{
- global $DB;
-
- $result = event_infoline(array(array('entry' => $entry)));
- if (is_array($result) && count($result) > 0)
- $result = reset($result);
- else
- return NULL;
-
- $result['period'] = sec_to_time(intval($result['occurence'])*60);
-
- $result['npcs_guid'] = $DB->selectCol('SELECT guid FROM game_event_creature WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
- $result['objects_guid'] = $DB->selectCol('SELECT guid FROM game_event_gameobject WHERE eventEntry=?d OR eventEntry=?d', $entry, -$entry);
- $result['creatures_quests_id'] = $DB->select('SELECT id AS creature, quest FROM game_event_creature_quest WHERE eventEntry=?d OR eventEntry=?d GROUP BY quest', $entry, -$entry);
-
- return $result;
-}
-
-*/
-
?>
diff --git a/includes/utilities.php b/includes/utilities.php
index 30246010..4d317864 100644
--- a/includes/utilities.php
+++ b/includes/utilities.php
@@ -280,7 +280,7 @@ class SmartyAoWoW extends Smarty
{
private $config = [];
private $jsGlobals = [];
- private $errors = [];
+ private $notices = [];
public function __construct($config)
{
@@ -1627,14 +1627,31 @@ class Util
// 6 => TYPE_TOTEM Rockbiter AmountX as Damage (ignore)
// 7 => TYPE_USE_SPELL Engineering gadgets
// 8 => TYPE_PRISMATIC_SOCKET Extra Sockets AmountX as socketCount (ignore)
- public static function parseItemEnchantment($eId, $raw = false, &$name = null)
+ public static function parseItemEnchantment($eId, $raw = false, &$misc = null)
{
$enchant = DB::Aowow()->selectRow('SELECT *, Id AS ARRAY_KEY FROM ?_itemenchantment WHERE Id = ?d', $eId);
if (!$enchant)
return [];
- $name = self::localizedString($enchant, 'text');
+ $misc = array(
+ 'name' => self::localizedString($enchant, 'text'),
+ 'text' => array(
+ 'text_loc0' => $enchant['text_loc0'],
+ 'text_loc2' => $enchant['text_loc2'],
+ 'text_loc3' => $enchant['text_loc3'],
+ 'text_loc6' => $enchant['text_loc6'],
+ 'text_loc8' => $enchant['text_loc8']
+ )
+ );
+ if ($enchant['skillLine'] > 0)
+ $misc['reqskill'] = $enchant['skillLine'];
+
+ if ($enchant['skillLevel'] > 0)
+ $misc['reqskillrank'] = $enchant['skillLevel'];
+
+ if ($enchant['requiredLevel'] > 0)
+ $misc['reqlevel'] = $enchant['requiredLevel'];
// parse stats
$jsonStats = [];
@@ -1950,7 +1967,7 @@ class Util
$sum = 0;
else if ($sum > 100)
{
- Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by LootId: entry '.$lootId.' / group '.$k.' has a total chance of '.$sum.'%. Some items cannot drop!');
+ Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by LootId: entry '.$lootId.' / group '.$k.' has a total chance of '.number_format($sum, 2).'%. Some items cannot drop!');
$sum = 100;
}
@@ -2111,7 +2128,7 @@ class Util
Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by Item: ungrouped Item/Ref '.$ref['item'].' has 0% chance assigned!');
if ($ref['isGrouped'] && $ref['sumChance'] > 100)
- Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by Item: group with Item/Ref '.$ref['item'].' has '.$ref['sumChance'].'% total chance! Some items cannot drop!');
+ Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by Item: group with Item/Ref '.$ref['item'].' has '.number_format($ref['sumChance'], 2).'% total chance! Some items cannot drop!');
if ($ref['isGrouped'] && $ref['sumChance'] == 100 && !$ref['chance'])
Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'Loot by Item: Item/Ref '.$ref['item'].' with adaptive chance cannot drop. Group already at 100%!');
diff --git a/pages/achievement.php b/pages/achievement.php
index 29caea5c..2db11bff 100644
--- a/pages/achievement.php
+++ b/pages/achievement.php
@@ -71,15 +71,27 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS);
- // infobox content
+ /***********/
+ /* Infobox */
+ /***********/
+
$infobox = [];
+
+ // points
+ if ($_ = $acv->getField('points'))
+ $infobox[] = Lang::$achievement['points'].Lang::$colon.'[achievementpoints='.$_.']';
+
+ // location
+ // todo (low)
+
+ // faction
switch ($acv->getField('faction'))
{
case 1:
- $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_ALLIANCE].'';
+ $infobox[] = Lang::$main['side'].': [span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]';
break;
case 2:
- $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_HORDE].'';
+ $infobox[] = Lang::$main['side'].': [span class=horde-icon]'.Lang::$game['si'][SIDE_HORDE].'[/span]';
break;
default: // case 3
$infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH];
@@ -87,10 +99,42 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// todo (low): crosslink with charactersDB to check if realmFirsts are still available
+ $infobox = array_merge($infobox, Lang::getInfoBoxForFlags($acv->getField('cuFlags')));
+
+ /**********/
+ /* Series */
+ /**********/
+
+ $series = [];
+
+ if ($c = $acv->getField('chainId'))
+ {
+ $chainAcv = new AchievementList(array(['chainId', $c]));
+
+ foreach ($chainAcv->iterate() as $aId => $__)
+ {
+ $pos = $chainAcv->getField('chainPos');
+ if (!isset($series[$pos]))
+ $series[$pos] = [];
+
+ $series[$pos][] = array(
+ 'side' => $chainAcv->getField('faction'),
+ 'typeStr' => Util::$typeStrings[TYPE_ACHIEVEMENT],
+ 'typeId' => $aId,
+ 'name' => $chainAcv->getField('name', true)
+ );
+ }
+ }
+
+ /****************/
+ /* Main Content */
+ /****************/
+
$pageData = array(
'title' => $acv->getField('name', true),
'path' => $tmpPath,
- 'infobox' => array_merge($infobox, Lang::getInfoBoxForFlags($acv->getField('cuFlags'))),
+ 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null,
+ 'series' => $series,
'relTabs' => [],
'buttons' => array(
BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$_id.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'],
@@ -99,7 +143,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
'page' => array(
'name' => $acv->getField('name', true),
'description' => $acv->getField('description', true),
- 'points' => $acv->getField('points'),
'iconname' => $acv->getField('iconString'),
'count' => $acv->getField('reqCriteriaCount'),
'reward' => $acv->getField('reward', true),
@@ -111,47 +154,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
)
);
- // listview: "see also"
- $conditions = array(
- ['name_loc'.User::$localeId, $acv->getField('name', true)],
- ['id', $_id, '!']
- );
- $saList = new AchievementList($conditions);
- $pageData['relTabs'][] = array(
- 'file' => 'achievement',
- 'data' => $saList->getListviewData(),
- 'params' => array(
- 'id' => 'see-also',
- 'name' => '$LANG.tab_seealso',
- 'visibleCols' => "$['category']",
- 'tabs' => '$tabsRelated'
- )
- );
-
- $saList->addGlobalsToJscript($smarty);
-
- // listview: "criteria of"
- $refs = DB::Aowow()->SelectCol('SELECT refAchievement FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d',
- ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT,
- $_id
- );
- if (!empty($refs))
- {
- $coList = new AchievementList(array(['id', $refs]));
- $pageData['relTabs'][] = array(
- 'file' => 'achievement',
- 'data' => $coList->getListviewData(),
- 'params' => array(
- 'id' => 'criteria-of',
- 'name' => '$LANG.tab_criteriaof',
- 'visibleCols' => "$['category']",
- 'tabs' => '$tabsRelated'
- )
- );
-
- $coList->addGlobalsToJscript($smarty);
- }
-
// create rewards
if ($foo = $acv->getField('rewards')[TYPE_ITEM])
{
@@ -172,9 +174,54 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
$pageData['page']['titleReward'][] = sprintf(Lang::$achievement['titleReward'], $bar->id, trim(str_replace('%s', '', $bar->getField('male', true))));
}
- // *****
- // ACHIEVEMENT CRITERIA
- // *****
+ /**************/
+ /* Extra Tabs */
+ /**************/
+
+ // tab: see also
+ $conditions = array(
+ ['name_loc'.User::$localeId, $acv->getField('name', true)],
+ ['id', $_id, '!']
+ );
+ $saList = new AchievementList($conditions);
+ $pageData['relTabs'][] = array(
+ 'file' => 'achievement',
+ 'data' => $saList->getListviewData(),
+ 'params' => array(
+ 'id' => 'see-also',
+ 'name' => '$LANG.tab_seealso',
+ 'visibleCols' => "$['category']",
+ 'tabs' => '$tabsRelated'
+ )
+ );
+
+ $saList->addGlobalsToJscript($smarty);
+
+ // tab: criteria of
+ $refs = DB::Aowow()->SelectCol('SELECT refAchievementId FROM ?_achievementcriteria WHERE Type = ?d AND value1 = ?d',
+ ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT,
+ $_id
+ );
+ if (!empty($refs))
+ {
+ $coList = new AchievementList(array(['id', $refs]));
+ $pageData['relTabs'][] = array(
+ 'file' => 'achievement',
+ 'data' => $coList->getListviewData(),
+ 'params' => array(
+ 'id' => 'criteria-of',
+ 'name' => '$LANG.tab_criteriaof',
+ 'visibleCols' => "$['category']",
+ 'tabs' => '$tabsRelated'
+ )
+ );
+
+ $coList->addGlobalsToJscript($smarty);
+ }
+
+ /*****************/
+ /* Criteria List */
+ /*****************/
$iconId = 1;
$rightCol = [];
@@ -182,11 +229,11 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
foreach ($acv->getCriteria() as $i => $crt)
{
// hide hidden criteria for regular users (really do..?)
- // if (($crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0)
+ // if (($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_HIDDEN) && User::$perms > 0)
// continue;
// alternative display option
- $displayMoney = $crt['complete_flags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER;
+ $displayMoney = $crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER;
$crtName = Util::localizedString($crt, 'name');
$tmp = array(
@@ -356,48 +403,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($rightCol)
$pageData['page']['criteria'] = array_merge($pageData['page']['criteria'], $rightCol);
- // *****
- // ACHIEVEMENT CHAIN
- // *****
-
- if ($acv->getField('series'))
- {
- $pageData['page']['series'] = array(
- array(
- 'id' => $_id,
- 'name' => $acv->getField('name', true),
- 'parent' => $acv->getField('series') >> 16,
- )
- );
- $tmp = $pageData['page']['series'][0];
- while ($tmp)
- {
- $tmp = DB::Aowow()->selectRow('SELECT id, name_loc0, name_loc?d, series >> 16 AS parent FROM ?_achievement WHERE id = ?',
- User::$localeId,
- $pageData['page']['series'][0]['parent']
- );
- if ($tmp)
- {
- $tmp['name'] = Util::localizedString($tmp, 'name');
- array_unshift($pageData['page']['series'], $tmp);
- }
- }
- $tmp = end($pageData['page']['series']);
- while ($tmp)
- {
- $end = end($pageData['page']['series']);
- $tmp = DB::Aowow()->selectRow('SELECT id, name_loc0, name_loc?d, series >> 16 AS parent FROM ?_achievement WHERE (series >> 16) = ?',
- User::$localeId,
- $end['id']
- );
- if ($tmp)
- {
- $tmp['name'] = Util::localizedString($tmp, 'name');
- array_push($pageData['page']['series'], $tmp);
- }
- }
- }
-
$smarty->saveCache($cacheKeyPage, $pageData);
}
diff --git a/pages/class.php b/pages/class.php
index 80a7508c..359d800d 100644
--- a/pages/class.php
+++ b/pages/class.php
@@ -6,23 +6,10 @@ if (!defined('AOWOW_REVISION'))
require 'includes/community.class.php';
-$_id = intVal($pageParam);
-$_mask = 1 << ($_id - 1);
-$_path = [0, 12, $_id];
-$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js
-$classSkills = array(
- 1 => [ 26, 256, 257],
- 2 => [594, 267, 184],
- 3 => [ 50, 163, 51],
- 4 => [253, 38, 39],
- 5 => [613, 56, 78],
- 6 => [770, 771, 772, 776],
- 7 => [375, 373, 374],
- 8 => [237, 8, 6],
- 9 => [355, 354, 593],
- 11 => [574, 134, 573]
-);
-
+$_id = intVal($pageParam);
+$_mask = 1 << ($_id - 1);
+$_path = [0, 12, $_id];
+$tcClassId = [null, 8, 3, 1, 5, 4, 9, 6, 2, 7, null, 0]; // see TalentCalc.js
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, $_id, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKeyPage, $pageData))
@@ -57,16 +44,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
if ($cl->getField('roles') & (1 << $i))
$roles[] = (count($roles) == 2 ? '\n' : '').Lang::$game['_roles'][$i];
- $infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$colon.implode(', ', $roles);
+ if ($roles)
+ $infobox[] = (count($roles) > 1 ? Lang::$game['roles'] : Lang::$game['role']).Lang::$colon.implode(', ', $roles);
// specs
$specList = [];
- $skills = new SkillList(array(['id', $classSkills[$_id]]));
+ $skills = new SkillList(array(['id', $cl->getField('skills')]));
$skills->addGlobalsToJscript($smarty);
foreach ($skills->iterate() as $k => $__)
$specList[$k] = '[icon name='.$skills->getField('iconString').'][url=?spells=7.'.$_id.'.'.$k.']'.$skills->getField('name', true).'[/url][/icon]';
- $infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
+ if ($specList)
+ $infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
/****************/
/* Main Content */
@@ -106,8 +95,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
[
'OR',
['s.reqClassMask', $_mask, '&'], // Glyphs, Proficiencies
- ['s.skillLine1', $classSkills[$_id]], // Abilities / Talents
- ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $classSkills[$_id]]]
+ ['s.skillLine1', $cl->getField('skills')], // Abilities / Talents
+ ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cl->getField('skills')]]
],
[ // last rank or unranked
'OR',
diff --git a/pages/classes.php b/pages/classes.php
index fc826ff8..bd8df464 100644
--- a/pages/classes.php
+++ b/pages/classes.php
@@ -8,16 +8,16 @@ $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, -1, -1, User::$localeId]);
if (!$smarty->loadCache($cacheKey, $pageData))
{
- $pageData = array(
- 'listviews' => []
- );
-
$classes = new CharClassList();
- $pageData['listviews'][] = array(
- 'file' => 'class',
- 'data' => $classes->getListviewData(),
- 'params' => []
+ $pageData = array(
+ 'listviews' => array(
+ array(
+ 'file' => 'class',
+ 'data' => $classes->getListviewData(),
+ 'params' => []
+ )
+ )
);
$smarty->saveCache($cacheKey, $pageData);
diff --git a/pages/pet.php b/pages/pet.php
index 1f06b848..73fa1d61 100644
--- a/pages/pet.php
+++ b/pages/pet.php
@@ -58,7 +58,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
// tab: tameable & gallery
$condition = array(
['ct.type', 1], // Beast
- ['ct.type_flags', 0x1, '&'], // tameable
+ ['ct.typeFlags', 0x1, '&'], // tameable
['ct.family', $_id], // displayed petType
[
'OR', // at least neutral to at least one faction
diff --git a/search.php b/search.php
index f6f8beed..483fe915 100644
--- a/search.php
+++ b/search.php
@@ -63,6 +63,9 @@ $_wtv = isset($_GET['wtv']) ? explode(':', $_GET['wtv']) : null;
if (isset($_GET['json']))
{
+ if ($_ = intVal($search)) // allow for search by Id
+ $query = $_;
+
if ($type == TYPE_ITEMSET)
$searchMask |= SEARCH_TYPE_JSON | 0x60;
else if ($type == TYPE_ITEM)
@@ -76,10 +79,11 @@ else if (isset($_GET['opensearch']))
else
$searchMask |= SEARCH_TYPE_REGULAR | SEARCH_MASK_ALL;
+
$cacheKey = implode('_', [CACHETYPE_SEARCH, $searchMask, sha1($query), User::$localeId]);
// invalid conditions: not enough characters to search OR no types to search
-if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
+if ((strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL)) && !($searchMask & SEARCH_TYPE_JSON && intVal($search)))
{
if ($searchMask & SEARCH_TYPE_REGULAR)
{
@@ -110,11 +114,6 @@ if (strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL))
// 1 Classes:
if ($searchMask & 0x1)
{
- /* custom data :(
- armor: build manually - ItemSubClassMask (+Shield +Relics)
- weapon: build manually - ItemSubClassMask
- roles: build manually - 1:heal; 2:mleDPS; 4:rngDPS; 8:tank
- */
$classes = new CharClassList(array(['name_loc'.User::$localeId, $query], $maxResults));
if ($data = $classes->getListviewData())
@@ -293,7 +292,7 @@ if ($searchMask & 0x20)
{
$conditions = array(
['item1', 0, '!'], // remove empty sets from search
- ['name_loc'.User::$localeId, $query],
+ is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query],
$maxResults
);
@@ -328,6 +327,7 @@ if ($searchMask & 0x20)
if ($searchMask & 0x40)
{
$miscData = $conditions = [];
+ $cnd = is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query];
if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && isset($found['itemset']))
{
@@ -336,11 +336,11 @@ if ($searchMask & 0x40)
}
else if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEM)
{
- $conditions = [['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], ['name_loc'.User::$localeId, $query], SQL_LIMIT_DEFAULT];
+ $conditions = [['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], $cnd, SQL_LIMIT_DEFAULT];
$miscData = ['wt' => $_wt, 'wtv' => $_wtv];
}
else
- $conditions = [['name_loc'.User::$localeId, $query], $maxResults];
+ $conditions = [$cnd, $maxResults];
$items = new ItemList($conditions, false, $miscData);
diff --git a/template/achievement.tpl b/template/achievement.tpl
index ac703f38..2f8fe8cd 100644
--- a/template/achievement.tpl
+++ b/template/achievement.tpl
@@ -16,59 +16,16 @@
g_initPath({$page.path});
//]]>
-{* include file='bricks/infobox.tpl' info=$lvData.infobox *}
-
-
- | {$lang.quickFacts} |
- |
-
- |
- {strip}{*************** CHAIN OF ACHIEVEMENTS ***************}
- {if isset($lvData.page.series)}
- | {$lang.series} |
-
-
-{section name=i loop=$lvData.page.series}
-
- | {$smarty.section.i.index+1}. |
-
- {if ($lvData.page.series[i].id == $page.typeId)}
- {$lvData.page.series[i].name}
- {else}
-
- {/if}
- |
-
-{/section}
-
- |
-
- {/if}
- {/strip}{*************** / CHAIN OF ACHIEVEMENTS ***************}
- | {$lang.screenshots} |
- |
- | {$lang.videos} |
- |
-
-
-
+{include file='bricks/infobox.tpl' info=$lvData.infobox series=$lvData.series}
+{include file='bricks/redButtons.tpl'}
-
-{include file='bricks/redButtons.tpl'}
-
{$lvData.page.name}
{$lvData.page.description}
diff --git a/template/bricks/infobox.tpl b/template/bricks/infobox.tpl
index cbb3be82..6cabb614 100644
--- a/template/bricks/infobox.tpl
+++ b/template/bricks/infobox.tpl
@@ -2,6 +2,31 @@
{if !empty($info)}
| {$lang.quickFacts} |
|
+{/if}
+{if !empty($series)}
+
| {$lang.series} |
|---|
+
+
+
+ {foreach from=$series key='idx' item='itr'}
+
+ | {$idx+1}. |
+
+ {foreach name=itemItr from=$itr item='i'}
+ {if $i.side == 1} {elseif $i.side == 2}{/if}
+ {if ($i.typeId == $page.typeId)}
+ {$i.name}
+ {else}
+ {$i.name}
+ {/if}
+ {if $i.side != 3}{/if}
+ {if $smarty.foreach.itemItr.last}{else} {/if}
+ {/foreach}
+ |
+
+ {/foreach}
+
+ |
{/if}
| {$lang.screenshots} |
|
diff --git a/template/css/global.css b/template/css/global.css
index e37a3347..ba599335 100644
--- a/template/css/global.css
+++ b/template/css/global.css
@@ -1460,10 +1460,10 @@ a.star-icon-right span
padding-left: 12px !important;
}
-.alliance2-icon
+.alliance-icon-padded
{
background: url(../../images/icons/alliance-icon.gif) 4px center no-repeat;
- padding-left: 18px !important;
+ padding-left: 20px !important;
}
.horde-icon
@@ -1472,6 +1472,12 @@ a.star-icon-right span
padding-left: 18px !important;
}
+.horde-icon-padded
+{
+ background: url(../../images/icons/horde-icon.gif) 1px center no-repeat;
+ padding-left: 20px !important;
+}
+
.ffapvp-icon
{
background: url(../../images/icons/money_ffa.gif) left center no-repeat;