diff --git a/data.php b/data.php index 0a0a247b..b3e0efd7 100644 --- a/data.php +++ b/data.php @@ -47,7 +47,7 @@ foreach ($datasets as $data) else if (file_exists('datasets/'.$data.$params)) echo file_get_contents('datasets/'.$data.$params); else if ($AoWoWconf['debug']) - echo "/* could not fetch static data: ".$data.$params." for locale: ".User::$localeString." */"; + echo "alert('could not fetch static data: ".$data.$params." for locale: ".User::$localeString."');"; echo "\n\n"; break; default: diff --git a/includes/defines.php b/includes/defines.php index 5854207b..cbccd130 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -176,7 +176,7 @@ define('LOOT_PROSPECTING', 'prospecting_loot_template'); define('LOOT_MILLING', 'milling_loot_template'); define('LOOT_PICKPOCKET', 'pickpocketing_loot_template'); define('LOOT_SKINNING', 'skinning_loot_template'); -define('LOOT_QUEST', 'mail_loot_template'); // changed to quest_mail_loot_template..? +define('LOOT_MAIL', 'mail_loot_template'); // used by achievements and quests define('LOOT_SPELL', 'spell_loot_template'); define('LOOT_REFERENCE', 'reference_loot_template'); diff --git a/includes/kernel.php b/includes/kernel.php index 57dc3b0b..f2092465 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -14,9 +14,10 @@ error_reporting($e); define('STATIC_URL', substr('http://'.$_SERVER['SERVER_NAME'].strtr($_SERVER['SCRIPT_NAME'], ['index.php' => '']), 0, -1)); -define('SQL_LIMIT_NONE', 0); -define('SQL_LIMIT_SEARCH', $AoWoWconf['searchLimit']); -define('SQL_LIMIT_DEFAULT', $AoWoWconf['defaultLimit']); +define('SQL_LIMIT_NONE', 0); +define('SQL_LIMIT_SEARCH', $AoWoWconf['searchLimit']); +define('SQL_LIMIT_QUCKSEARCH', $AoWoWconf['quickSearchLimit']); +define('SQL_LIMIT_DEFAULT', $AoWoWconf['defaultLimit']); require 'includes/libs/Smarty-2.6.26/libs/Smarty.class.php';// Libraray: http://www.smarty.net/ // require 'includes/libs/Smarty-3.1.14/libs/Smarty.class.php'; // Libraray: http://www.smarty.net/ diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index e51051b9..ae0273b0 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -9,6 +9,7 @@ class AchievementList extends BaseType use listviewHelper; public static $type = TYPE_ACHIEVEMENT; + public static $brickFile = 'achievement'; public $criteria = []; public $tooltip = []; @@ -19,6 +20,10 @@ class AchievementList extends BaseType 'ac' => ['j' => ['?_achievementcriteria AS `ac` ON `ac`.`refAchievementId` = `a`.`id`', true], 'g' => '`a`.`id`'] ); + /* + todo: evaluate TC custom-data-tables: a*_criteria_data should be merged on installation, a*_reward linked with mail_loot_template and achievement + */ + public function __construct($conditions = [], $applyFilter = false) { parent::__construct($conditions, $applyFilter); diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php index b7fa8868..1a394201 100644 --- a/includes/types/basetype.class.php +++ b/includes/types/basetype.class.php @@ -311,8 +311,9 @@ abstract class BaseType public function getRandomId() { - $pattern = '/SELECT .* (-?[\w_]*\.?(id|entry)) AS ARRAY_KEY,?.* FROM (.*) WHERE .*/i'; - $replace = 'SELECT $1 FROM $3 ORDER BY RAND() ASC LIMIT 1'; + // its not optimal, so if anyone has an alternative idea.. + $pattern = '/SELECT .* (-?`?[\w_]*\`?.?`?(id|entry)`?) AS ARRAY_KEY,?.* FROM (\?[\w_-]+) (`?\w*`?)/i'; + $replace = 'SELECT $1 FROM $3 $4 WHERE (cuFlags & '.CUSTOM_EXCLUDE_FOR_LISTVIEW.') = 0 ORDER BY RAND() ASC LIMIT 1'; $query = preg_replace($pattern, $replace, $this->queryBase); return DB::Aowow()->selectCell($query); diff --git a/includes/types/charclass.class.php b/includes/types/charclass.class.php index 3dfb5c51..9b6ccadf 100644 --- a/includes/types/charclass.class.php +++ b/includes/types/charclass.class.php @@ -7,6 +7,7 @@ if (!defined('AOWOW_REVISION')) class CharClassList extends BaseType { public static $type = TYPE_CLASS; + public static $brickFile = 'class'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_classes c'; diff --git a/includes/types/charrace.class.php b/includes/types/charrace.class.php index 161b504a..9a76f5ca 100644 --- a/includes/types/charrace.class.php +++ b/includes/types/charrace.class.php @@ -7,6 +7,7 @@ if (!defined('AOWOW_REVISION')) class CharRaceList extends BaseType { public static $type = TYPE_RACE; + public static $brickFile = 'race'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_races r'; diff --git a/includes/types/creature.class.php b/includes/types/creature.class.php index 981954ca..bfd7a0eb 100644 --- a/includes/types/creature.class.php +++ b/includes/types/creature.class.php @@ -9,6 +9,7 @@ class CreatureList extends BaseType use spawnHelper; public static $type = TYPE_NPC; + public static $brickFile = 'creature'; public $tooltips = []; diff --git a/includes/types/currency.class.php b/includes/types/currency.class.php index e2255a98..e72941f3 100644 --- a/includes/types/currency.class.php +++ b/includes/types/currency.class.php @@ -7,6 +7,7 @@ if (!defined('AOWOW_REVISION')) class CurrencyList extends BaseType { public static $type = TYPE_CURRENCY; + public static $brickFile = 'currency'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_currencies c'; diff --git a/includes/types/faction.class.php b/includes/types/faction.class.php index 5abeaced..50991bd7 100644 --- a/includes/types/faction.class.php +++ b/includes/types/faction.class.php @@ -7,11 +7,12 @@ if (!defined('AOWOW_REVISION')) class FactionList extends BaseType { public static $type = TYPE_FACTION; + public static $brickFile = 'faction'; - protected $queryBase = 'SELECT f1.*, f1.id AS ARRAY_KEY, f1.parentFactionId AS cat FROM ?_factions f1'; + protected $queryBase = 'SELECT f.*, f.parentFactionId AS cat, f.id AS ARRAY_KEY FROM ?_factions f'; protected $queryOpts = array( - 'f1' => [['f2']], - 'f2' => ['j' => ['?_factions f2 ON f1.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2'] + 'f' => [['f2']], + 'f2' => ['j' => ['?_factions f2 ON f.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2'] ); public function __construct($conditions = []) diff --git a/includes/types/gameobject.class.php b/includes/types/gameobject.class.php index 51ecfb7d..dc493a16 100644 --- a/includes/types/gameobject.class.php +++ b/includes/types/gameobject.class.php @@ -9,12 +9,14 @@ class GameObjectList extends BaseType use listviewHelper, spawnHelper; public static $type = TYPE_OBJECT; + public static $brickFile = 'object'; - protected $queryBase = 'SELECT *, go.entry AS ARRAY_KEY FROM gameobject_template go'; + protected $queryBase = 'SELECT *, o.id AS ARRAY_KEY FROM ?_objects o'; protected $queryOpts = array( - 'go' => [['lg', 'l']], - 'lg' => ['j' => ['locales_gameobject lg ON go.entry = lg.entry', true]], - 'l' => ['j' => ['?_lock l ON l.id = IF(go.type = 3, data0, null)', true], 's' => ', l.type1, l.properties1, l.reqSkill1, l.type2, l.properties2, l.reqSkill2'] + 'o' => [['ft']], + 'ft' => ['j' => ['?_factiontemplate ft ON ft.id = o.faction', true], 's' => ', ft.*'], + 'qr' => ['j' => ['gameobject_questrelation qr ON qr.id = o.id', true]], // started by GO + 'ir' => ['j' => ['gameobject_involvedrelation ir ON ir.id = o.id', true]], // ends at GO ); public function __construct($conditions = [], $applyFilter = false) @@ -25,52 +27,32 @@ class GameObjectList extends BaseType return; // post processing - // most of this will be obsolete, when gameobjects get their own table foreach ($this->iterate() as $_id => &$curTpl) { + // unpack miscInfo: + $curTpl['lootStack'] = []; + $curTpl['spells'] = []; + $curTpl['spellFocusId'] = 0; + + if (in_array($curTpl['type'], [OBJECT_GOOBER, OBJECT_RITUAL, OBJECT_SPELLCASTER, OBJECT_FLAGSTAND, OBJECT_FLAGDROP, OBJECT_AURA_GENERATOR, OBJECT_TRAP])) + $curTpl['spells'] = array_combine(['onUse', 'onSuccess', 'aura', 'triggered'], [$curTpl['onUseSpell'], $curTpl['onSuccessSpell'], $curTpl['auraSpell'], $curTpl['triggeredSpell']]); + + if (!$curTpl['miscInfo']) + continue; + switch ($curTpl['type']) { case OBJECT_CHEST: - $curTpl['lootId'] = $curTpl['data1']; - $curTpl['lootStack'] = [$curTpl['data4'], $curTpl['data5']]; - $curTpl['lockId'] = $curTpl['data0']; - - if (!isset($curTpl['properties1'])) - break; - - if ($curTpl['properties1'] == LOCK_PROPERTY_HERBALISM) - { - $curTpl['reqSkill'] = $curTpl['reqSkill1']; - $curTpl['type'] = -3; - } - else if ($curTpl['properties1'] == LOCK_PROPERTY_MINING) - { - $curTpl['reqSkill'] = $curTpl['reqSkill1']; - $curTpl['type'] = -4; - } - else if ($curTpl['properties1'] == LOCK_PROPERTY_FOOTLOCKER) - { - $curTpl['reqSkill'] = $curTpl['reqSkill1']; - $curTpl['type'] = -5; - } - else if( $curTpl['properties2'] == LOCK_PROPERTY_FOOTLOCKER) - { - $curTpl['reqSkill'] = $curTpl['reqSkill2']; - $curTpl['type'] = -5; - } - - break; case OBJECT_FISHINGHOLE: - $curTpl['lootId'] = $curTpl['data1']; - $curTpl['lootStack'] = [$curTpl['data2'], $curTpl['data3']]; + $curTpl['lootStack'] = explode(' ', $curTpl['miscInfo']); break; - default: // adding more, when i need them - $curTpl['lockId'] = 0; + case OBJECT_CAPTURE_POINT: + $curTpl['capture'] = explode(' ', $curTpl['miscInfo']); + break; + case OBJECT_MEETINGSTONE: + $curTpl['mStone'] = explode(' ', $curTpl['miscInfo']); break; } - - for ($i = 0; $i < 24; $i++) // kill indescriptive/unused fields - unset($curTpl['data'.$i]); } } @@ -84,13 +66,9 @@ class GameObjectList extends BaseType name_loc6, name_loc8 FROM - gameobject_template gt - LEFT JOIN - locales_gameobject lg - ON - lg.entry = gt.entry + ?_objects WHERE - gt.entry = ?d', + id = ?d', $id ); return Util::localizedString($n, 'name'); @@ -104,7 +82,7 @@ class GameObjectList extends BaseType $data[$this->id] = array( 'id' => $this->id, 'name' => $this->getField('name', true), - 'type' => $this->curTpl['type'] + 'type' => $this->curTpl['typeCat'] ); if (!empty($this->curTpl['reqSkill'])) @@ -124,10 +102,13 @@ class GameObjectList extends BaseType $x = ''; $x .= ''; - $x .= ''; - if ($locks = Lang::getLocks($this->curTpl['lockId'])) - foreach ($locks as $l) - $x .= ''; + if ($_ = @Lang::$gameObject['type'][$this->curTpl['typeCat']]) + $x .= ''; + + if (isset($this->curTpl['lockId'])) + if ($locks = Lang::getLocks($this->curTpl['lockId'])) + foreach ($locks as $l) + $x .= ''; $x .= '
'.$this->getField('name', true).'
[TYPE '.$this->curTpl['type'].']
'.$l.'
'.$_.'
'.$l.'
'; @@ -136,7 +117,104 @@ class GameObjectList extends BaseType return $this->tooltips[$this->id]; } - public function addGlobalsToJScript(&$template, $addMask = 0) { } + public function addGlobalsToJScript(&$template, $addMask = 0) + { + foreach ($this->iterate() as $id => $__) + $template->extendGlobalData(self::$type, [$id => ['name' => $this->getField('name', true)]]); + } +} + + +class GameObjectListFilter extends Filter +{ + protected $genericFilter = array( + 15 => [FILTER_CR_NUMERIC, 'entry', null], // id + 7 => [FILTER_CR_NUMERIC, 'reqSkill', null], // requiredskilllevel + ); + +/* + { id: 1, name: 'foundin', type: 'zone' }, + { id: 16, name: 'relatedevent', type: 'event-any+none' }, +*/ + + protected function createSQLForCriterium(&$cr) + { + if (in_array($cr[0], array_keys($this->genericFilter))) + { + if ($genCR = $this->genericCriterion($cr)) + return $genCR; + + unset($cr); + $this->error = true; + return [1]; + } + + switch ($cr[0]) + { + case 4: + if (!$this->int2Bool($cr[1])) + break; + + return $cr[1] ? ['OR', ['flags', 0x2, '&'], ['type', 3]] : ['AND', [['flags', 0x2, '&'], 0], ['type', 3, '!']]; + case 5: // averagemoneycontained [op] [int] GOs don't contain money .. eval to 0 == true + if (!$this->isSaneNumeric($cr[2], false) || !$this->int2Op($cr[1])) + break; + + return eval('return ('.$cr[2].' '.$cr[1].' 0)') ? [1] : [0]; + case 2: // startsquest [side] + switch ($cr[1]) + { + case 1: // any + return ['qr.id', null, '!']; + case 2: // alliance only + return ['AND', ['qr.id', null, '!'], ['ft.A', -1, '!'], ['ft.H', -1]]; + case 3: // horde only + return ['AND', ['qr.id', null, '!'], ['ft.A', -1], ['ft.H', -1, '!']]; + case 4: // both + return ['AND', ['qr.id', null, '!'], ['OR', ['faction', 0], ['AND', ['ft.A', -1, '!'], ['ft.H', -1, '!']]]]; + case 5: // none + return ['qr.id', null]; + } + break; + case 3: // endsquest [side] + switch ($cr[1]) + { + case 1: // any + return ['qi.id', null, '!']; + case 2: // alliance only + return ['AND', ['qi.id', null, '!'], ['ft.A', -1, '!'], ['ft.H', -1]]; + case 3: // horde only + return ['AND', ['qi.id', null, '!'], ['ft.A', -1], ['ft.H', -1, '!']]; + case 4: // both + return ['AND', ['qi.id', null, '!'], ['OR', ['faction', 0], ['AND', ['ft.A', -1, '!'], ['ft.H', -1, '!']]]]; + case 5: // none + return ['qi.id', null]; + } + break; + case 13: // hascomments [yn] + break; + case 11: // hasscreenshots [yn] + break; + case 18: // hasvideos [yn] + break; + } + + unset($cr); + $this->error = 1; + return [1]; + } + + protected function createSQLForValues() + { + $parts = []; + $_v = $this->fiData['v']; + + // name + if (isset($_v['na'])) + $parts[] = ['name_loc'.User::$localeId, $_v['na']]; + + return $parts; + } } ?> diff --git a/includes/types/item.class.php b/includes/types/item.class.php index 29537209..89023732 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -9,6 +9,7 @@ class ItemList extends BaseType use ListviewHelper; public static $type = TYPE_ITEM; + public static $brickFile = 'item'; public $tooltip = []; public $json = []; @@ -1435,7 +1436,6 @@ class ItemList extends BaseType } -// missing each and everything class ItemListFilter extends Filter { // usable-by - limit weapon/armor selection per CharClass - itemClass => available itemsubclasses diff --git a/includes/types/itemset.class.php b/includes/types/itemset.class.php index e7da2129..ad8b5b55 100644 --- a/includes/types/itemset.class.php +++ b/includes/types/itemset.class.php @@ -9,6 +9,7 @@ class ItemsetList extends BaseType use ListviewHelper; public static $type = TYPE_ITEMSET; + public static $brickFile = 'itemset'; public $pieceToSet = []; // used to build g_items and search private $classes = []; // used to build g_classes diff --git a/includes/types/pet.class.php b/includes/types/pet.class.php index 12b5edd4..b4d5681b 100644 --- a/includes/types/pet.class.php +++ b/includes/types/pet.class.php @@ -9,6 +9,7 @@ class PetList extends BaseType use ListviewHelper; public static $type = TYPE_PET; + public static $brickFile = 'pet'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_pet p'; diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index 81fcf06a..094da394 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -7,24 +7,30 @@ if (!defined('AOWOW_REVISION')) class QuestList extends BaseType { public static $type = TYPE_QUEST; + public static $brickFile = 'quest'; public $requires = []; public $rewards = []; 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.id', true]] + 'qt' => [['lq', 'xp']], + 'lq' => ['j' => ['locales_quest lq ON qt.id = lq.id', true]], + 'xp' => ['j' => ['?_questxp xp ON qt.level = xp.id', true], 's' => ', xp.*'], + 'goStart' => ['j' => 'gameobject_questrelation goStart ON goStart.quest = qt.id'], // started by GO + 'goEnd' => ['j' => 'gameobject_involvedrelation goEnd ON goEnd.quest = qt.id'], // ends at GO + 'npcStart' => ['j' => 'creature_questrelation npcStart ON npcStart.quest = qt.id'], // started by NPC + 'npcEnd' => ['j' => 'creature_involvedrelation npcEnd ON npcEnd.quest = qt.id'], // ends at NPC + 'itemStart' => ['j' => ['?_items itemStart ON itemStart.startQuest = qt.id', true], 'g' => 'qt.id'] // started by item .. grouping required, as the same quest may have multiple starter ); - public function __construct($conditions = []) + public function __construct($conditions = [], $applyFilter = false) { - parent::__construct($conditions); + parent::__construct($conditions, $applyFilter); // post processing foreach ($this->iterate() as $id => &$_curTpl) { - $_curTpl['cat1'] = $_curTpl['ZoneOrSort']; // should probably be in a method... $_curTpl['cat2'] = 0; @@ -37,6 +43,11 @@ class QuestList extends BaseType } } + // set xp + $_curTpl['xp'] = $_curTpl['Field'.$_curTpl['RewardXPId']]; + for ($i = 0; $i < 9; $i++) + unset($_curTpl['Field'.$i]); + // todo (med): extend for reward case $data = []; for ($i = 1; $i < 7; $i++) @@ -81,17 +92,6 @@ class QuestList extends BaseType ); return Util::localizedString($n, 'title'); } - - public static function getXPReward($questLevel, $xpId) - { - if (!is_numeric($xpId) || $xpId < 0 || $xpId > 8) - return 0; - - if ($xp = DB::Aowow()->selectCell('SELECT Field?d FROM ?_questxp WHERE Id = ?d', $xpId, $questLevel)) - return $xp; - else - return 0; - } // static use END public function getSourceData() @@ -127,7 +127,7 @@ class QuestList extends BaseType 'name' => $this->getField('Title', true), 'side' => Util::sideByRaceMask($this->curTpl['RequiredRaces']), 'wflags' => 0x0, - 'xp' => self::getXPReward($this->curTpl['Level'], $this->curTpl['RewardXPId']) + 'xp' => $this->curTpl['xp'] ); $rewards = []; @@ -229,7 +229,7 @@ class QuestList extends BaseType $x = ''; if ($level) { - $level = sprintf(Lang::$quest['level'], $level); + $level = sprintf(Lang::$quest['questLevel'], $level); if ($this->curTpl['Flags'] & 0x1000) // daily $level .= ' '.Lang::$quest['daily']; @@ -314,4 +314,186 @@ class QuestList extends BaseType } } + +class QuestListFilter extends Filter +{ + protected $enums = array(); + protected $genericFilter = array(); + +/* + { id: 34, name: 'availabletoplayers', type: 'yn' }, + { id: 37, name: 'classspecific', type: 'classs' }, + { id: 38, name: 'racespecific', type: 'race' }, + { id: 27, name: 'daily', type: 'yn' }, + { id: 28, name: 'weekly', type: 'yn' }, + { id: 29, name: 'repeatable', type: 'yn' }, + { id: 30, name: 'id', type: 'num', before: 'name' }, + { id: 44, name: 'countsforloremaster_stc', type: 'yn' }, + { id: 9, name: 'objectiveearnrepwith', type: 'faction-any+none' }, + { id: 33, name: 'relatedevent', type: 'event-any+none' }, + { id: 5, name: 'sharable', type: 'yn' }, + { id: 11, name: 'suggestedplayers', type: 'num' }, + { id: 6, name: 'timer', type: 'num' }, + { id: 42, name: 'flags', type: 'flags', staffonly: true }, + { id: 2, name: 'experiencegained', type: 'num' }, + { id: 43, name: 'currencyrewarded', type: 'currency' }, + { id: 45, name: 'titlerewarded', type: 'yn' }, + { id: 23, name: 'itemchoices', type: 'num' }, + { id: 22, name: 'itemrewards', type: 'num' }, + { id: 3, name: 'moneyrewarded', type: 'num' }, + { id: 4, name: 'spellrewarded', type: 'yn' }, + { id: 1, name: 'increasesrepwith', type: 'faction' }, + { id: 10, name: 'decreasesrepwith', type: 'faction' }, + { id: 7, name: 'firstquestseries', type: 'yn' }, + { id: 15, name: 'lastquestseries', type: 'yn' }, + { id: 16, name: 'partseries', type: 'yn' }, + { id: 25, name: 'hascomments', type: 'yn' }, + { id: 18, name: 'hasscreenshots', type: 'yn' }, + { id: 36, name: 'hasvideos', type: 'yn' }, + +*/ + + protected function createSQLForCriterium(&$cr) + { + if (in_array($cr[0], array_keys($this->genericFilter))) + { + if ($genCR = $this->genericCriterion($cr)) + return $genCR; + + unset($cr); + $this->error = true; + return [1]; + } + + switch ($cr[0]) + { + case 19: // startsfrom [enum] + switch ($cr[1]) + { + case 1: // npc + return ['npcStart.id', null, '!']; + break; + case 2: // object + return ['goStart.id', null, '!']; + break; + case 3: // item + return ['itemStart.id', null, '!']; + } + break; + case 21: // endsat [enum] + switch ($cr[1]) + { + case 1: // npc + return ['npcEnd.id', null, '!']; + break; + case 2: // object + return ['goEnd.id', null, '!']; + break; + } + break; + // case 24: // lacksstartend [bool] cost an impossible amount of resources + // if ($this->int2Bool($cr[1])) + // { + // if ($cr[1]) + // return ['OR', ['AND', ['npcStart.id', null], ['goStart.id', null], ['itemStart.id', null]], ['AND', ['npcEnd.id', null], ['goEnd.id', null]]]; + // else + // return ['AND', ['OR', ['npcStart.id', null, '!'], ['goStart.id', null, '!'], ['itemStart.id', null, '!']], ['OR', ['npcEnd.id', null, '!'], ['goEnd.id', null, '!']]]; + // } + // break; + default: + break; + } + + unset($cr); + $this->error = 1; + return [1]; + } + + protected function createSQLForValues() + { + $parts = []; + $_v = $this->fiData['v']; + + // name + if (isset($_v['na'])) + { + $name = User::$localeId ? 'title_loc'.User::$localeId : 'title'; + $objectives = User::$localeId ? 'objectives_loc'.User::$localeId : 'objectives'; + $description = User::$localeId ? 'details_loc'.User::$localeId : 'details'; + + if (isset($_v['ex']) && $_v['ex'] == 'on') + $parts[] = ['OR', [$name, $_v['na']], [$objectives, $_v['na']], [$description, $_v['na']]]; + else + $parts[] = [$name, $_v['na']]; + } + + // level min + if (isset($_v['minle'])) + { + if (is_int($_v['minle']) && $_v['minle'] > 0) + $parts[] = ['level', $_v['minle'], '>=']; // not considering quests that are always at player level (-1) + else + unset($_v['minle']); + } + + // level max + if (isset($_v['maxle'])) + { + if (is_int($_v['maxle']) && $_v['maxle'] > 0) + $parts[] = ['level', $_v['maxle'], '<=']; + else + unset($_v['maxle']); + } + + // reqLevel min + if (isset($_v['minrl'])) + { + if (is_int($_v['minrl']) && $_v['minrl'] > 0) + $parts[] = ['minLevel', $_v['minrl'], '>='];// ignoring maxLevel + else + unset($_v['minrl']); + } + + // reqLevel max + if (isset($_v['maxrl'])) + { + if (is_int($_v['maxrl']) && $_v['maxrl'] > 0) + $parts[] = ['minLevel', $_v['maxrl'], '<='];// ignoring maxLevel + else + unset($_v['maxrl']); + } + + // side + if (isset($_v['si'])) + { + $ex = [['requiredRaces', RACE_MASK_ALL, '&'], RACE_MASK_ALL, '!']; + $notEx = ['OR', ['requiredRaces', 0], [['requiredRaces', RACE_MASK_ALL, '&'], RACE_MASK_ALL]]; + + switch ($_v['si']) + { + case 3: + $parts[] = $notEx; + break; + case 2: + $parts[] = ['OR', $notEx, ['requiredRaces', RACE_MASK_HORDE, '&']]; + break; + case -2: + $parts[] = ['AND', $ex, ['requiredRaces', RACE_MASK_HORDE, '&']]; + break; + case 1: + $parts[] = ['OR', $notEx, ['requiredRaces', RACE_MASK_ALLIANCE, '&']]; + break; + case -1: + $parts[] = ['AND', $ex, ['requiredRaces', RACE_MASK_ALLIANCE, '&']]; + break; + default: + unset($_v['si']); + } + } + + return $parts; + } +} + + ?> diff --git a/includes/types/skill.class.php b/includes/types/skill.class.php index 5580c43e..456aaa3d 100644 --- a/includes/types/skill.class.php +++ b/includes/types/skill.class.php @@ -7,6 +7,7 @@ if (!defined('AOWOW_REVISION')) class SkillList extends BaseType { public static $type = TYPE_SKILL; + public static $brickFile = 'skill'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_skillLine sl'; diff --git a/includes/types/spell.class.php b/includes/types/spell.class.php index 2ec064d6..78e9eefa 100644 --- a/includes/types/spell.class.php +++ b/includes/types/spell.class.php @@ -15,12 +15,14 @@ class SpellList extends BaseType public $sources = []; public static $type = TYPE_SPELL; + public static $brickFile = 'spell'; + public static $skillLines = array( - 6 => [43, 44, 45, 46, 54, 55, 95, 118, 136, 160, 162, 172, 173, 176, 226, 228, 229, 473], // Weapons - 8 => [293, 413, 414, 415, 433], // Armor - 9 => [129, 185, 356, 762], // sec. Professions - 10 => [98, 109, 111, 113, 115, 137, 138, 139, 140, 141, 313, 315, 673, 759], // Languages - 11 => [164, 165, 171, 182, 186, 197, 202, 333, 393, 755, 773] // prim. Professions + 6 => [ 43, 44, 45, 46, 54, 55, 95, 118, 136, 160, 162, 172, 173, 176, 226, 228, 229, 473], // Weapons + 8 => [293, 413, 414, 415, 433], // Armor + 9 => [129, 185, 356, 762], // sec. Professions + 10 => [ 98, 109, 111, 113, 115, 137, 138, 139, 140, 141, 313, 315, 673, 759], // Languages + 11 => [164, 165, 171, 182, 186, 197, 202, 333, 393, 755, 773] // prim. Professions ); public static $spellTypes = array( 6 => 1, @@ -1552,14 +1554,7 @@ Lasts 5 min. $?$gte($pl,68)[][Cannot be used on items level 138 and higher.] $org = $this->curTpl['learnedAt']; if ($ylw > 1) - { - return [ - $org < $ylw ? $org : 0, - $org < $grn ? $ylw : 0, - $org < $gry ? $grn : 0, - $gry - ]; - } + return [$org, $ylw, $grn, $gry]; } public function getListviewData() diff --git a/includes/types/title.class.php b/includes/types/title.class.php index 62fcba3f..91950580 100644 --- a/includes/types/title.class.php +++ b/includes/types/title.class.php @@ -9,6 +9,7 @@ class TitleList extends BaseType use listviewHelper; public static $type = TYPE_TITLE; + public static $brickFile = 'title'; public $sources = []; diff --git a/includes/types/worldevent.class.php b/includes/types/worldevent.class.php index 26d1be4b..f760fde1 100644 --- a/includes/types/worldevent.class.php +++ b/includes/types/worldevent.class.php @@ -7,8 +7,9 @@ if (!defined('AOWOW_REVISION')) class WorldEventList extends BaseType { public static $type = TYPE_WORLDEVENT; + public static $brickFile = 'event'; - protected $queryBase = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e'; + protected $queryBase = 'SELECT *, -e.id as id, -e.id AS ARRAY_KEY FROM ?_events e'; protected $queryOpts = array( 'e' => ['j' => ['?_holidays h2 ON e.holidayId = h2.id', true], 'o' => '-e.id ASC'], 'h' => ['j' => ['?_holidays h ON e.holidayId = h.id']] diff --git a/includes/types/zone.class.php b/includes/types/zone.class.php index eba4590b..0c1092dd 100644 --- a/includes/types/zone.class.php +++ b/includes/types/zone.class.php @@ -12,6 +12,7 @@ if (!defined('AOWOW_REVISION')) class ZoneList extends BaseType { public static $type = TYPE_ZONE; + public static $brickFile = 'zone'; protected $queryBase = 'SELECT *, id AS ARRAY_KEY FROM ?_zones z'; diff --git a/includes/utilities.php b/includes/utilities.php index bed0b5dc..bc6fe39c 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -98,7 +98,7 @@ class SmartyAoWoW extends Smarty $buff = []; foreach ($this->notices as $data) if (User::isInGroup($data[0])) - $buff[] = $data[1]; + $buff[] = Util::jsEscape($data[1]); if ($buff) { @@ -182,24 +182,11 @@ class SmartyAoWoW extends Smarty if (isset($jsg[$type])) return; - switch ($type) - { // [brickFile, [data], [extra]] - case TYPE_NPC: $jsg[TYPE_NPC] = ['creatures', [], []]; break; - case TYPE_OBJECT: $jsg[TYPE_OBJECT] = ['objects', [], []]; break; - case TYPE_ITEM: $jsg[TYPE_ITEM] = ['items', [], []]; break; - case TYPE_QUEST: $jsg[TYPE_QUEST] = ['quests', [], []]; break; - case TYPE_SPELL: $jsg[TYPE_SPELL] = ['spells', [], []]; break; - case TYPE_ZONE: $jsg[TYPE_ZONE] = ['zones', [], []]; break; - case TYPE_FACTION: $jsg[TYPE_FACTION] = ['factions', [], []]; break; - case TYPE_PET: $jsg[TYPE_PET] = ['pets', [], []]; break; - case TYPE_ACHIEVEMENT: $jsg[TYPE_ACHIEVEMENT] = ['achievements', [], []]; break; - case TYPE_TITLE: $jsg[TYPE_TITLE] = ['titles', [], []]; break; - case TYPE_WORLDEVENT: $jsg[TYPE_WORLDEVENT] = ['holidays', [], []]; break; - case TYPE_CLASS: $jsg[TYPE_CLASS] = ['classes', [], []]; break; - case TYPE_RACE: $jsg[TYPE_RACE] = ['races', [], []]; break; - case TYPE_SKILL: $jsg[TYPE_SKILL] = ['skills', [], []]; break; - case TYPE_CURRENCY: $jsg[TYPE_CURRENCY] = ['currencies', [], []]; break; - } + $jsg[$type] = array( + (new ReflectionProperty(Util::$typeClasses[$type], 'brickFile'))->getValue(), // brickfile + [], // data + [] // extra + ); } private function applyGlobals() @@ -215,25 +202,9 @@ class SmartyAoWoW extends Smarty $this->initJSGlobal($type); $ids = array_unique($ids, SORT_NUMERIC); + $cnd = [['id', $ids], 0]; - switch ($type) - { - case TYPE_NPC: (new CreatureList(array(['ct.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_OBJECT: (new GameobjectList(array(['gt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_ITEM: (new ItemList(array(['i.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_QUEST: (new QuestList(array(['qt.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_SPELL: (new SpellList(array(['s.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_ZONE: (new ZoneList(array(['z.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_FACTION: (new FactionList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_PET: (new PetList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_ACHIEVEMENT: (new AchievementList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_TITLE: (new TitleList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_WORLDEVENT: (new WorldEventList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_CLASS: (new CharClassList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_RACE: (new CharRaceList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_SKILL: (new SkillList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_CURRENCY: (new CurrencyList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - } + (new Util::$typeClasses[$type]($cnd))->addGlobalsToJscript($this, GLOBALINFO_SELF); } } @@ -299,7 +270,7 @@ class SmartyAoWoW extends Smarty $cache = explode("\n", $cache); @list($time, $rev) = explode(' ', $cache[0]); - $expireTime = $time + $this->config['page']['cacheTimer']; + $expireTime = $time + $this->config['cacheTimer']; if ($expireTime <= time() || $rev < AOWOW_REVISION) return false; @@ -329,6 +300,12 @@ class Util 'www', null, 'fr', 'de', null, null, 'es', null, 'ru' ); + public static $typeClasses = array( + null, 'CreatureList', 'GameObjectList', 'ItemList', 'ItemsetList', 'QuestList', 'SpellList', + 'ZoneList', 'FactionList', 'PetList', 'AchievementList', 'TitleList', 'WorldEventList', 'CharClassList', + 'CharRaceList', 'SkillList', null, 'CurrencyList' + ); + public static $typeStrings = array( // zero-indexed null, 'npc', 'object', 'item', 'itemset', 'quest', 'spell', 'zone', 'faction', 'pet', 'achievement', 'title', 'event', 'class', 'race', 'skill', null, 'currency' @@ -497,7 +474,7 @@ class Util LOOT_SKINNING, // npc (see its flags for mining, herbing or actual skinning) LOOT_FISHING, // zone LOOT_GAMEOBJECT, // object - LOOT_QUEST, // quest (mail rewards) + LOOT_MAIL, // quest || achievement LOOT_SPELL // spell ); @@ -1117,11 +1094,13 @@ class Util } else { - if (!(($s['d'] + $s['h']) % 365)) // whole years + $_ = $s['d'] + $s['h']; + + if ($_ && !($_ % 365)) // whole years return round(($s['d'] + $s['h'] *24) / 365, 2)." ".Lang::$timeUnits[$s['d'] / 365 == 1 && !$s['h'] ? 'sg' : 'pl'][0]; - if (!(($s['d'] + $s['h']) % 30)) // whole month + if ($_ && !($_ % 30)) // whole month return round(($s['d'] + $s['h'] * 24) / 30, 2)." ".Lang::$timeUnits[$s['d'] / 30 == 1 && !$s['h'] ? 'sg' : 'pl'][1]; - if (!(($s['d'] + $s['h']) % 7)) // whole weeks + if ($_ && !($_ % 7)) // whole weeks return round(($s['d'] + $s['h'] * 24) / 7, 2)." ".Lang::$timeUnits[$s['d'] / 7 == 1 && !$s['h'] ? 'sg' : 'pl'][2]; if ($s['d']) return round($s['d'] + $s['h'] / 24, 2)." ".Lang::$timeUnits[$s['d'] == 1 && !$s['h'] ? 'sg' : 'pl'][3]; @@ -1193,6 +1172,8 @@ class Util // html may contain 'Pictures' $text = preg_replace('/"Interface\\\Pictures\\\([\w_\-]+)"/i', '"images/interface/Pictures/\1.jpg"', strtr($text, $pairs)); } + else + $text = strtr($text, ["\n" => '
', "\r" => '']); $from = array( '/\|T([\w]+\\\)*([^\.]+)\.blp:\d+\|t/ui', // images (force size to tiny) |T:|t @@ -1221,8 +1202,6 @@ class Util '$N' => '<'.Lang::$main['name'].'>', '$b' => '
', '$B' => '
', - "\n" => '
', - "\r" => '', '|n' => '' // what .. the fuck .. another type of line terminator? (only in spanish though) ); @@ -1479,8 +1458,8 @@ class Util { case 0: // no params works always return true; - case 1: // null is avalid || key in a n-dim-array || value in a 1-dim-array - return $keys[0] === null || isset($struct[$keys[0]]) || in_array($keys[0], $struct); + case 1: // null is avalid || value in a 1-dim-array || key in a n-dim-array + return $keys[0] === null || in_array($keys[0], $struct) || (isset($struct[$keys[0]])); case 2: // first param has to be a key. otherwise invalid if (!isset($struct[$keys[0]])) return false; @@ -1868,23 +1847,24 @@ class Util // [fileName, tabData, tabName, tabId, extraCols, hiddenCols, visibleCols] $tabsFinal = array( - ['item', [], '$LANG.tab_containedin', 'contained-in-item', [], [], []], - ['item', [], '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], [], []], - ['item', [], '$LANG.tab_prospectedfrom', 'prospected-from', [], [], []], - ['item', [], '$LANG.tab_milledfrom', 'milled-from', [], [], []], - ['creature', [], '$LANG.tab_droppedby', 'dropped-by', [], [], []], - ['creature', [], '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], [], []], - ['creature', [], '$LANG.tab_skinnedfrom', 'skinned-from', [], [], []], - ['creature', [], '$LANG.tab_minedfromnpc', 'mined-from-npc', [], [], []], - ['creature', [], '$LANG.tab_salvagedfrom', 'salvaged-from', [], [], []], - ['creature', [], '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], [], []], - ['quest', [], '$LANG.tab_rewardfrom', 'reward-from-quest', [], [], []], - ['zone', [], '$LANG.tab_fishedin', 'fished-in-zone', [], [], []], - ['object', [], '$LANG.tab_containedin', 'contained-in-object', [], [], []], - ['object', [], '$LANG.tab_minedfrom', 'mined-from-object', [], [], []], - ['object', [], '$LANG.tab_gatheredfrom', 'gathered-from-object', [], [], []], - ['object', [], '$LANG.tab_fishedin', 'fished-in-object', [], [], []], - ['spell', [], '$LANG.tab_createdby', 'created-by', [], [], []] + ['item', [], '$LANG.tab_containedin', 'contained-in-item', [], [], []], + ['item', [], '$LANG.tab_disenchantedfrom', 'disenchanted-from', [], [], []], + ['item', [], '$LANG.tab_prospectedfrom', 'prospected-from', [], [], []], + ['item', [], '$LANG.tab_milledfrom', 'milled-from', [], [], []], + ['creature', [], '$LANG.tab_droppedby', 'dropped-by', [], [], []], + ['creature', [], '$LANG.tab_pickpocketedfrom', 'pickpocketed-from', [], [], []], + ['creature', [], '$LANG.tab_skinnedfrom', 'skinned-from', [], [], []], + ['creature', [], '$LANG.tab_minedfromnpc', 'mined-from-npc', [], [], []], + ['creature', [], '$LANG.tab_salvagedfrom', 'salvaged-from', [], [], []], + ['creature', [], '$LANG.tab_gatheredfromnpc', 'gathered-from-npc', [], [], []], + ['quest', [], '$LANG.tab_rewardfrom', 'reward-from-quest', [], [], []], + ['zone', [], '$LANG.tab_fishedin', 'fished-in-zone', [], [], []], + ['object', [], '$LANG.tab_containedin', 'contained-in-object', [], [], []], + ['object', [], '$LANG.tab_minedfrom', 'mined-from-object', [], [], []], + ['object', [], '$LANG.tab_gatheredfrom', 'gathered-from-object', [], [], []], + ['object', [], '$LANG.tab_fishedin', 'fished-in-object', [], [], []], + ['spell', [], '$LANG.tab_createdby', 'created-by', [], [], []], + ['achievement', [], '$LANG.tab_rewardfrom', 'reward-from-achievemnt', [], [], []] ); $refResults = []; $chanceMods = []; @@ -2027,7 +2007,7 @@ class Util if (!$ids) break; - $srcObj = new GameObjectList(array(['type', [OBJECT_CHEST, OBJECT_FISHINGHOLE]], ['data1', $ids])); + $srcObj = new GameObjectList(array(['lootId', $ids])); if ($srcObj->error) break; @@ -2049,7 +2029,7 @@ class Util $tabsFinal[$tabId][6][] = 'skill'; } break; - case LOOT_QUEST: + case LOOT_MAIL: $conditions = array(['RewardChoiceItemId1', $itemId], ['RewardChoiceItemId2', $itemId], ['RewardChoiceItemId3', $itemId], ['RewardChoiceItemId4', $itemId], ['RewardChoiceItemId5', $itemId], ['RewardChoiceItemId6', $itemId], ['RewardItemId1', $itemId], ['RewardItemId2', $itemId], ['RewardItemId3', $itemId], ['RewardItemId4', $itemId], 'OR'); @@ -2065,6 +2045,13 @@ class Util foreach ($srcObj->iterate() as $_) $tabsFinal[10][1][] = array_merge($srcData[$srcObj->id], empty($result[$srcObj->id]) ? ['percent' => -1] : $result[$srcObj->id]); } + + /* + + todo: search for achievements here + $tabsFinal[17] + */ + break; case LOOT_SPELL: $conditions = ['OR', ['effect1CreateItemId', $itemId], ['effect2CreateItemId', $itemId], ['effect3CreateItemId', $itemId]]; diff --git a/localization/lang.class.php b/localization/lang.class.php index 05aada93..44fe00c6 100644 --- a/localization/lang.class.php +++ b/localization/lang.class.php @@ -16,6 +16,7 @@ class Lang public static $currency; public static $event; public static $faction; + public static $gameObject; public static $item; public static $itemset; public static $maps; @@ -68,7 +69,7 @@ class Lang $locks = []; $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); if (!$lock) - return ''; + return $locks; for ($i = 1; $i <= 5; $i++) { @@ -91,8 +92,7 @@ class Lang if (!in_array($prop, [1, 2, 3, 4, 9, 16, 20])) continue; - $txt = DB::Aowow()->selectRow('SELECT * FROM ?_locktype WHERE id = ?d', $prop); // todo (low): convert to static text - $name = Util::localizedString($txt, 'name'); + $name = Lang::$spell['lockType'][$prop]; if (!$name) continue; @@ -117,7 +117,7 @@ class Lang else continue; - $locks[$lock['type'.$i] == 1 ? $i : -$i] = sprintf(Lang::$game['requires'], $name); + $locks[$lock['type'.$i] == 1 ? $prop : -$prop] = sprintf(Lang::$game['requires'], $name); } return $locks; diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 57717307..3dbedb28 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -31,6 +31,7 @@ $lang = array( 'pageNotFound' => "Diese|Dieser|Dieses %s existiert nicht.", // todo: dämliche Fälle... 'gender' => "Geschlecht", 'sex' => [null, 'Mann', 'Frau'], + 'players' => "Spieler", 'quickFacts' => "Kurzübersicht", 'screenshots' => "Screenshots", 'videos' => "Videos", @@ -65,6 +66,7 @@ $lang = array( 'refineSearch' => "Tipp: Präzisiere deine Suche mit Durchsuchen einer Unterkategorie.", 'clear' => "leeren", 'exactMatch' => "Exakt passend", + '_reqLevel' => "Mindeststufe", // infobox 'unavailable' => "Nicht für Spieler verfügbar", @@ -141,12 +143,15 @@ $lang = array( 'itemsets' => "Ausrüstungssets", 'mechanic' => "Auswirkung", 'mechAbbr' => "Ausw.", + 'meetingStone' => "Versammlungsstein", 'npc' => "NPC", 'npcs' => "NPCs", 'pet' => "Begleiter", 'pets' => "Begleiter", 'profile' => "", 'profiles' => "Profile", + 'quest' => "Quest", + 'quests' => "Quests", 'requires' => "Benötigt %s", 'requires2' => "Benötigt", 'reqLevel' => "Benötigt Stufe %s", @@ -260,6 +265,17 @@ $lang = array( 'publicDesc' => "Öffentliche Beschreibung", 'viewPubDesc' => "Die Beschreibung in deinem öffentlichen Profil ansehen", ), + 'gameObject' => array( + 'cat' => [0 => "Anderes", 9 => "Bücher", 3 => "Behälter", -5 => "Truhen", 25 => "Fischschwärme", -3 => "Kräuter", -4 => "Erzadern", -2 => "Quest", -6 => "Werkzeuge"], + 'type' => [ 9 => "Buch", 3 => "Behälter", -5 => "Truhe", 25 => "", -3 => "Kraut", -4 => "Erzvorkommen", -2 => "Quest", -6 => ""], + 'unkPosition' => "Der Standort dieses Objekts ist nicht bekannt.", + 'key' => "Schlüssel", + 'focus' => "Zauberfokus", + 'focusDesc' => "Zauber, die diesen Fokus benötigen, können an diesem Objekt gewirkt werden.", + 'trap' => "Falle", + 'triggeredBy' => "Ausgelöst durch", + 'capturePoint' => "Eroberungspunkt" + ), 'npc' => array( 'rank' => [0 => "Normal", 1 => "Elite", 4 => "Rar", 2 => "Rar Elite", 3 => "Boss"], 'classification'=> "Einstufung", @@ -272,6 +288,7 @@ $lang = array( 'gainsDesc' => "Nach dem Töten dieses NPCs erhaltet Ihr", 'repWith' => "Ruf mit der Fraktion", 'stopsAt' => "Stoppt bei %s", + 'vehicle' => "Fahrzeug", 'textTypes' => [null, "schreit", "sagt", "flüstert"], 'modes' => array( 1 => ["Normal", "Heroisch"], @@ -330,9 +347,13 @@ $lang = array( ) ), 'quest' => array( - 'level' => 'Stufe %s', + 'questLevel' => 'Stufe %s', 'daily' => 'Täglich', - 'requirements' => 'Anforderungen' + 'requirements' => 'Anforderungen', + 'questInfo' => array( + 0 => 'Normal', 1 => 'Gruppe', 21 => 'Leben', 41 => 'PvP', 62 => 'Schlachtzug', 81 => 'Dungeon', 82 => 'Weltereignis', + 83 => 'Legendär', 84 => 'Eskorte', 85 => 'Heroisch', 88 => 'Schlachtzug (10)', 89 => 'Schlachtzug (25)' + ) ), 'title' => array( 'cat' => array( @@ -359,7 +380,13 @@ $lang = array( 'spillover' => "Reputationsüberlauf", 'spilloverDesc' => "Für diese Fraktion erhaltener Ruf wird zusätzlich mit den unten aufgeführten Fraktionen anteilig verrechnet.", 'maxStanding' => "Max. Ruf", - 'quartermaster' => "Rüstmeister" + 'quartermaster' => "Rüstmeister", + 'cat' => array( + 1118 => ["Classic", 469 => "Allianz", 169 => "Dampfdruckkartell", 67 => "Horde", 891 => "Streitkräfte der Allianz", 892 => "Streitkräfte der Horde"], + 980 => ["The Burning Crusade", 936 => "Shattrath"], + 1097 => ["Wrath of the Lich King", 1052 => "Expedition der Horde", 1117 => "Sholazarbecken", 1037 => "Vorposten der Allianz"], + 0 => "Sonstige" + ) ), 'itemset' => array( '_desc' => "%s ist das %s. Es enthält %s Teile.", @@ -576,7 +603,6 @@ $lang = array( '_unavailable' => "Dieser Gegenstand ist nicht für Spieler verfügbar.", '_rndEnchants' => "Zufällige Verzauberungen", '_chance' => "(Chance von %s%%)", - '_reqLevel' => "Mindeststufe", 'reqRating' => "Benötigt eine persönliche Arenawertung und Teamwertung von %d.", 'slot' => "Platz", '_quality' => "Qualität", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 3c7d2679..10f542ce 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -26,6 +26,7 @@ $lang = array( 'pageNotFound' => "This %s doesn't exist.", 'gender' => "Gender", 'sex' => [null, 'Male', 'Female'], + 'players' => "Players", 'quickFacts' => "Quick Facts", 'screenshots' => "Screenshots", 'videos' => "Videos", @@ -52,6 +53,7 @@ $lang = array( 'refineSearch' => "Tip: Refine your search by browsing a subcategory.", 'clear' => "clear", 'exactMatch' => "Exact match", + '_reqLevel' => "Required level", // infobox 'unavailable' => "Not available to players", // alternative wording found: "No longer available to players" ... aw screw it <_< @@ -128,12 +130,15 @@ $lang = array( 'itemsets' => "Item Sets", 'mechanic' => "Mechanic", 'mechAbbr' => "Mech.", + 'meetingStone' => "Meeting Stone", 'npc' => "NPC", 'npcs' => "NPCs", 'pet' => "Pet", 'pets' => "Hunter Pets", 'profile' => "profile", 'profiles' => "Profiles", + 'quest' => "quest", + 'quests' => "Quests", 'requires' => "Requires %s", 'requires2' => "Requires", 'reqLevel' => "Requires Level %s", @@ -247,7 +252,18 @@ $lang = array( 'publicDesc' => "Public Description", 'viewPubDesc' => "View your Public Description in your Profile Page", ), - 'npc' => array( + 'gameObject' => array( + 'cat' => [0 => "Other", 9 => "Books", 3 => "Containers", -5 => "Chests", 25 => "Fishing Pools", -3 => "Herbs", -4 => "Mineral Veins", -2 => "Quest", -6 => "Tools"], + 'type' => [ 9 => "Book", 3 => "Container", -5 => "Chest", 25 => "", -3 => "Herb", -4 => "Mineral Vein", -2 => "Quest", -6 => ""], + 'unkPosition' => "The location of this object is unknown.", + 'key' => "Key", + 'focus' => "Spell Focus", + 'focusDesc' => "Spells requiring this Focus can be cast near this Object", + 'trap' => "Trap", + 'triggeredBy' => "Triggered by", + 'capturePoint' => "Capture Point" + ), + 'npc' => array( 'rank' => [0 => "Normal", 1 => "Elite", 4 => "Rare", 2 => "Rare Elite", 3 => "Boss"], 'classification'=> "Classification", 'petFamily' => "Pet familiy", @@ -259,6 +275,7 @@ $lang = array( 'gainsDesc' => "After killing this NPC you will gain", 'repWith' => "reputation with", 'stopsAt' => "stops at %s", + 'vehicle' => "Vehicle", 'textTypes' => [null, "yells", "says", "whispers"], 'modes' => array( 1 => ["Normal", "Heroic"], @@ -317,9 +334,13 @@ $lang = array( ) ), 'quest' => array( - 'level' => 'Level %s', + 'questLevel' => 'Level %s', 'daily' => 'Daily', - 'requirements' => 'Requirements' + 'requirements' => 'Requirements', + 'questInfo' => array( + 0 => 'Normal', 1 => 'Group', 21 => 'Life', 41 => 'PvP', 62 => 'Raid', 81 => 'Dungeon', 82 => 'World Event', + 83 => 'Legendary', 84 => 'Escort', 85 => 'Heroic', 88 => 'Raid (10)', 89 => 'Raid (25)' + ) ), 'title' => array( 'cat' => array( @@ -346,7 +367,13 @@ $lang = array( 'spillover' => "Reputation Spillover", 'spilloverDesc' => "Gaining Reputation with this faction also yields a proportional gain with the factions listed below.", 'maxStanding' => "Max. Standing", - 'quartermaster' => "Quartermaster" + 'quartermaster' => "Quartermaster", + 'cat' => array( + 1118 => ["Classic", 469 => "Alliance", 169 => "Steamwheedle Cartel", 67 => "Horde", 891 => "Alliance Forces", 892 => "Horde Forces"], + 980 => ["The Burning Crusade", 936 => "Shattrath City"], + 1097 => ["Wrath of the Lich King", 1052 => "Horde Expedition", 1117 => "Sholazar Basin", 1037 => "Alliance Vanguard"], + 0 => "Other" + ) ), 'itemset' => array( '_desc' => "%s is the %s. It contains %s pieces.", @@ -563,7 +590,6 @@ $lang = array( '_unavailable' => "This item is not available to players.", '_rndEnchants' => "Random Enchantments", '_chance' => "(%s%% chance)", - '_reqLevel' => "Required level", 'reqRating' => "Requires personal and team arena rating of %d
in 3v3 or 5v5 brackets", 'slot' => "Slot", '_quality' => "Quality", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index 746f5c6d..e8d98e8c 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -31,6 +31,7 @@ $lang = array( 'pageNotFound' => "Este %s no existe.", 'gender' => "Género", 'sex' => [null, 'Hombre', 'Mujer'], + 'players' => "Jugadores", 'quickFacts' => "Notas rápidas", 'screenshots' => "Capturas de pantalla", 'videos' => "Videos", @@ -57,6 +58,7 @@ $lang = array( 'refineSearch' => "Sugerencia: Refina tu búsqueda llendo a una subcategoría.", 'clear' => "borrar", 'exactMatch' => "Coincidencia exacta", + '_reqLevel' => "Nivel requerido", // infobox 'unavailable' => "No está disponible a los jugadores", @@ -133,12 +135,15 @@ $lang = array( 'itemsets' => "Conjuntos de objetos", 'mechanic' => "Mecanica", 'mechAbbr' => "Mec.", + 'meetingStone' => "Roca de encuentro", 'npc' => "PNJ", 'npcs' => "PNJs", 'pet' => "Mascota", 'pets' => "Mascotas de cazador", 'profile' => "", 'profiles' => "Perfiles", + 'quest' => "misión", + 'quests' => "Misiones", 'requires' => "Requiere %s", 'requires2' => "Requiere", 'reqLevel' => "Necesitas ser de nivel %s", @@ -218,6 +223,17 @@ $lang = array( 'goForum' => "Feedback forum", ), 'account' => [], + 'gameObject' => array( + 'cat' => [0 => "Otros", 9 => "Libros", 3 => "Contenedores", -5 => "Cofres", 25 => "[Fishing Pools]", -3 => "Hierbas", -4 => "Venas de minerales", -2 => "Misiones", -6 => "Herramientas"], + 'type' => [ 9 => "Libro", 3 => "Contenedore", -5 => "Cofre", 25 => "", -3 => "Hierba", -4 => "Filóne de mineral", -2 => "Misión", -6 => ""], + 'unkPosition' => "No se conoce la ubicación de esta entidad.", + 'key' => "Llave", + 'focus' => "[Spell Focus]", + 'focusDesc' => "[Spells requiring this Focus can be cast near this Object]", + 'trap' => "Trampa", + 'triggeredBy' => "Accionado por", + 'capturePoint' => "Punto de captura" + ), 'npc' => array( 'rank' => [0 => "Normal", 1 => "Élite", 4 => "Raro", 2 => "Élite raro", 3 => "Jefe"], 'classification'=> "Clasificación", @@ -230,6 +246,7 @@ $lang = array( 'gainsDesc' => "Tras acabar con este PNJ ganarás", 'repWith' => "reputación con", 'stopsAt' => "se detiene en %s", + 'vehicle' => "Vehículo", 'textTypes' => [null, "grita", "dice", "susurra"], 'modes' => array( 1 => ["Normal", "Heroico"], @@ -288,9 +305,13 @@ $lang = array( ) ), 'quest' => array( - 'level' => 'Nivel %s', + 'questLevel' => 'Nivel %s', 'daily' => 'Diaria', - 'requirements' => 'Requisitos' + 'requirements' => 'Requisitos', + 'questInfo' => array( + 0 => 'Normal', 1 => 'Élite', 21 => 'Vida', 41 => 'JcJ', 62 => 'Banda', 81 => 'Mazmorra', 82 => 'Evento del mundo', + 83 => 'Legendaria', 84 => 'Escolta', 85 => 'Heroica', 88 => 'Banda (10)', 89 => 'Banda (25)' + ) ), 'title' => array( 'cat' => array( @@ -317,7 +338,13 @@ $lang = array( 'spillover' => "[Reputation Spillover]", 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", 'maxStanding' => "Posición máxima", - 'quartermaster' => "Intendente" + 'quartermaster' => "Intendente", + 'cat' => array( + 1118 => ["Clásicas", 469 => "Alianza", 169 => "Cártel Bonvapor", 67 => "Horda", 891 => "Fuerzas de la Alianza", 892 => "Fuerzas de la Horda"], + 980 => ["The Burning Crusade", 936 => "Ciudad de Shattrath"], + 1097 => ["Wrath of the Lich King", 1052 => "Expedición de la Horda", 1117 => "Cuenca de Sholazar", 1037 => "Vanguardia de la Alianza"], + 0 => "Otros" + ) ), 'itemset' => array( '_desc' => "%s es el %s. Contiene %s piezas.", @@ -534,7 +561,6 @@ $lang = array( '_unavailable' => "Este objeto no está disponible para los jugadores.", '_rndEnchants' => "Encantamientos aleatorios", '_chance' => "(probabilidad %s%%)", - '_reqLevel' => "Nivel requerido", 'reqRating' => "Requiere un índice de arena personal y de equipo de %d", 'slot' => "Casilla", '_quality' => "Calidad", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index becae17e..b3121a3a 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -31,6 +31,7 @@ $lang = array( 'pageNotFound' => "Ce %s n'existe pas.", 'gender' => "Genre", 'sex' => [null, 'Homme', 'Femme'], + 'players' => "Joueurs", 'quickFacts' => "En bref", 'screenshots' => "Captures d'écran", 'videos' => "Vidéos", @@ -57,6 +58,7 @@ $lang = array( 'refineSearch' => "Astuce : Affinez votre recherche en utilisant une sous-catégorie.", 'clear' => "effacer", 'exactMatch' => "Concordance exacte", + '_reqLevel' => "Niveau requis", // infobox 'unavailable' => "Non disponible aux joueurs", @@ -133,12 +135,15 @@ $lang = array( 'itemsets' => "Ensembles d'objets", 'mechanic' => "Mécanique", 'mechAbbr' => "Mécan.", + 'meetingStone' => "Pierre de rencontre", 'npc' => "PNJ", 'npcs' => "PNJs", 'pet' => "Familier", 'pets' => "Familiers de chasseur", 'profile' => "", 'profiles' => "Profils", + 'quest' => "quête", + 'quests' => "Quêtes", 'requires' => "%s requis", 'requires2' => "Requiert", 'reqLevel' => "Niveau %s requis", @@ -218,6 +223,17 @@ $lang = array( 'goForum' => "Feedback forum", ), 'account' => [], + 'gameObject' => array( + 'cat' => [0 => "Autre", 9 => "Livres", 3 => "Conteneurs", -5 => "Coffres", 25 => "Bancs de poissons", -3 => "Herbes", -4 => "Filons de minerai", -2 => "Quêtes", -6 => "Outils"], + 'type' => [ 9 => "Livre", 3 => "Conteneur", -5 => "Coffre", 25 => "", -3 => "Herbe", -4 => "Filon de minerai", -2 => "Quête", -6 => ""], + 'unkPosition' => "L'emplacement de cette entité est inconnu.", + 'key' => "Clé", + 'focus' => "[Spell Focus]", + 'focusDesc' => "[Spells requiring this Focus can be cast near this Object]", + 'trap' => "Piège", + 'triggeredBy' => "Déclenché par", + 'capturePoint' => "Point de capture" + ), 'npc' => array( 'rank' => [0 => "Standard", 1 => "Élite", 4 => "Rare", 2 => "Élite rare", 3 =>"Boss"], 'classification'=> "Classification", @@ -230,6 +246,7 @@ $lang = array( 'gainsDesc' => "Après avoir tué ce PNJ vous allez obtenir", 'repWith' => "points de réputation avec", 'stopsAt' => "arrête à %s", + 'vehicle' => "Véhicule", 'textTypes' => [null, "crie", "dit", "chuchote"], 'modes' => array( 1 => ["Normal", "Héroïque"], @@ -288,9 +305,13 @@ $lang = array( ) ), 'quest' => array( - 'level' => 'Niveau %s', + 'questLevel' => 'Niveau %s', 'daily' => 'Journalière', - 'requirements' => 'Conditions' + 'requirements' => 'Conditions', + 'questInfo' => array( + 0 => 'Standard', 1 => 'Groupe', 21 => 'Vie', 41 => 'JcJ', 62 => 'Raid', 81 => 'Donjon', 82 => 'Évènement mondial', + 83 => 'Légendaire', 84 => 'Escorte', 85 => 'Héroïque', 88 => 'Raid (10)', 89 => 'Raid (25)' + ) ), 'title' => array( 'cat' => array( @@ -317,7 +338,13 @@ $lang = array( 'spillover' => "[Reputation Spillover]", 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", 'maxStanding' => "Niveau maximum", - 'quartermaster' => "Intendant" + 'quartermaster' => "Intendant", + 'cat' => array( + 1118 => ["Classique", 469 => "Alliance", 169 => "Cartel Gentepression", 67 => "Horde", 891 => "Forces de l'Alliance", 892 => "Forces de la Horde"], + 980 => ["The Burning Crusade", 936 => "Shattrath"], + 1097 => ["Wrath of the Lich King", 1052 => "Expédition de la Horde", 1117 => "Bassin de Sholazar", 1037 => "Avant-garde de l'Alliance"], + 0 => "Autre" + ) ), 'itemset' => array( '_desc' => "%s est le %s. Il contient %s pièces.", @@ -534,7 +561,6 @@ $lang = array( '_unavailable' => "Este objeto no está disponible para los jugadores.", '_rndEnchants' => "Enchantements aléatoires", '_chance' => "(%s%% de chance)", - '_reqLevel' => "Niveau requis", 'reqRating' => "Nécessite une cote d'arène personnelle et en équipe de %d
en arène de 3c3 ou 5c5.", 'slot' => "Emplacement", '_quality' => "Qualité", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index 4023f58b..e831b7b2 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -31,6 +31,7 @@ $lang = array( 'pageNotFound' => "Такое %s не существует.", 'gender' => "Пол", 'sex' => [null, 'Мужчина', 'Женщина'], + 'players' => "Игрокам", 'quickFacts' => "Краткая информация", 'screenshots' => "Изображения", 'videos' => "Видео", @@ -57,6 +58,7 @@ $lang = array( 'refineSearch' => "Совет: Уточните поиск, добавив подкатегорию.", 'clear' => "Очистить", 'exactMatch' => "Полное совпадение", + '_reqLevel' => "Требуется уровень", // infobox 'unavailable' => "Недоступно игрокам", @@ -133,12 +135,15 @@ $lang = array( 'itemsets' => "Комплекты", 'mechanic' => "Механика", 'mechAbbr' => "Механика", + 'meetingStone' => "Камень встреч", 'npc' => "НИП", 'npcs' => "НИП", 'pet' => "Питомец", 'pets' => "Питомцы охотников", 'profile' => "", 'profiles' => "Профили", + 'quest' => "задание", + 'quests' => "Задания", 'requires' => "Требует %s", 'requires2' => "Требуется:", 'reqLevel' => "Требуется уровень: %s", @@ -171,7 +176,7 @@ $lang = array( 11 => "драконий", 12 => "калимаг", 13 => "гномский", 14 => "язык троллей", 33 => "наречие нежити", 35 => "дренейский", 36 => "наречие зомби", 37 => "машинный гномский", 38 => "машинный гоблинский" ), 'gl' => array(null, "Большой", "Малый"), - 'si' => array(-2 => "Орда только", -1 => "Альянс только", null, "Альянс", "Орда", "Обе"), + 'si' => array(1 => "Альянс", -1 => "Альянс только", 2 => "Орда", -2 => "Орда только", null, 3 => "Обе"), 'resistances' => array(null, 'Сопротивление светлой магии', 'Сопротивление огню', 'Сопротивление силам природы', 'Сопротивление магии льда', 'Сопротивление темной магии', 'Сопротивление тайной магии'), 'dt' => array(null, 'Магия', 'Проклятие', 'Болезнь', 'Яд', 'Незаметность', 'Невидимость', null, null, 'Исступление'), 'sc' => array("Физический урон", "Свет", "Огонь", "природа", "Лед", "Тьма", "Тайная магия"), @@ -218,6 +223,17 @@ $lang = array( 'goForum' => "Feedback forum", ), 'account' => [], + 'gameObject' => array( + 'cat' => [0 => "Другое", 9 => "Книги", 3 => "Контейнеры", -5 => "Сундуки", 25 => "[Fishing Pools]", -3 => "Травы", -4 => "Полезные ископаемые", -2 => "Задания", -6 => "Инструменты"], + 'type' => [ 9 => "Книга", 3 => "Контейнер", -5 => "Сундук", 25 => "", -3 => "Растение", -4 => "Полезное ископаемое", -2 => "Задание", -6 => ""], + 'unkPosition' => "Местонахождение этого объекта неизвестно.", + 'key' => "Ключ", + 'focus' => "[Spell Focus]", + 'focusDesc' => "[Spells requiring this Focus can be cast near this Object]", + 'trap' => "Ловушки", + 'triggeredBy' => "Срабатывает от", + 'capturePoint' => "Точка захвата" + ), 'npc' => array( 'rank' => [0 => "Обычный", 1 => "Элитный", 4 => "Редкий", 2 => "Редкий элитный", 3 =>"Босс"], 'classification'=> "Классификация", @@ -230,6 +246,7 @@ $lang = array( 'gainsDesc' => "В награду за убийство этого НИПа вы получите", 'repWith' => "репутации с", 'stopsAt' => 'останавливается на уровне "%s"', + 'vehicle' => "Автомобиль", 'textTypes' => [null, "кричит", "говорит", "шепчет"], 'modes' => array( 1 => ["Обычный", "Героический"], @@ -288,9 +305,13 @@ $lang = array( ) ), 'quest' => array( - 'level' => '%s-го уровня', + 'questLevel' => '%s-го уровня', 'daily' => 'Ежедневно', - 'requirements' => 'Требования' + 'requirements' => 'Требования', + 'questInfo' => array( + 0 => 'Обычный', 1 => 'Группа', 21 => 'Жизнь', 41 => 'PvP', 62 => 'Рейд', 81 => 'Подземелье', 82 => 'Игровое событие', + 83 => 'Легенда', 84 => 'Сопровождение', 85 => 'Героическое', 88 => 'Рейд (10)', 89 => 'Рейд (25)' + ) ), 'title' => array( 'cat' => array( @@ -317,7 +338,13 @@ $lang = array( 'spillover' => "[Reputation Spillover]", 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", 'maxStanding' => "Макс Уровень", - 'quartermaster' => "Интендант" + 'quartermaster' => "Интендант", + 'cat' => array( + 1118 => ["World of Warcraft", 469 => "Альянс", 169 => "Картель Хитрая Шестеренка", 67 => "Орда", 891 => "Силы Альянса", 892 => "Силы Орды"], + 980 => ["The Burning Crusade", 936 => "Город Шаттрат"], + 1097 => ["Wrath of the Lich King", 1052 => "Экспедиция Орды", 1117 => "Низина Шолазар", 1037 => "Авангард Альянса"], + 0 => "Другое" + ) ), 'itemset' => array( '_desc' => "%s%s. Он состоит из %s предметов.", @@ -534,7 +561,6 @@ $lang = array( '_unavailable' => "Этот предмет не доступен игрокам.", '_rndEnchants' => "Случайные улучшения", '_chance' => "(шанс %s%%)", - '_reqLevel' => "Требуется уровень", 'reqRating' => "Требуется личный и командный рейтинг на арене не ниже %d", 'slot' => "Слот", '_quality' => "Качество", diff --git a/pages/achievement.php b/pages/achievement.php index 8f0fe76b..5c982332 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -394,7 +394,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $tmp['standard'] = true; // Add a gold coin icon $tmp['extra_text'] = $displayMoney ? Util::formatMoney($qty) : $crtName; - var_dump($tmp); break; } // If the right column diff --git a/pages/factions.php b/pages/factions.php index b8a580bf..cbaaf4ae 100644 --- a/pages/factions.php +++ b/pages/factions.php @@ -28,22 +28,24 @@ if (!$smarty->loadCache($cacheKey, $pageData)) if (isset($cats[0]) && empty($cats[1])) { if (!$cats[0]) - $conditions[] = ['f1.parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!']; + $conditions[] = ['parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!']; else { $subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $cats[0]); - $conditions[] = ['OR', ['f1.parentFactionId', $subs], ['f1.id', $subs]]; + $conditions[] = ['OR', ['parentFactionId', $subs], ['id', $subs]]; } $path[] = $cats[0]; - // array_unshift($title, Lang::$factions['cat'][$cats[0]]); + + $t = Lang::$faction['cat'][$cats[0]]; + array_unshift($title, is_array($t) ? $t[0] : $t); } else if (!empty($cats[1])) { - $conditions[] = ['f1.parentFactionId', $cats[1]]; + $conditions[] = ['parentFactionId', $cats[1]]; $path[] = $cats[0]; $path[] = $cats[1]; - // array_unshift($title, Lang::$factions['cat'][$cats[1]]); + array_unshift($title, Lang::$faction['cat'][$cats[0]][$cats[1]]); } $factions = new FactionList($conditions); diff --git a/pages/item.php b/pages/item.php index 793a8a84..782cd15d 100644 --- a/pages/item.php +++ b/pages/item.php @@ -9,8 +9,9 @@ if (isset($_GET['xml'])) require 'includes/community.class.php'; -$_id = intVal($pageParam); -$_path = [0, 0]; +$_id = intVal($pageParam); +$_path = [0, 0]; +$_visSlots = [SLOT_HEAD, SLOT_SHOULDERS, SLOT_SHIRT, SLOT_CHEST, SLOT_WAIST, SLOT_LEGS, SLOT_FEET, SLOT_WRISTS, SLOT_HANDS, SLOT_BACK, SLOT_MAIN_HAND, SLOT_OFF_HAND, SLOT_RANGED, SLOT_TABARD]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $_id, -1, User::$localeId]); @@ -246,7 +247,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) /****************/ $cmpUpg = in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) || $item->getField('gemEnchantmentId'); - $view3D = in_array($_class, [ITEM_CLASS_WEAPON, ITEM_CLASS_ARMOR]) && $item->getField('displayId'); + $view3D = in_array($_slot, $_visSlots) && $item->getField('displayId'); // path if (in_array($_class, [5, 8, 14])) @@ -562,13 +563,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) if ($lockIds) { // objects - $conditions = array( - 'OR', - ['AND', ['data0', $lockIds], ['type', [OBJECT_QUESTGIVER, OBJECT_CHEST, OBJECT_TRAP, OBJECT_GOOBER, OBJECT_CAMERA, OBJECT_FLAGSTAND, OBJECT_FLAGDROP]]], - ['AND', ['data1', $lockIds], ['type', [OBJECT_DOOR, OBJECT_BUTTON]]] - ); - - $lockedObj = new GameObjectList($conditions); + $lockedObj = new GameObjectList(array(['lockId', $lockIds])); if (!$lockedObj->error) { $pageData['relTabs'][] = array( @@ -700,6 +695,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) } // tab: same model as + // todo (low): should also work for creatures summoned by item if (($model = $item->getField('model')) && $_slot) { $sameModel = new ItemList(array(['model', $model], ['id', $_id, '!'], ['slot', $_slot])); diff --git a/pages/miscTools.php b/pages/miscTools.php index 095f6e80..f80127ca 100644 --- a/pages/miscTools.php +++ b/pages/miscTools.php @@ -10,35 +10,18 @@ $_path = [1, 8]; $subMenu = $h1Links = null; $_title = ''; $_rss = isset($_GET['rss']); +$lv = []; switch ($pageCall) { case 'random': $type = array_rand(array_filter(Util::$typeStrings)); - $page = Util::$typeStrings[$type]; - $id = 0; + $typeId = 0; - switch ($type) - { - case TYPE_NPC: $id = (new CreatureList(null))->getRandomId(); break; - case TYPE_OBJECT: $id = (new GameobjectList(null))->getRandomId(); break; - case TYPE_ITEM: $id = (new ItemList(null))->getRandomId(); break; - case TYPE_ITEMSET: $id = (new ItemsetList(null))->getRandomId(); break; - case TYPE_QUEST: $id = (new QuestList(null))->getRandomId(); break; - case TYPE_SPELL: $id = (new SpellList(null))->getRandomId(); break; - case TYPE_ZONE: $id = (new ZoneList(null))->getRandomId(); break; - case TYPE_FACTION: $id = (new FactionList(null))->getRandomId(); break; - case TYPE_PET: $id = (new PetList(null))->getRandomId(); break; - case TYPE_ACHIEVEMENT: $id = (new AchievementList(null))->getRandomId(); break; - case TYPE_TITLE: $id = (new TitleList(null))->getRandomId(); break; - case TYPE_WORLDEVENT: $id = (new WorldEventList(null))->getRandomId(); break; - case TYPE_CLASS: $id = (new CharClassList(null))->getRandomId(); break; - case TYPE_RACE: $id = (new CharRaceList(null))->getRandomId(); break; - case TYPE_SKILL: $id = (new SkillList(null))->getRandomId(); break; - case TYPE_CURRENCY: $id = (new CurrencyList(null))->getRandomId(); break; - } + if ($type != TYPE_QUEST) + $typeId = (new Util::$typeClasses[$type](null))->getRandomId(); - header('Location: ?'.$page.'='.$id); + header('Location: ?'.Util::$typeStrings[$type].'='.$typeId); die(); case 'latest-comments': $menu = 2; @@ -52,22 +35,18 @@ switch ($pageCall) break; case 'latest-screenshots': $menu = 3; - $lv = array( - array( - 'file' => 'screenshot', - 'data' => [], - 'params' => [] - ) + $lv[] = array( + 'file' => 'screenshot', + 'data' => [], + 'params' => [] ); break; case 'latest-videos': $menu = 11; - $lv = array( - array( - 'file' => 'video', - 'data' => [], - 'params' => [] - ) + $lv[] = array( + 'file' => 'video', + 'data' => [], + 'params' => [] ); break; case 'latest-articles': @@ -76,15 +55,42 @@ switch ($pageCall) break; case 'latest-additions': $menu = 0; - $lv = []; + $extraText = ''; break; case 'unrated-comments': $menu = 5; - $lv = []; + $lv[] = array( + 'file' => 'commentpreview', + 'data' => [], + 'params' => [] + ); break; case 'missing-screenshots': $menu = 13; - $lv = []; + $cnd = [[['cuFlags', CUSTOM_HAS_SCREENSHOT, '&'], 0]]; + + if (!User::isInGroup(U_GROUP_STAFF)) + $cnd[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; + + foreach (Util::$typeClasses as $classStr) + { + // temp: as long as we use world.quest_template + if ($classStr == 'QuestList') + continue; + + $typeObj = new $classStr($cnd); + + if (!$typeObj->error) + { + $typeObj->addGlobalsToJscript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + $lv[] = array( + 'file' => (new ReflectionProperty($typeObj, 'brickFile'))->getValue(), + 'data' => $typeObj->getListviewData(), + 'params' => ['tabs' => '$myTabs'] + ); + } + } break; case 'most-comments': if ($pageParam && !in_array($pageParam, [1, 7, 30])) @@ -102,7 +108,11 @@ switch ($pageCall) } $menu = 12; - $lv = []; + $lv[] = array( + 'file' => 'commentpreview', + 'data' => [], + 'params' => [] + ); break; default: $smarty->error(); @@ -136,14 +146,6 @@ if (strstr($pageCall, 'latest') || $pageCall == 'most-comments') $h1Links = ''.Lang::$main['subscribe'].''; } -$pageData = array( - 'listviews' => $lv, - 'page' => array( - 'name' => Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null), - 'h1Links' => $h1Links, - ) -); - array_push($_path, $menu); if ($subMenu) array_push($_path, $subMenu); @@ -152,14 +154,16 @@ if ($subMenu) // menuId 8: Utilities g_initPath() // tabId 1: Tools g_initHeader() $smarty->updatePageVars(array( - 'title' => Lang::$main['utilities'][$menu] . ($_title ? ' - ' . $_title : null), - 'path' => json_encode($_path, JSON_NUMERIC_CHECK), - 'tab' => 1 + 'name' => Lang::$main['utilities'][$menu] . ($_title ? Lang::$colon . $_title : null), + 'h1Links' => $h1Links, + 'title' => Lang::$main['utilities'][$menu] . ($_title ? ' - ' . $_title : null), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 1 )); $smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $lv); // load the page -$smarty->display('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/npc.php b/pages/npc.php index 5e784de0..08231dff 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -82,7 +82,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (count($maps) == 1) // should only exist in one instance { $map = new ZoneList(array(1, ['mapId', $maps[0]])); - // $mapType = $map->getField('areaType'); + // $mapType = $map->getField('areaType'); //NYI } /***********/ @@ -128,13 +128,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($_ = intVal(($npc->getField('minGold') + $npc->getField('maxGold')) / 2)) $infobox[] = Lang::$npc['worth'].Lang::$colon.'[tooltip=tooltip_avgmoneydropped][money='.$_.'][/tooltip]'; + // is Vehicle + if ($npc->getField('vehicleId')) + $infobox[] = Lang::$npc['vehicle']; + // AI if (User::isInGroup(U_GROUP_STAFF)) { - if ($_ = $npc->getField('aiName')) - $infobox[] = 'AI'.Lang::$colon.$_; - else if ($_ = $npc->getField('scriptName')) + if ($_ = $npc->getField('scriptName')) $infobox[] = 'Script'.Lang::$colon.$_; + else if ($_ = $npc->getField('aiName')) + $infobox[] = 'AI'.Lang::$colon.$_; } $_nf = function ($num) { return number_format($num, 0, '', '.'); }; @@ -298,7 +302,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { // fixup .. either set %s for emotes or dont >.< $text = Util::localizedString($t, 'text'); - if (in_array($t['type'], [2, 3, 16, 41]) && strpos($text, '%s') === false) + if (in_array($t['type'], [2, 16]) && strpos($text, '%s') === false) $text = '%s '.$text; $line = array( @@ -367,11 +371,150 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // tab: SAI // hmm, how should this loot like - // tab: abilities - // for spell in template and smartScripts if set + // tab: abilities / tab_controlledabilities (dep: VehicleId) + // SMART_SCRIPT_TYPE_CREATURE = 0; SMART_ACTION_CAST = 11; SMART_ACTION_ADD_AURA = 75; SMART_ACTION_INVOKER_CAST = 85; SMART_ACTION_CROSS_CAST = 86 + $smartSpells = DB::Aowow()->selectCol('SELECT action_param1 FROM smart_scripts WHERE source_type = 0 AND action_type IN (11, 75, 85, 86) AND entryOrGUID = ?d', $_id); + $tplSpells = []; + $conditions = [['id', $smartSpells]]; + + for ($i = 1; $i < 9; $i++) + if ($_ = $npc->getField('spell'.$i)) + $tplSpells[] = $_; + + if ($tplSpells) + { + $conditions[] = ['id', $tplSpells]; + $conditions[] = 'OR'; + } + + if ($tplSpells || $smartSpells) + { + $abilities = new SpellList($conditions); + if (!$abilities->error) + { + $abilities->addGlobalsToJScript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); + $normal = $abilities->getListviewData(); + $controled = []; + + if ($npc->getField('vehicleId')) // not quite right. All seats should be checked for allowed-to-cast-flag-something + { + foreach ($normal as $id => $values) + { + if (in_array($id, $smartSpells)) + continue; + + $controled[$id] = $values; + unset($normal[$id]); + } + } + + if ($normal) + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $normal, + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_abilities', + 'id' => 'abilities' + ] + ); + + if ($controled) + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $controled, + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_controlledabilities', + 'id' => 'controlled-abilities' + ] + ); + } + } + + // tab: summoned by + $conditions = array( + 'OR', + ['AND', ['effect1Id', 28], ['effect1MiscValue', $_id]], + ['AND', ['effect2Id', 28], ['effect2MiscValue', $_id]], + ['AND', ['effect3Id', 28], ['effect3MiscValue', $_id]] + ); + + $summoned = new SpellList($conditions); + if (!$summoned->error) + { + $summoned->addGlobalsToJscript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $summoned->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_summonedby', + 'id' => 'summoned-by' + ] + ); + } + // tab: teaches - // pet spells, class spells, trade spells + if ($npc->getField('npcflag') & NPC_FLAG_TRAINER) + { + $teachQuery = 'SELECT IFNULL(t2.spell, t1.spell) AS ARRAY_KEY, IFNULL(t2.spellcost, t1.spellcost) AS cost, IFNULL(t2.reqskill, t1.reqskill) AS reqSkillId, + IFNULL(t2.reqskillvalue, t1.reqskillvalue) AS reqSkillValue, IFNULL(t2.reqlevel, t1.reqlevel) AS reqLevel + FROM npc_trainer t1 LEFT JOIN npc_trainer t2 ON t2.entry = IF(t1.spell < 0, -t1.spell, null) WHERE t1.entry = ?d'; + + if ($tSpells = DB::Aowow()->select($teachQuery, $_id)) + { + $teaches = new SpellList(array(['id', array_keys($tSpells)])); + if (!$teaches->error) + { + $teaches->addGlobalsToJscript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); + $data = $teaches->getListviewData(); + + $extra = []; + foreach ($tSpells as $sId => $train) + { + if (empty($data[$sId])) + continue; + + if ($_ = $train['reqSkillId']) + { + Util::$pageTemplate->extendGlobalIds(TYPE_SKILL, $_); + if (!isset($extra[0])) + $extra[0] = 'Listview.extraCols.condition'; + + $data[$sId]['condition'] = ['type' => TYPE_SKILL, 'typeId' => $_, 'status' => 1, 'reqSkillLvl' => $train['reqSkillValue']]; + } + + if ($_ = $train['reqLevel']) + { + if (!isset($extra[1])) + $extra[1] = "Listview.funcBox.createSimpleCol('reqLevel', LANG.tooltip_reqlevel, '7%', 'reqLevel')"; + + $data[$sId]['reqLevel'] = $_; + } + + if ($_ = $train['cost']) + $data[$sId]['trainingcost'] = $_; + } + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $data, + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_teaches', + 'id' => 'teaches', + 'visibleCols' => "$['trainingcost']", + 'extraCols' => $extra ? '$['.implode(', ', $extra).']' : null + ] + ); + } + } + else + Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'NPC '.$_id.' is flagged as trainer, but doesn\'t have any spells set'); + } // tab: sells if ($sells = DB::Aowow()->selectCol('SELECT item FROM npc_vendor nv WHERE entry = ?d UNION SELECT item FROM game_event_npc_vendor genv JOIN creature c ON genv.guid = c.guid WHERE c.id = ?d', $_id, $_id)) @@ -495,44 +638,38 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // tab: starts quest (questrelation) - if ($starts = DB::Aowow()->selectCol('SELECT quest FROM creature_questrelation WHERE id = ?d', $_id)) + // tab: starts quest + $starts = new QuestList(array(['npcStart.id', $_id])); + if (!$starts->error) { - $started = new QuestList(array(['id', $starts])); - if (!$started->error) - { - $started->addGlobalsToJScript(Util::$pageTemplate); + $starts->addGlobalsToJScript(Util::$pageTemplate); - $pageData['relTabs'][] = array( - 'file' => 'quest', - 'data' => $started->getListviewData(), - 'params' => [ - 'tabs' => '$tabsRelated', - 'name' => '$LANG.tab_starts', - 'id' => 'starts' - ] - ); - } + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $starts->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_starts', + 'id' => 'starts' + ] + ); } - // tab: ends quest (involvedrelation) - if ($ends = DB::Aowow()->selectCol('SELECT quest FROM creature_involvedrelation WHERE id = ?d', $_id)) + // tab: ends quest + $ends = new QuestList(array(['npcEnd.id', $_id])); + if (!$ends->error) { - $ended = new QuestList(array(['id', $ends])); - if (!$ended->error) - { - $ended->addGlobalsToJScript(Util::$pageTemplate); + $ends->addGlobalsToJScript(Util::$pageTemplate); - $pageData['relTabs'][] = array( - 'file' => 'quest', - 'data' => $ended->getListviewData(), - 'params' => [ - 'tabs' => '$tabsRelated', - 'name' => '$LANG.tab_ends', - 'id' => 'ends' - ] - ); - } + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $ends->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_ends', + 'id' => 'ends' + ] + ); } // tab: objective of quest diff --git a/pages/object.php b/pages/object.php index 7847c9d3..73c06066 100644 --- a/pages/object.php +++ b/pages/object.php @@ -6,7 +6,8 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 5]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_OBJECT, $_id, -1, User::$localeId]); $cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_OBJECT, $_id, -1, User::$localeId]); @@ -20,7 +21,7 @@ if (isset($_GET['power'])) if (!$smarty->loadCache($cacheKeyTooltip, $x)) { - $object = new GameObjectList(array(['entry', $_id])); + $object = new GameObjectList(array(['id', $_id])); if ($object->error) die('$WowheadPower.registerObject('.$_id.', '.User::$localeId.', {});'); @@ -41,34 +42,169 @@ if (isset($_GET['power'])) // regular page if (!$smarty->loadCache($cacheKeyPage, $pageData)) { - $object = new GameObjectList(array(['entry', $_id])); + $object = new GameObjectList(array(['id', $_id])); if ($object->error) $smarty->notFound(Lang::$game['gameObject'], $_id); + $_path[] = $object->getField('typeCat'); + + + /* NOTE + + much like items GOs should have difficulty versions of itself, that are spawned for bosses, but this data is mostly contained in scripts + also certain chests/caches/ect should be linked to their boss mob + + all of this has to be done manually + */ + + /***********/ + /* Infobox */ + /***********/ + + $infobox = []; + + // Reaction + $_ = function ($r) + { + if ($r == 1) return 2; + if ($r == -1) return 10; + return; + }; + $infobox[] = Lang::$npc['react'].Lang::$colon.'[color=q'.$_($object->getField('A')).']A[/color] [color=q'.$_($object->getField('H')).']H[/color]'; + + // reqSkill + switch ($object->getField('typeCat')) + { + case -3: // Herbalism + $infobox[] = sprintf(Lang::$game['requires'], Lang::$spell['lockType'][2].' ('.$object->getField('reqSkill').')'); + break; + case -4: // Mining + $infobox[] = sprintf(Lang::$game['requires'], Lang::$spell['lockType'][3].' ('.$object->getField('reqSkill').')'); + break; + case -5: // Lockpicking + $infobox[] = sprintf(Lang::$game['requires'], Lang::$spell['lockType'][1].' ('.$object->getField('reqSkill').')'); + break; + default: // requires key .. maybe + { + $locks = Lang::getLocks($object->getField('lockId')); + $l = ''; + foreach ($locks as $idx => $_) + { + if ($idx < 0) + continue; + + Util::$pageTemplate->extendGlobalIds(TYPE_ITEM, $idx); + $l = Lang::$gameObject['key'].Lang::$colon.'[item='.$idx.']'; + } + + // if no propper item is found use a skill + if ($locks) + $infobox[] = $l ? $l : array_pop($locks); + } + } + + // linked trap + if ($_ = $object->getField('linkedTrap')) + { + Util::$pageTemplate->extendGlobalIds(TYPE_OBJECT, $_); + $infobox[] = Lang::$gameObject['trap'].Lang::$colon.'[object='.$_.']'; + } + + // trap for + $trigger = new GameObjectList(array(['linkedTrap', $_id])); + if (!$trigger->error) + { + $trigger->addGlobalsToJScript(Util::$pageTemplate); + $infobox[] = Lang::$gameObject['triggeredBy'].Lang::$colon.'[object='.$trigger->id.']'; + } + + // SpellFocus + if ($_ = $object->getField('spellFocusId')) + $infobox[] = '[tooltip name=focus]'.Lang::$gameObject['focusDesc'].'[/tooltip][span class=tip tooltip=focus]'.Lang::$gameObject['focus'].Lang::$colon.Util::localizedString(DB::Aowow()->selectRow('SELECT * FROM ?_spellFocusObject WHERE id = ?d', $_), 'name').'[/span]'; + + // lootinfo: [min, max, restock] + if (($_ = $object->getField('lootStack')) && $_[0]) + { + $buff = Lang::$item['charges'].Lang::$colon.$_[0]; + if ($_[0] < $_[1]) + $buff .= Lang::$game['valueDelim'].$_[1]; + + // since Veins don't have charges anymore, the timer is questionable + $infobox[] = $_[2] > 1 ? '[tooltip name=restock][Recharges every '.Util::formatTime($_[2] * 1000).'][/tooltip][span class=tip tooltip=restock]'.$buff.'[/span]' : $buff; + } + + // meeting stone [minLevel, maxLevel, zone] + if ($object->getField('type') == OBJECT_MEETINGSTONE) + { + if ($_ = $object->getField('mStone')) + { + Util::$pageTemplate->extendGlobalIds(TYPE_ZONE, $_[2]); + $m = Lang::$game['meetingStone'].Lang::$colon.'[zone='.$_[2].']'; + + $l = $_[0]; + if ($_[0] > 1 && $_[1] > $_[0]) + $l .= Lang::$game['valueDelim'].min($_[1], MAX_LEVEL); + + $infobox[] = $l ? '[tooltip name=meetingstone]'.sprintf(Lang::$game['reqLevel'], $l).'[/tooltip][span class=tip tooltip=meetingstone]'.$m.'[/span]' : $m; + } + } + + // capture area [minPlayer, maxPlayer, minTime, maxTime, radius] + if ($object->getField('type') == OBJECT_CAPTURE_POINT) + { + if ($_ = $object->getField('capture')) + { + $buff = Lang::$gameObject['capturePoint']; + + if ($_[2] > 1 || $_[0]) + $buff .= Lang::$colon.'[ul]'; + + if ($_[2] > 1) + $buff .= '[li]'.Lang::$game['duration'].Lang::$colon.($_[3] > $_[2] ? Util::FormatTime($_[3] * 1000, true).' - ' : null).Util::FormatTime($_[2] * 1000, true).'[/li]'; + + if ($_[1]) + $buff .= '[li]'.Lang::$main['players'].Lang::$colon.$_[0].($_[1] > $_[0] ? ' - '.$_[1] : null).'[/li]'; + + if ($_[4]) + $buff .= '[li]'.sprintf(Lang::$spell['range'], $_[4]).'[/li]'; + + if ($_[2] > 1 || $_[0]) + $buff .= '[/ul]'; + } + + $infobox[] = $buff; + } + + // AI + if (User::isInGroup(U_GROUP_STAFF)) + { + if ($_ = $object->getField('ScriptName')) + $infobox[] = 'Script'.Lang::$colon.$_; + else if ($_ = $object->getField('AIName')) + $infobox[] = 'AI'.Lang::$colon.$_; + } + + + /****************/ + /* Main Content */ + /****************/ + + // pageText + $pageText = []; + if ($next = $object->getField('pageTextId')) + { + while ($next) + { + $row = DB::Aowow()->selectRow('SELECT *, text as Text_loc0 FROM page_text pt LEFT JOIN locales_page_text lpt ON pt.entry = lpt.entry WHERE pt.entry = ?d', $next); + $next = $row['next_page']; + $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text')); + } + } + + // positions + $positions = []; /* - ListView for fishing holes - - id:'fished-in', - hiddenCols:['instancetype', 'level', 'territory', 'category'], - extraCols:[{if $percent}Listview.extraCols.percent{/if}], - sort:['-percent', 'name'], - -*/ - - // NYI -> die() - $smarty->error(); - - - - // path(0, 5, $object['type']), - - // $object['starts'] = array(); - // $object['ends'] = array(); - // array(ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT), - // $object['criteria_of'] = array(); - // object contains [..] - - $object['position'] = position($object['entry'], 'gameobject'); + $positions = position($object['entry'], 'gameobject'); // Исправить type, чтобы подсвечивались event-овые объекты if ($object['position']) foreach ($object['position'] as $z => $zone) @@ -79,33 +215,255 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $object['position'][$z]['points'][$p]['type'] = 4; $object['position'][$z]['points'][$p]['events'] = implode(", ", $names); } +*/ + // menuId 5: Object g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'title' => $object->getField('name', true).' - '.Util::ucFirst(Lang::$game['gameObject']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'name' => $object->getField('name', true), + 'tab' => 0, + 'type' => TYPE_OBJECT, + 'typeId' => $_id, + 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'pageText' => $pageText, + 'positions' => $positions, + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true, + BUTTON_VIEW3D => ['displayId' => $object->getField('displayId'), 'type' => TYPE_OBJECT, 'typeId' => $_id] + ), + 'reqCSS' => array( + $pageText ? ['path' => 'template/css/Book.css'] : null, + // ['path' => 'template/css/Mapper.css'], + // ['path' => 'template/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6'] + ), + 'reqJS' => array( + $pageText ? 'template/js/Book.js' : null, + // 'template/js/Mapper.js', + 'template/js/swfobject.js' + ) + ), + 'relTabs' => [] + ); + + + /**************/ + /* Extra Tabs */ + /**************/ + + // tab: summoned by + $conditions = array( + 'OR', + ['AND', ['effect1Id', [50, 76, 104, 105, 106, 107]], ['effect1MiscValue', $_id]], + ['AND', ['effect2Id', [50, 76, 104, 105, 106, 107]], ['effect2MiscValue', $_id]], + ['AND', ['effect3Id', [50, 76, 104, 105, 106, 107]], ['effect3MiscValue', $_id]] + ); + + $summons = new SpellList($conditions); + if (!$summons->error) + { + $summons->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $summons->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'summoned-by', + 'name' => '$LANG.tab_summonedby' + ] + ); + } + + // tab: related spells + if ($_ = $object->getField('spells')) + { + $relSpells = new SpellList(array(['id', $_])); + if (!$relSpells->error) + { + $relSpells->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + $data = $relSpells->getListviewData(); + + foreach ($data as $relId => $d) + $data[$relId]['trigger'] = array_search($relId, $_); + + $pageData['relTabs'][] = array( + 'file' => 'spell', + 'data' => $data, + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'spells', + 'name' => '$LANG.tab_spells', + 'hiddenCols' => "$['skill']", + 'extraCols' => "$[Listview.funcBox.createSimpleCol('trigger', 'Condition', '10%', 'trigger')]" + ] + ); + } + } + + // tab: criteria of + $acvs = new AchievementList(array(['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT, ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT]], ['ac.value1', $_id])); + if (!$acvs->error) + { + $acvs->addGlobalsToJScript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $acvs->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'criteria-of', + 'name' => '$LANG.tab_criteriaof' + ] + ); + } + + // tab: starts + $started = new QuestList(array(['goStart.id', $_id])); + if (!$started->error) + { + $started->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $started->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_starts', + 'id' => 'starts' + ] + ); + } + + // tab: ends + $ends = new QuestList(array(['goEnd.id', $_id])); + if (!$ends->error) + { + $ends->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $ends->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_ends', + 'id' => 'ends' + ] + ); + } + + // tab: related quests + if ($_ = $object->getField('reqQuest')) + { + $relQuest = new QuestList(array(['id', $_])); + if (!$relQuest->error) + { + $relQuest->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $relQuest->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_quests', + 'id' => 'quests' + ] + ); + } + } + + // tab: contains + $reqQuest = []; + if ($_ = $object->getField('lootId')) + { + if ($itemLoot = Util::handleLoot(LOOT_GAMEOBJECT, $_, User::isInGroup(U_GROUP_STAFF), $extraCols)) + { + $hiddenCols = ['source', 'side', 'slot', 'reqlevel']; + foreach ($itemLoot as $l => $lv) + { + if (!empty($hiddenCols)) + foreach ($hiddenCols as $k => $str) + if (!empty($lv[$str])) + unset($hiddenCols[$k]); + + if (!$lv['quest']) + continue; + + $extraCols[] = 'Listview.extraCols.condition'; + + $reqQuest[$lv['id']] = 0; + + $itemLoot[$l]['condition'] = ['type' => TYPE_QUEST, 'typeId' => &$reqQuest[$lv['id']], 'status' => 1]; + } + + $extraCols[] = 'Listview.extraCols.percent'; + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $itemLoot, + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_contains', + 'id' => 'contains', + 'extraCols' => "$[".implode(', ', array_unique($extraCols))."]", + 'hiddenCols' => $hiddenCols ? '$'.json_encode(array_values($hiddenCols)) : null + ] + ); + } + } + + if ($reqIds = array_keys($reqQuest)) // apply quest-conditions as back-reference + { + $conditions = array( + 'OR', + ['requiredSourceItemId1', $reqIds], ['requiredSourceItemId2', $reqIds], + ['requiredSourceItemId3', $reqIds], ['requiredSourceItemId4', $reqIds], + ['requiredItemId1', $reqIds], ['requiredItemId2', $reqIds], ['requiredItemId3', $reqIds], + ['requiredItemId4', $reqIds], ['requiredItemId5', $reqIds], ['requiredItemId6', $reqIds] + ); + + $reqQuests = new QuestList($conditions); + $reqQuests->addGlobalsToJscript($smarty); + + foreach ($reqQuests->iterate() as $qId => $__) + { + if (empty($reqQuests->requires[$qId][TYPE_ITEM])) + continue; + + foreach ($reqIds as $rId) + if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM])) + $reqQuest[$rId] = $reqQuests->id; + } + } + + // tab: Same model as .. whats the fucking point..? + $sameModel = new GameObjectList(array(['displayId', $object->getField('displayId')], ['id', $_id, '!'])); + if (!$sameModel->error) + { + $sameModel->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'object', + 'data' => $sameModel->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_samemodelas', + 'id' => 'same-model-as' + ] + ); + } $smarty->saveCache($cacheKeyPage, $pageData); } -// menuId 5: Object g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title'].' - '.Util::ucFirst(Lang::$game['gameObject']), - 'path' => $pageData['path'], - 'tab' => 0, - 'type' => TYPE_OBJECT, - 'typeId' => $_id, - 'reqCSS' => array( - $object['pageText'] ? ['path' => 'template/css/Book.css'] : null, - ['path' => 'template/css/Mapper.css'], - ['path' => 'template/css/Mapper_ie6.css', 'ieCond' => 'lte IE 6'] - ), - 'reqJS' => array( - $object['pageText'] ? 'template/js/Book.js' : null, - 'template/js/Mapper.js' - ) -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_OBJECT, $_id)); // comments, screenshots, videos -$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$object, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, Lang::$gameObject, ['colon' => Lang::$colon])); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('object.tpl'); diff --git a/pages/objects.php b/pages/objects.php index 3cb2e5fa..bdf20e11 100644 --- a/pages/objects.php +++ b/pages/objects.php @@ -4,78 +4,77 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; -$path = [0, 5]; -$validCats = [-2, -3, -4, -5, 3, 9]; -$title = [Util::ucFirst(Lang::$game['gameObjects'])]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_OBJECT, -1, isset($cat) ? $cat : -1, User::$localeId]); +$filter = []; +$conditions = []; +$cat = Util::extractURLParams($pageParam); +$path = [0, 5]; +$validCats = [-2, -3, -4, -5, -6, 0, 3, 9, 25]; +$title = [Util::ucFirst(Lang::$game['gameObjects'])]; +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_OBJECT, -1, $cat ? $cat[0] : -1, User::$localeId]); if (!Util::isValidPage($validCats, $cat)) $smarty->error(); -if (isset($cat)) +if ($cat) { - $path[] = $cat; // should be only one parameter anyway - // array_unshift($title, Lang::$object['cat'][$cat]); + $path[] = $cat[0]; + array_unshift($title, Lang::$gameObject['cat'][$cat[0]]); + $conditions[] = ['typeCat', (int)$cat[0]]; } -if (!$smarty->loadCache($cacheKey, $pageData)) +if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { + $objects = new GameObjectList($conditions, true); + + // menuId 5: Object g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'listviews' => [] + 'page' => array( + 'tab' => 0, + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'subCat' => $pageParam ? '='.$pageParam : '', + 'reqJS' => ['template/js/filters.js'] + ), + 'lv' => [] ); - $conditions = []; - - if ($cat == -3) - { - $conditions[] = ['type', 3]; - $conditions[] = ['l.properties1', LOCK_PROPERTY_HERBALISM]; - } - else if ($cat == -4) - { - $conditions[] = ['type', 3]; - $conditions[] = ['l.properties1', LOCK_PROPERTY_MINING]; - } - else if ($cat == -5) - { - $conditions[] = ['type', 3]; - $conditions[] = ['l.properties2', LOCK_PROPERTY_FOOTLOCKER]; - } - else - $conditions[] = ['type', (int)$cat]; // quest not supported - - $objects = new GameObjectList($conditions); + // recreate form selection + $filter = array_merge($objects->filterGetForm('form'), $filter); + $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; + $filter['fi'] = $objects->filterGetForm(); $params = []; if ($objects->hasSetFields(['reqSkill'])) $params['visibleCols'] = "$['skill']"; - $pageData['listviews'][] = array( + $lv = array( 'file' => 'object', 'data' => $objects->getListviewData(), 'params' => $params ); + // create note if search limit was exceeded + if ($objects->getMatches() > SQL_LIMIT_DEFAULT) + { + $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_objectsfound', $objects->getMatches(), SQL_LIMIT_DEFAULT); + $lv['params']['_truncated'] = 1; + } + if ($objects->filterGetError()) + $lv['params']['_errors'] = '$1'; - $objects->addGlobalsToJscript($smarty); + $pageData['lv'] = $lv; - $smarty->saveCache($cacheKey, $pageData); + $smarty->saveCache($cacheKey, $pageData, $filter); } -// menuId 5: Object g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'tab' => 0, - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]" -)); -$smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->updatePageVars($pageData['page']); +$smarty->assign('filter', $filter); +$smarty->assign('lang', array_merge(Lang::$main, ['colon' => Lang::$colon])); +$smarty->assign('lvData', $pageData['lv']); // load the page -// $smarty->display('objects.tpl'); -$smarty->display('generic-no-filter.tpl'); +$smarty->display('objects.tpl'); ?> diff --git a/pages/race.php b/pages/race.php index 38bc9945..56b4dccd 100644 --- a/pages/race.php +++ b/pages/race.php @@ -198,7 +198,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_RACE, $_id)); // comments, screenshots, videos $smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('detail-page-generic.tpl'); diff --git a/pages/skill.php b/pages/skill.php index 35a44ca2..ec2b659f 100644 --- a/pages/skill.php +++ b/pages/skill.php @@ -6,7 +6,8 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 14]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SKILL, $_id, -1, User::$localeId]); @@ -18,33 +19,38 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $_cat = $skill->getField('typeCat'); + $_path[] = (in_array($_cat, [9, 11]) || $_id == 762) ? $_id : $_cat; + /****************/ /* Main Content */ /****************/ + // menuId 14: Skill g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $skill->getField('name', true), - 'path' => [0, 14], - 'relTabs' => [], - 'icons' => [$skill->getField('iconString')], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true - ), 'page' => array( - 'name' => $skill->getField('name', true), - 'id' => $_id + 'title' => $skill->getField('name', true)." - ".Util::ucfirst(Lang::$game['skill']), + 'name' => $skill->getField('name', true), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_SKILL, + 'typeId' => $_id, + 'headIcons' => [$skill->getField('iconString')], + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true + ) ), + 'relTabs' => [] ); - $pageData['path'][] = (in_array($_cat, [9, 11]) || $_id == 762) ? $_id : $_cat; - /**************/ /* Extra Tabs */ /**************/ if (in_array($_cat, [-5, 9, 11])) { + // tab: recipes [spells] (crafted) $condition = array( ['OR', ['s.reagent1', 0, '>'], ['s.reagent2', 0, '>'], ['s.reagent3', 0, '>'], ['s.reagent4', 0, '>'], ['s.reagent5', 0, '>'], ['s.reagent6', 0, '>'], ['s.reagent7', 0, '>'], ['s.reagent8', 0, '>']], ['OR', ['s.skillLine1', $_id], ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $_id]]], @@ -54,7 +60,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $recipes = new SpellList($condition); // also relevant for 3 if (!$recipes->error) { - // 1 recipes [spells] (crafted) $recipes->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); $pageData['relTabs'][] = array( @@ -70,8 +75,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ); } - // 2 recipe Items [items] (Books) - $skill2Filter = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773]; + // tab: recipe Items [items] (Books) + $filterRecipe = [null, 165, 197, 202, 164, 185, 171, 129, 333, 356, 755, 773, 186, 182]; $conditions = array( ['requiredSkill', $_id], ['class', ITEM_CLASS_RECIPE], @@ -83,6 +88,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $recipeItems->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + if ($_ = array_search($_id, $filterRecipe)) + $_ = sprintf(Util::$filterResultString, "?items=9.".$_); + $pageData['relTabs'][] = array( 'file' => 'item', 'data' => $recipeItems->getListviewData(), @@ -90,13 +98,14 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'id' => 'recipe-items', 'name' => '$LANG.tab_recipeitems', 'tabs' => '$tabsRelated', - 'note' => !empty(array_flip($skill2Filter)[$_id]) ? sprintf(Util::$filterResultString, "?items=9.".array_flip($skill2Filter)[$_id]) : null + 'note' => $_ ) ); } - // 3 crafted items [items] - $created = []; + // tab: crafted items [items] + $filterItem = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773]; + $created = []; foreach ($recipes->iterate() as $__) if ($idx = $recipes->canCreateItem()) foreach ($idx as $i) @@ -109,6 +118,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $created->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + if ($_ = array_search($_id, $filterItem)) + $_ = sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=".$_.";crv=0"); + $pageData['relTabs'][] = array( 'file' => 'item', 'data' => $created->getListviewData(), @@ -116,13 +128,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'id' => 'crafted-items', 'name' => '$LANG.tab_crafteditems', 'tabs' => '$tabsRelated', - // 'note' => sprintf(Util::$filterResultString, "?items&filter=cr=86;crs=6;crv=0") // todo (med): after items; [craftedbyProfession (name)] + 'note' => $_ ) ); } } - // 4a required by [item] + // tab: required by [item] $conditions = array( ['requiredSkill', $_id], ['class', ITEM_CLASS_RECIPE, '!'], @@ -134,6 +146,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $reqBy->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + if ($_ = array_search($_id, $filterItem)) + $_ = sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=".$_.":2;crv=0:0"); + $pageData['relTabs'][] = array( 'file' => 'item', 'data' => $reqBy->getListviewData(), @@ -141,12 +156,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'id' => 'required-by', 'name' => '$LANG.tab_requiredby', 'tabs' => '$tabsRelated', - // 'note' => sprintf(Util::$filterResultString, "?items&filter=cr=99:168;crs=6:2;crv=0:0") // todo (med): after items; [requiresProfession (yes), teachesSpell (no)] + 'note' => $_ ) ); } - // 4b required by [itemset] + // tab: required by [itemset] $conditions = array( ['skillId', $_id], 0 @@ -169,7 +184,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // 5 spells [spells] (exclude first tab) + // tab: spells [spells] (exclude first tab) $reqClass = 0x0; $reqRace = 0x0; $condition = array( @@ -223,7 +238,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // 6 trainers [npcs] + // tab: trainers [npcs] if (in_array($_cat, [-5, 6, 7, 8, 9, 11])) { $list = []; @@ -268,7 +283,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // 7 quests [quests] + // tab: quests [quests] if (in_array($_cat, [9, 11])) // only for professions { $sort = 0; @@ -304,7 +319,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // 8 related classes (apply classes from 5) + // tab: related classes (apply classes from [itemset]) $class = []; for ($i = 0; $i < 11; $i++) if ($reqClass & (1 << $i)) @@ -325,7 +340,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - // 9 related races (apply races from 5) + // tab: related races (apply races from [itemset]) $race = []; for ($i = 0; $i < 12; $i++) if ($reqRace & (1 << $i)) @@ -349,19 +364,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->saveCache($cacheKeyPage, $pageData); } -// menuId 14: Skill g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['skill']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_SKILL, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_SKILL, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main)); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('detail-page-generic.tpl'); diff --git a/pages/skills.php b/pages/skills.php index 682a913a..7c54a090 100644 --- a/pages/skills.php +++ b/pages/skills.php @@ -4,11 +4,11 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; +$cat = Util::extractURLParams($pageParam); $path = [0, 14]; $title = [Util::ucFirst(Lang::$game['skills'])]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_SKILL, -1, $cat ? $cat : -1, User::$localeId]); -$validCats = [-6, -5, -4, 6, 8, 9, 10, 11]; +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_SKILL, -1, $cat ? $cat[0] : -1, User::$localeId]); +$validCats = [-6, -5, -4, 6, 7, 8, 9, 10, 11]; if (!Util::isValidPage($validCats, $cat)) $smarty->error(); @@ -18,17 +18,22 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $conditions = [['categoryId', 12, '!']]; // DND if ($cat) { - $conditions[] = ['typeCat', $cat]; - $path[] = $cat; - array_unshift($title, Lang::$skill['cat'][$cat]); + $conditions[] = ['typeCat', $cat[0]]; + $path[] = $cat[0]; + array_unshift($title, Lang::$skill['cat'][$cat[0]]); } $skills = new SkillList($conditions); + // menuId 14: Skill g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $title, - 'path' => $path, - 'listviews' => array( + 'page' => array( + 'title' => implode(' - ', $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0 + ), + 'lv' => array( array( 'file' => 'skill', 'data' => $skills->getListviewData(), @@ -41,15 +46,9 @@ if (!$smarty->loadCache($cacheKey, $pageData)) } -// menuId 14: Skill g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(' - ', $title), - 'path' => json_encode($path, JSON_NUMERIC_CHECK), - 'tab' => 0 -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['lv']); // load the page $smarty->display('list-page-generic.tpl'); diff --git a/pages/spell.php b/pages/spell.php index 313db37c..061e4a15 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -179,7 +179,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($_ = $spell->getField('spellFocusObject')) // spellFocus { $bar = DB::Aowow()->selectRow('SELECT * FROM ?_spellFocusObject WHERE id = ?d', $_); - $focus = new GameObjectList(array(['type', 8], ['data0', $_], 1)); + $focus = new GameObjectList(array(['spellFocusId', $_], 1)); $infobox[] = '[li]'.Lang::$game['requires2'].' '.($focus->error ? Util::localizedString($bar, 'name') : '[url=?object='.$focus->id.']'.Util::localizedString($bar, 'name').'[/url]').'[/li]'; } @@ -399,25 +399,31 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) array_unshift($reagentResult, null); unset($reagentResult[0]); + // menuId 1: Spell g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $spell->getField('name', true), - 'path' => json_encode($_path, JSON_NUMERIC_CHECK), - 'infobox' => $infobox, - 'relTabs' => [], - 'buttons' => array( - BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$_id], - BUTTON_VIEW3D => false, - BUTTON_WOWHEAD => true - ), 'page' => array( + 'title' => $spell->getField('name', true).' - '.Util::ucFirst(Lang::$game['spell']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_SPELL, + 'typeId' => $_id, + 'reqJS' => array( + $pageData['buttons'][BUTTON_VIEW3D] ? 'template/js/swfobject.js' : null + ), + 'redButtons' => array( + BUTTON_LINKS => ['color' => 'ff71d5ff', 'linkId' => Util::$typeStrings[TYPE_SPELL].':'.$_id], + BUTTON_VIEW3D => false, + BUTTON_WOWHEAD => true + ), + 'infobox' => $infobox, 'scaling' => '', 'powerCost' => $spell->createPowerCostForCurrent(), 'castTime' => $spell->createCastTimeForCurrent(false, false), 'tools' => $spell->getToolsForCurrent(), 'reagents' => [$enhanced, $reagentResult], 'name' => $spell->getField('name', true), - 'icon' => $spell->getField('iconString'), - 'stack' => $spell->getField('stackAmount'), + 'headIcons' => [$spell->getField('iconString'), $spell->getField('stackAmount')], 'level' => $spell->getField('spellLevel'), 'rangeName' => $spell->getField('rangeText', true), 'range' => $spell->getField('rangeMaxHostile'), @@ -426,7 +432,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'school' => User::isInGroup(U_GROUP_STAFF) ? sprintf(Util::$dfnString, Util::asHex($spell->getField('schoolMask')), Lang::getMagicSchools($spell->getField('schoolMask'))) : Lang::getMagicSchools($spell->getField('schoolMask')), 'dispel' => Lang::$game['dt'][$spell->getField('dispelType')], 'mechanic' => Lang::$game['me'][$spell->getField('mechanic')], - ) + ), + 'relTabs' => [] ); if ($spell->getField('attributes2') & 0x80000) @@ -706,11 +713,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $foo['name'] .= Lang::$colon.Util::ucFirst(Lang::$game['quest']).' #'.$effMV;; break; case 28: // Summon - case 75: // Summon Totem - case 87: // Summon Totem (slot 1) - case 88: // Summon Totem (slot 2) - case 89: // Summon Totem (slot 3) - case 90: // Summon Totem (slot 4) + case 90: // Kill Credit $_ = Lang::$game['npc'].' #'.$effMV; $summon = new CreatureList(array(['ct.id', $effMV])); if (!$summon->error) @@ -759,18 +762,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; case 50: // Trans Door case 76: // Summon Object (Wild) - case 86: // Activate Object + // case 86: // Activate Object case 104: // Summon Object (slot 1) case 105: // Summon Object (slot 2) case 106: // Summon Object (slot 3) case 107: // Summon Object (slot 4) - // todo (low): create go/modelviewer-data $_ = Util::ucFirst(Lang::$game['gameObject']).' #'.$effMV; - $n = GameObjectList::getName($effMV); // $summon = new GameObjectList(array(['go.id', $effMV])); - if ($n/*!$summon->error*/) + $summon = new GameObjectList(array(['o.id', $effMV])); + if (!$summon->error) { - $_ = '('.$n/*$summon->getField('name', true)*/.')'; - //$pageData['buttons'][BUTTON_VIEW3D] = ['type' => TYPE_NPC, 'displayId' => $summon->getRandomModelId()]; + $_ = '('.$summon->getField('name', true).')'; + $pageData['buttons'][BUTTON_VIEW3D] = ['type' => TYPE_OBJECT, 'displayId' => $summon->getField('displayId')]; } $foo['name'] .= Lang::$colon.$_; @@ -894,7 +896,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) ); if ($st['creatureType'] > 0) - $pageData['infobox'][] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; + $pageData['page']['infobox'][] = '[li]'.Lang::$game['type'].Lang::$colon.Lang::$game['ct'][$st['creatureType']].'[/li]'; if ($_ = Util::localizedString($st, 'name')) $bar = User::isInGroup(U_GROUP_STAFF) ? sprintf(Util::$dfnString, Lang::$spell['_value'].Lang::$colon.$effMV, $_) : $_; @@ -1070,7 +1072,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) unset($foo['value']); } - $pageData['infobox'] = !empty($pageData['infobox']) ? '[ul]'.implode('', $pageData['infobox']).'[/ul]' : null; + $pageData['page']['infobox'] = !empty($pageData['page']['infobox']) ? '[ul]'.implode('', $pageData['page']['infobox']).'[/ul]' : null; unset($foo); // clear reference @@ -1315,6 +1317,30 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $ubItems->addGlobalsToJScript($smarty, GLOBALINFO_SELF); } + // tab: used by - object + $conditions = array( + 'OR', + ['onUseSpell', $spell->id], ['onSuccessSpell', $spell->id], + ['auraSpell', $spell->id], ['triggeredSpell', $spell->id] + ); + + $ubObjects = new GameObjectList($conditions); + if (!$ubObjects->error) + { + $pageData['relTabs'][] = array( + 'file' => 'object', + 'data' => $ubObjects->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'id' => 'used-by-object', + 'name' => '$LANG.tab_usedby' + ] + ); + + $ubObjects->addGlobalsToJScript($smarty); + } + + // tab: criteria of $conditions = array( ['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2, ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL] @@ -1728,22 +1754,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 1: Spell g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title'].' - '.Util::ucFirst(Lang::$game['spell']), - 'path' => $pageData['path'], - 'tab' => 0, - 'type' => TYPE_SPELL, - 'typeId' => $_id, - 'reqJS' => array( - $pageData['buttons'][BUTTON_VIEW3D] ? 'template/js/swfobject.js' : null - ) -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_SPELL, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$spell, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('spell.tpl'); diff --git a/pages/spells.php b/pages/spells.php index 81ae81ec..093833cc 100644 --- a/pages/spells.php +++ b/pages/spells.php @@ -78,363 +78,375 @@ $shortFilter = array( if (!Util::isValidPage($validCats, $cats)) $smarty->error(); -$path = array_merge($path, $cats); - -if (isset($cats)) -{ - if (isset($cats[1])) - array_pop($title); - - $x = @Lang::$spell['cat'][$cats[0]]; - if (is_array($x)) - { - if (is_array($x[0])) - array_unshift($title, $x[0][0]); - else - array_unshift($title, $x[0]); - } - else if ($x !== null) - array_unshift($title, $x); -} - if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { $conditions = []; $visibleCols = []; $hiddenCols = []; - - $pageData = array( - 'page' => [], + $lv = array( + 'file' => 'spell', 'data' => [], - 'title' => '', - 'path' => '', 'params' => [] ); - switch($cats[0]) + // reconstruct path & title + $path = array_merge($path, $cats); + + if ($cats) { - case -2: // Character Talents - $filter['classPanel'] = true; + if (isset($cats[1])) + array_pop($title); - array_push($visibleCols, 'singleclass', 'level', 'schools', 'tier'); + $x = @Lang::$spell['cat'][$cats[0]]; + if (is_array($x)) + { + if (is_array($x[0])) + array_unshift($title, $x[0][0]); + else + array_unshift($title, $x[0]); + } + else if ($x !== null) + array_unshift($title, $x); - $conditions[] = ['s.typeCat', -2]; + switch($cats[0]) + { + case -2: // Character Talents + $filter['classPanel'] = true; - if (isset($cats[1])) - array_unshift($title, Lang::$game['cl'][$cats[1]]); + array_push($visibleCols, 'singleclass', 'level', 'schools', 'tier'); - if (isset($cats[1]) && empty($cats[2])) // i will NOT redefine those class2skillId ... reusing - $conditions[] = ['s.skillLine1', $validCats[-2][$cats[1]]]; - else if (isset($cats[1])) - $conditions[] = ['s.skillLine1', $cats[2]]; + $conditions[] = ['s.typeCat', -2]; - break; - case -3: // Pet Spells - array_push($visibleCols, 'level', 'schools'); + if (isset($cats[1])) + array_unshift($title, Lang::$game['cl'][$cats[1]]); - $conditions[] = ['s.typeCat', -3]; + if (isset($cats[1]) && empty($cats[2])) // i will NOT redefine those class2skillId ... reusing + $conditions[] = ['s.skillLine1', $validCats[-2][$cats[1]]]; + else if (isset($cats[1])) + $conditions[] = ['s.skillLine1', $cats[2]]; - if (isset($cats[1])) - { - $xCond = null; - for ($i = -2; $i < 0; $i++) + break; + case -3: // Pet Spells + array_push($visibleCols, 'level', 'schools'); + + $conditions[] = ['s.typeCat', -3]; + + if (isset($cats[1])) { - foreach (Util::$skillLineMask[$i] as $idx => $pair) + $xCond = null; + for ($i = -2; $i < 0; $i++) { - if ($pair[1] == $cats[1]) + foreach (Util::$skillLineMask[$i] as $idx => $pair) { - $xCond = ['AND', ['s.skillLine1', $i], ['s.skillLine2OrMask', 1 << $idx, '&']]; - break; + if ($pair[1] == $cats[1]) + { + $xCond = ['AND', ['s.skillLine1', $i], ['s.skillLine2OrMask', 1 << $idx, '&']]; + break; + } } } + + $conditions[] = [ + 'OR', + $xCond, + ['s.skillLine1', $cats[1]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[1]]] + ]; + + array_unshift($title, Lang::$spell['cat'][-3][$cats[1]]); + } + else + { + $conditions[] = [ + 'OR', + ['s.skillLine1', [-1, -2]], + ['s.skillLine1', $validCats[-3]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $validCats[-3]]] + ]; + } + + break; + case -4: // Racials + array_push($visibleCols, 'classes'); + + $conditions[] = ['s.typeCat', -4]; + + break; + case -8: // NPC-Spells + case -9: // GM Spells + array_push($visibleCols, 'level'); + case -5: // Mounts + case -6: // Companions + $conditions[] = ['s.typeCat', $cats[0]]; + + break; + case -7: // Pet Talents + array_push($visibleCols, 'level', 'tier'); + + $conditions[] = ['s.typeCat', -7]; + + if (isset($cats[1])) + { + array_unshift($title, Lang::$spell['cat'][-7][$cats[1]]); + + switch($cats[1]) // Spells can be used by multiple specs + { + case 409: // Tenacity + $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&']; + $url = '?pets=1'; + break; + case 410: // Cunning + $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&']; + $url = '?pets=2'; + break; + case 411: // Ferocity + $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; + $url = '?pets=0'; + break; + } + + $lv['params']['note'] = '$$WH.sprintf(LANG.lvnote_pettalents, "'.$url.'")'; + } + + $lv['params']['_petTalents'] = 1; // not conviced, this is correct, but .. it works + + break; + case -11: // Proficiencies ... the subIds are actually SkillLineCategories + if (!isset($cats[1]) || $cats[1] != 10) + array_push($visibleCols, 'classes'); + + $conditions[] = ['s.typeCat', -11]; + + if (isset($cats[1])) + { + if ($cats[1] == 6) // todo (med): we know Weapon(6) includes spell Shoot(3018), that has a mask; but really, ANY proficiency or petSkill should be in that mask so there is no need to differenciate + $conditions[] = ['OR', ['s.skillLine1', SpellList::$skillLines[$cats[1]]], ['s.skillLine1', -3]]; + else + $conditions[] = ['s.skillLine1', SpellList::$skillLines[$cats[1]]]; + + array_unshift($title, Lang::$spell['cat'][-11][$cats[1]]); + } + + break; + case -13: // Glyphs + $filter['classPanel'] = true; + $filter['glyphPanel'] = true; + + array_push($visibleCols, 'singleclass', 'glyphtype'); + + $conditions[] = ['s.typeCat', -13]; + + if (isset($cats[1])) + { + array_unshift($title, Lang::$game['cl'][$cats[1]]); + $conditions[] = ['s.reqClassMask', 1 << ($cats[1] - 1), '&']; + } + + break; + case 7: // Abilities + $filter['classPanel'] = true; + + array_push($visibleCols, 'level', 'singleclass', 'schools'); + + if (isset($cats[1])) + array_unshift($title, Lang::$game['cl'][$cats[1]]); + + $conditions[] = ['s.typeCat', [7, -2]]; + $conditions[] = [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0]; + + // Runeforging listed multiple times, exclude from explicit skill-listing + // if (isset($cats[1]) && $cats[1] == 6 && isset($cats[2]) && $cats[2] != 776) + // $conditions[] = [['s.attributes0', 0x80, '&'], 0]; + // else + // $conditions[] = [ + // [['s.attributes0', 0x80, '&'], 0], // ~SPELL_ATTR0_HIDDEN_CLIENTSIDE + // ['s.attributes0', 0x20, '&'], // SPELL_ATTR0_TRADESPELL (DK: Runeforging) + // 'OR' + // ]; + + if (isset($cats[2])) + { + $conditions[] = [ + 'OR', + ['s.skillLine1', $cats[2]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[2]]] + ]; + + } + else if (isset($cats[1])) + { + $conditions[] = [ + 'OR', + ['s.skillLine1', $validCats[7][$cats[1]]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $validCats[7][$cats[1]]]] + ]; + + } + + break; + case 9: // Secondary Skills + array_push($visibleCols, 'source'); + + $conditions[] = ['s.typeCat', 9]; + + if (isset($cats[1])) + { + array_unshift($title, Lang::$spell['cat'][9][$cats[1]]); + + $conditions[] = [ + 'OR', + ['s.skillLine1', $cats[1]], + ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[1]]] + ]; + + if ($sf = @$shortFilter[$cats[1]]) + { + $txt = ''; + if ($sf[0] && $sf[1]) + $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); + else if ($sf[0]) + $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]); + else if ($sf[1]) + $txt = sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); + + $note = Lang::$spell['cat'][$cats[0]][$cats[1]]; + if (is_array($note)) + $note = $note[0]; + + $lv['params']['note'] = sprintf(Lang::$spell['relItems']['base'], $txt, $note); + $lv['params']['sort'] = "$['skill', 'name']"; + } } - $conditions[] = [ - 'OR', - $xCond, - ['s.skillLine1', $cats[1]], - ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[1]]] - ]; + break; + case 11: // Professions + array_push($visibleCols, 'source'); - array_unshift($title, Lang::$spell['cat'][-3][$cats[1]]); - } - else - { - $conditions[] = [ - 'OR', - ['s.skillLine1', [-1, -2]], - ['s.skillLine1', $validCats[-3]], - ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $validCats[-3]]] - ]; - } + $conditions[] = ['s.typeCat', 11]; - break; - case -4: // Racials - array_push($visibleCols, 'classes'); - - $conditions[] = ['s.typeCat', -4]; - - break; - case -8: // NPC-Spells - case -9: // GM Spells - array_push($visibleCols, 'level'); - case -5: // Mounts - case -6: // Companions - $conditions[] = ['s.typeCat', $cats[0]]; - - break; - case -7: // Pet Talents - array_push($visibleCols, 'level', 'tier'); - - $conditions[] = ['s.typeCat', -7]; - - if (isset($cats[1])) - { - array_unshift($title, Lang::$spell['cat'][-7][$cats[1]]); - - switch($cats[1]) // Spells can be used by multiple specs + if (isset($cats[2])) { - case 409: // Tenacity - $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE1, '&']; - $url = '?pets=1'; - break; - case 410: // Cunning - $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE2, '&']; - $url = '?pets=2'; - break; - case 411: // Ferocity - $conditions[] = ['s.cuFlags', SPELL_CU_PET_TALENT_TYPE0, '&']; - $url = '?pets=0'; - break; + array_unshift($title, Lang::$spell['cat'][11][$cats[1]][$cats[2]]); + + if ($cats[2] == 9787) // general weaponsmithing + $conditions[] = ['s.reqSpellId', [9787, 17039, 17040, 17041]]; + else + $conditions[] = ['s.reqSpellId', $cats[2]]; + } + else if (isset($cats[1])) + { + $x = Lang::$spell['cat'][11][$cats[1]]; + if (is_array($x)) + array_unshift($title, $x[0]); + else + array_unshift($title, $x); + $conditions[] = ['s.skillLine1', $cats[1]]; } - $pageData['params']['note'] = '$$WH.sprintf(LANG.lvnote_pettalents, "'.$url.'")'; - } - - $pageData['params']['_petTalents'] = 1; // not conviced, this is correct, but .. it works - - break; - case -11: // Proficiencies ... the subIds are actually SkillLineCategories - if (!isset($cats[1]) || $cats[1] != 10) - array_push($visibleCols, 'classes'); - - $conditions[] = ['s.typeCat', -11]; - - if (isset($cats[1])) - { - if ($cats[1] == 6) // todo (med): we know Weapon(6) includes spell Shoot(3018), that has a mask; but really, ANY proficiency or petSkill should be in that mask so there is no need to differenciate - $conditions[] = ['OR', ['s.skillLine1', SpellList::$skillLines[$cats[1]]], ['s.skillLine1', -3]]; - else - $conditions[] = ['s.skillLine1', SpellList::$skillLines[$cats[1]]]; - - array_unshift($title, Lang::$spell['cat'][-11][$cats[1]]); - } - - break; - case -13: // Glyphs - $filter['classPanel'] = true; - $filter['glyphPanel'] = true; - - array_push($visibleCols, 'singleclass', 'glyphtype'); - - $conditions[] = ['s.typeCat', -13]; - - if (isset($cats[1])) - { - array_unshift($title, Lang::$game['cl'][$cats[1]]); - $conditions[] = ['s.reqClassMask', 1 << ($cats[1] - 1), '&']; - } - - break; - case 7: // Abilities - $filter['classPanel'] = true; - - array_push($visibleCols, 'level', 'singleclass', 'schools'); - - if (isset($cats[1])) - array_unshift($title, Lang::$game['cl'][$cats[1]]); - - $conditions[] = ['s.typeCat', [7, -2]]; - $conditions[] = [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0]; - - // Runeforging listed multiple times, exclude from explicit skill-listing - // if (isset($cats[1]) && $cats[1] == 6 && isset($cats[2]) && $cats[2] != 776) - // $conditions[] = [['s.attributes0', 0x80, '&'], 0]; - // else - // $conditions[] = [ - // [['s.attributes0', 0x80, '&'], 0], // ~SPELL_ATTR0_HIDDEN_CLIENTSIDE - // ['s.attributes0', 0x20, '&'], // SPELL_ATTR0_TRADESPELL (DK: Runeforging) - // 'OR' - // ]; - - if (isset($cats[2])) - { - $conditions[] = [ - 'OR', - ['s.skillLine1', $cats[2]], - ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[2]]] - ]; - - } - else if (isset($cats[1])) - { - $conditions[] = [ - 'OR', - ['s.skillLine1', $validCats[7][$cats[1]]], - ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $validCats[7][$cats[1]]]] - ]; - - } - - break; - case 9: // Secondary Skills - array_push($visibleCols, 'source'); - - $conditions[] = ['s.typeCat', 9]; - - if (isset($cats[1])) - { - array_unshift($title, Lang::$spell['cat'][9][$cats[1]]); - - $conditions[] = [ - 'OR', - ['s.skillLine1', $cats[1]], - ['AND', ['s.skillLine1', 0, '>'], ['s.skillLine2OrMask', $cats[1]]] - ]; - - if ($sf = @$shortFilter[$cats[1]]) + if (isset($cats[1])) { - $txt = ''; - if ($sf[0] && $sf[1]) - $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); - else if ($sf[0]) - $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]); - else if ($sf[1]) - $txt = sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); + $conditions[] = ['s.skillLine1', $cats[1]]; - $note = Lang::$spell['cat'][$cats[0]][$cats[1]]; - if (is_array($note)) - $note = $note[0]; + if ($sf = @$shortFilter[$cats[1]]) + { + $txt = ''; + if ($sf[0] && $sf[1]) + $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); + else if ($sf[0]) + $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]); + else if ($sf[1]) + $txt = sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); - $pageData['params']['note'] = sprintf(Lang::$spell['relItems']['base'], $txt, $note); - $pageData['params']['sort'] = "$['skill', 'name']"; + $note = Lang::$spell['cat'][$cats[0]][$cats[1]]; + if (is_array($note)) + $note = $note[0]; + + $lv['params']['note'] = sprintf(Lang::$spell['relItems']['base'], $txt, $note); + $lv['params']['sort'] = "$['skill', 'name']"; + } } - } - - break; - case 11: // Professions - array_push($visibleCols, 'source'); - - $conditions[] = ['s.typeCat', 11]; - - if (isset($cats[2])) - { - array_unshift($title, Lang::$spell['cat'][11][$cats[1]][$cats[2]]); - - if ($cats[2] == 9787) // general weaponsmithing - $conditions[] = ['s.reqSpellId', [9787, 17039, 17040, 17041]]; - else - $conditions[] = ['s.reqSpellId', $cats[2]]; - } - else if (isset($cats[1])) - { - $x = Lang::$spell['cat'][11][$cats[1]]; - if (is_array($x)) - array_unshift($title, $x[0]); - else - array_unshift($title, $x); - $conditions[] = ['s.skillLine1', $cats[1]]; - } - - if (isset($cats[1])) - { - $conditions[] = ['s.skillLine1', $cats[1]]; - - if ($sf = @$shortFilter[$cats[1]]) - { - $txt = ''; - if ($sf[0] && $sf[1]) - $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]) . Lang::$spell['relItems']['link'] . sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); - else if ($sf[0]) - $txt = sprintf(Lang::$spell['relItems']['crafted'], $sf[0]); - else if ($sf[1]) - $txt = sprintf(Lang::$spell['relItems']['recipes'], $sf[1]); - - $note = Lang::$spell['cat'][$cats[0]][$cats[1]]; - if (is_array($note)) - $note = $note[0]; - - $pageData['params']['note'] = sprintf(Lang::$spell['relItems']['base'], $txt, $note); - $pageData['params']['sort'] = "$['skill', 'name']"; - } - } - - break; - case 0: // misc. Spells - array_push($visibleCols, 'level'); - - if ($cats[0] !== null) // !any Spell (php loose comparison: (null == 0) is true) - { - $conditions[] = array( - 'OR', - ['s.typeCat', 0], - ['s.cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'] - ); break; - } + case 0: // misc. Spells + array_push($visibleCols, 'level'); + + if ($cats[0] !== null) // !any Spell (php loose comparison: (null == 0) is true) + { + $conditions[] = array( + 'OR', + ['s.typeCat', 0], + ['s.cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'] + ); + + break; + } + } } $spells = new SpellList($conditions, true); - $pageData['data'] = $spells->getListviewData(); - $spells->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); - - // create note if search limit was exceeded; overwriting 'note' is intentional - if ($spells->getMatches() > SQL_LIMIT_DEFAULT) - { - $pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), SQL_LIMIT_DEFAULT); - $pageData['params']['_truncated'] = 1; - } - - if ($spells->filterGetError()) - $pageData['params']['_errors'] = '$1'; - - $mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost']); - - if ($mask & 0x1) - $visibleCols[] = 'reagents'; - if (!($mask & 0x2) && $cats[0] != 9 && $cats[0] != 11) - $hiddenCols[] = 'skill'; - if (($mask & 0x4) || $spells->getField('trainingCost')) - $visibleCols[] = 'trainingcost'; - - if ($visibleCols) - $pageData['params']['visibleCols'] = '$'.json_encode($visibleCols); - - if ($hiddenCols) - $pageData['params']['hiddenCols'] = '$'.json_encode($hiddenCols); + $lv['data'] = $spells->getListviewData(); // recreate form selection $filter = array_merge($spells->filterGetForm('form'), $filter); $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $filter['fi'] = $spells->filterGetForm(); + if (isset($filter['gl']) && !is_array($filter['gl'])) + { + while (count($path) < 4) + $path[] = 0; + + $path[] = $filter['gl']; + } + if (!empty($filter['fi']['extraCols'])) - $pageData['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; + $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; + + // create note if search limit was exceeded; overwriting 'note' is intentional + if ($spells->getMatches() > SQL_LIMIT_DEFAULT) + { + $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_spellsfound', $spells->getMatches(), SQL_LIMIT_DEFAULT); + $lv['params']['_truncated'] = 1; + } + + if ($spells->filterGetError()) + $lv['params']['_errors'] = '$1'; + + $mask = $spells->hasSetFields(['reagent1', 'skillLines', 'trainingCost']); + + if ($mask & 0x1) + $visibleCols[] = 'reagents'; + if (!($mask & 0x2) && $cats && $cats[0] != 9 && $cats[0] != 11) + $hiddenCols[] = 'skill'; + if (($mask & 0x4) || $spells->getField('trainingCost')) + $visibleCols[] = 'trainingcost'; + + if ($visibleCols) + $lv['params']['visibleCols'] = '$'.json_encode($visibleCols); + + if ($hiddenCols) + $lv['params']['hiddenCols'] = '$'.json_encode($hiddenCols); + + // menuId 1: Spell g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'subCat' => $pageParam !== null ? '='.$pageParam : '', + 'reqJS' => array( + 'template/js/filters.js' + ) + ), + 'lv' => $lv + ); $smarty->saveCache($cacheKey, $pageData, $filter); } -if (isset($filter['gl']) && !is_array($filter['gl'])) -{ - while (count($path) < 4) - $path[] = 0; - - $path[] = $filter['gl']; -} - // sort for dropdown-menus asort(Lang::$game['ra']); @@ -442,20 +454,10 @@ asort(Lang::$game['cl']); asort(Lang::$game['sc']); asort(Lang::$game['me']); -// menuId 1: Spell g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]", - 'tab' => 0, - 'subCat' => $pageParam !== null ? '='.$pageParam : '', - 'reqJS' => array( - 'template/js/filters.js' - ) -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('filter', $filter); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['lv']); // load the page $smarty->display('spells.tpl'); diff --git a/search.php b/search.php index d42625d4..8c5f182e 100644 --- a/search.php +++ b/search.php @@ -19,31 +19,8 @@ if (!defined('AOWOW_REVISION')) str[10][4] // type, typeId, param1 (4:quality, 3,6,9,10,17:icon, 5:faction), param2 (3:quality, 6:rank) ] else - 1: Listview - template: 'classs', id: 'classes', name: LANG.tab_classes, - 2: Listview - template: 'race', id: 'races', name: LANG.tab_races, - 3: Listview - template: 'title', id: 'titles', name: LANG.tab_titles, - 4: Listview - template: 'holiday', id: 'holidays', name: LANG.tab_holidays, - 5: Listview - template: 'currency', id: 'currencies', name: LANG.tab_currencies, - 6: Listview - template: 'itemset', id: 'itemsets', name: LANG.tab_itemsets, - 7: Listview - template: 'item', id: 'items', name: LANG.tab_items, - 8: Listview - template: 'spell', id: 'abilities', name: LANG.tab_abilities, - 9: Listview - template: 'spell', id: 'talents', name: LANG.tab_talents, - 10: Listview - template: 'spell', id: 'glyphs', name: LANG.tab_glyphs, - 11: Listview - template: 'spell', id: 'proficiencies', name: LANG.tab_proficiencies, - 12: Listview - template: 'spell', id: 'professions', name: LANG.tab_professions, - 13: Listview - template: 'spell', id: 'companions', name: LANG.tab_companions, - 14: Listview - template: 'spell', id: 'mounts', name: LANG.tab_mounts, - 15: Listview - template: 'npc', id: 'npcs', name: LANG.tab_npcs, - 16: Listview - template: 'quest', id: 'quests', name: LANG.tab_quests, - 17: Listview - template: 'achievement', id: 'achievements', name: LANG.tab_achievements, - 18: Listview - template: 'achievement', id: 'statistics', name: LANG.tab_statistics, - 19: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones, - 20: Listview - template: 'object', id: 'objects', name: LANG.tab_objects, - 21: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions, - 22: Listview - template: 'skill', id: 'skills', name: LANG.tab_skills, - 23: Listview - template: 'pet', id: 'pets', name: LANG.tab_pets, - 24: Listview - template: 'spell', id: 'npc-abilities', name: LANG.tab_npcabilities, - 25: Listview - template: 'spell', id: 'spells', name: LANG.tab_uncategorizedspells, + => listviews + todo 26: Listview - template: 'profile', id: 'characters', name: LANG.tab_characters, visibleCols: ['race','classs','level','talents','gearscore','achievementpoints'], 27: Profiles..? 28: Guilds..? @@ -55,7 +32,7 @@ $query = Util::sqlEscape(str_replace('?', '_', str_replace('*', '%', ($sear $type = @intVal($_GET['type']); $searchMask = 0x0; $found = []; -$jsGlobals = []; +$cndBase = ['AND']; $maxResults = SQL_LIMIT_SEARCH; $_wt = isset($_GET['wt']) ? explode(':', $_GET['wt']) : null; @@ -73,12 +50,17 @@ if (isset($_GET['json'])) } else if (isset($_GET['opensearch'])) { - $maxResults = 10; + $maxResults = SQL_LIMIT_QUCKSEARCH; $searchMask |= SEARCH_TYPE_OPEN | SEARCH_MASK_OPEN; } else $searchMask |= SEARCH_TYPE_REGULAR | SEARCH_MASK_ALL; +$cndBase[] = $maxResults; + +// Exclude internal wow stuff +if (!User::isInGroup(U_GROUP_STAFF)) + $cndBase[] = [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0]; $cacheKey = implode('_', [CACHETYPE_SEARCH, $searchMask, sha1($query), User::$localeId]); @@ -111,952 +93,946 @@ if ((strlen($query) < 3 || !($searchMask & SEARCH_MASK_ALL)) && !($searchMask & } } -// 1 Classes: -if ($searchMask & 0x1) +if (!$smarty->loadCache($cacheKey, $found)) { - $classes = new CharClassList(array(['name_loc'.User::$localeId, $query], $maxResults)); - - if ($data = $classes->getListviewData()) + // 1 Classes: + if ($searchMask & 0x00000001) { - foreach ($classes->iterate() as $__) - $data[$classes->id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"'; + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - $found['class'] = array( - 'type' => TYPE_CLASS, - 'appendix' => ' (Class)', - 'matches' => $classes->getMatches(), - 'file' => 'class', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] + $classes = new CharClassList($cnd); + + if ($data = $classes->getListviewData()) + { + foreach ($classes->iterate() as $__) + $data[$classes->id]['param1'] = '"class_'.strToLower($classes->getField('fileString')).'"'; + + $found['class'] = array( + 'type' => TYPE_CLASS, + 'appendix' => ' (Class)', + 'matches' => $classes->getMatches(), + 'file' => CharClassList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($classes->getMatches() > $maxResults) + { + // $found['class']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $classes->getMatches(), $maxResults); + $found['class']['params']['_truncated'] = 1; + } + } + } + + // 2 Races: + if ($searchMask & 0x00000002) + { + /* custom data :( + faction: dbc-data is internal -> doesn't work how to link to displayable faction..? + leader: 29611 for human .. DAFUQ?! + zone: starting zone... + */ + + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); + + $races = new CharRaceList($cnd); + + if ($data = $races->getListviewData()) + { + foreach ($races->iterate() as $__) + $data[$races->id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"'; + + $found['race'] = array( + 'type' => TYPE_RACE, + 'appendix' => ' (Race)', + 'matches' => $races->getMatches(), + 'file' => CharRaceList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($races->getMatches() > $maxResults) + { + // $found['race']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $races->getMatches(), $maxResults); + $found['race']['params']['_truncated'] = 1; + } + } + } + + // 3 Titles: + if ($searchMask & 0x00000004) + { + /* custom data :( + category:1, // custom data .. FU! + expansion:0, // custom data .. FU FU! + gender:3, // again.. luckiely 136; 137 only + side:2, // hmm, derive from source..? + source: {} // g_sources .. holy cow.. that will cost some nerves + */ + + $sources = array( + 4 => [], // Quest + 12 => [], // Achievement + 13 => [] // DB-Text ); - if ($classes->getMatches() > $maxResults) - { - // $found['class']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $classes->getMatches(), $maxResults); - $found['class']['params']['_truncated'] = 1; - } - } -} - -// 2 Races: -if ($searchMask & 0x2) -{ - /* custom data :( - faction: dbc-data is internal -> doesn't work how to link to displayable faction..? - leader: 29611 for human .. DAFUQ?! - zone: starting zone... - */ - - $races = new CharRaceList(array(['name_loc'.User::$localeId, $query], $maxResults)); - - if ($data = $races->getListviewData()) - { - foreach ($races->iterate() as $__) - $data[$races->id]['param1'] = '"race_'.strToLower($races->getField('fileString')).'_male"'; - - $found['race'] = array( - 'type' => TYPE_RACE, - 'appendix' => ' (Race)', - 'matches' => $races->getMatches(), - 'file' => 'race', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - - if ($races->getMatches() > $maxResults) - { - // $found['race']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $races->getMatches(), $maxResults); - $found['race']['params']['_truncated'] = 1; - } - } -} - -// 3 Titles: -if ($searchMask & 0x4) -{ - /* custom data :( - category:1, // custom data .. FU! - expansion:0, // custom data .. FU FU! - gender:3, // again.. luckiely 136; 137 only - side:2, // hmm, derive from source..? - source: {} // g_sources .. holy cow.. that will cost some nerves - */ - - $sources = array( - 4 => [], // Quest - 12 => [], // Achievement - 13 => [] // DB-Text - ); - - $conditions = array( - 'OR', - ['male_loc'.User::$localeId, $query], - ['female_loc'.User::$localeId, $query], - $maxResults - ); - - $titles = new TitleList($conditions); - - if ($data = $titles->getListviewData()) - { - $found['title'] = array( - 'type' => TYPE_TITLE, - 'appendix' => ' (Title)', - 'matches' => $titles->getMatches(), - 'file' => 'title', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - - if ($titles->getMatches() > $maxResults) - { - // $found['title']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $titles->getMatches(), $maxResults); - $found['title']['params']['_truncated'] = 1; - } - } -} - -// 4 World Events: -if ($searchMask & 0x8) -{ - /* custom data :( - icons: data/interface/calendar/calendar_[a-z]start.blp - */ - - $conditions = array( - 'OR', - ['h.name_loc'.User::$localeId, $query], - ['AND', ['e.description', $query], ['e.holidayId', 0]], - $maxResults - ); - - $wEvents = new WorldEventList($conditions); - - if ($data = $wEvents->getListviewData()) - { - $wEvents->addGlobalsToJscript($smarty); - - foreach ($data as &$d) - { - $updated = WorldEventList::updateDates($d); - unset($d['_date']); - $d['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false; - $d['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false; - $d['rec'] = $updated['rec']; - } - - $found['event'] = array( - 'type' => TYPE_WORLDEVENT, - 'appendix' => ' (World Event)', - 'matches' => $wEvents->getMatches(), - 'file' => 'event', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - - if ($wEvents->getMatches() > $maxResults) - { - // $found['event']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $wEvents->getMatches(), $maxResults); - $found['event']['params']['_truncated'] = 1; - } - } -} - -// 5 Currencies -if ($searchMask & 0x10) -{ - $money = new CurrencyList(array($maxResults, ['name_loc'.User::$localeId, $query])); - - if ($data = $money->getListviewData()) - { - foreach ($money->iterate() as $__) - $data[$money->id]['param1'] = '"'.strToLower($money->getField('iconString')).'"'; - - $found['currency'] = array( - 'type' => TYPE_CURRENCY, - 'appendix' => ' (Currency)', - 'matches' => $money->getMatches(), - 'file' => 'currency', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - - if ($money->getMatches() > $maxResults) - { - $found['currency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_currenciesfound', $money->getMatches(), $maxResults); - $found['currency']['params']['_truncated'] = 1; - } - } -} - -// 6 Itemsets -if ($searchMask & 0x20) -{ - $conditions = array( - ['item1', 0, '!'], // remove empty sets from search - is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query], - $maxResults - ); - - $sets = new ItemsetList($conditions); - - if ($data = $sets->getListviewData()) - { - $sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - - foreach ($sets->iterate() as $__) - $data[$sets->id]['param1'] = $sets->getField('quality'); - - $found['itemset'] = array( - 'type' => TYPE_ITEMSET, - 'appendix' => ' (Item Set)', - 'matches' => $sets->getMatches(), - 'file' => 'itemset', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'], - 'pcsToSet' => $sets->pieceToSet - ); - - if ($sets->getMatches() > $maxResults) - { - $found['itemset']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $maxResults); - $found['itemset']['params']['_truncated'] = 1; - } - } -} - -// 7 Items -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'])) - { - $conditions = [['i.id', array_keys($found['itemset']['pcsToSet'])], SQL_LIMIT_NONE]; - $miscData = ['pcsToSet' => @$found['itemset']['pcsToSet']]; - } - else if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEM) - { - $conditions = [['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], $cnd, SQL_LIMIT_DEFAULT]; - $miscData = ['wt' => $_wt, 'wtv' => $_wtv]; - } - else - $conditions = [$cnd, $maxResults]; - - $items = new ItemList($conditions, false, $miscData); - - if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0)) - { - $items->addGlobalsToJscript($smarty); - - foreach ($items->iterate() as $__) - { - $data[$items->id]['param1'] = '"'.$items->getField('iconString').'"'; - $data[$items->id]['param2'] = $items->getField('quality'); - - if ($searchMask & SEARCH_TYPE_OPEN) - $data[$items->id]['name'] = substr($data[$items->id]['name'], 1); - } - - $found['item'] = array( - 'type' => TYPE_ITEM, - 'appendix' => ' (Item)', - 'matches' => $items->getMatches(), - 'file' => 'item', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - - if ($items->getMatches() > $maxResults) - { - $found['item']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $maxResults); - $found['item']['params']['_truncated'] = 1; - } - } -} - -// 8 Abilities (Player + Pet) -if ($searchMask & 0x80) -{ - $conditions = array( // hmm, inclued classMounts..? - ['s.typeCat', [7, -2, -3]], - [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0], - [['s.attributes0', 0x80, '&'], 0], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $abilities = new SpellList($conditions); - - if ($data = $abilities->getListviewData()) - { - $abilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); - - $vis = ['level', 'singleclass', 'schools']; - if ($abilities->hasSetFields(['reagent1'])) - $vis[] = 'reagents'; - - foreach ($abilities->iterate() as $__) - { - $data[$abilities->id]['param1'] = '"'.strToLower($abilities->getField('iconString')).'"'; - $data[$abilities->id]['param2'] = '"'.$abilities->ranks[$abilities->id].'"'; - } - - $found['ability'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Ability)', - 'matches' => $abilities->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'abilities', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_abilities', - 'visibleCols' => '$'.json_encode($vis) - ] - ); - - if ($abilities->getMatches() > $maxResults) - { - $found['ability']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_abilitiesfound', $abilities->getMatches(), $maxResults); - $found['ability']['params']['_truncated'] = 1; - } - } -} - -// 9 Talents (Player + Pet) -if ($searchMask & 0x100) -{ - $conditions = array( - ['s.typeCat', [-7, -2]], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $talents = new SpellList($conditions); - - if ($data = $talents->getListviewData()) - { - $talents->addGlobalsToJscript($smarty); - - $vis = ['level', 'singleclass', 'schools']; - if ($abilities->hasSetFields(['reagent1'])) - $vis[] = 'reagents'; - - foreach ($talents->iterate() as $__) - { - $data[$talents->id]['param1'] = '"'.strToLower($talents->getField('iconString')).'"'; - $data[$talents->id]['param2'] = '"'.$talents->ranks[$talents->id].'"'; - } - - $found['talent'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Talent)', - 'matches' => $talents->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'talents', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_talents', - 'visibleCols' => '$'.json_encode($vis) - ] - ); - - if ($talents->getMatches() > $maxResults) - { - $found['talent']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_talentsfound', $talents->getMatches(), $maxResults); - $found['talent']['params']['_truncated'] = 1; - } - } -} - -// 10 Glyphs -if ($searchMask & 0x200) -{ - $conditions = array( - ['s.typeCat', -13], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $glyphs = new SpellList($conditions); - - if ($data = $glyphs->getListviewData()) - { - $glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - - foreach ($glyphs->iterate() as $__) - $data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"'; - - $found['glyph'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Glyph)', - 'matches' => $glyphs->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'glyphs', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_glyphs', - 'visibleCols' => "$['singleclass', 'glyphtype']" - ] - ); - - if ($glyphs->getMatches() > $maxResults) - { - $found['glyph']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_glyphsfound', $glyphs->getMatches(), $maxResults); - $found['glyph']['params']['_truncated'] = 1; - } - } -} - -// 11 Proficiencies -if ($searchMask & 0x400) -{ - $conditions = array( - ['s.typeCat', -11], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $prof = new SpellList($conditions); - - if ($data = $prof->getListviewData()) - { - $prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - - foreach ($prof->iterate() as $__) - $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; - - $found['proficiency'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Proficiency)', - 'matches' => $prof->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'proficiencies', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_proficiencies', - 'visibleCols' => "$['classes']" - ] - ); - - if ($prof->getMatches() > $maxResults) - { - $found['proficiency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $prof->getMatches(), $maxResults); - $found['proficiency']['params']['_truncated'] = 1; - } - } -} - -// 12 Professions (Primary + Secondary) -if ($searchMask & 0x800) -{ - $conditions = array( - ['s.typeCat', [9, 11]], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $prof = new SpellList($conditions); - - if ($data = $prof->getListviewData()) - { - $prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); - - foreach ($prof->iterate() as $__) - $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; - - $found['profession'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Profession)', - 'matches' => $prof->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'professions', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_professions', - 'visibleCols' => "$['source', 'reagents']" - ] - ); - - if ($prof->getMatches() > $maxResults) - { - $found['profession']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_professionfound', $prof->getMatches(), $maxResults); - $found['profession']['params']['_truncated'] = 1; - } - } -} - -// 13 Companions -if ($searchMask & 0x1000) -{ - - $conditions = array( - ['s.typeCat', -6], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $vPets = new SpellList($conditions); - - if ($data = $vPets->getListviewData()) - { - $vPets->addGlobalsToJscript($smarty); - - foreach ($vPets->iterate() as $__) - $data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"'; - - $found['companion'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Companion)', - 'matches' => $vPets->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'companions', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_companions', - 'visibleCols' => "$['reagents']" - ] - ); - - if ($vPets->getMatches() > $maxResults) - { - $found['companion']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_companionsfound', $vPets->getMatches(), $maxResults); - $found['companion']['params']['_truncated'] = 1; - } - } -} - -// 14 Mounts -if ($searchMask & 0x2000) -{ - $conditions = array( - ['s.typeCat', -5], - ['s.name_loc'.User::$localeId, $query], - $maxResults - ); - - $mounts = new SpellList($conditions); - - if ($data = $mounts->getListviewData()) - { - $mounts->addGlobalsToJscript($smarty, GLOBALINFO_SELF); - - foreach ($mounts->iterate() as $__) - $data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"'; - - $found['mount'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Mount)', - 'matches' => $mounts->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'mounts', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_mounts', - ] - ); - - if ($mounts->getMatches() > $maxResults) - { - $found['mount']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_mountsfound', $mounts->getMatches(), $maxResults); - $found['mount']['params']['_truncated'] = 1; - } - } -} - -// 15 NPCs -if ($searchMask & 0x4000) -{ - $conditions = array( - [ + $cnd = array_merge($cndBase, array( 'OR', - ['name_loc'.User::$localeId, $query] - ], + ['male_loc'.User::$localeId, $query], + ['female_loc'.User::$localeId, $query] + )); + + $titles = new TitleList($cnd); + + if ($data = $titles->getListviewData()) + { + $found['title'] = array( + 'type' => TYPE_TITLE, + 'appendix' => ' (Title)', + 'matches' => $titles->getMatches(), + 'file' => TitleList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($titles->getMatches() > $maxResults) + { + // $found['title']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $titles->getMatches(), $maxResults); + $found['title']['params']['_truncated'] = 1; + } + } + } + + // 4 World Events: + if ($searchMask & 0x00000008) + { + /* custom data :( + icons: data/interface/calendar/calendar_[a-z]start.blp + */ + + $cnd = array_merge($cndBase, array( + 'OR', + ['h.name_loc'.User::$localeId, $query], + ['AND', ['e.description', $query], ['e.holidayId', 0]] + )); + + $wEvents = new WorldEventList($cnd); + + if ($data = $wEvents->getListviewData()) + { + $wEvents->addGlobalsToJscript($smarty); + + foreach ($data as &$d) + { + $updated = WorldEventList::updateDates($d); + unset($d['_date']); + $d['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false; + $d['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false; + $d['rec'] = $updated['rec']; + } + + $found['event'] = array( + 'type' => TYPE_WORLDEVENT, + 'appendix' => ' (World Event)', + 'matches' => $wEvents->getMatches(), + 'file' => WorldEventList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($wEvents->getMatches() > $maxResults) + { + // $found['event']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_', $wEvents->getMatches(), $maxResults); + $found['event']['params']['_truncated'] = 1; + } + } + } + + // 5 Currencies + if ($searchMask & 0x0000010) + { + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); + + $money = new CurrencyList($cnd); + + if ($data = $money->getListviewData()) + { + foreach ($money->iterate() as $__) + $data[$money->id]['param1'] = '"'.strToLower($money->getField('iconString')).'"'; + + $found['currency'] = array( + 'type' => TYPE_CURRENCY, + 'appendix' => ' (Currency)', + 'matches' => $money->getMatches(), + 'file' => CurrencyList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($money->getMatches() > $maxResults) + { + $found['currency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_currenciesfound', $money->getMatches(), $maxResults); + $found['currency']['params']['_truncated'] = 1; + } + } + } + + // 6 Itemsets + if ($searchMask & 0x0000020) + { + // ['item1', 0, '!'], // remove empty sets from search, set in cuFlags + $cnd = array_merge($cndBase, is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query]); + + $sets = new ItemsetList($cnd); + + if ($data = $sets->getListviewData()) + { + $sets->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($sets->iterate() as $__) + $data[$sets->id]['param1'] = $sets->getField('quality'); + + $found['itemset'] = array( + 'type' => TYPE_ITEMSET, + 'appendix' => ' (Item Set)', + 'matches' => $sets->getMatches(), + 'file' => ItemsetList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'], + 'pcsToSet' => $sets->pieceToSet + ); + + if ($sets->getMatches() > $maxResults) + { + $found['itemset']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsetsfound', $sets->getMatches(), $maxResults); + $found['itemset']['params']['_truncated'] = 1; + } + } + } + + // 7 Items + if ($searchMask & 0x0000040) + { + $miscData = []; + $cndAdd = is_int($query) ? ['id', $query] : ['name_loc'.User::$localeId, $query]; + + if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEMSET && isset($found['itemset'])) + { + $cnd = [['i.id', array_keys($found['itemset']['pcsToSet'])], SQL_LIMIT_NONE]; + $miscData = ['pcsToSet' => @$found['itemset']['pcsToSet']]; + } + else if (($searchMask & SEARCH_TYPE_JSON) && $type == TYPE_ITEM) + { + $cnd = array_merge($cndBase, [['AND', ['i.class', [ITEM_CLASS_WEAPON, ITEM_CLASS_GEM, ITEM_CLASS_ARMOR]], $cndAdd]]); + $miscData = ['wt' => $_wt, 'wtv' => $_wtv]; + } + else + $cnd = array_merge($cndBase, [$cndAdd]); + + $items = new ItemList($cnd, false, $miscData); + + if ($data = $items->getListviewData($searchMask & SEARCH_TYPE_JSON ? (ITEMINFO_SUBITEMS | ITEMINFO_JSON) : 0)) + { + $items->addGlobalsToJscript($smarty); + + foreach ($items->iterate() as $__) + { + $data[$items->id]['param1'] = '"'.$items->getField('iconString').'"'; + $data[$items->id]['param2'] = $items->getField('quality'); + + if ($searchMask & SEARCH_TYPE_OPEN) + $data[$items->id]['name'] = substr($data[$items->id]['name'], 1); + } + + $found['item'] = array( + 'type' => TYPE_ITEM, + 'appendix' => ' (Item)', + 'matches' => $items->getMatches(), + 'file' => ItemList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($items->getMatches() > $maxResults) + { + $found['item']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_itemsfound', $items->getMatches(), $maxResults); + $found['item']['params']['_truncated'] = 1; + } + } + } + + // 8 Abilities (Player + Pet) + if ($searchMask & 0x0000080) + { + $cnd = array_merge($cndBase, array( // hmm, inclued classMounts..? + 'AND', + ['s.typeCat', [7, -2, -3]], + [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT), '&'], 0], + [['s.attributes0', 0x80, '&'], 0], + ['s.name_loc'.User::$localeId, $query] + )); + + $abilities = new SpellList($cnd); + + if ($data = $abilities->getListviewData()) + { + $abilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + $vis = ['level', 'singleclass', 'schools']; + if ($abilities->hasSetFields(['reagent1'])) + $vis[] = 'reagents'; + + foreach ($abilities->iterate() as $__) + { + $data[$abilities->id]['param1'] = '"'.strToLower($abilities->getField('iconString')).'"'; + $data[$abilities->id]['param2'] = '"'.$abilities->ranks[$abilities->id].'"'; + } + + $found['ability'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Ability)', + 'matches' => $abilities->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'abilities', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_abilities', + 'visibleCols' => '$'.json_encode($vis) + ] + ); + + if ($abilities->getMatches() > $maxResults) + { + $found['ability']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_abilitiesfound', $abilities->getMatches(), $maxResults); + $found['ability']['params']['_truncated'] = 1; + } + } + } + + // 9 Talents (Player + Pet) + if ($searchMask & 0x0000100) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', [-7, -2]], + ['s.name_loc'.User::$localeId, $query] + )); + + $talents = new SpellList($cnd); + + if ($data = $talents->getListviewData()) + { + $talents->addGlobalsToJscript($smarty); + + $vis = ['level', 'singleclass', 'schools']; + if ($abilities->hasSetFields(['reagent1'])) + $vis[] = 'reagents'; + + foreach ($talents->iterate() as $__) + { + $data[$talents->id]['param1'] = '"'.strToLower($talents->getField('iconString')).'"'; + $data[$talents->id]['param2'] = '"'.$talents->ranks[$talents->id].'"'; + } + + $found['talent'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Talent)', + 'matches' => $talents->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'talents', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_talents', + 'visibleCols' => '$'.json_encode($vis) + ] + ); + + if ($talents->getMatches() > $maxResults) + { + $found['talent']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_talentsfound', $talents->getMatches(), $maxResults); + $found['talent']['params']['_truncated'] = 1; + } + } + } + + // 10 Glyphs + if ($searchMask & 0x0000200) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', -13], + ['s.name_loc'.User::$localeId, $query] + )); + + $glyphs = new SpellList($cnd); + + if ($data = $glyphs->getListviewData()) + { + $glyphs->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($glyphs->iterate() as $__) + $data[$glyphs->id]['param1'] = '"'.strToLower($glyphs->getField('iconString')).'"'; + + $found['glyph'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Glyph)', + 'matches' => $glyphs->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'glyphs', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_glyphs', + 'visibleCols' => "$['singleclass', 'glyphtype']" + ] + ); + + if ($glyphs->getMatches() > $maxResults) + { + $found['glyph']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_glyphsfound', $glyphs->getMatches(), $maxResults); + $found['glyph']['params']['_truncated'] = 1; + } + } + } + + // 11 Proficiencies + if ($searchMask & 0x0000400) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', -11], + ['s.name_loc'.User::$localeId, $query] + )); + + $prof = new SpellList($cnd); + + if ($data = $prof->getListviewData()) + { + $prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($prof->iterate() as $__) + $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; + + $found['proficiency'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Proficiency)', + 'matches' => $prof->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'proficiencies', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_proficiencies', + 'visibleCols' => "$['classes']" + ] + ); + + if ($prof->getMatches() > $maxResults) + { + $found['proficiency']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $prof->getMatches(), $maxResults); + $found['proficiency']['params']['_truncated'] = 1; + } + } + } + + // 12 Professions (Primary + Secondary) + if ($searchMask & 0x0000800) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', [9, 11]], + ['s.name_loc'.User::$localeId, $query] + )); + + $prof = new SpellList($cnd); + + if ($data = $prof->getListviewData()) + { + $prof->addGlobalsToJscript($smarty, GLOBALINFO_SELF | GLOBALINFO_RELATED); + + foreach ($prof->iterate() as $__) + $data[$prof->id]['param1'] = '"'.strToLower($prof->getField('iconString')).'"'; + + $found['profession'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Profession)', + 'matches' => $prof->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'professions', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_professions', + 'visibleCols' => "$['source', 'reagents']" + ] + ); + + if ($prof->getMatches() > $maxResults) + { + $found['profession']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_professionfound', $prof->getMatches(), $maxResults); + $found['profession']['params']['_truncated'] = 1; + } + } + } + + // 13 Companions + if ($searchMask & 0x0001000) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', -6], + ['s.name_loc'.User::$localeId, $query] + )); + + $vPets = new SpellList($cnd); + + if ($data = $vPets->getListviewData()) + { + $vPets->addGlobalsToJscript($smarty); + + foreach ($vPets->iterate() as $__) + $data[$vPets->id]['param1'] = '"'.strToLower($vPets->getField('iconString')).'"'; + + $found['companion'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Companion)', + 'matches' => $vPets->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'companions', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_companions', + 'visibleCols' => "$['reagents']" + ] + ); + + if ($vPets->getMatches() > $maxResults) + { + $found['companion']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_companionsfound', $vPets->getMatches(), $maxResults); + $found['companion']['params']['_truncated'] = 1; + } + } + } + + // 14 Mounts + if ($searchMask & 0x0002000) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.typeCat', -5], + ['s.name_loc'.User::$localeId, $query] + )); + + $mounts = new SpellList($cnd); + + if ($data = $mounts->getListviewData()) + { + $mounts->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($mounts->iterate() as $__) + $data[$mounts->id]['param1'] = '"'.strToLower($mounts->getField('iconString')).'"'; + + $found['mount'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Mount)', + 'matches' => $mounts->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'mounts', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_mounts', + ] + ); + + if ($mounts->getMatches() > $maxResults) + { + $found['mount']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_mountsfound', $mounts->getMatches(), $maxResults); + $found['mount']['params']['_truncated'] = 1; + } + } + } + + // 15 NPCs + if ($searchMask & 0x0004000) + { // [['cuFlags', MASKE, '&'], 0], // todo (med): exclude trigger creatures and difficulty entries - $maxResults - ); + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - $npcs = new CreatureList($conditions); + $npcs = new CreatureList($cnd); - if ($data = $npcs->getListviewData()) - { - $found['npc'] = array( - 'type' => TYPE_NPC, - 'appendix' => ' (NPC)', - 'matches' => $npcs->getMatches(), - 'file' => 'creature', - 'data' => $data, - 'params' => [ - 'id' => 'npcs', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_npcs', - ] - ); - - if ($npcs->getMatches() > $maxResults) + if ($data = $npcs->getListviewData()) { - $found['npc']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), $maxResults); - $found['npc']['params']['_truncated'] = 1; + $found['npc'] = array( + 'type' => TYPE_NPC, + 'appendix' => ' (NPC)', + 'matches' => $npcs->getMatches(), + 'file' => CreatureList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'npcs', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_npcs', + ] + ); + + if ($npcs->getMatches() > $maxResults) + { + $found['npc']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), $maxResults); + $found['npc']['params']['_truncated'] = 1; + } } } -} -// 16 Quests -if ($searchMask & 0x8000) -{ - $conditions = array( -// [['cuFlags', MASK, '&'], 0], // todo (med): identify disabled quests - [User::$localeId ? 'lq.Title_loc'.User::$localeId : 'Title', $query], // todo (high): unify name-fields - $maxResults - ); - - $quests = new QuestList($conditions); - - if ($data = $quests->getListviewData()) + // 16 Quests + if ($searchMask & 0x0008000) { - $quests->addGlobalsToJScript($smarty); - - $found['quest'] = array( - 'type' => TYPE_QUEST, - 'appendix' => ' (Quest)', - 'matches' => $quests->getMatches(), - 'file' => 'quest', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); - } - - if ($quests->getMatches() > $maxResults) - { - $found['quest']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_questsfound', $quests->getMatches(), $maxResults); - $found['quest']['params']['_truncated'] = 1; - } -} - -// 17 Achievements -if ($searchMask & 0x10000) -{ - $conditions = array( - [['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0], - ['name_loc'.User::$localeId, $query], - $maxResults - ); - - $acvs = new AchievementList($conditions); - - if ($data = $acvs->getListviewData()) - { - $acvs->addGlobalsToJScript($smarty); - - foreach ($acvs->iterate() as $__) - $data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"'; - - $found['achievement'] = array( - 'type' => TYPE_ACHIEVEMENT, - 'appendix' => ' (Achievement)', - 'matches' => $acvs->getMatches(), - 'file' => 'achievement', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs', - 'visibleCols' => "$['category']" - ] + // [['cuFlags', MASK, '&'], 0], // todo (med): identify disabled quests + // use defined $conditions array when using own table + $cnd = array( + [User::$localeId ? 'lq.Title_loc'.User::$localeId : 'Title', $query], + $maxResults ); - if ($acvs->getMatches() > $maxResults) + $quests = new QuestList($cnd); + + if ($data = $quests->getListviewData()) { - $found['achievement']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_achievementsfound', $acvs->getMatches(), $maxResults); - $found['achievement']['params']['_truncated'] = 1; + $quests->addGlobalsToJScript($smarty); + + $found['quest'] = array( + 'type' => TYPE_QUEST, + 'appendix' => ' (Quest)', + 'matches' => $quests->getMatches(), + 'file' => QuestList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + } + + if ($quests->getMatches() > $maxResults) + { + $found['quest']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_questsfound', $quests->getMatches(), $maxResults); + $found['quest']['params']['_truncated'] = 1; } } -} -// 18 Statistics -if ($searchMask & 0x20000) -{ - $conditions = array( - ['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], - ['name_loc'.User::$localeId, $query], - $maxResults - ); - - $stats = new AchievementList($conditions); - - if ($data = $stats->getListviewData()) + // 17 Achievements + if ($searchMask & 0x0010000) { - $stats->addGlobalsToJScript($smarty, GLOBALINFO_SELF); + $cnd = array_merge($cndBase, array( + 'AND', + [['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], 0], + ['name_loc'.User::$localeId, $query] + )); - $found['statistic'] = array( - 'type' => TYPE_ACHIEVEMENT, - 'matches' => $stats->getMatches(), - 'file' => 'achievement', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs', - 'visibleCols' => "$['category']", - 'hiddenCols' => "$['side', 'points', 'rewards']", - 'name' => '$LANG.tab_statistics', - 'id' => 'statistics' - ] - ); + $acvs = new AchievementList($cnd); - if ($stats->getMatches() > $maxResults) + if ($data = $acvs->getListviewData()) { - $found['statistic']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_statisticsfound', $stats->getMatches(), $maxResults); - $found['statistic']['params']['_truncated'] = 1; + $acvs->addGlobalsToJScript($smarty); + + foreach ($acvs->iterate() as $__) + $data[$acvs->id]['param1'] = '"'.strToLower($acvs->getField('iconString')).'"'; + + $found['achievement'] = array( + 'type' => TYPE_ACHIEVEMENT, + 'appendix' => ' (Achievement)', + 'matches' => $acvs->getMatches(), + 'file' => AchievementList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs', + 'visibleCols' => "$['category']" + ] + ); + + if ($acvs->getMatches() > $maxResults) + { + $found['achievement']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_achievementsfound', $acvs->getMatches(), $maxResults); + $found['achievement']['params']['_truncated'] = 1; + } } } -} -// 19 Zones -if ($searchMask & 0x40000) -{ - $conditions = array( - ['name_loc'.User::$localeId, $query], - $maxResults - ); - - $zones = new ZoneList($conditions); - - if ($data = $zones->getListviewData()) + // 18 Statistics + if ($searchMask & 0x0020000) { - $zones->addGlobalsToJScript($smarty); + $cnd = array_merge($cndBase, array( + 'AND', + ['flags', ACHIEVEMENT_FLAG_COUNTER, '&'], + ['name_loc'.User::$localeId, $query] + )); - $found['zone'] = array( - 'type' => TYPE_ZONE, - 'appendix' => ' (Zone)', - 'matches' => $zones->getMatches(), - 'file' => 'zone', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs' - ] - ); + $stats = new AchievementList($cnd); - if ($zones->getMatches() > $maxResults) + if ($data = $stats->getListviewData()) { - $found['zone']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_zonesfound', $zones->getMatches(), $maxResults); - $found['zone']['params']['_truncated'] = 1; + $stats->addGlobalsToJScript($smarty, GLOBALINFO_SELF); + + $found['statistic'] = array( + 'type' => TYPE_ACHIEVEMENT, + 'matches' => $stats->getMatches(), + 'file' => AchievementList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs', + 'visibleCols' => "$['category']", + 'hiddenCols' => "$['side', 'points', 'rewards']", + 'name' => '$LANG.tab_statistics', + 'id' => 'statistics' + ] + ); + + if ($stats->getMatches() > $maxResults) + { + $found['statistic']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_statisticsfound', $stats->getMatches(), $maxResults); + $found['statistic']['params']['_truncated'] = 1; + } } } -} -// 20 Objects -if ($searchMask & 0x80000) -{ - $conditions = array( - [(User::$localeId ? 'lg.name_loc'.User::$localeId : 'name'), $query], - $maxResults - ); - - $objects = new GameObjectList($conditions); - - if ($data = $objects->getListviewData()) + // 19 Zones + if ($searchMask & 0x0040000) { - $objects->addGlobalsToJScript($smarty); + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - $found['object'] = array( - 'type' => TYPE_OBJECT, - 'appendix' => ' (Object)', - 'matches' => $objects->getMatches(), - 'file' => 'object', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs' - ] - ); + $zones = new ZoneList($cnd); - if ($objects->getMatches() > $maxResults) + if ($data = $zones->getListviewData()) { - $found['object']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_objectsfound', $objects->getMatches(), $maxResults); - $found['object']['params']['_truncated'] = 1; + $zones->addGlobalsToJScript($smarty); + + $found['zone'] = array( + 'type' => TYPE_ZONE, + 'appendix' => ' (Zone)', + 'matches' => $zones->getMatches(), + 'file' => ZoneList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($zones->getMatches() > $maxResults) + { + $found['zone']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_zonesfound', $zones->getMatches(), $maxResults); + $found['zone']['params']['_truncated'] = 1; + } } } -} -// 21 Factions -if ($searchMask & 0x100000) -{ - $conditions = array( - ['name_loc'.User::$localeId, $query], - [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], - $maxResults - ); - - $factions = new FactionList($conditions); - - if ($data = $factions->getListviewData()) + // 20 Objects + if ($searchMask & 0x0080000) { - $found['faction'] = array( - 'type' => TYPE_FACTION, - 'appendix' => ' (Faction)', - 'matches' => $factions->getMatches(), - 'file' => 'faction', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs' - ] - ); + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - if ($factions->getMatches() > $maxResults) + $objects = new GameObjectList($cnd); + + if ($data = $objects->getListviewData()) { - $found['faction']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_factionsfound', $factions->getMatches(), $maxResults); - $found['faction']['params']['_truncated'] = 1; + $objects->addGlobalsToJScript($smarty); + + $found['object'] = array( + 'type' => TYPE_OBJECT, + 'appendix' => ' (Object)', + 'matches' => $objects->getMatches(), + 'file' => GameObjectList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($objects->getMatches() > $maxResults) + { + $found['object']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_objectsfound', $objects->getMatches(), $maxResults); + $found['object']['params']['_truncated'] = 1; + } } } -} -// 22 Skills -if ($searchMask & 0x200000) -{ - $skills = new SkillList(array($maxResults, ['name_loc'.User::$localeId, $query])); - - if ($data = $skills->getListviewData()) + // 21 Factions + if ($searchMask & 0x0100000) { - foreach ($skills->iterate() as $id => $__) - $data[$id]['param1'] = '"'.$skills->getField('iconString').'"'; + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - $found['pet'] = array( - 'type' => TYPE_SKILL, - 'appendix' => ' (Skill)', - 'matches' => $skills->getMatches(), - 'file' => 'skill', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs' - ] - ); + $factions = new FactionList($cnd); - if ($skills->getMatches() > $maxResults) + if ($data = $factions->getListviewData()) { - $found['pet']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_skillsfound', $skills->getMatches(), $maxResults); - $found['pet']['params']['_truncated'] = 1; + $found['faction'] = array( + 'type' => TYPE_FACTION, + 'appendix' => ' (Faction)', + 'matches' => $factions->getMatches(), + 'file' => FactionList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($factions->getMatches() > $maxResults) + { + $found['faction']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_factionsfound', $factions->getMatches(), $maxResults); + $found['faction']['params']['_truncated'] = 1; + } } } -} -// 23 Pets -if ($searchMask & 0x400000) -{ - $pets = new PetList(array($maxResults, ['name_loc'.User::$localeId, $query])); - - if ($data = $pets->getListviewData()) + // 22 Skills + if ($searchMask & 0x0200000) { - foreach ($pets->iterate() as $__) - $data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"'; + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - $found['pet'] = array( - 'type' => TYPE_PET, - 'appendix' => ' (Pet)', - 'matches' => $pets->getMatches(), - 'file' => 'pet', - 'data' => $data, - 'params' => ['tabs' => '$myTabs'] - ); + $skills = new SkillList($cnd); - if ($pets->getMatches() > $maxResults) + if ($data = $skills->getListviewData()) { - $found['pet']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_petsfound', $pets->getMatches(), $maxResults); - $found['pet']['params']['_truncated'] = 1; + foreach ($skills->iterate() as $id => $__) + $data[$id]['param1'] = '"'.$skills->getField('iconString').'"'; + + $found['pet'] = array( + 'type' => TYPE_SKILL, + 'appendix' => ' (Skill)', + 'matches' => $skills->getMatches(), + 'file' => SkillList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($skills->getMatches() > $maxResults) + { + $found['pet']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_skillsfound', $skills->getMatches(), $maxResults); + $found['pet']['params']['_truncated'] = 1; + } } } -} -// 24 NPCAbilities -if ($searchMask & 0x800000) -{ - $conditions = array( - ['s.name_loc'.User::$localeId, $query], - ['s.typeCat', -8], - $maxResults - ); - - $npcAbilities = new SpellList($conditions); - - if ($data = $npcAbilities->getListviewData()) + // 23 Pets + if ($searchMask & 0x0400000) { - $npcAbilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + $cnd = array_merge($cndBase, [['name_loc'.User::$localeId, $query]]); - foreach ($npcAbilities->iterate() as $__) - $data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"'; + $pets = new PetList($cnd); - $found['npcSpell'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Spell)', - 'matches' => $npcAbilities->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'id' => 'npc-abilities', - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_npcabilities', - 'visibleCols' => "$['level']", - 'hiddenCols' => "$['skill']" - ] - ); - - if ($npcAbilities->getMatches() > $maxResults) + if ($data = $pets->getListviewData()) { - $found['npcSpell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $npcAbilities->getMatches(), $maxResults); - $found['npcSpell']['params']['_truncated'] = 1; + foreach ($pets->iterate() as $__) + $data[$pets->id]['param1'] = '"'.$pets->getField('iconString').'"'; + + $found['pet'] = array( + 'type' => TYPE_PET, + 'appendix' => ' (Pet)', + 'matches' => $pets->getMatches(), + 'file' => PetList::$brickFile, + 'data' => $data, + 'params' => ['tabs' => '$myTabs'] + ); + + if ($pets->getMatches() > $maxResults) + { + $found['pet']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_petsfound', $pets->getMatches(), $maxResults); + $found['pet']['params']['_truncated'] = 1; + } } } -} -// 25 Spells (Misc + GM) -if ($searchMask & 0x1000000) -{ - $conditions = array( - ['s.name_loc'.User::$localeId, $query], - ['OR', ['s.typeCat', [0, -9]], ['s.cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&']], - $maxResults - ); - - $misc = new SpellList($conditions); - - if ($data = $misc->getListviewData()) + // 24 NPCAbilities + if ($searchMask & 0x0800000) { - $misc->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + $cnd = array_merge($cndBase, array( + 'AND', + ['s.name_loc'.User::$localeId, $query], + ['s.typeCat', -8] + )); - foreach ($misc->iterate() as $__) - $data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"'; + $npcAbilities = new SpellList($cnd); - $found['spell'] = array( - 'type' => TYPE_SPELL, - 'appendix' => ' (Spell)', - 'matches' => $misc->getMatches(), - 'file' => 'spell', - 'data' => $data, - 'params' => [ - 'tabs' => '$myTabs', - 'name' => '$LANG.tab_uncategorizedspells', - 'visibleCols' => "$['level']", - 'hiddenCols' => "$['skill']", - ] - ); - - if ($misc->getMatches() > $maxResults) + if ($data = $npcAbilities->getListviewData()) { - $found['spell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $misc->getMatches(), $maxResults); - $found['spell']['params']['_truncated'] = 1; + $npcAbilities->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($npcAbilities->iterate() as $__) + $data[$npcAbilities->id]['param1'] = '"'.strToLower($npcAbilities->getField('iconString')).'"'; + + $found['npcSpell'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Spell)', + 'matches' => $npcAbilities->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'id' => 'npc-abilities', + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_npcabilities', + 'visibleCols' => "$['level']", + 'hiddenCols' => "$['skill']" + ] + ); + + if ($npcAbilities->getMatches() > $maxResults) + { + $found['npcSpell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $npcAbilities->getMatches(), $maxResults); + $found['npcSpell']['params']['_truncated'] = 1; + } } } + + // 25 Spells (Misc + GM) + if ($searchMask & 0x1000000) + { + $cnd = array_merge($cndBase, array( + 'AND', + ['s.name_loc'.User::$localeId, $query], + ['s.typeCat', [0, -9]] + )); + + $misc = new SpellList($cnd); + + if ($data = $misc->getListviewData()) + { + $misc->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + foreach ($misc->iterate() as $__) + $data[$misc->id]['param1'] = '"'.strToLower($misc->getField('iconString')).'"'; + + $found['spell'] = array( + 'type' => TYPE_SPELL, + 'appendix' => ' (Spell)', + 'matches' => $misc->getMatches(), + 'file' => SpellList::$brickFile, + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs', + 'name' => '$LANG.tab_uncategorizedspells', + 'visibleCols' => "$['level']", + 'hiddenCols' => "$['skill']", + ] + ); + + if ($misc->getMatches() > $maxResults) + { + $found['spell']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_spellsfound', $misc->getMatches(), $maxResults); + $found['spell']['params']['_truncated'] = 1; + } + } + } + + // 26 Characters + // if ($searchMask & 0x2000000) + + // 27 Guilds + // if ($searchMask & 0x4000000) + + $smarty->saveCache($cacheKey, $found); } -// 26 Characters -// if ($searchMask & 0x2000000) - -// 27 Guilds -// if ($searchMask & 0x4000000) - /* !note! dear reader, if you ever try to generate a string, that is to be evaled by JS, NEVER EVER terminate with a \n $totalHoursWasted +=2; @@ -1176,7 +1152,6 @@ else /* if ($searchMask & SEARCH_TYPE_REGULAR) */ )); $smarty->assign('lang', array_merge(Lang::$main, Lang::$search)); $smarty->assign('found', $found); - $smarty->assign('lvData', $jsGlobals); $smarty->assign('search', $search); $smarty->display('search.tpl'); diff --git a/template/bricks/book.tpl b/template/bricks/book.tpl new file mode 100644 index 00000000..59173e26 --- /dev/null +++ b/template/bricks/book.tpl @@ -0,0 +1,15 @@ +{if !empty($pageText)} +
+

{$lang.content}

+ +
+ + +{/if} diff --git a/template/bricks/globals/achievements.tpl b/template/bricks/globals/achievement.tpl similarity index 100% rename from template/bricks/globals/achievements.tpl rename to template/bricks/globals/achievement.tpl diff --git a/template/bricks/globals/classes.tpl b/template/bricks/globals/class.tpl similarity index 100% rename from template/bricks/globals/classes.tpl rename to template/bricks/globals/class.tpl diff --git a/template/bricks/globals/creatures.tpl b/template/bricks/globals/creature.tpl similarity index 100% rename from template/bricks/globals/creatures.tpl rename to template/bricks/globals/creature.tpl diff --git a/template/bricks/globals/currencies.tpl b/template/bricks/globals/currency.tpl similarity index 100% rename from template/bricks/globals/currencies.tpl rename to template/bricks/globals/currency.tpl diff --git a/template/bricks/globals/holidays.tpl b/template/bricks/globals/event.tpl similarity index 100% rename from template/bricks/globals/holidays.tpl rename to template/bricks/globals/event.tpl diff --git a/template/bricks/globals/factions.tpl b/template/bricks/globals/faction.tpl similarity index 100% rename from template/bricks/globals/factions.tpl rename to template/bricks/globals/faction.tpl diff --git a/template/bricks/globals/items.tpl b/template/bricks/globals/item.tpl similarity index 100% rename from template/bricks/globals/items.tpl rename to template/bricks/globals/item.tpl diff --git a/template/bricks/globals/object.tpl b/template/bricks/globals/object.tpl new file mode 100644 index 00000000..79565df6 --- /dev/null +++ b/template/bricks/globals/object.tpl @@ -0,0 +1,8 @@ +var _ = g_objects; +{strip} +{foreach from=$data key=id item=item} + _[{$id}]={ldelim} + name_{$user.language}:'{$item.name|escape:"javascript"}' + {rdelim}; +{/foreach} +{/strip} diff --git a/template/bricks/globals/pets.tpl b/template/bricks/globals/pet.tpl similarity index 100% rename from template/bricks/globals/pets.tpl rename to template/bricks/globals/pet.tpl diff --git a/template/bricks/globals/quests.tpl b/template/bricks/globals/quest.tpl similarity index 100% rename from template/bricks/globals/quests.tpl rename to template/bricks/globals/quest.tpl diff --git a/template/bricks/globals/races.tpl b/template/bricks/globals/race.tpl similarity index 100% rename from template/bricks/globals/races.tpl rename to template/bricks/globals/race.tpl diff --git a/template/bricks/globals/skills.tpl b/template/bricks/globals/skill.tpl similarity index 100% rename from template/bricks/globals/skills.tpl rename to template/bricks/globals/skill.tpl diff --git a/template/bricks/globals/spells.tpl b/template/bricks/globals/spell.tpl similarity index 100% rename from template/bricks/globals/spells.tpl rename to template/bricks/globals/spell.tpl diff --git a/template/bricks/globals/titles.tpl b/template/bricks/globals/title.tpl similarity index 100% rename from template/bricks/globals/titles.tpl rename to template/bricks/globals/title.tpl diff --git a/template/bricks/globals/zones.tpl b/template/bricks/globals/zone.tpl similarity index 100% rename from template/bricks/globals/zones.tpl rename to template/bricks/globals/zone.tpl diff --git a/template/item.tpl b/template/item.tpl index 82b02517..32e1513b 100644 --- a/template/item.tpl +++ b/template/item.tpl @@ -65,21 +65,7 @@ {/if} {/if} -{if !empty($pageText)} -
-

{$lang.content}

- -
- - -{/if} +{include file='bricks/book.tpl'}

{$lang.related}

diff --git a/template/js/global.js b/template/js/global.js index 11bd0ef9..5bd741c8 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -5731,6 +5731,8 @@ Listview.extraCols = { }, getState: function(cond) { switch (g_types[cond.type]) { + case 'skill': + return Listview.extraCols.condition.getSkillState(cond); case 'spell': return Listview.extraCols.condition.getSpellState(cond); case 'item': @@ -5745,6 +5747,26 @@ Listview.extraCols = { return {}; } }, + getSkillState: function(cond) { + if (!cond.typeId || !g_skills[cond.typeId]) { + return; + } + + var + cnd = {}, + item = g_skills[cond.typeId]; + + cnd.icon = item.icon.toLowerCase(); + cnd.state = cond.status ? $WH.ct(LANG.pr_note_known) : $WH.ct(LANG.pr_note_missing); + cnd.color = cond.status ? 'q2' : 'q10'; + cnd.name = item['name_' + g_locale.name]; + cnd.url = '?skill=' + cond.typeId; + + if (cond.reqSkillLvl) + cnd.name += ' (' + cond.reqSkillLvl + ')'; + + return cnd; + }, getSpellState: function(cond) { if (!cond.typeId || !g_spells[cond.typeId]) { return; diff --git a/template/object.tpl b/template/object.tpl index 68ecb5e8..d8df761b 100644 --- a/template/object.tpl +++ b/template/object.tpl @@ -1,36 +1,31 @@ {include file='header.tpl'} -
+
+
+
-
-
- - - -{if isset($object.key) or isset($object.lockpicking) or isset($object.mining) or isset($object.herbalism)} - - - -
{#Quick_Facts#}
-
    - {if isset($object.key)}
  • {#Key#}{$lang.colon}[{$object.key.name}]
  • {/if} - {if isset($object.lockpicking)}
  • {#Lockpickable#} ({$object.lockpicking})
  • {/if} - {if isset($object.mining)}
  • {#Mining#} ({$object.mining})
  • {/if} - {if isset($object.herbalism)}
  • {#Herb#} ({$object.herbalism})
  • {/if} -
-
+{if !empty($announcements)} + {foreach from=$announcements item=item} + {include file='bricks/announcement.tpl' an=$item} + {/foreach} {/if} + + +{include file='bricks/infobox.tpl'} +
+{include file='bricks/redButtons.tpl'} - WowheadWowhead -

{$object.name}

+

{$name}

-{if $object.position} +{include file='bricks/article.tpl'} + +{if $positions}
{#This_Object_can_be_found_in#} {strip} @@ -75,33 +70,18 @@
- {else} - {#This_Object_cant_be_found#} -{/if} - -{if isset($object.pagetext)} -

Content

-
- {strip} - - {/strip} + {$lang.unkPosition} {/if} +{include file='bricks/book.tpl'}

{$lang.related}

-{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} +{include file='bricks/tabsRelated.tpl' tabs=$lvData} {include file='bricks/contribute.tpl'} diff --git a/template/objects.tpl b/template/objects.tpl index 4cd43664..d18ccc8b 100644 --- a/template/objects.tpl +++ b/template/objects.tpl @@ -1,20 +1,61 @@ {include file='header.tpl'} -
-
-
- +
+
+
-
+{if !empty($announcements)} + {foreach from=$announcements item=item} + {include file='bricks/announcement.tpl' an=$item} + {/foreach} +{/if} - + -
-
-
+
+
+ + +
{$lang.name|ucFirst}:  
+ +
+ + +
+
{$lang.refineSearch}
+ {$lang.match}{$lang.colon} +
+ +
+ +
+ + +
+ +
+
+
+ + + +
+ + +
+
+
{include file='footer.tpl'} diff --git a/template/spell.tpl b/template/spell.tpl index dd12e8e3..44de1845 100644 --- a/template/spell.tpl +++ b/template/spell.tpl @@ -12,55 +12,55 @@ {include file='bricks/infobox.tpl'}
-{include file='bricks/headIcons.tpl' icons=$lvData.icons} +{*include file='bricks/headIcons.tpl'*} {include file='bricks/redButtons.tpl'} - {$lvData.page.name}{else}>{$lvData.page.name}{/if} + {$name}{else}>{$name}{/if} {include file='bricks/tooltip.tpl'} -{if $lvData.page.reagents} - {if $lvData.page.tools}
{/if} -{include file='bricks/reagentList.tpl' reagents=$lvData.page.reagents[1] enhanced=$lvData.page.reagents[0]} - {if $lvData.page.tools}
{/if} +{if $reagents[0]} + {if $tools}
{/if} +{include file='bricks/reagentList.tpl' reagents=$reagents[1] enhanced=$reagents[0]} + {if $tools}
{/if} {/if} -{if $lvData.page.tools} - {if $lvData.page.reagents}
{/if} +{if $tools} + {if $reagents[0]}
{/if}

{$lang.tools}

-{section name=i loop=$lvData.page.tools} - +{section name=i loop=$tools} + {/section}
{$lvData.page.tools[i].name}
{$tools[i].name}
- {if $lvData.page.reagents}
{/if}{ -/if} + {if $reagents[0]}
{/if} +{/if}
{include file='bricks/article.tpl'} {* -if !empty($lvData.page.transfer)} +if !empty($transfer)}
- {$lang._transfer|sprintf:$lvData.page.transfer.id:´´:$lvData.page.transfer.icon:$lvData.page.transfer.name:$lvData.page.transfer.facInt:$lvData.page.transfer.facName} + {$lang._transfer|sprintf:$transfer.id:´´:$transfer.icon:$transfer.name:$transfer.facInt:$transfer.facName} {/if} *} -{if isset($lvData.page.unavailable)} +{if isset($unavailable)}
{$lang._unavailable} {/if} @@ -82,92 +82,92 @@ if !empty($lvData.page.transfer)} {$lang.duration} - {if !empty($lvData.page.duration)}{$lvData.page.duration}{else}{$lang.n_a}{/if} + {if !empty($duration)}{$duration}{else}{$lang.n_a}{/if} {$lang.school} - {$lvData.page.school} + {$school} {$lang.mechanic} - {if $lvData.page.mechanic}{$lvData.page.mechanic}{else}{$lang.n_a}{/if} + {if $mechanic}{$mechanic}{else}{$lang.n_a}{/if} {$lang.dispelType} - {if $lvData.page.dispel}{$lvData.page.dispel}{else}{$lang.n_a}{/if} + {if $dispel}{$dispel}{else}{$lang.n_a}{/if} {$lang._gcdCategory} - {$lvData.page.gcdCat} + {$gcdCat} {$lang._cost} - {if !empty($lvData.page.powerCost)}{$lvData.page.powerCost}{else}{$lang._none}{/if} + {if !empty($powerCost)}{$powerCost}{else}{$lang._none}{/if} {$lang._range} - {$lvData.page.range} {$lang._distUnit} ({$lvData.page.rangeName}) + {$range} {$lang._distUnit} ({$rangeName}) {$lang._castTime} - {$lvData.page.castTime} + {$castTime} {$lang._cooldown} - {if !empty($lvData.page.cooldown)}{$lvData.page.cooldown}{else}{$lang.n_a}{/if} + {if !empty($cooldown)}{$cooldown}{else}{$lang.n_a}{/if} {$lang._gcd} - {$lvData.page.gcd} + {$gcd} -{if !empty($lvData.page.scaling)} +{if !empty($scaling)} {$lang._scaling} - {$lvData.page.scaling} + {$scaling} {/if} -{if !empty($lvData.page.stances)} +{if !empty($stances)} {$lang._forms} - {$lvData.page.stances} + {$stances} {/if} -{if !empty($lvData.page.items)} +{if !empty($items)} {$lang.requires2} - {$lvData.page.items} + {$items} {/if} -{section name=i loop=$lvData.page.effect} +{section name=i loop=$effect} {$lang._effect} #{$smarty.section.i.index+1} - {$lvData.page.effect[i].name} + {$effect[i].name} - {if isset($lvData.page.effect[i].value)}
{$lang._value}{$lang.colon}{$lvData.page.effect[i].value}{/if} - {if isset($lvData.page.effect[i].radius)}
{$lang._radius}{$lang.colon}{$lvData.page.effect[i].radius} {$lang._distUnit}{/if} - {if isset($lvData.page.effect[i].interval)}
{$lang._interval}{$lang.colon}{$lvData.page.effect[i].interval}{/if} - {if isset($lvData.page.effect[i].mechanic)}
{$lang.mechanic}{$lang.colon}{$lvData.page.effect[i].mechanic}{/if} - {if isset($lvData.page.effect[i].procData)}
{if $lvData.page.effect[i].procData[0] < 0}{$lang.ppm|sprintf:$lvData.page.effect[i].procData[0]*-1}{else}{$lang.procChance}{$lang.colon}{$lvData.page.effect[i].procData[0]}%{/if}{if $lvData.page.effect[i].procData[1]} ({$lang.cooldown|sprintf:$lvData.page.effect[i].procData[1]}){/if}{/if} + {if isset($effect[i].value)}
{$lang._value}{$lang.colon}{$effect[i].value}{/if} + {if isset($effect[i].radius)}
{$lang._radius}{$lang.colon}{$effect[i].radius} {$lang._distUnit}{/if} + {if isset($effect[i].interval)}
{$lang._interval}{$lang.colon}{$effect[i].interval}{/if} + {if isset($effect[i].mechanic)}
{$lang.mechanic}{$lang.colon}{$effect[i].mechanic}{/if} + {if isset($effect[i].procData)}
{if $effect[i].procData[0] < 0}{$lang.ppm|sprintf:$effect[i].procData[0]*-1}{else}{$lang.procChance}{$lang.colon}{$effect[i].procData[0]}%{/if}{if $effect[i].procData[1]} ({$lang.cooldown|sprintf:$effect[i].procData[1]}){/if}{/if}
-{if isset($lvData.page.effect[i].icon)} +{if isset($effect[i].icon)} -{if isset($lvData.page.effect[i].icon.quality)} - +{if isset($effect[i].icon.quality)} + {else} - + {/if}
{$lvData.page.effect[i].icon.name}{$effect[i].icon.name}{if !$lvData.page.effect[i].icon.name|strpos:"#"}{/if}{$lvData.page.effect[i].icon.name}{if !$lvData.page.effect[i].icon.name|strpos:"#"}{/if}{if !$effect[i].icon.name|strpos:"#"}{/if}{$effect[i].icon.name}{if !$effect[i].icon.name|strpos:"#"}{/if}
{/if} @@ -178,7 +178,7 @@ if !empty($lvData.page.transfer)}

{$lang.related}

-{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} +{include file='bricks/tabsRelated.tpl' tabs=$lvData} {include file='bricks/contribute.tpl'} diff --git a/template/spells.tpl b/template/spells.tpl index 7295c8b4..8352de7c 100644 --- a/template/spells.tpl +++ b/template/spells.tpl @@ -11,14 +11,14 @@ {/if}
-
+
{$lang.school}{$lang.colon}
{$lang.clear}