mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
- allow for search by Id if json-searching
- changed, how achievement chains are saved (more obvious and probably faster) - misc preparations for setup overhaul
This commit is contained in:
@@ -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 (isset($this->criteria[$this->id]))
|
||||
return $this->criteria[$this->id];
|
||||
|
||||
$result = DB::Aowow()->Select('SELECT * FROM ?_achievementcriteria WHERE `refAchievementId` = ?d 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)
|
||||
return $this->criteria[$this->id];
|
||||
else
|
||||
return $this->criteria[$this->id][$idx];
|
||||
}
|
||||
|
||||
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).' <span class="moneygold">'.number_format($crt['value2' ] / 10000).'</span><br />';
|
||||
else
|
||||
$criteria .= '- '.htmlspecialchars($crtName).'<br />';
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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 = [])
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
?>
|
||||
|
||||
@@ -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%!');
|
||||
|
||||
@@ -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'].': <span class="alliance-icon">'.Lang::$game['si'][SIDE_ALLIANCE].'</span>';
|
||||
$infobox[] = Lang::$main['side'].': [span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]';
|
||||
break;
|
||||
case 2:
|
||||
$infobox[] = Lang::$main['side'].': <span class="horde-icon">'.Lang::$game['si'][SIDE_HORDE].'</span>';
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,19 +10,6 @@ $_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]
|
||||
);
|
||||
|
||||
$cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CLASS, $_id, -1, User::$localeId]);
|
||||
|
||||
if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
@@ -57,15 +44,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData))
|
||||
if ($cl->getField('roles') & (1 << $i))
|
||||
$roles[] = (count($roles) == 2 ? '\n' : '').Lang::$game['_roles'][$i];
|
||||
|
||||
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]';
|
||||
|
||||
if ($specList)
|
||||
$infobox[] = Lang::$game['specs'].Lang::$colon.'[ul][li]'.implode('[/li][li]', $specList).'[/li][/ul]';
|
||||
|
||||
/****************/
|
||||
@@ -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',
|
||||
|
||||
@@ -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(
|
||||
$pageData = array(
|
||||
'listviews' => array(
|
||||
array(
|
||||
'file' => 'class',
|
||||
'data' => $classes->getListviewData(),
|
||||
'params' => []
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$smarty->saveCache($cacheKey, $pageData);
|
||||
|
||||
@@ -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
|
||||
|
||||
18
search.php
18
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);
|
||||
|
||||
|
||||
@@ -16,59 +16,16 @@
|
||||
g_initPath({$page.path});
|
||||
//]]></script>
|
||||
|
||||
{* include file='bricks/infobox.tpl' info=$lvData.infobox *}
|
||||
|
||||
<table class="infobox">
|
||||
<tr><th>{$lang.quickFacts}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div>
|
||||
<ul>
|
||||
{if $lvData.page.points}<li><div>{$lang.points}{$lang.colon}<span class="moneyachievement tip" onmouseover="Listview.funcBox.moneyAchievementOver(event)" onmousemove="$WH.Tooltip.cursorUpdate(event)" onmouseout="$WH.Tooltip.hide()">{$lvData.page.points}</span></div></li>{/if}
|
||||
{foreach from=$lvData.infobox item=info}
|
||||
<li><div>{$info}</div></li>
|
||||
{/foreach}
|
||||
{*<li><div>Location: {$lvData.page.location}</div></li> todo: need to be parsed first *}
|
||||
</ul>
|
||||
</td></tr>
|
||||
{strip}{*************** CHAIN OF ACHIEVEMENTS ***************}
|
||||
{if isset($lvData.page.series)}
|
||||
<tr><th>{$lang.series}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div>
|
||||
<table class="series">
|
||||
{section name=i loop=$lvData.page.series}
|
||||
<tr>
|
||||
<th>{$smarty.section.i.index+1}.</th>
|
||||
<td>
|
||||
{if ($lvData.page.series[i].id == $page.typeId)}
|
||||
<b>{$lvData.page.series[i].name}</b>
|
||||
{else}
|
||||
<div><a href="?achievement={$lvData.page.series[i].id}">{$lvData.page.series[i].name}</a></div>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/section}
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
{/if}
|
||||
{/strip}{*************** / CHAIN OF ACHIEVEMENTS ***************}
|
||||
<tr><th id="infobox-screenshots">{$lang.screenshots}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div><div id="infobox-sticky-ss"></div></td></tr>
|
||||
<tr><th id="infobox-videos">{$lang.videos}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div><div id="infobox-sticky-vi"></div></td></tr>
|
||||
</table>
|
||||
<script type="text/javascript">ss_appendSticky()</script>
|
||||
<script type="text/javascript">vi_appendSticky()</script>
|
||||
{include file='bricks/infobox.tpl' info=$lvData.infobox series=$lvData.series}
|
||||
|
||||
<div class="text">
|
||||
{include file='bricks/redButtons.tpl'}
|
||||
|
||||
<div id="h1-icon-generic" class="h1-icon"></div>
|
||||
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
$WH.ge('h1-icon-generic').appendChild(Icon.create('{$lvData.page.iconname|escape:"javascript"}', 1));
|
||||
//]]></script>
|
||||
|
||||
{include file='bricks/redButtons.tpl'}
|
||||
|
||||
<h1 class="h1-icon">{$lvData.page.name}</h1>
|
||||
|
||||
{$lvData.page.description}
|
||||
|
||||
@@ -2,6 +2,31 @@
|
||||
{if !empty($info)}
|
||||
<tr><th id="infobox-quick-facts">{$lang.quickFacts}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div><div id="infobox-contents0"></div></td></tr>
|
||||
{/if}
|
||||
{if !empty($series)}
|
||||
<tr><th id="infobox-series">{$lang.series}</th></tr>
|
||||
<tr><td>
|
||||
<div class="infobox-spacer"></div>
|
||||
<table class="series">
|
||||
{foreach from=$series key='idx' item='itr'}
|
||||
<tr>
|
||||
<th>{$idx+1}.</th>
|
||||
<td><div>
|
||||
{foreach name=itemItr from=$itr item='i'}
|
||||
{if $i.side == 1}<span class="alliance-icon-padded">{elseif $i.side == 2}<span class="horde-icon-padded">{/if}
|
||||
{if ($i.typeId == $page.typeId)}
|
||||
<b>{$i.name}</b>
|
||||
{else}
|
||||
<a href="?{$i.typeStr}={$i.typeId}">{$i.name}</a>
|
||||
{/if}
|
||||
{if $i.side != 3}</span>{/if}
|
||||
{if $smarty.foreach.itemItr.last}{else}<br />{/if}
|
||||
{/foreach}
|
||||
</div></td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</td></tr>
|
||||
{/if}
|
||||
<tr><th id="infobox-screenshots">{$lang.screenshots}</th></tr>
|
||||
<tr><td><div class="infobox-spacer"></div><div id="infobox-sticky-ss"></div></td></tr>
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user