From 819a46ae155916d83cbd90d9b8122d3941ae5f09 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sat, 8 Feb 2014 12:09:48 +0100 Subject: [PATCH] detail page for events (with not much in it) detail and listview for NPCs (without spawns, spells and some filters) forcing the template to be more generic - noticed, that the loot display is off. It happens with different modes on a creature, that has the same loot but different chances or quantities ... analyzing --- includes/defines.php | 22 + includes/kernel.php | 2 +- includes/types/achievement.class.php | 8 +- includes/types/basetype.class.php | 15 +- includes/types/creature.class.php | 347 ++++++- includes/types/faction.class.php | 6 +- includes/types/item.class.php | 42 +- includes/types/quest.class.php | 2 +- includes/types/worldevent.class.php | 71 +- includes/utilities.php | 449 ++------- localization/lang.class.php | 279 ++++++ localization/locale_dede.php | 37 +- localization/locale_enus.php | 33 +- localization/locale_eses.php | 33 +- localization/locale_frfr.php | 35 +- localization/locale_ruru.php | 33 +- pages/achievement.php | 63 +- pages/achievements.php | 56 +- pages/class.php | 60 +- pages/classes.php | 21 +- pages/compare.php | 40 +- pages/currencies.php | 52 +- pages/currency.php | 61 +- pages/event.php | 190 ++++ pages/events.php | 73 +- pages/faction.php | 146 ++- pages/factions.php | 25 +- pages/item.php | 140 ++- pages/items.php | 73 +- pages/itemset.php | 68 +- pages/itemsets.php | 56 +- pages/miscTools.php | 2 +- pages/npc.php | 929 ++++++++++-------- pages/npcs.php | 88 ++ pages/object.php | 2 +- pages/pet.php | 54 +- pages/pets.php | 47 +- pages/quest.php | 2 +- pages/race.php | 47 +- pages/races.php | 21 +- pages/skill.php | 6 +- pages/skills.php | 2 +- pages/spell.php | 48 +- pages/spells.php | 4 +- pages/title.php | 47 +- pages/titles.php | 42 +- pages/zones.php | 2 +- search.php | 8 +- template/404.tpl | 4 +- template/achievement.tpl | 46 +- template/achievements.tpl | 4 +- template/bricks/headIcons.tpl | 10 + template/bricks/infobox.tpl | 8 +- template/bricks/listviews/event.tpl | 14 +- template/bricks/redButtons.tpl | 20 +- template/bricks/tooltip.tpl | 24 +- template/class.tpl | 43 - template/compare.tpl | 4 +- template/css/basic.css | 1 + template/css/global.css | 18 +- .../{faction.tpl => detail-page-generic.tpl} | 22 +- template/factions.tpl | 20 - template/generic-no-filter.tpl | 55 -- template/head.tpl | 6 +- template/header.tpl | 4 +- template/item.tpl | 38 +- template/items.tpl | 10 +- template/itemset.tpl | 40 +- template/itemsets.tpl | 6 +- template/js/filters.js | 20 +- template/js/global.js | 46 +- template/js/locale_dede.js | 5 +- template/js/locale_enus.js | 5 +- template/js/locale_eses.js | 5 +- template/js/locale_frfr.js | 5 +- template/js/locale_ruru.js | 5 +- template/list-page-generic.tpl | 55 ++ template/npc.tpl | 128 +++ template/npcs.tpl | 112 +++ template/pet.tpl | 45 - template/race.tpl | 45 - template/search.tpl | 2 +- template/skill.tpl | 44 - template/spell.tpl | 29 +- template/title.tpl | 39 - 85 files changed, 2942 insertions(+), 1934 deletions(-) create mode 100644 localization/lang.class.php create mode 100644 pages/event.php create mode 100644 pages/npcs.php create mode 100644 template/bricks/headIcons.tpl delete mode 100644 template/class.tpl rename template/{faction.tpl => detail-page-generic.tpl} (58%) delete mode 100644 template/factions.tpl delete mode 100644 template/generic-no-filter.tpl create mode 100644 template/list-page-generic.tpl create mode 100644 template/npc.tpl create mode 100644 template/npcs.tpl delete mode 100644 template/pet.tpl delete mode 100644 template/race.tpl delete mode 100644 template/skill.tpl delete mode 100644 template/title.tpl diff --git a/includes/defines.php b/includes/defines.php index 84a1a099..5854207b 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -161,6 +161,9 @@ define('OBJECT_CU_STEALTHED', 0x20); define('OBJECT_CU_CASTER_GROUPED', 0x40); define('OBJECT_CU_NOT_PERSISTANT', 0x80); +define('NPC_CU_INSTANCE_BOSS', 0x01); +define('NPC_CU_DIFFICULTY_DUMMY', 0x02); + define('MAX_LEVEL', 80); // Loot handles @@ -325,6 +328,25 @@ define('LOCK_PROPERTY_MINING', 3); define('NPC_TYPEFLAG_HERBLOOT', 0x0100); define('NPC_TYPEFLAG_MININGLOOT', 0x0200); define('NPC_TYPEFLAG_ENGINEERLOOT', 0x8000); +define('NPC_TYPEFLAG_SPECIALLOOT', 0x8300); + +define('NPC_RANK_NORMAL', 0); +define('NPC_RANK_ELITE', 1); +define('NPC_RANK_RARE_ELITE', 2); +define('NPC_RANK_BOSS', 3); +define('NPC_RANK_RARE', 4); + +define('NPC_FLAG_TRAINER', 0x00000010); +define('NPC_FLAG_CLASS_TRAINER', 0x00000020); +define('NPC_FLAG_VENDOR', 0x00000080); +define('NPC_FLAG_REPAIRER', 0x00001000); +define('NPC_FLAG_FLIGHT_MASTER', 0x00002000); +define('NPC_FLAG_INNKEEPER', 0x00010000); +define('NPC_FLAG_BANKER', 0x00020000); +define('NPC_FLAG_GUILD_MASTER', 0x00080000); +define('NPC_FLAG_BATTLEMASTER', 0x00100000); +define('NPC_FLAG_AUCTIONEER', 0x00200000); +define('NPC_FLAG_STABLE_MASTER', 0x00400000); // GameObject define('OBJECT_DOOR', 0); diff --git a/includes/kernel.php b/includes/kernel.php index 233b8e7d..57dc3b0b 100644 --- a/includes/kernel.php +++ b/includes/kernel.php @@ -22,6 +22,7 @@ require 'includes/libs/Smarty-2.6.26/libs/Smarty.class.php';// Libraray: http:// // require 'includes/libs/Smarty-3.1.14/libs/Smarty.class.php'; // Libraray: http://www.smarty.net/ require 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using mysqli variant: https://bitbucket.org/brainreaver/dbsimple/src) require 'includes/utilities.php'; +require 'localization/lang.class.php'; require 'includes/user.class.php'; require 'includes/database.class.php'; @@ -94,7 +95,6 @@ User::assignUserToTemplate($smarty, true); // parse page-parameters .. sanitize before use! @list($str, $trash) = explode('&', $_SERVER['QUERY_STRING'], 2); @list($pageCall, $pageParam) = explode('=', $str, 2); -$smarty->assign('query', [$pageCall, $pageParam]); $smarty->assign('wowhead', 'http://'.Util::$subDomains[User::$localeId].'.wowhead.com/'.$str); ?> diff --git a/includes/types/achievement.class.php b/includes/types/achievement.class.php index 2f01b377..e51051b9 100644 --- a/includes/types/achievement.class.php +++ b/includes/types/achievement.class.php @@ -168,22 +168,22 @@ class AchievementList extends BaseType } if ($crt['completionFlags'] & ACHIEVEMENT_CRITERIA_FLAG_MONEY_COUNTER) - $criteria .= '- '.htmlspecialchars($crtName).' '.number_format($crt['value2' ] / 10000).'
'; + $criteria .= '- '.Util::jsEscape($crtName).' '.number_format($crt['value2' ] / 10000).'
'; else - $criteria .= '- '.htmlspecialchars($crtName).'
'; + $criteria .= '- '.Util::jsEscape($crtName).'
'; if (++$i == round(count($rows)/2)) $criteria .= ''; } $x = '
'; - $x .= Util::jsEscape(htmlspecialchars($name)); + $x .= Util::jsEscape($name); $x .= '
'; if ($description || $criteria) $x .= ''; - if ($fac) - $x .= ''; + // todo (low): exclude not displayed factions + if ($f = FactionList::getName($this->getField('factionId'))) + $x .= ''; $x .= '
'; if ($description) - $x .= '
'.Util::jsEscape(htmlspecialchars($description)).'
'; + $x .= '
'.Util::jsEscape($description).'
'; if ($criteria) { diff --git a/includes/types/basetype.class.php b/includes/types/basetype.class.php index bb945829..b7fa8868 100644 --- a/includes/types/basetype.class.php +++ b/includes/types/basetype.class.php @@ -20,11 +20,12 @@ abstract class BaseType /* * condition as array [expression, value, operator] * expression: str - must match fieldname; - * int - impl. 1: select everything + * int - 1: select everything; 0: select nothing * array - another condition array * value: str - operator defaults to: LIKE %% * int - operator defaults to: = * array - operator defaults to: IN () + * null - operator defaults to: IS [NULL] * operator: modifies/overrides default * ! - negated default value (NOT LIKE; <>; NOT IN) * condition as str @@ -41,12 +42,13 @@ abstract class BaseType * ['flags', 0xFF, '&'], * ['flags2', 0xF, '&'], * ] - * [['mask', 0x3, '&'], 0] + * [['mask', 0x3, '&'], 0], + * ['joinedTbl.field', NULL] // NULL must be explicitly specified "['joinedTbl.field']" would be skipped as erronous definition (only really usefull when left-joining) * 'OR', * 5 * ) * results in - * WHERE ((`id` = 45) OR (`name` NOT LIKE "%test%") OR ((`flags` & 255) AND (`flags2` & 15)) OR ((`mask` & 3) = 0)) LIMIT 5 + * WHERE ((`id` = 45) OR (`name` NOT LIKE "%test%") OR ((`flags` & 255) AND (`flags2` & 15)) OR ((`mask` & 3) = 0)) OR (`joinedTbl`.`field` IS NULL) LIMIT 5 */ public function __construct($conditions = [], $applyFilter = false) { @@ -175,6 +177,11 @@ abstract class BaseType $op = (isset($c[2]) && $c[2] == '!') ? 'NOT LIKE' : 'LIKE'; $val = $val === '' ? '""' : '"%'.$val.'%"'; } + else if (count($c) > 1 && $c[1] === null) // specifficly check for NULL + { + $op = (isset($c[2]) && $c[2] == '!') ? 'IS NOT' : 'IS'; + $val = 'NULL'; + } else // null for example return null; @@ -578,7 +585,7 @@ abstract class Filter $tmp = []; foreach (array_merge($this->fiData['c'], $this->fiData['v']) as $k => $v) { - if ($v == '') + if ($v === '') continue; else if (is_array($v)) $tmp[$k] = $k."=".implode(':', $v); diff --git a/includes/types/creature.class.php b/includes/types/creature.class.php index ff7f56be..981954ca 100644 --- a/includes/types/creature.class.php +++ b/includes/types/creature.class.php @@ -13,9 +13,16 @@ class CreatureList extends BaseType public $tooltips = []; protected $queryBase = 'SELECT ct.*, ct.id AS ARRAY_KEY FROM ?_creature ct'; - protected $queryOpts = array( - 'ct' => [['ft']], - 'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.factionA', 's' => ', ft.A, ft.H, ft.factionId'] + public $queryOpts = array( + 'ct' => [['ft', 'clsMin', 'clsMax', 'qr']], + 'ft' => ['j' => '?_factiontemplate ft ON ft.id = ct.factionA', 's' => ', ft.*'], + 'clsMin' => ['j' => 'creature_classlevelstats clsMin ON ct.unitClass = clsMin.class AND ct.minLevel = clsMin.level', 's' => ', CASE ct.exp WHEN 0 THEN clsMin.basehp0 * healthMod WHEN 1 THEN clsMin.basehp1 * healthMod ELSE clsMin.basehp2 * healthMod END AS healthMin, clsMin.baseMana * manaMod AS manaMin'], + 'clsMax' => ['j' => 'creature_classlevelstats clsMax ON ct.unitClass = clsMax.class AND ct.maxLevel = clsMax.level', 's' => ', CASE ct.exp WHEN 0 THEN clsMax.basehp0 * healthMod WHEN 1 THEN clsMax.basehp1 * healthMod ELSE clsMax.basehp2 * healthMod END AS healthMax, clsMax.baseMana * manaMod AS manaMax'], + 'qr' => ['j' => ['creature_questrelation qr ON qr.id = ct.id', true], 's' => ', qr.quest', 'g' => 'ct.id'], // start + 'ir' => ['j' => ['creature_involvedrelation ir ON ir.id = ct.id', true]], // end + 'qtqr' => ['j' => 'quest_template qtqr ON qr.quest = qtqr.id'], + 'qtir' => ['j' => 'quest_template qtir ON ir.quest = qtir.id'], + 'rep' => ['j' => ['creature_onkill_reputation rep ON rep.creature_id = ct.id', true]] ); public static function getName($id) @@ -48,15 +55,16 @@ class CreatureList extends BaseType $type = $this->curTpl['type']; $row3 = [Lang::$game['level']]; $fam = $this->curTpl['family']; - // todo (low): rework, when factions are implemented - $fac = DB::Aowow()->selectRow('SELECT * FROM dbc.faction f JOIN dbc.factionTemplate ft ON f.id = ft.factionId WHERE ft.id = ?d AND NOT f.reputationFlags1 & 0x4 AND f.reputationIndex <> -1', $this->curTpl['factionA']); if (!($this->curTpl['typeFlags'] & 0x4)) { - $level = $this->curTpl['minlevel']; - if ($level != $this->curTpl['maxlevel']) - $level .= ' - '.$this->curTpl['maxlevel']; + $level = $this->curTpl['minLevel']; + if ($level != $this->curTpl['maxLevel']) + $level .= ' - '.$this->curTpl['maxLevel']; } + else + $level = '??'; + $row3[] = $level; if ($type) @@ -75,8 +83,9 @@ class CreatureList extends BaseType if ($type == 1 && $fam) // 1: Beast $x .= '
'.Lang::$game['fa'][$fam].'
'.Util::localizedString($fac, 'name').'
'.$f.'
'; @@ -125,19 +134,19 @@ class CreatureList extends BaseType if (isset($data[$texStr])) { - if ($data[$texStr]['minlevel'] > $this->curTpl['minlevel']) - $data[$texStr]['minlevel'] = $this->curTpl['minlevel']; + if ($data[$texStr]['minlevel'] > $this->curTpl['minLevel']) + $data[$texStr]['minlevel'] = $this->curTpl['minLevel']; - if ($data[$texStr]['maxlevel'] < $this->curTpl['maxlevel']) - $data[$texStr]['maxlevel'] = $this->curTpl['maxlevel']; + if ($data[$texStr]['maxlevel'] < $this->curTpl['maxLevel']) + $data[$texStr]['maxlevel'] = $this->curTpl['maxLevel']; $data[$texStr]['count']++; } else $data[$texStr] = array( 'family' => $this->curTpl['family'], - 'minlevel' => $this->curTpl['minlevel'], - 'maxlevel' => $this->curTpl['maxlevel'], + 'minlevel' => $this->curTpl['minLevel'], + 'maxlevel' => $this->curTpl['maxLevel'], 'modelId' => $this->curTpl['modelId'], 'displayId' => $this->curTpl['displayId1'], 'skin' => $texStr, @@ -147,18 +156,21 @@ class CreatureList extends BaseType else { $data[$this->id] = array( - 'family' => $this->curTpl['family'], - 'minlevel' => $this->curTpl['minlevel'], - 'maxlevel' => $this->curTpl['maxlevel'], - 'id' => $this->id, - 'boss' => $this->curTpl['typeFlags'] & 0x4 ? 1 : 0, - 'rank' => $this->curTpl['rank'], // classification(?) - 'location' => $this->getSpawns(SPAWNINFO_ZONES), - 'name' => $this->getField('name', true), - 'type' => $this->curTpl['type'], - 'react' => '['.$this->curTpl['A'].', '.$this->curTpl['H'].']' + 'family' => $this->curTpl['family'], + 'minlevel' => $this->curTpl['minLevel'], + 'maxlevel' => $this->curTpl['maxLevel'], + 'id' => $this->id, + 'boss' => $this->curTpl['typeFlags'] & 0x4 ? 1 : 0, + 'classification' => $this->curTpl['rank'], + 'location' => $this->getSpawns(SPAWNINFO_ZONES), + 'name' => $this->getField('name', true), + 'type' => $this->curTpl['type'], + 'react' => [$this->curTpl['A'], $this->curTpl['H']], ); + if ($this->getField('quest')) + $data[$this->id]['hasQuests'] = 1; + if ($_ = $this->getField('subname', true)) $data[$this->id]['tag'] = $_; @@ -181,4 +193,287 @@ class CreatureList extends BaseType } + +class CreatureListFilter extends Filter +{ + protected $enums = array( + 3 => array( 469, 1037, 1106, 529, 1012, 87, 21, 910, 609, 942, 909, 530, 69, 577, 930, 1068, 1104, 729, 369, 92, 54, 946, 67, 1052, 749, + 47, 989, 1090, 1098, 978, 1011, 93, 1015, 1038, 76, 470, 349, 1031, 1077, 809, 911, 890, 970, 169, 730, 72, 70, 932, 1156, 933, + 510, 1126, 1067, 1073, 509, 941, 1105, 990, 934, 935, 1094, 1119, 1124, 1064, 967, 1091, 59, 947, 81, 576, 922, 68, 1050, 1085, 889, + 589, 270) + ); + + // cr => [type, field, misc, extraCol] + protected $genericFilter = array( // misc (bool): _NUMERIC => useFloat; _STRING => localized; _FLAG => match Value; _BOOLEAN => stringSet + 5 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_REPAIRER ], // canrepair + 9 => [FILTER_CR_BOOLEAN, 'lootId', ], // lootable + 11 => [FILTER_CR_BOOLEAN, 'pickpocketLootId', ], // pickpocketable + 18 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_AUCTIONEER ], // auctioneer + 19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker + 20 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BATTLEMASTER ], // battlemaster + 21 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_FLIGHT_MASTER ], // flightmaster + 22 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // guildmaster + 23 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_INNKEEPER ], // innkeeper + 24 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_CLASS_TRAINER ], // talentunlearner + 25 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_GUILD_MASTER ], // tabardvendor + 27 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_STABLE_MASTER ], // stablemaster + 28 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_TRAINER ], // trainer + 29 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_VENDOR ], // vendor + 19 => [FILTER_CR_FLAG, 'npcflag', NPC_FLAG_BANKER ], // banker + 37 => [FILTER_CR_NUMERIC, 'id', null, true], // id + 35 => [FILTER_CR_STRING, 'textureString' ], // useskin + 32 => [FILTER_CR_FLAG, 'cuFlags', NPC_CU_INSTANCE_BOSS ] // instanceboss + ); + + 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 1: // health [num] + if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1])) + break; + + // remap OP for this special case + switch ($cr[1]) + { + case '=': // min > max is totally possible + $this->parent->queryOpts['clsMin']['h'] = 'IF(healthMin > healthMax, healthMax, healthMin) <= '.$cr[2]; + $this->parent->queryOpts['clsMax']['h'] = 'IF(healthMin > healthMax, healthMin, healthMax) >= '.$cr[2]; + break; + case '>': + $this->parent->queryOpts['clsMin']['h'] = 'IF(healthMin > healthMax, healthMax, healthMin) > '.$cr[2]; + break; + case '>=': + $this->parent->queryOpts['clsMin']['h'] = 'IF(healthMin > healthMax, healthMax, healthMin) >= '.$cr[2]; + break; + case '<': + $this->parent->queryOpts['clsMax']['h'] = 'IF(healthMin > healthMax, healthMin, healthMax) < '.$cr[2]; + break; + case '<=': + $this->parent->queryOpts['clsMax']['h'] = 'IF(healthMin > healthMax, healthMin, healthMax) <= '.$cr[2]; + break; + } + return [1]; // always true, use post-filter + case 2: // mana [num] + if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1])) + break; + + // remap OP for this special case + switch ($cr[1]) + { + case '=': + $this->parent->queryOpts['clsMin']['h'] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2]; + $this->parent->queryOpts['clsMax']['h'] = 'IF(manaMin > manaMax, manaMin, manaMax) => '.$cr[2]; + break; + case '>': + $this->parent->queryOpts['clsMax']['h'] = 'IF(manaMin > manaMax, manaMin, manaMax) > '.$cr[2]; + break; + case '>=': + $this->parent->queryOpts['clsMax']['h'] = 'IF(manaMin > manaMax, manaMin, manaMax) >= '.$cr[2]; + break; + case '<': + $this->parent->queryOpts['clsMin']['h'] = 'IF(manaMin > manaMax, manaMax, manaMin) < '.$cr[2]; + break; + case '<=': + $this->parent->queryOpts['clsMin']['h'] = 'IF(manaMin > manaMax, manaMax, manaMin) <= '.$cr[2]; + break; + } + return [1]; // always true, use post-filter + case 7: // startsquest [enum] + switch ($cr[1]) + { + case 1: // any + return ['ir.quest', 0, '!']; + case 2: // alliance + return ['AND', ['ir.quest', 0, '!'], [['qtqr.RequiredRaces', RACE_MASK_HORDE, '&'], 0], ['qtqr.RequiredRaces', RACE_MASK_ALLIANCE, '&']]; + case 3: // horde + return ['AND', ['ir.quest', 0, '!'], [['qtqr.RequiredRaces', RACE_MASK_ALLIANCE, '&'], 0], ['qtqr.RequiredRaces', RACE_MASK_HORDE, '&']]; + case 4: // both + return ['AND', ['ir.quest', 0, '!'], ['OR', ['AND', ['qtqr.RequiredRaces', RACE_MASK_ALLIANCE, '&'], ['qtqr.RequiredRaces', RACE_MASK_HORDE, '&']], ['qtqr.RequiredRaces', 0]]]; + case 5: // none + return ['ir.quest', NULL]; + } + break; + case 8: // endsquest [enum] + switch ($cr[1]) + { + case 1: // any + return ['qr.quest', 0, '!']; + case 2: // alliance + return ['AND', ['qr.quest', 0, '!'], [['qtqi.RequiredRaces', RACE_MASK_HORDE, '&'], 0], ['qtqi.RequiredRaces', RACE_MASK_ALLIANCE, '&']]; + case 3: // horde + return ['AND', ['qr.quest', 0, '!'], [['qtqi.RequiredRaces', RACE_MASK_ALLIANCE, '&'], 0], ['qtqi.RequiredRaces', RACE_MASK_HORDE, '&']]; + case 4: // both + return ['AND', ['qr.quest', 0, '!'], ['OR', ['AND', ['qtqi.RequiredRaces', RACE_MASK_ALLIANCE, '&'], ['qtqi.RequiredRaces', RACE_MASK_HORDE, '&']], ['qtqi.RequiredRaces', 0]]]; + case 5: // none + return ['qr.quest', NULL]; + } + break; + case 3: // faction [enum] + if (in_array($cr[1], $this->enums[$cr[0]])) + { + $facTpls = []; + $facs = new FactionList(array('OR', ['parentFactionId', $cr[1]], ['id', $cr[1]])); + foreach ($facs->iterate() as $__) + $facTpls = array_merge($facTpls, $facs->getField('templateIds')); + + if (!$facTpls) + return [0]; + + return ['OR', ['factionA', $facTpls], ['factionH', $facTpls]]; + } + break; + case 42: // increasesrepwith [enum] + if (in_array($cr[1], $this->enums[3])) // reuse + return ['OR', ['AND', ['rep.RewOnKillRepFaction1', $cr[1]], ['rep.RewOnKillRepValue1', 0, '>']], ['AND', ['rep.RewOnKillRepFaction2', $cr[1]], ['rep.RewOnKillRepValue2', 0, '>']]]; + + break; + case 43: // decreasesrepwith [enum] + if (in_array($cr[1], $this->enums[3])) // reuse + return ['OR', ['AND', ['rep.RewOnKillRepFaction1', $cr[1]], ['rep.RewOnKillRepValue1', 0, '<']], ['AND', ['rep.RewOnKillRepFaction2', $cr[1]], ['rep.RewOnKillRepValue2', 0, '<']]]; + + break; + case 12: // averagemoneydropped [op] [int] + if (!$this->isSaneNumeric($cr[2]) || !$this->int2Op($cr[1])) + break; + + return ['AND', ['((minGold + maxGold) / 2)', $cr[2], $cr[1]]]; + case 15: // gatherable [yn] + if ($this->int2Bool($cr[1])) + { + if ($cr[1]) + return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_HERBLOOT, '&']]; + else + return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_HERBLOOT, '&'], 0]]; + } + break; + case 44: // salvageable [yn] + if ($this->int2Bool($cr[1])) + { + if ($cr[1]) + return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_ENGINEERLOOT, '&']]; + else + return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_ENGINEERLOOT, '&'], 0]]; + } + break; + case 16: // minable [yn] + if ($this->int2Bool($cr[1])) + { + if ($cr[1]) + return ['AND', ['skinLootId', 0, '>'], ['typeFlags', NPC_TYPEFLAG_MININGLOOT, '&']]; + else + return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_MININGLOOT, '&'], 0]]; + } + break; + case 10: // skinnable [yn] + if ($this->int2Bool($cr[1])) + { + if ($cr[1]) + return ['AND', ['skinLootId', 0, '>'], [['typeFlags', NPC_TYPEFLAG_SPECIALLOOT, '&'], 0]]; + else + return ['OR', ['skinLootId', 0], [['typeFlags', NPC_TYPEFLAG_SPECIALLOOT, '&'], 0, '!']]; + } + break; + case 6: // foundin [enum] + case 38: // relatedevent [enum] + case 34: // usemodel [str] // displayId -> id:creatureDisplayInfo.dbc/model -> id:cratureModelData.dbc/modelPath + case 33: // hascomments [yn] + case 31: // hasscreenshots [yn] + case 40: // hasvideos [yn] + case 41: // haslocation [yn] [staff] +/* todo */ return [1]; + } + + unset($cr); + $this->error = true; + return [1]; + } + + protected function createSQLForValues() + { + $parts = []; + $_v = &$this->fiData['v']; + + // name [str] + if (isset($_v['na'])) + { + if (isset($_v['ex']) && $_v['ex'] == 'on') + $parts[] = ['OR', ['name_loc'.User::$localeId, $_v['na']], ['subname_loc'.User::$localeId, $_v['na']]]; + else + $parts[] = ['name_loc'.User::$localeId, $_v['na']]; + } + + // pet family [list] + if (isset($_v['fa'])) + { + $_ = (array)$_v['fa']; + if (!array_diff($_, [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 20, 21, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 45, 46])) + $parts[] = ['family', $_]; + else + unset($_v['cl']); + } + + // creatureLevel min [int] + if (isset($_v['minle'])) + { + if (is_int($_v['minle']) && $_v['minle'] > 0) + $parts[] = ['minLevel', $_v['minle'], '>=']; + else + unset($_v['minle']); + } + + // creatureLevel max [int] + if (isset($_v['maxle'])) + { + if (is_int($_v['maxle']) && $_v['maxle'] > 0) + $parts[] = ['maxLevel', $_v['maxle'], '<=']; + else + unset($_v['maxle']); + } + + // classification [list] + if (isset($_v['cl'])) + { + $_ = (array)$_v['cl']; + if (!array_diff($_, [0, 1, 2, 3, 4])) + $parts[] = ['rank', $_]; + else + unset($_v['cl']); + } + + // react Alliance [int] + if (isset($_v['ra'])) + { + $_ = (int)$_v['ra']; + if (in_array($_, [-1, 0, 1])) + $parts[] = ['ft.A', $_]; + else + unset($_v['ra']); + } + + // react Horde [int] + if (isset($_v['rh'])) + { + $_ = (int)$_v['rh']; + if (in_array($_, [-1, 0, 1])) + $parts[] = ['ft.H', $_]; + else + unset($_v['rh']); + } + + return $parts; + } + +} + ?> diff --git a/includes/types/faction.class.php b/includes/types/faction.class.php index b4d35bab..5abeaced 100644 --- a/includes/types/faction.class.php +++ b/includes/types/faction.class.php @@ -25,12 +25,10 @@ class FactionList extends BaseType foreach ($this->iterate() as &$_curTpl) { // prepare factionTemplates - if ($_curTpl['templateIds']) - $_curTpl['templateIds'] = explode(' ', $_curTpl['templateIds']); + $_curTpl['templateIds'] = $_curTpl['templateIds'] ? explode(' ', $_curTpl['templateIds']) : []; // prepare quartermaster - if ($_curTpl['qmNpcIds']) - $_curTpl['qmNpcIds'] = explode(' ', $_curTpl['qmNpcIds']); + $_curTpl['qmNpcIds'] = $_curTpl['qmNpcIds'] ? explode(' ', $_curTpl['qmNpcIds']) : []; } } diff --git a/includes/types/item.class.php b/includes/types/item.class.php index b6236cec..29537209 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -81,17 +81,20 @@ class ItemList extends BaseType { $ids = array_keys($this->templates); $itemz = DB::Aowow()->select(' - SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, iec.* FROM npc_vendor nv LEFT JOIN ?_itemextendedcost iec ON nv.extendedCost = iec.id WHERE nv.item IN (?a) + SELECT nv.item AS ARRAY_KEY1, nv.entry AS ARRAY_KEY2, 0 AS eventId, nv.maxcount, iec.* FROM npc_vendor nv LEFT JOIN ?_itemextendedcost iec ON nv.extendedCost = iec.id WHERE {nv.entry IN (?a) AND} nv.item IN (?a) UNION - SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, genv.eventEntry AS eventId, genv.maxcount, iec.* FROM game_event_npc_vendor genv JOIN creature c ON c.guid = genv.guid LEFT JOIN ?_itemextendedcost iec ON genv.extendedCost = iec.id WHERE genv.item IN (?a)', + SELECT genv.item AS ARRAY_KEY1, c.id AS ARRAY_KEY2, genv.eventEntry AS eventId, genv.maxcount, iec.* FROM game_event_npc_vendor genv JOIN creature c ON c.guid = genv.guid LEFT JOIN ?_itemextendedcost iec ON genv.extendedCost = iec.id {JOIN creature c ON c.guid = genv.guid AND 1= ?d} WHERE {c.id IN (?a) AND} genv.item IN (?a)', + empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC], $ids, + empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : 1, + empty($filter[TYPE_NPC]) || !is_array($filter[TYPE_NPC]) ? DBSIMPLE_SKIP : $filter[TYPE_NPC], $ids ); $cItems = []; - foreach ($itemz as &$vendors) + foreach ($itemz as $k => $vendors) { - foreach ($vendors as $k => $costs) + foreach ($vendors as $l => $costs) { $data = array( 'stock' => $costs['maxcount'] ? $costs['maxcount'] : -1, @@ -124,8 +127,10 @@ class ItemList extends BaseType } } - $vendors[$k] = $data; + $vendors[$l] = $data; } + + $itemz[$k] = $vendors; } // convert items to currency if possible @@ -134,9 +139,9 @@ class ItemList extends BaseType $moneyItems = new CurrencyList(array(['itemId', $cItems])); $moneyItems->addGlobalsToJscript(Util::$pageTemplate); - foreach ($itemz as $id => &$vendors) + foreach ($itemz as $id => $vendors) { - foreach ($vendors as &$costs) + foreach ($vendors as $l => $costs) { foreach ($costs as $k => $v) { @@ -158,7 +163,9 @@ class ItemList extends BaseType Util::$pageTemplate->extendGlobalIds(TYPE_ITEM, $k); } } + $vendors[$l] = $costs; } + $itemz[$id] = $vendors; } } @@ -170,19 +177,12 @@ class ItemList extends BaseType // apply filter if given $tok = @$filter[TYPE_ITEM]; $cur = @$filter[TYPE_CURRENCY]; - $npc = @$filter[TYPE_NPC]; // bought at specific vendor $reqRating = -1; foreach ($result as $itemId => $data) { foreach ($data as $npcId => $costs) { - if ($npc && $npcId != $npc) - { - unset($data[$npcId]); - continue; - } - if ($tok || $cur) // bought with specific token or currency { $valid = false; @@ -269,7 +269,6 @@ class ItemList extends BaseType $cost = @reset($this->getExtendedCost($miscData)[$this->id]); if ($cost) { - $currency = []; $tokens = []; foreach ($cost as $k => $qty) @@ -285,6 +284,17 @@ class ItemList extends BaseType $data[$this->id]['stock'] = $cost['stock']; $data[$this->id]['cost'] = [$this->getField('buyPrice')]; + + if ($e = $cost['event']) + { + Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, $e); + $data[$this->id]['condition'] = array( + 'type' => TYPE_WORLDEVENT, + 'typeId' => -$e, + 'status' => 1 + ); + } + if ($currency || $tokens) // fill idx:3 if required $data[$this->id]['cost'][] = $currency; @@ -725,7 +735,7 @@ class ItemList extends BaseType else if ($_reqLvl > 1) $x .= sprintf(Lang::$game['reqLevel'], $_reqLvl).'
'; - // required arena team raing / perosnal rating / todo (low): sort out what kind of rating + // required arena team rating / personal rating / todo (low): sort out what kind of rating if (@$this->getExtendedCost([], $reqRating)[$this->id] && $reqRating) $x .= sprintf(Lang::$item['reqRating'], $reqRating); diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index d39a9b15..81fcf06a 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -75,7 +75,7 @@ class QuestList extends BaseType quest_template q, locales_quest l WHERE - q.id = l.entry AND + q.id = l.id AND q.id = ?d', $id ); diff --git a/includes/types/worldevent.class.php b/includes/types/worldevent.class.php index c356a7f9..26d1be4b 100644 --- a/includes/types/worldevent.class.php +++ b/includes/types/worldevent.class.php @@ -9,7 +9,10 @@ class WorldEventList extends BaseType public static $type = TYPE_WORLDEVENT; protected $queryBase = 'SELECT *, -e.id AS ARRAY_KEY, -e.id as id FROM ?_events e'; - protected $queryOpts = ['e' => ['j' => ['?_holidays h ON e.holidayId = h.id', true], 'o' => '-e.id ASC']]; + 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']] + ); public function __construct($conditions = []) { @@ -73,49 +76,44 @@ class WorldEventList extends BaseType return Util::localizedString($row, 'name'); } - public static function updateDates($start, $end, $occurence, $final = 5000000000) // in the far far FAR future.. + public static function updateDates($date = null) { - if (!$start) + if (!$date || empty($date['firstDate']) || empty($date['length'])) { return array( - 'start' => 0, - 'end' => 0, - 'nextStart' => 0, - 'nextEnd' => 0 + 'start' => 0, + 'end' => 0, + 'rec' => 0 ); } // Convert everything to seconds - $start = intVal($start); - $end = intVal($end); - $occurence = intVal($occurence); - $final = intVal($final); + $firstDate = intVal($date['firstDate']); + $lastDate = !empty($date['lastDate']) ? intVal($date['lastDate']) : 5000000000; // in the far far FAR future..; + $interval = !empty($date['rec']) ? intVal($date['rec']) : -1; + $length = intVal($date['length']); - $now = time(); - $year = date("Y", $now); + $curStart = $firstDate; + $curEnd = $firstDate + $length; + $nextStart = $curStart + $interval; + $nextEnd = $curEnd + $interval; - $curStart = $start; - $curEnd = $end; - $nextStart = $curStart + $occurence; - $nextEnd = $curEnd + $occurence; - - while ($nextEnd <= $final && date("Y", $nextEnd) <= $year && $curEnd <= $now) + while ($interval > 0 && $nextEnd <= $lastDate && $curEnd < time()) { $curStart = $nextStart; $curEnd = $nextEnd; - $nextStart = $curStart + $occurence; - $nextEnd = $curEnd + $occurence; + $nextStart = $curStart + $interval; + $nextEnd = $curEnd + $interval; } return array( - 'start' => $curStart, - 'end' => $curEnd, - 'nextStart' => $nextStart, - 'nextEnd' => $nextEnd + 'start' => $curStart, + 'end' => $curEnd, + 'rec' => $interval ); } - public function getListviewData() + public function getListviewData($forNow = false) { $data = []; @@ -125,12 +123,27 @@ class WorldEventList extends BaseType 'category' => $this->curTpl['category'], 'id' => $this->id, 'name' => $this->getField('name', true), - 'rec' => $this->curTpl['occurence'], - 'startDate' => $this->curTpl['startTime'], - 'endDate' => $this->curTpl['startTime'] + $this->curTpl['length'] + '_date' => array( + 'rec' => $this->curTpl['occurence'], + 'length' => $this->curTpl['length'], + 'firstDate' => $this->curTpl['startTime'], + 'lastDate' => $this->curTpl['endTime'] + ) ); } + if ($forNow) + { + foreach ($data as &$d) + { + $u = self::updateDates($d['_date']); + unset($d['_date']); + $d['startDate'] = $u['start']; + $d['endDate'] = $u['end']; + $d['rec'] = $u['rec']; + } + } + return $data; } diff --git a/includes/utilities.php b/includes/utilities.php index bf3afe7c..bed0b5dc 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -3,280 +3,6 @@ if (!defined('AOWOW_REVISION')) die('invalid access'); -class Lang -{ - public static $timeUnits; - public static $main; - public static $account; - public static $game; - public static $error; - - public static $search; - public static $profiler; - - public static $achievement; - public static $class; - public static $currency; - public static $event; - public static $faction; - public static $item; - public static $itemset; - public static $maps; - public static $npc; - public static $pet; - public static $quest; - public static $skill; - public static $spell; - public static $title; - public static $zone; - - public static $colon; - - public static function load($loc) - { - if (!file_exists('localization/locale_'.$loc.'.php')) - die('File for localization '.strToUpper($loc).' not found.'); - else - require 'localization/locale_'.$loc.'.php'; - - foreach ($lang as $k => $v) - self::$$k = $v; - - // *cough* .. reuse-hack - self::$item['cat'][2] = [self::$item['cat'][2], self::$spell['weaponSubClass']]; - self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')'; - } - - // todo: expand - public static function getInfoBoxForFlags($flags) - { - $tmp = []; - - if ($flags & CUSTOM_DISABLED) - $tmp[] = '[tooltip name=disabledHint]'.Util::jsEscape(self::$main['disabledHint']).'[/tooltip][span class=tip tooltip=disabledHint]'.Util::jsEscape(self::$main['disabled']).'[/span]'; - - if ($flags & CUSTOM_SERVERSIDE) - $tmp[] = '[tooltip name=serversideHint]'.Util::jsEscape(self::$main['serversideHint']).'[/tooltip][span class=tip tooltip=serversideHint]'.Util::jsEscape(self::$main['serverside']).'[/span]'; - - if ($flags & CUSTOM_UNAVAILABLE) - $tmp[] = self::$main['unavailable']; - - return $tmp; - } - - public static function getLocks($lockId, $interactive = false) - { - $locks = []; - $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); - if (!$lock) - return ''; - - for ($i = 1; $i <= 5; $i++) - { - $prop = $lock['properties'.$i]; - $rank = $lock['reqSkill'.$i]; - $name = ''; - - if ($lock['type'.$i] == 1) // opened by item - { - $name = ItemList::getName($prop); - if (!$name) - continue; - - if ($interactive) - $name = ''.$name.''; - } - else if ($lock['type'.$i] == 2) // opened by skill - { - // exclude unusual stuff - 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'); - if (!$name) - continue; - - if ($interactive) - { - $skill = 0; - switch ($prop) - { - case 1: $skill = 633; break; // Lockpicking - case 2: $skill = 182; break; // Herbing - case 3: $skill = 186; break; // Mining - case 20: $skill = 773; break; // Scribing - } - - if ($skill) - $name = ''.$name.''; - } - - if ($rank > 0) - $name .= ' ('.$rank.')'; - } - else - continue; - - $locks[$lock['type'.$i] == 1 ? $i : -$i] = sprintf(Lang::$game['requires'], $name); - } - - return $locks; - } - - public static function getReputationLevelForPoints($pts) - { - if ($pts >= 41999) - return self::$game['rep'][REP_EXALTED]; - else if ($pts >= 20999) - return self::$game['rep'][REP_REVERED]; - else if ($pts >= 8999) - return self::$game['rep'][REP_HONORED]; - else if ($pts >= 2999) - return self::$game['rep'][REP_FRIENDLY]; - else /* if ($pts >= 1) */ - return self::$game['rep'][REP_NEUTRAL]; - } - - public static function getRequiredItems($class, $mask, $short = true) - { - if (!in_array($class, [ITEM_CLASS_MISC, ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON])) - return ''; - - // not checking weapon / armor here. It's highly unlikely that they overlap - if ($short) - { - // misc - Mounts - if ($class == ITEM_CLASS_MISC) - return ''; - - // all basic armor classes - if ($class == ITEM_CLASS_ARMOR && ($mask & 0x1E) == 0x1E) - return ''; - - // all weapon classes - if ($class == ITEM_CLASS_WEAPON && ($mask & 0x1DE5FF) == 0x1DE5FF) - return ''; - - foreach (Lang::$spell['subClassMasks'] as $m => $str) - if ($mask == $m) - return $str; - } - - if ($class == ITEM_CLASS_MISC) // yeah hardcoded.. sue me! - return Lang::$spell['cat'][-5]; - - $tmp = []; - $strs = Lang::$spell[$class == ITEM_CLASS_ARMOR ? 'armorSubClass' : 'weaponSubClass']; - foreach ($strs as $k => $str) - if ($mask & (1 << $k) && $str) - $tmp[] = $str; - - return implode(', ', $tmp); - } - - public static function getStances($stanceMask) - { - $stanceMask &= 0xFC27909F; // clamp to available stances/forms.. - - $tmp = []; - $i = 1; - - while ($stanceMask) - { - if ($stanceMask & (1 << ($i - 1))) - { - $tmp[] = self::$game['st'][$i]; - $stanceMask &= ~(1 << ($i - 1)); - } - $i++; - } - - return implode(', ', $tmp); - } - - public static function getMagicSchools($schoolMask) - { - $schoolMask &= SPELL_ALL_SCHOOLS; // clamp to available schools.. - $tmp = []; - $i = 0; - - while ($schoolMask) - { - if ($schoolMask & (1 << $i)) - { - $tmp[] = self::$game['sc'][$i]; - $schoolMask &= ~(1 << $i); - } - $i++; - } - - return implode(', ', $tmp); - } - - public static function getClassString($classMask) - { - $classMask &= CLASS_MASK_ALL; // clamp to available classes.. - - if ($classMask == CLASS_MASK_ALL) // available to all classes - return false; - - $tmp = []; - $i = 1; - - while ($classMask) - { - if ($classMask & (1 << ($i - 1))) - { - $tmp[] = ''.self::$game['cl'][$i].''; - $classMask &= ~(1 << ($i - 1)); - } - $i++; - } - - return implode(', ', $tmp); - } - - public static function getRaceString($raceMask) - { - $raceMask &= RACE_MASK_ALL; // clamp to available races.. - - if ($raceMask == RACE_MASK_ALL) // available to all races (we don't display 'both factions') - return false; - - $tmp = []; - $side = 0; - $i = 1; - - if (!$raceMask) - return array('side' => SIDE_BOTH, 'name' => self::$game['ra'][0]); - - if ($raceMask == RACE_MASK_HORDE) - return array('side' => SIDE_HORDE, 'name' => self::$game['ra'][-2]); - - if ($raceMask == RACE_MASK_ALLIANCE) - return array('side' => SIDE_ALLIANCE, 'name' => self::$game['ra'][-1]); - - if ($raceMask & RACE_MASK_HORDE) - $side |= SIDE_HORDE; - - if ($raceMask & RACE_MASK_ALLIANCE) - $side |= SIDE_ALLIANCE; - - while ($raceMask) - { - if ($raceMask & (1 << ($i - 1))) - { - $tmp[] = ''.self::$game['ra'][$i].''; - $raceMask &= ~(1 << ($i - 1)); - } - $i++; - } - - return array ('side' => $side, 'name' => implode(', ', $tmp)); - } -} - class SmartyAoWoW extends Smarty { private $config = []; @@ -289,8 +15,6 @@ class SmartyAoWoW extends Smarty $cwd = str_replace("\\", "/", getcwd()); - $this->assign('appName', $config['name']); - $this->assign('AOWOW_REVISION', AOWOW_REVISION); $this->config = $config; $this->template_dir = $cwd.'/template/'; $this->compile_dir = $cwd.'/cache/template/'; @@ -300,17 +24,20 @@ class SmartyAoWoW extends Smarty $this->left_delimiter = '{'; $this->right_delimiter = '}'; $this->caching = false; // Total Cache, this site does not work - $this->_tpl_vars['page'] = array( - 'reqJS' => [], // <[string]> path to required JSFile - 'reqCSS' => [], // <[string,string]> path to required CSSFile, IE condition - 'title' => null, // [string] page title - 'tab' => null, // [int] # of tab to highlight in the menu - 'type' => null, // [int] numCode for spell, npc, object, ect - 'typeId' => null, // [int] entry to display - 'path' => '[]' // [string] (js:array) path to preselect in the menu + $this->_tpl_vars = array( + 'reqJS' => [], // <[string]> path to required JSFile + 'reqCSS' => [], // <[string,string]> path to required CSSFile, IE condition + 'title' => null, // [string] page title + 'tab' => null, // [int] # of tab to highlight in the menu + 'type' => null, // [int] numCode for spell, npc, object, ect + 'typeId' => null, // [int] entry to display + 'path' => '[]', // [string] (js:array) path to preselect in the menu + 'jsGlobals' => [], + 'redButtons' => [], + 'headIcons' => [], // icons in front of title ); - $this->_tpl_vars['jsGlobals'] = []; - $this->_tpl_vars['redButtons'] = []; + $this->assign('appName', $config['name']); + $this->assign('AOWOW_REVISION', AOWOW_REVISION); } // using Smarty::assign would overwrite every pair and result in undefined indizes @@ -320,7 +47,7 @@ class SmartyAoWoW extends Smarty return; foreach ($pageVars as $var => $val) - $this->_tpl_vars['page'][$var] = $val; + $this->_tpl_vars[$var] = $val; } // use, if you want to alert the staff to a problem with Trinity @@ -334,13 +61,13 @@ class SmartyAoWoW extends Smarty $tv = &$this->_tpl_vars; // fetch article & static infobox - if ($tv['page']['type'] && $tv['page']['typeId']) + if ($tv['type'] && $tv['typeId']) { $article = DB::Aowow()->selectRow( 'SELECT SQL_CALC_FOUND_ROWS article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = ?d UNION ALL '. 'SELECT article, quickInfo, locale FROM ?_articles WHERE type = ?d AND typeId = ?d AND locale = 0 AND FOUND_ROWS() = 0', - $tv['page']['type'], $tv['page']['typeId'], User::$localeId, - $tv['page']['type'], $tv['page']['typeId'] + $tv['type'], $tv['typeId'], User::$localeId, + $tv['type'], $tv['typeId'] ); if ($article) @@ -390,12 +117,12 @@ class SmartyAoWoW extends Smarty } // fetch announcements - if ($tv['query'][0] && !preg_match('/[^a-z]/i', $tv['query'][0])) + if (preg_match('/^([a-z\-]+)=?.*$/i', $_SERVER['QUERY_STRING'], $match)) { if (!isset($tv['announcements'])) $tv['announcements'] = []; - $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ? OR page = "*")', $tv['query'][0]); + $ann = DB::Aowow()->Select('SELECT * FROM ?_announcements WHERE status = 1 AND (page = ? OR page = "*")', $match[0]); foreach ($ann as $k => $v) { if ($t = Util::localizedString($v, 'text')) @@ -510,11 +237,11 @@ class SmartyAoWoW extends Smarty } } - public function notFound($subject) + public function notFound($subject, $entry) { $this->updatePageVars(array( 'subject' => Util::ucFirst($subject), - 'id' => intVal($this->_tpl_vars['query'][1]), + 'id' => $entry, 'notFound' => sprintf(Lang::$main['pageNotFound'], $subject) )); @@ -733,8 +460,7 @@ class Util 'clothChestArmor', 'leatherChestArmor', 'mailChestArmor', 'plateChestArmor' ); - public static $dateFormatShort = "Y/m/d"; - public static $dateFormatLong = "Y/m/d H:i:s"; + public static $dateFormatInternal = "Y/m/d H:i:s"; public static $changeLevelString = '%s'; @@ -1370,6 +1096,12 @@ class Util if ($short) { + if ($_ = round($s['d'] / 365)) + return $_." ".Lang::$timeUnits['ab'][0]; + if ($_ = round($s['d'] / 30)) + return $_." ".Lang::$timeUnits['ab'][1]; + if ($_ = round($s['d'] / 7)) + return $_." ".Lang::$timeUnits['ab'][2]; if ($_ = round($s['d'])) return $_." ".Lang::$timeUnits['ab'][3]; if ($_ = round($s['h'])) @@ -1385,6 +1117,12 @@ class Util } else { + if (!(($s['d'] + $s['h']) % 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 + 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 + 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]; if ($s['h']) @@ -1449,26 +1187,30 @@ class Util '' => '', '' => '', '' => '', - '

' => '
', - "\n" => '', - "\r" => '' + '

' => '
' ); - // html may contain images + // 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" => '']); - // gender switch - // ok, directed gender-reference: ($g:male:female:ref) where 'ref' is the variable (see $pairs) forward in the text determining the gender - $text = preg_replace('/\$g\s*([^:;]+)\s*:\s*([^:;]+)\s*(:?[^:;]*);/ui', '<\1/\2>', $text); + $from = array( + '/\|T([\w]+\\\)*([^\.]+)\.blp:\d+\|t/ui', // images (force size to tiny) |T:|t + '/\|c(\w{6})\w{2}([^\|]+)\|r/ui', // color |c|r + '/\$g\s*([^:;]+)\s*:\s*([^:;]+)\s*(:?[^:;]*);/ui',// directed gender-reference $g::: + '/\$t([^;]+);/ui', // nonesense, that the client apparently ignores + '/\|\d\-?\d?\((\$\w)\)/ui' // and another modifier for something russian |3-6($r) + ); - // nonesense, that the client apparently ignores - $text = preg_replace('/\$t([^;]+);/ui', '', $text); + $to = array( + '', + '\2', + '<\1/\2>', + '', + '\1' + ); - // and another modifier for something russian |3-6($r) .. jesus christ <_< - $text = preg_replace('/\|\d\-?\d?\((\$\w)\)/ui', '\1', $text); + $text = preg_replace($from, $to, $text); $pairs = array( '$c' => '<'.Lang::$game['class'].'>', @@ -1479,6 +1221,8 @@ class Util '$N' => '<'.Lang::$main['name'].'>', '$b' => '
', '$B' => '
', + "\n" => '
', + "\r" => '', '|n' => '' // what .. the fuck .. another type of line terminator? (only in spanish though) ); @@ -1523,10 +1267,9 @@ class Util return strtr(trim($string), array( '\\' => '\\\\', "'" => "\\'", - // '"' => '\\"', + '"' => '\\"', "\r" => '\\r', - "\n" => '\\n', - // ' '<\/', + "\n" => '\\n' )); } @@ -1567,12 +1310,14 @@ class Util public static function extractURLParams($str) { - $arr = explode('.', $str); + $arr = explode('.', $str); + $params = []; - foreach ($arr as $i => $a) - $arr[$i] = is_numeric($a) ? (int)$a : null; + foreach ($arr as $v) + if (is_numeric($v)) + $params[] = (int)$v; - return $arr; + return $params; } // for item and spells @@ -1732,19 +1477,20 @@ class Util { switch (count($keys)) { - case 0: + case 0: // no params works always return true; - case 1: - return (is_int($keys) && in_array($keys, $struct)) || (is_array($keys) && (isset($struct[$keys[0]]) || $keys[0] === null && count($keys) == 1)); - case 2: + 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 2: // first param has to be a key. otherwise invalid if (!isset($struct[$keys[0]])) return false; + // check if the sub-array is n-imensional if (count($struct[$keys[0]]) == count($struct[$keys[0]], COUNT_RECURSIVE)) - return in_array($keys[1], $struct[$keys[0]]); + return in_array($keys[1], $struct[$keys[0]]); // second param is value in second level array else - return isset($struct[$keys[0]][$keys[1]]); - case 3: + return isset($struct[$keys[0]][$keys[1]]); // check if params is key of another array + case 3: // 3 params MUST point to a specific value return isset($struct[$keys[0]][$keys[1]]) && in_array($keys[2], $struct[$keys[0]][$keys[1]]); } @@ -1872,7 +1618,7 @@ class Util quest_mail_loot_template entry quest_template RewMailTemplateId reference_loot_template entry many <- many _loot_template -mincountOrRef In case of negative mincountOrRef */ - private static function getLootByEntry($tableName, $lootId, $groupId = 0, $baseChance = 1.0) + private static function getLootByEntry($tableName, $lootId, &$handledRefs, $groupId = 0, $baseChance = 1.0) { $loot = []; $rawItems = []; @@ -1895,17 +1641,17 @@ class Util 'realChanceMod' => $baseChance ); - if ($entry['lootmode'] > 1) - { + // if ($entry['lootmode'] > 1) + // { $buff = []; for ($i = 0; $i < 8; $i++) if ($entry['lootmode'] & (1 << $i)) - $buff[] = $i; + $buff[] = $i + 1; $set['mode'] = implode(', ', $buff); - } - else - $set['mode'] = 0; + // } + // else + // $set['mode'] = 0; /* modes:{"mode":8,"4":{"count":7173,"outof":17619},"8":{"count":7173,"outof":10684}} @@ -1921,11 +1667,17 @@ class Util */ if ($entry['mincountOrRef'] < 0) - { // todo (high): find out, why i used this in the first place. (don't do drugs, kids) - list($data, $raw) = self::getLootByEntry(LOOT_REFERENCE, $entry['mincountOrRef'], /*$entry['groupid'],*/ 0, abs($entry['ChanceOrQuestChance'] / 100)); + { + // bandaid.. remove when propperly handling lootmodes + if (!in_array($entry['mincountOrRef'], $handledRefs)) + { // todo (high): find out, why i used this in the first place. (don't do drugs, kids) + list($data, $raw) = self::getLootByEntry(LOOT_REFERENCE, $entry['mincountOrRef'], $handledRefs, /*$entry['groupid'],*/ 0, abs($entry['ChanceOrQuestChance'] / 100)); - $loot = array_merge($loot, $data); - $rawItems = array_merge($rawItems, $raw); + $handledRefs[] = $entry['mincountOrRef']; + + $loot = array_merge($loot, $data); + $rawItems = array_merge($rawItems, $raw); + } $set['content'] = $entry['mincountOrRef']; $set['multiplier'] = $entry['maxcount']; @@ -1999,13 +1751,16 @@ class Util // if (is_array($entry) && in_array($table, [LOOT_CREATURE, LOOT_GAMEOBJECT]) // iterate over the 4 available difficulties and assign modes - */ - $struct = self::getLootByEntry($table, $entry); + + modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}} + */ + $handledRefs = []; + $struct = self::getLootByEntry($table, $entry, $handledRefs); if (!$struct) return $lv; - $items = new ItemList(array(['i.id', $struct[1]])); + $items = new ItemList(array(['i.id', $struct[1]], SQL_LIMIT_NONE)); $items->addGlobalsToJscript(Util::$pageTemplate, GLOBALINFO_SELF | GLOBALINFO_RELATED); $foo = $items->getListviewData(); @@ -2042,7 +1797,7 @@ class Util else $lv[$loot['content']]['percent'] += $base['percent']; } - else + else // in case of limited trash loot, check if $foo[] exists $lv[] = array_merge($foo[$loot['content']], $base, ['stack' => [$loot['min'], $loot['max']]]); } else if ($debug) // create dummy for ref-drop @@ -2081,11 +1836,21 @@ class Util else { $fields = ['mode', 'reference']; + $base = []; $set = 0; foreach ($lv as $foo) + { foreach ($fields as $idx => $field) - if (!empty($foo[$field])) + { + if (!isset($base[$idx])) + $base[$idx] = @$foo[$field]; + else if ($base[$idx] != @$foo[$field]) $set |= 1 << $idx; + } + + if ($set == (pow(2, count($fields)) - 1)) + break; + } $debugCols[] = "Listview.funcBox.createSimpleCol('group', 'Group', '7%', 'group')"; foreach ($fields as $idx => $field) @@ -2341,11 +2106,11 @@ class Util foreach ($srcObj->iterate() as $_) { - if ($tabId < 0 && $curTpl['type_flags'] & NPC_TYPEFLAG_HERBLOOT) + if ($tabId < 0 && $curTpl['typeFlags'] & NPC_TYPEFLAG_HERBLOOT) $tabId = 9; - else if ($tabId < 0 && $curTpl['type_flags'] & NPC_TYPEFLAG_ENGINEERLOOT) + else if ($tabId < 0 && $curTpl['typeFlags'] & NPC_TYPEFLAG_ENGINEERLOOT) $tabId = 8; - else if ($tabId < 0 && $curTpl['type_flags'] & NPC_TYPEFLAG_MININGLOOT) + else if ($tabId < 0 && $curTpl['typeFlags'] & NPC_TYPEFLAG_MININGLOOT) $tabId = 7; else if ($tabId < 0) $tabId = abs($tabId); // general case (skinning) diff --git a/localization/lang.class.php b/localization/lang.class.php new file mode 100644 index 00000000..05aada93 --- /dev/null +++ b/localization/lang.class.php @@ -0,0 +1,279 @@ + $v) + self::$$k = $v; + + // *cough* .. reuse-hack + self::$item['cat'][2] = [self::$item['cat'][2], self::$spell['weaponSubClass']]; + self::$item['cat'][2][1][14] .= ' ('.self::$item['cat'][2][0].')'; + } + + // todo: expand + public static function getInfoBoxForFlags($flags) + { + $tmp = []; + + if ($flags & CUSTOM_DISABLED) + $tmp[] = '[tooltip name=disabledHint]'.Util::jsEscape(self::$main['disabledHint']).'[/tooltip][span class=tip tooltip=disabledHint]'.Util::jsEscape(self::$main['disabled']).'[/span]'; + + if ($flags & CUSTOM_SERVERSIDE) + $tmp[] = '[tooltip name=serversideHint]'.Util::jsEscape(self::$main['serversideHint']).'[/tooltip][span class=tip tooltip=serversideHint]'.Util::jsEscape(self::$main['serverside']).'[/span]'; + + if ($flags & CUSTOM_UNAVAILABLE) + $tmp[] = self::$main['unavailable']; + + return $tmp; + } + + public static function getLocks($lockId, $interactive = false) + { + $locks = []; + $lock = DB::Aowow()->selectRow('SELECT * FROM ?_lock WHERE id = ?d', $lockId); + if (!$lock) + return ''; + + for ($i = 1; $i <= 5; $i++) + { + $prop = $lock['properties'.$i]; + $rank = $lock['reqSkill'.$i]; + $name = ''; + + if ($lock['type'.$i] == 1) // opened by item + { + $name = ItemList::getName($prop); + if (!$name) + continue; + + if ($interactive) + $name = ''.$name.''; + } + else if ($lock['type'.$i] == 2) // opened by skill + { + // exclude unusual stuff + 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'); + if (!$name) + continue; + + if ($interactive) + { + $skill = 0; + switch ($prop) + { + case 1: $skill = 633; break; // Lockpicking + case 2: $skill = 182; break; // Herbing + case 3: $skill = 186; break; // Mining + case 20: $skill = 773; break; // Scribing + } + + if ($skill) + $name = ''.$name.''; + } + + if ($rank > 0) + $name .= ' ('.$rank.')'; + } + else + continue; + + $locks[$lock['type'.$i] == 1 ? $i : -$i] = sprintf(Lang::$game['requires'], $name); + } + + return $locks; + } + + public static function getReputationLevelForPoints($pts) + { + if ($pts >= 41999) + return self::$game['rep'][REP_EXALTED]; + else if ($pts >= 20999) + return self::$game['rep'][REP_REVERED]; + else if ($pts >= 8999) + return self::$game['rep'][REP_HONORED]; + else if ($pts >= 2999) + return self::$game['rep'][REP_FRIENDLY]; + else /* if ($pts >= 1) */ + return self::$game['rep'][REP_NEUTRAL]; + } + + public static function getRequiredItems($class, $mask, $short = true) + { + if (!in_array($class, [ITEM_CLASS_MISC, ITEM_CLASS_ARMOR, ITEM_CLASS_WEAPON])) + return ''; + + // not checking weapon / armor here. It's highly unlikely that they overlap + if ($short) + { + // misc - Mounts + if ($class == ITEM_CLASS_MISC) + return ''; + + // all basic armor classes + if ($class == ITEM_CLASS_ARMOR && ($mask & 0x1E) == 0x1E) + return ''; + + // all weapon classes + if ($class == ITEM_CLASS_WEAPON && ($mask & 0x1DE5FF) == 0x1DE5FF) + return ''; + + foreach (Lang::$spell['subClassMasks'] as $m => $str) + if ($mask == $m) + return $str; + } + + if ($class == ITEM_CLASS_MISC) // yeah hardcoded.. sue me! + return Lang::$spell['cat'][-5]; + + $tmp = []; + $strs = Lang::$spell[$class == ITEM_CLASS_ARMOR ? 'armorSubClass' : 'weaponSubClass']; + foreach ($strs as $k => $str) + if ($mask & (1 << $k) && $str) + $tmp[] = $str; + + return implode(', ', $tmp); + } + + public static function getStances($stanceMask) + { + $stanceMask &= 0xFC27909F; // clamp to available stances/forms.. + + $tmp = []; + $i = 1; + + while ($stanceMask) + { + if ($stanceMask & (1 << ($i - 1))) + { + $tmp[] = self::$game['st'][$i]; + $stanceMask &= ~(1 << ($i - 1)); + } + $i++; + } + + return implode(', ', $tmp); + } + + public static function getMagicSchools($schoolMask) + { + $schoolMask &= SPELL_ALL_SCHOOLS; // clamp to available schools.. + $tmp = []; + $i = 0; + + while ($schoolMask) + { + if ($schoolMask & (1 << $i)) + { + $tmp[] = self::$game['sc'][$i]; + $schoolMask &= ~(1 << $i); + } + $i++; + } + + return implode(', ', $tmp); + } + + public static function getClassString($classMask) + { + $classMask &= CLASS_MASK_ALL; // clamp to available classes.. + + if ($classMask == CLASS_MASK_ALL) // available to all classes + return false; + + $tmp = []; + $i = 1; + + while ($classMask) + { + if ($classMask & (1 << ($i - 1))) + { + $tmp[] = ''.self::$game['cl'][$i].''; + $classMask &= ~(1 << ($i - 1)); + } + $i++; + } + + return implode(', ', $tmp); + } + + public static function getRaceString($raceMask) + { + $raceMask &= RACE_MASK_ALL; // clamp to available races.. + + if ($raceMask == RACE_MASK_ALL) // available to all races (we don't display 'both factions') + return false; + + $tmp = []; + $side = 0; + $i = 1; + + if (!$raceMask) + return array('side' => SIDE_BOTH, 'name' => self::$game['ra'][0]); + + if ($raceMask == RACE_MASK_HORDE) + return array('side' => SIDE_HORDE, 'name' => self::$game['ra'][-2]); + + if ($raceMask == RACE_MASK_ALLIANCE) + return array('side' => SIDE_ALLIANCE, 'name' => self::$game['ra'][-1]); + + if ($raceMask & RACE_MASK_HORDE) + $side |= SIDE_HORDE; + + if ($raceMask & RACE_MASK_ALLIANCE) + $side |= SIDE_ALLIANCE; + + while ($raceMask) + { + if ($raceMask & (1 << ($i - 1))) + { + $tmp[] = ''.self::$game['ra'][$i].''; + $raceMask &= ~(1 << ($i - 1)); + } + $i++; + } + + return array ('side' => $side, 'name' => implode(', ', $tmp)); + } +} + +?> \ No newline at end of file diff --git a/localization/locale_dede.php b/localization/locale_dede.php index b8e4236a..57717307 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -145,9 +145,9 @@ $lang = array( 'npcs' => "NPCs", 'pet' => "Begleiter", 'pets' => "Begleiter", - 'requires' => "Benötigt %s", 'profile' => "", 'profiles' => "Profile", + 'requires' => "Benötigt %s", 'requires2' => "Benötigt", 'reqLevel' => "Benötigt Stufe %s", 'reqLevelHlm' => "Benötigt Stufe %s", @@ -203,7 +203,7 @@ $lang = array( ), 'ct' => array( "Nicht kategorisiert", "Wildtier", "Drachkin", "Dämon", "Elementar", "Riese", "Untoter", "Humanoid", - "Tier", "Mechanisch", "Nicht spezifiziert", "Totem", "Haustier", "Gas Wolke" + "Tier", "Mechanisch", "Nicht spezifiziert", "Totem", "Haustier", "Gaswolke" ), 'fa' => array( 1 => "Wolf", 2 => "Katze", 3 => "Spinne", 4 => "Bär", 5 => "Eber", 6 => "Krokilisk", 7 => "Aasvogel", 8 => "Krebs", @@ -261,9 +261,32 @@ $lang = array( 'viewPubDesc' => "Die Beschreibung in deinem öffentlichen Profil ansehen", ), 'npc' => array( - 'rank' => ['Normal', 'Elite', 'Rar Elite', 'Boss', 'Rar'] + 'rank' => [0 => "Normal", 1 => "Elite", 4 => "Rar", 2 => "Rar Elite", 3 => "Boss"], + 'classification'=> "Einstufung", + 'petFamily' => "Tierart", + 'react' => "Reaktion", + 'worth' => "Wert", + 'unkPosition' => "Der Aufenthaltsort dieses NPCs ist nicht bekannt.", + 'difficultyPH' => "Dieser NPC ist ein Platzhalter für einen anderen Modus von", + 'quotes' => "Zitate", + 'gainsDesc' => "Nach dem Töten dieses NPCs erhaltet Ihr", + 'repWith' => "Ruf mit der Fraktion", + 'stopsAt' => "Stoppt bei %s", + 'textTypes' => [null, "schreit", "sagt", "flüstert"], + 'modes' => array( + 1 => ["Normal", "Heroisch"], + 2 => ["10-Spieler Normal", "25-Spieler Normal", "10-Spieler Heroisch", "25-Spieler Heroisch"] + ), + 'cat' => array( + "Nicht kategorisiert", "Wildtiere", "Drachkin", "Dämonen", "Elementare", "Riesen", "Untote", "Humanoide", + "Tiere", "Mechanisch", "Nicht spezifiziert", "Totems", "Haustiere", "Gaswolken" + ) ), 'event' => array( + 'start' => "Anfang", + 'end' => "Ende", + 'interval' => "Intervall", + 'inProgress' => "Ereignis findet gerade statt", 'category' => array("Nicht kategorisiert", "Feiertage", "Wiederkehrend", "Spieler vs. Spieler") ), 'achievement' => array( @@ -275,6 +298,7 @@ $lang = array( 'itemReward' => "Ihr bekommt:", 'titleReward' => "Euch wird der Titel \"%s\" verliehen", 'slain' => "getötet", + 'reqNumCrt' => "Benötigt" ), 'class' => array( 'racialLeader' => "Volksanführer", @@ -322,6 +346,7 @@ $lang = array( ) ), 'currency' => array( + 'cap' => "Obergrenze", 'cat' => array( 1 => "Verschiedenes", 2 => "Spieler gegen Spieler", 4 => "Classic", 21 => "Wrath of the Lich King", 22 => "Dungeon und Schlachtzug", 23 => "Burning Crusade", 41 => "Test", 3 => "Unbenutzt" ) @@ -344,7 +369,7 @@ $lang = array( '_pieces' => "Teile", '_unavailable' => "Dieses Ausrüstungsset ist nicht für Spieler verfügbar.", '_tag' => "Tag", - + 'summary' => "Zusammenfassung", 'notes' => array( null, "Dungeon-Set 1", "Dungeon-Set 2", "Tier 1 Raid-Set", "Tier 2 Raid-Set", "Tier 3 Raid-Set", "Level 60 PvP-Set (Rar)", "Level 60 PvP-Set (Rar, alt)", @@ -698,7 +723,9 @@ $lang = array( "Unbekannter Bonus #%d (%d)", ) ), - 'colon' => ': ' + 'colon' => ': ', + 'dateFmtShort' => "d.m.Y", + 'dateFmtLong' => "d.m.Y \u\m H:i" ); ?> diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 50ba6838..3c7d2679 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -248,9 +248,32 @@ $lang = array( 'viewPubDesc' => "View your Public Description in your Profile Page", ), 'npc' => array( - 'rank' => ['Normal', 'Elite', 'Rare Elite', 'Boss', 'Rare'] + 'rank' => [0 => "Normal", 1 => "Elite", 4 => "Rare", 2 => "Rare Elite", 3 => "Boss"], + 'classification'=> "Classification", + 'petFamily' => "Pet familiy", + 'react' => "React", + 'worth' => "Worth", + 'unkPosition' => "The location of this NPC is unknown.", + 'difficultyPH' => "This NPC is a placeholder for a different mode of", + 'quotes' => "Quotes", + 'gainsDesc' => "After killing this NPC you will gain", + 'repWith' => "reputation with", + 'stopsAt' => "stops at %s", + 'textTypes' => [null, "yells", "says", "whispers"], + 'modes' => array( + 1 => ["Normal", "Heroic"], + 2 => ["10-player Normal", "25-player Normal", "10-player Heroic", "25-player Heroic"] + ), + 'cat' => array( + "Uncategorized", "Beasts", "Dragonkins", "Demons", "Elementals", "Giants", "Undead", "Humanoids", + "Critters", "Mechanicals", "Not specified", "Totems", "Non-combat Pets", "Gas Clouds" + ), ), 'event' => array( + 'start' => "Start", + 'end' => "End", + 'interval' => "Interval", + 'inProgress' => "Event is currently in progress", 'category' => array("Uncategorized", "Holidays", "Recurring", "Player vs. Player") ), 'achievement' => array( @@ -262,6 +285,7 @@ $lang = array( 'itemReward' => "You will receive:", 'titleReward' => "You shall be granted the title \"%s\"", 'slain' => "slain", + 'reqNumCrt' => "Requires" ), 'class' => array( 'racialLeader' => "Racial leader", @@ -309,6 +333,7 @@ $lang = array( ) ), 'currency' => array( + 'cap' => "Total cap", 'cat' => array( 1 => "Miscellaneous", 2 => "Player vs. Player", 4 => "Classic", 21 => "Wrath of the Lich King", 22 => "Dungeon and Raid", 23 => "Burning Crusade", 41 => "Test", 3 => "Unused" ) @@ -331,7 +356,7 @@ $lang = array( '_pieces' => "pieces", '_unavailable' => "This item set is not available to players.", '_tag' => "Tag", - + 'summary' => "Summary", 'notes' => array( null, "Dungeon Set 1", "Dungeon Set 2", "Tier 1 Raid Set", "Tier 2 Raid Set", "Tier 3 Raid Set", "Level 60 PvP Rare Set", "Level 60 PvP Rare Set (Old)", @@ -685,7 +710,9 @@ $lang = array( "Unknown Bonus #%d (%d)", ) ), - 'colon' => ': ' + 'colon' => ': ', + 'dateFmtShort' => "Y/m/d", + 'dateFmtLong' => "Y/m/d \a\\t H:i" ); ?> diff --git a/localization/locale_eses.php b/localization/locale_eses.php index f6db132c..746f5c6d 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -219,9 +219,32 @@ $lang = array( ), 'account' => [], 'npc' => array( - 'rank' => ['Normal', 'Élite', 'Élite raro', 'Jefe', 'Raro'] + 'rank' => [0 => "Normal", 1 => "Élite", 4 => "Raro", 2 => "Élite raro", 3 => "Jefe"], + 'classification'=> "Clasificación", + 'petFamily' => "Familia de mascota", + 'react' => "Reacción", + 'worth' => "Valor", + 'unkPosition' => "No se conoce la ubicación de este PNJ.", + 'difficultyPH' => "[Este PNJ es un marcador de posición para un modo diferente de]", + 'quotes' => "Citas", + 'gainsDesc' => "Tras acabar con este PNJ ganarás", + 'repWith' => "reputación con", + 'stopsAt' => "se detiene en %s", + 'textTypes' => [null, "grita", "dice", "susurra"], + 'modes' => array( + 1 => ["Normal", "Heroico"], + 2 => ["10 jugadores Normal", "25 jugadores Normal", "10 jugadores Heroico", "25 jugadores Heroico"] + ), + 'cat' => array( + "Sin categoría", "Bestia", "Dragonante", "Demonio", "Elemental", "Gigante", "No-muerto", "Humanoide", + "Alimaña", "Mecánico", "Sin especificar", "Tótem", "Mascota mansa", "Nube de gas" + ) ), 'event' => array( + 'start' => "Empieza", + 'end' => "Termina", + 'interval' => "Intervalo", + 'inProgress' => "El evento está en progreso actualmente", 'category' => array("Sin categoría", "Vacacionales", "Periódicos", "Jugador contra Jugador") ), 'achievement' => array( @@ -233,6 +256,7 @@ $lang = array( 'itemReward' => "Recibirás:", 'titleReward' => "Deberías obtener el título \"%s\"", 'slain' => "matado", + 'reqNumCrt' => "Requiere" ), 'class' => array( 'racialLeader' => "Lider racial", @@ -280,6 +304,7 @@ $lang = array( ) ), 'currency' => array( + 'cap' => "Límite total", 'cat' => array( 1 => "Miscelánea", 2 => "Jugador contra Jugador", 4 => "Clásico", 21 => "Wrath of the Lich King", 22 => "Mazmorra y banda", 23 => "Burning Crusade", 41 => "Prueba", 3 => "No las uso" ) @@ -302,7 +327,7 @@ $lang = array( '_pieces' => "piezas", '_unavailable' => "Este conjunto de objetos no está disponible para jugadores.", '_tag' => "Etiqueta", - + 'summary' => "Resúmen", 'notes' => array( null, "Set de mazmorra 1", "Set de mazmorra 2", "Set de banda tier 1", "Set de banda tier 2", "Set de banda tier 3", "Set JcJ nivel 60 superior", "Set JcJ nivel 60 superior (obsoleto)", @@ -656,7 +681,9 @@ $lang = array( "Estadística no utilizada #%d (%d)", ) ), - 'colon' => ': ' + 'colon' => ': ', + 'dateFmtShort' => "d/m/Y", + 'dateFmtLong' => "d/m/Y \a \l\a\s H:i" ); ?> diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index d8c0617e..becae17e 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -219,9 +219,32 @@ $lang = array( ), 'account' => [], 'npc' => array( - 'rank' => ['Standard', 'Élite', 'Élite rare', 'Boss', 'Rare'] + 'rank' => [0 => "Standard", 1 => "Élite", 4 => "Rare", 2 => "Élite rare", 3 =>"Boss"], + 'classification'=> "Classification", + 'petFamily' => "Familier", + 'react' => "Réaction", + 'worth' => "Vaut", + 'unkPosition' => "L'emplacement de ce PNJ est inconnu.", + 'difficultyPH' => "[Ce PNJ est un espace réservé pour un autre mode de]", + 'quotes' => "Citations", + 'gainsDesc' => "Après avoir tué ce PNJ vous allez obtenir", + 'repWith' => "points de réputation avec", + 'stopsAt' => "arrête à %s", + 'textTypes' => [null, "crie", "dit", "chuchote"], + 'modes' => array( + 1 => ["Normal", "Héroïque"], + 2 => ["10-joueurs Normal", "25-joueurs Normal", "10-joueurs Héroïque", "25-joueurs Héroïque"] + ), + 'cat' => array( + "Non classés", "Bêtes", "Draconien", "Démons", "Élémentaires", "Géants", "Mort-vivant", "Humanoïdes", + "Bestioles", "Mécaniques", "Non spécifié", "Totems", "Familier pacifique", "Nuages de gaz" + ) ), 'event' => array( + 'start' => "Début", + 'end' => "Fin", + 'interval' => "Intervalle", + 'inProgress' => "L'évènement est présentement en cours", 'category' => array("Non classés", "Vacances", "Récurrent", "Joueur ctr. Joueur") ), 'achievement' => array( @@ -233,6 +256,7 @@ $lang = array( 'itemReward' => "Vous recevrez :", 'titleReward' => "Vous devriez recevoir le titre \"%s\"", 'slain' => "tué", + 'reqNumCrt' => "Nécessite" ), 'class' => array( 'racialLeader' => "Leader racial", @@ -280,6 +304,7 @@ $lang = array( ) ), 'currency' => array( + 'cap' => "Maximum total", 'cat' => array( 1 => "Divers", 2 => "JcJ", 4 => "Classique", 21 => "Wrath of the Lich King", 22 => "Raid", 23 => "Burning Crusade", 41 => "Test", 3 => "Inutilisées" ) @@ -302,7 +327,7 @@ $lang = array( '_pieces' => "pièces", '_unavailable' => "Cet objet n'est plus disponible aux joueurs.", '_tag' => "Étiquette", - + 'summary' => "Résumé", 'notes' => array( null, "Ensemble de donjon 1", "Ensemble de donjon 2", "Ensemble de raid palier 1", "Ensemble de raid palier 2", "Ensemble de raid palier 3", "Ensemble JcJ niveau 60 supérieur", "Ensemble JcJ niveau 60 supérieur (désuet)", @@ -606,7 +631,7 @@ $lang = array( 12 => "Quest", 13 => "Keys", ), - 'statType' => array( + 'statType' => array( "Augmente vos points de mana de %d.", "Augmente vos points de vie de %d.", null, @@ -656,7 +681,9 @@ $lang = array( "Stat Inutilisée #%d (%d)", ) ), - 'colon' => ' : ' + 'colon' => ' : ', + 'dateFmtShort' => "Y-m-d", + 'dateFmtLong' => "Y-m-d à H:i" ); ?> diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index 97270c1b..4023f58b 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -219,9 +219,32 @@ $lang = array( ), 'account' => [], 'npc' => array( - 'rank' => ['Обычный', 'Элитный', 'Редкий элитный', 'Босс', 'Редкий'] + 'rank' => [0 => "Обычный", 1 => "Элитный", 4 => "Редкий", 2 => "Редкий элитный", 3 =>"Босс"], + 'classification'=> "Классификация", + 'petFamily' => "Семейство питомца", + 'react' => "Реакция", + 'worth' => "Деньги", + 'unkPosition' => "Местоположение этого НИП неизвестно.", + 'difficultyPH' => "[Этот НИП является прототипом для другого режима]", + 'quotes' => "Цитаты", + 'gainsDesc' => "В награду за убийство этого НИПа вы получите", + 'repWith' => "репутации с", + 'stopsAt' => 'останавливается на уровне "%s"', + 'textTypes' => [null, "кричит", "говорит", "шепчет"], + 'modes' => array( + 1 => ["Обычный", "Героический"], + 2 => ["10 нормал.", "25 нормал.", "10 героич.", "25 героич."] + ), + 'cat' => array( + "Разное", "Животные", "Дракон", "Демоны", "Элементали", "Великаны", "Нежить", "Гуманоиды", + "Существа", "Механизмы", "Не указано", "Тотемы", "Спутники", "Облака газа" + ) ), 'event' => array( + 'start' => "Начало", + 'end' => "Конец", + 'interval' => "[Interval]", + 'inProgress' => "Событие активно в данный момент", 'category' => array("Разное", "Праздники", "Периодические", "PvP") ), 'achievement' => array( @@ -233,6 +256,7 @@ $lang = array( 'itemReward' => "Вы получите:", 'titleReward' => "Наградное звание: \"%s\"", 'slain' => "убито", + 'reqNumCrt' => "Требуется" ), 'class' => array( 'racialLeader' => "Лидер расы", @@ -280,6 +304,7 @@ $lang = array( ) ), 'currency' => array( + 'cap' => "Максимум всего", 'cat' => array( 1 => "Разное", 2 => "PvP", 4 => "World of Warcraft", 21 => "Wrath of the Lich King", 22 => "Подземелья и рейды", 23 => "Burning Crusade", 41 => "Test", 3 => "Неактивно" ) @@ -302,7 +327,7 @@ $lang = array( '_pieces' => "частей", '_unavailable' => "Этот набор предметов не доступен игрокам.", '_tag' => "Тэг", - + 'summary' => "Сводка", 'notes' => array( null, "Комплект подземелий 1", "Комплект подземелий 2", "Рейдовый комплект Tier 1", "Рейдовый комплект Tier 2", "Рейдовый комплект Tier 3", "PvP Комплект для 60 уровня", "PvP Комплект для 60 уровня (старая версия)", @@ -656,7 +681,9 @@ $lang = array( "Unknown Bonus #%d (%d)", ) ), - 'colon' => ': ' + 'colon' => ': ', + 'dateFmtShort' => "Y-m-d", + 'dateFmtLong' => "Y-m-d в H:i" ); ?> diff --git a/pages/achievement.php b/pages/achievement.php index 0c659e12..8f0fe76b 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -55,19 +55,19 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $acv = new AchievementList(array(['id', $_id])); if ($acv->error) - $smarty->notFound(Lang::$game['achievement']); + $smarty->notFound(Lang::$game['achievement'], $_id); // create page title and path $curCat = $acv->getField('category'); - $tmpPath = []; + $path = []; do { - array_unshift($tmpPath, $curCat); + array_unshift($path, $curCat); $curCat = DB::Aowow()->SelectCell('SELECT parentCategory FROM ?_achievementcategory WHERE id = ?d', $curCat); } while ($curCat > 0); - array_unshift($tmpPath, 0, 9); + array_unshift($path, 0, 9); $acv->addGlobalsToJscript($smarty, GLOBALINFO_REWARDS); @@ -130,20 +130,24 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 9: Achievement g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $acv->getField('name', true), - 'path' => $tmpPath, - 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, - 'series' => $series, - 'relTabs' => [], - 'buttons' => array( - BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$_id.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'], - BUTTON_WOWHEAD => true - ), 'page' => array( + 'title' => $acv->getField('name', true).' - '.Util::ucfirst(Lang::$game['achievement']), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_ACHIEVEMENT, + 'typeId' => $_id, + 'headIcons' => $acv->getField('iconString'), + 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'series' => $series, + 'redButtons' => array( + BUTTON_LINKS => ['color' => 'ffffff00', 'linkId' => Util::$typeStrings[TYPE_ACHIEVEMENT].':'.$_id.':"..UnitGUID("player")..":0:0:0:0:0:0:0:0'], + BUTTON_WOWHEAD => true + ), 'name' => $acv->getField('name', true), 'description' => $acv->getField('description', true), - 'iconname' => $acv->getField('iconString'), 'count' => $acv->getField('reqCriteriaCount'), 'reward' => $acv->getField('reward', true), 'nCriteria' => count($acv->getCriteria()), @@ -151,7 +155,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'itemReward' => [], 'criteria' => [], 'icons' => [] - ) + ), + 'relTabs' => [] ); // create rewards @@ -302,9 +307,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'text' => $crtName, ); break; - // link to title + // link to title - todo (low): crosslink case ACHIEVEMENT_CRITERIA_TYPE_EARNED_PVP_TITLE: - // todo: crosslink + $tmp['extra_text'] = Util::ucFirst(Lang::$game['title']).Lang::$colon.$crtName; break; // link to achivement (/w icon) case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT: @@ -322,10 +327,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; // link to quest case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST: - $crtName = QuestList::getName($obj); + // $crtName = ; $tmp['link'] = array( 'href' => '?quest='.$obj, - 'text' => $crtName ? $crtName : $crtName, + 'text' => $crtName ? $crtName : QuestList::getName($obj), ); break; // link to spell (/w icon) @@ -334,7 +339,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL: case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2: - $text = !empty($crtName) ? $crtName : SpellList::getName($obj); + $text = $crtName ? $crtName : SpellList::getName($obj); $tmp['link'] = array( 'href' => '?spell='.$obj, 'text' => $text @@ -371,10 +376,9 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) break; // link to faction (/w target reputation) case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: - $crtName = FactionList::getName($obj); $tmp['link'] = array( 'href' => '?faction='.$obj, - 'text' => $crtName ? $crtName : $crtName, + 'text' => $crtName ? $crtName : FactionList::getName($obj), ); $tmp['extra_text'] = ' ('.Lang::getReputationLevelForPoints($qty).')'; break; @@ -390,6 +394,7 @@ 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 @@ -406,20 +411,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $smarty->saveCache($cacheKeyPage, $pageData); } - -// menuId 9: Achievement g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title'].' - '.Util::ucfirst(Lang::$game['achievement']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_ACHIEVEMENT, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_ACHIEVEMENT, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$achievement, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('achievement.tpl'); diff --git a/pages/achievements.php b/pages/achievements.php index f6098ee4..3d0ef0fa 100644 --- a/pages/achievements.php +++ b/pages/achievements.php @@ -40,11 +40,11 @@ if (!Util::isValidPage($validCats, $cats)) if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { // include child categories if current category is empty - $condition = !$cats[0] ? null : (int)end($cats); - $acvList = new AchievementList($condition ? [['category', $condition]] : [], true); + $condition = !empty($cats) ? [['category', (int)end($cats)]] : []; + $acvList = new AchievementList($condition, true); if (!$acvList->getMatches()) { - $curCats = $catList = [$condition ? $condition : 0]; + $curCats = $catList = [!empty($cats) ? (int)end($cats) : 0]; while ($curCats) { $curCats = DB::Aowow()->SelectCol('SELECT Id FROM ?_achievementCategory WHERE parentCategory IN (?a)', $curCats); @@ -59,24 +59,32 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) $filter['fi'] = $acvList->filterGetForm(); // create page title and path - if (is_array($cats)) + if ($cats) { - $catrows = DB::Aowow()->Select('SELECT * FROM ?_achievementcategory WHERE id IN (?a)', - $cats - ); - + $catrows = DB::Aowow()->Select('SELECT * FROM ?_achievementcategory WHERE id IN (?a)', $cats); foreach ($catrows as $cat) { - $path[] = $cat['id']; + $path[] = $cat['id']; $title[] = Util::localizedString($cat, 'name'); } array_unshift($title, Util::ucFirst(Lang::$game['achievements'])); } - // listview content + // page content + // menuId 9: Achievement g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'data' => $acvList->getListviewData(), - 'params' => [] + 'page' => array( + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'subCat' => $pageParam ? '='.$pageParam : '', + 'reqJS' => ['template/js/filters.js'] + ), + 'lv' => array( + 'data' => $acvList->getListviewData(), + 'params' => [] + ) ); // fill g_items, g_titles, g_achievements @@ -84,20 +92,20 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) // if we are have different cats display field if ($acvList->hasDiffFields(['category'])) - $pageData['params']['visibleCols'] = "$['category']"; + $pageData['lv']['params']['visibleCols'] = "$['category']"; if (!empty($filter['fi']['extraCols'])) - $pageData['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; + $pageData['lv']['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; // create note if search limit was exceeded if ($acvList->getMatches() > SQL_LIMIT_DEFAULT) { - $pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), SQL_LIMIT_DEFAULT); - $pageData['params']['_truncated'] = 1; + $pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_achievementsfound', $acvList->getMatches(), SQL_LIMIT_DEFAULT); + $pageData['lv']['params']['_truncated'] = 1; } if ($acvList->filterGetError()) - $pageData['params']['_errors'] = '$1'; + $pageData['lv']['params']['_errors'] = '$1'; $smarty->saveCache($cacheKey, $pageData, $filter); } @@ -106,20 +114,10 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) // sort for dropdown-menus asort(Lang::$game['si']); -// menuId 9: Achievement g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]", - 'tab' => 0, - 'subCat' => $pageParam ? '='.$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('achievements.tpl'); diff --git a/pages/class.php b/pages/class.php index 359d800d..7e25f44b 100644 --- a/pages/class.php +++ b/pages/class.php @@ -16,7 +16,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $cl = new CharClassList(array(['id', $_id])); if ($cl->error) - $smarty->notFound(Lang::$game['class']); + $smarty->notFound(Lang::$game['class'], $_id); /***********/ /* Infobox */ @@ -61,22 +61,28 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 12: Class g_initPath() + // tabId 0: Database g_initHeader() $pageData = array ( - 'title' => $cl->getField('name', true).' - '.Util::ucFirst(Lang::$game['class']), - 'path' => $_path, - 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', - 'relTabs' => [], - 'buttons' => array( - BUTTON_LINKS => ['color' => '', 'linkId' => ''], - BUTTON_WOWHEAD => true, - BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$_id] * 3], 'pet' => false], - BUTTON_FORUM => false // doto (low): $GLOBALS['AoWoWconf']['boardUrl'] + X - ), 'page' => array( + 'title' => $cl->getField('name', true).' - '.Util::ucFirst(Lang::$game['class']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_CLASS, + 'typeId' => $_id, + 'reqJS' => ['template/js/swfobject.js'], 'name' => $cl->getField('name', true), - 'icon' => 'class_'.strtolower($cl->getField('fileString')), - 'expansion' => Util::$expansionString[$cl->getField('expansion')] - ) + 'expansion' => Util::$expansionString[$cl->getField('expansion')], + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'headIcons' => ['class_'.strtolower($cl->getField('fileString'))], + 'redButtons' => array( + BUTTON_LINKS => ['color' => '', 'linkId' => ''], + BUTTON_WOWHEAD => true, + BUTTON_TALENT => ['href' => '?talent#'.Util::$tcEncoding[$tcClassId[$_id] * 3], 'pet' => false], + BUTTON_FORUM => false // doto (low): $GLOBALS['AoWoWconf']['boardUrl'] + X + ) + ), + 'relTabs' => [], ); /**************/ @@ -91,7 +97,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // '$LANG.tab_talents', $conditions = array( ['s.typeCat', [-13, -11, -2, 7]], - [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_EXCLUDE_CATEGORY_SEARCH), '&'], 0], + [['s.cuFlags', (SPELL_CU_TRIGGERED | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0], [ 'OR', ['s.reqClassMask', $_mask, '&'], // Glyphs, Proficiencies @@ -150,7 +156,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'hiddenCols' => isset($hidden) ? $hidden : null, 'computeDataFunc' => '$Listview.funcBox.initSubclassFilter', 'onAfterCreate' => '$Listview.funcBox.addSubclassIndicator', - 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs=4;crv=0'), + 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=152;crs='.$_id.';crv=0'), '_truncated' => 1 ) ); @@ -191,8 +197,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // Tab: Trainer $conditions = array( ['npcflag', 0x30, '&'], // is trainer - ['trainer_type', 0], // trains class spells - ['trainer_class', $_id] + ['trainerType', 0], // trains class spells + ['trainerClass', $_id] ); $trainer = new CreatureList($conditions); @@ -222,24 +228,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 12: Class g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title'], - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_CLASS, - 'typeId' => $_id, - 'reqJS' => array( - 'template/js/swfobject.js' - ) -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_CLASS, $_id)); // comments, screenshots, videos $smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page -$smarty->display('class.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/classes.php b/pages/classes.php index bd8df464..f7ade61c 100644 --- a/pages/classes.php +++ b/pages/classes.php @@ -10,8 +10,15 @@ if (!$smarty->loadCache($cacheKey, $pageData)) { $classes = new CharClassList(); + // menuId 12: Class g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'listviews' => array( + 'page' => array( + 'title' => Util::ucFirst(Lang::$game['classes']), + 'path' => "[0, 12]", + 'tab' => 0 + ), + 'lv' => array( array( 'file' => 'class', 'data' => $classes->getListviewData(), @@ -24,17 +31,11 @@ if (!$smarty->loadCache($cacheKey, $pageData)) } -// menuId 12: Class g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => Util::ucFirst(Lang::$game['classes']), - 'path' => "[0, 12]", - '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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/compare.php b/pages/compare.php index 5c0131b6..06b31bec 100644 --- a/pages/compare.php +++ b/pages/compare.php @@ -4,7 +4,25 @@ if (!defined('AOWOW_REVISION')) die('invalid access'); -$pageData = ['items' => null, 'summary' => '[]']; + +// tabId 1: Tools g_initHeader() +$pageData = array( + 'items' => null, + 'summary' => '[]', + 'title' => Lang::$main['compareTool'], + 'tab' => 1, + 'reqCSS' => array( + ['path' => 'template/css/Summary.css'], + ['path' => 'template/css/Summary_ie6.css', 'ieCond' => 'lte IE 6'], + ), + 'reqJS' => array( + 'template/js/Draggable.js', + 'template/js/filters.js', + 'template/js/Summary.js', + 'template/js/swfobject.js', + '?data=weight-presets.gems.enchants.itemsets' + ) +); $compareString = ''; // prefer $_GET over $_COOKIE @@ -16,7 +34,7 @@ else if (!empty($_COOKIE['compare_groups'])) if ($compareString) { $sets = explode(";", $compareString); - $items = []; + $items = $outSet = []; foreach ($sets as $set) { $itemsting = explode(":", $set); @@ -54,23 +72,7 @@ if ($compareString) } -// tabId 1: Tools g_initHeader() -$smarty->updatePageVars(array( - 'title' => Lang::$main['compareTool'], - 'tab' => 1, - 'reqCSS' => array( - ['path' => 'template/css/Summary.css'], - ['path' => 'template/css/Summary_ie6.css', 'ieCond' => 'lte IE 6'], - ), - 'reqJS' => array( - 'template/js/Draggable.js', - 'template/js/filters.js', - 'template/js/Summary.js', - 'template/js/swfobject.js', - '?data=weight-presets.gems.enchants.itemsets' - ), -)); -$smarty->assign('lvData', $pageData); +$smarty->updatePageVars($pageData); $smarty->assign('lang', Lang::$main); // load the page diff --git a/pages/currencies.php b/pages/currencies.php index 67ed0e29..af56bbaf 100644 --- a/pages/currencies.php +++ b/pages/currencies.php @@ -4,52 +4,52 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; +$cat = Util::extractURLParams($pageParam); $path = [0, 15]; $validCats = [1, 2, 3, 22]; $title = [Util::ucFirst(Lang::$game['currencies'])]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, -1, isset($cat) ? $cat : -1, User::$localeId]); +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, -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::$currency['cat'][$cat]); + $path[] = $cat[0]; // should be only one parameter anyway + array_unshift($title, Lang::$currency['cat'][$cat[0]]); } if (!$smarty->loadCache($cacheKey, $pageData)) { - $pageData = array( - 'listviews' => [] - ); - - $money = new CurrencyList(isset($cat) ? array(['category', (int)$cat]) : []); - - $pageData['listviews'][] = array( - 'file' => 'currency', - 'data' => $money->getListviewData(), - 'params' => [] - ); - + $money = new CurrencyList($cat ? array(['category', (int)$cat[0]]) : []); $money->addGlobalsToJscript($smarty); + // menuId 15: Currency g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'tab' => 0, + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK) + ), + 'lv' => array( + array( + 'file' => 'currency', + 'data' => $money->getListviewData(), + 'params' => [] + ) + ) + ); + $smarty->saveCache($cacheKey, $pageData); } -// menuId 15: Currency g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'tab' => 0, - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]" -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('lang', Lang::$main); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['lv']); // load the page -$smarty->display('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/currency.php b/pages/currency.php index 2d2e818e..631de56e 100644 --- a/pages/currency.php +++ b/pages/currency.php @@ -6,7 +6,8 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 15]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_CURRENCY, $_id, -1, User::$localeId]); @@ -14,34 +15,47 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $currency = new CurrencyList(array(['id', $_id])); if ($currency->error) - $smarty->notFound(Lang::$game['skill']); + $smarty->notFound(Lang::$game['skill'], $_id); $_cat = $currency->getField('category'); $_itemId = $currency->getField('itemId'); $_isSpecial = $_id == 103 || $_id == 104; // honor && arena points are not handled as items + $_path[] = $_cat; + + /***********/ + /* Infobox */ + /**********/ + + $infobox = ''; + if ($_id == 103) // Arena Points + $infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$colon.'10\'000[/li][/ul]'; + else if ($_id == 104) // Honor + $infobox = '[ul][li]'.Lang::$currency['cap'].Lang::$colon.'75\'000[/li][/ul]'; /****************/ /* Main Content */ /****************/ + // menuId 14: Skill g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $currency->getField('name', true), - 'path' => [0, 15], - 'relTabs' => [], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true - ), 'page' => array( - 'name' => $currency->getField('name', true), - 'icon' => $currency->getField('iconString'), - 'id' => $_id + 'title' => $currency->getField('name', true)." - ".Util::ucfirst(Lang::$game['skill']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_CURRENCY, + 'typeId' => $_id, + 'infobox' => $infobox, + 'name' => $currency->getField('name', true), + 'headIcons' => [$currency->getField('iconString')], + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true + ) ), + 'relTabs' => [] ); - if ($_cat) - $pageData['path'][] = $_cat; - /**************/ /* Extra Tabs */ /**************/ @@ -148,7 +162,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) // tab: created by (spell) [for items its handled in Util::getLootSource()] if ($_id == 104) { - $createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR'])); + $createdBy = new SpellList(array(['effect1Id', 45], ['effect2Id', 45], ['effect3Id', 45], 'OR')); if (!$createdBy->error) { if ($createdBy->hasSetFields(['reagent1'])) @@ -203,21 +217,12 @@ 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_CURRENCY, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_CURRENCY, $_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('skill.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/event.php b/pages/event.php new file mode 100644 index 00000000..45226c64 --- /dev/null +++ b/pages/event.php @@ -0,0 +1,190 @@ +loadCache($cacheKeyPage, $pageData)) +{ + $conditions = []; + if ($_id < 0) + $conditions[] = ['id', -$_id]; + else + $conditions[] = ['holidayId', $_id]; + + $event = new WorldEventList($conditions); + if ($event->error) + $smarty->notFound(Lang::$game['event'], $_id); + + $hId = $event->getField('holidayId'); + + // redirect if associated with a holiday + if ($hId && $_id != $hId) + header('Location: '.STATIC_URL.'?event='.$hId); + + if ($hId) + { + switch ($event->getField('scheduleType')) + { + case -1: $_path[] = 1; break; + case 0: + case 1: $_path[] = 2; break; + case 2: $_path[] = 3; break; + } + } + else + $_path[] = 0; + + /***********/ + /* Infobox */ + /***********/ + + $infobox = []; + + // - boss + // - faction (only darkmoon faire) + + // finalized after the cache is handled + + /****************/ + /* Main Content */ + /****************/ + + // menuId 11: Event g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'dates' => array( + 'firstDate' => $event->getField('startTime'), + 'lastDate' => $event->getField('endTime'), + 'length' => $event->getField('length'), + 'rec' => $event->getField('occurence') + ), + 'page' => array( + 'title' => $event->getField('name', true).' - '.Util::ucFirst(Lang::$game['event']), + 'name' => $event->getField('name', true), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_WORLDEVENT, + 'typeId' => $_id, + 'infobox' => $infobox, + 'headIcons' => [$event->getField('iconString')], + 'redButtons' => array( + BUTTON_WOWHEAD => $_id > 0, + BUTTON_LINKS => true + ) + ), + 'relTabs' => [] + ); + + /**************/ + /* Extra Tabs */ + /**************/ + + // NPC spawns + + // GO spawns + + // Quests + + // Items requiring Holiday + + // tab: see also (event conditions) + $eId = $event->getField('eventBak'); + if($rel = DB::Aowow()->selectCol('SELECT IF(eventEntry = prerequisite_event, NULL, IF(eventEntry = ?d, -prerequisite_event, eventEntry)) FROM game_event_prerequisite WHERE prerequisite_event = ?d OR eventEntry = ?d', $eId, $eId, $eId)) + { + $list = []; + array_walk($rel, function(&$v, $k) use (&$list) { + if ($v > 0) + $list[] = $v; + else if ($v == null) + Util::$pageTemplate->internalNotice(U_GROUP_EMPLOYEE, 'game_event_prerequisite: this event has itself as prerequisite'); + }); + + $relEvents = new WorldEventList(array(['id', $list])); + $relEvents->addGlobalsToJscript(Util::$pageTemplate); + $relData = $relEvents->getListviewData(true); + foreach ($relEvents->iterate() as $id => $__) + { + $relData[$id]['condition'] = array( + 'type' => TYPE_WORLDEVENT, + 'typeId' => -$eId, + 'status' => 2 + ); + } + + $event->addGlobalsToJscript(Util::$pageTemplate); + foreach ($rel as $r) + { + if ($r >= 0) + continue; + + Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, -$r); + + $d = $event->getListviewData(true); + $d[-$eId]['condition'] = array( + 'type' => TYPE_WORLDEVENT, + 'typeId' => $r, + 'status' => 2 + ); + + $relData= array_merge($relData, $d); + } + + $pageData['relTabs'][] = array( + 'file' => 'event', + 'data' => $relData, + 'params' => array( + 'id' => 'see-also', + 'name' => '$LANG.tab_seealso', + 'tabs' => '$tabsRelated', + 'hiddenCols' => "$['date']", + 'extraCols' => '$[Listview.extraCols.condition]' + ) + ); + } + + + $smarty->saveCache($cacheKeyPage, $pageData); +} + +/***********/ +/* Infobox */ +/***********/ + +$updated = WorldEventList::updateDates($pageData['dates']); + +// in progress +if ($updated['start'] < time() && $updated['end'] > time()) + array_unshift($pageData['page']['infobox'], '[span class=q2]'.Lang::$event['inProgress'].'[/span]'); + +// occurence +if ($updated['rec'] > 0) + array_unshift($pageData['page']['infobox'], Lang::$event['interval'].Lang::$colon.Util::formatTime($updated['rec'] * 1000)); + +// end +if ($updated['end']) + array_unshift($pageData['page']['infobox'], Lang::$event['end'].Lang::$colon.date(Lang::$dateFmtLong, $updated['end'])); + +// start +if ($updated['end']) + array_unshift($pageData['page']['infobox'], Lang::$event['start'].Lang::$colon.date(Lang::$dateFmtLong, $updated['start'])); + +$pageData['page']['infobox'] = '[ul][li]'.implode('[/li][li]', $pageData['page']['infobox']).'[/li][/ul]'; + + +$smarty->updatePageVars($pageData['page']); +$smarty->assign('community', CommunityContent::getAll(TYPE_WORLDEVENT, $_id)); // comments, screenshots, videos +$smarty->assign('lang', array_merge(Lang::$main)); +$smarty->assign('lvData', $pageData['relTabs']); + +// load the page +$smarty->display('detail-page-generic.tpl'); + +?> diff --git a/pages/events.php b/pages/events.php index 2e10dd55..aa00233e 100644 --- a/pages/events.php +++ b/pages/events.php @@ -4,61 +4,59 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; +$cat = Util::extractURLParams($pageParam); $condition = []; $path = [0, 11]; $validCats = [0, 1, 2, 3]; $title = [Lang::$game['events']]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_WORLDEVENT, -1, $cat, User::$localeId]); +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_WORLDEVENT, -1, $cat ? $cat[0] : -1, User::$localeId]); if (!Util::isValidPage($validCats, $cat)) $smarty->error(); -$path[] = $cat; - -if (isset($cat)) - array_unshift($title, Lang::$event['category'][$cat]); - if (!$smarty->loadCache($cacheKey, $pageData)) { - if ($cat !== null) + if ($cat) { - switch ($cat) + $path[] = $cat[0]; + array_unshift($title, Lang::$event['category'][$cat[0]]); + switch ($cat[0]) { - case 0: - $condition[] = ['holidayId', 0]; - break; - case 1: - $condition[] = ['scheduleType', -1]; - break; - case 2: - $condition[] = ['scheduleType', [0, 1]]; - break; - case 3: - $condition[] = ['scheduleType', 2]; - break; + case 0: $condition[] = ['e.holidayId', 0]; break; + case 1: $condition[] = ['h.scheduleType', -1]; break; + case 2: $condition[] = ['h.scheduleType', [0, 1]]; break; + case 3: $condition[] = ['h.scheduleType', 2]; break; } } $events = new WorldEventList($condition); + $events->addGlobalsToJScript($smarty); $deps = []; foreach ($events->iterate() as $__) if ($d = $events->getField('requires')) $deps[$events->id] = $d; + + // menuId 11: Event g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'listviews' => [], - 'deps' => $deps + 'page' => array( + 'tab' => 0, + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK) + ), + 'lv' => [], + 'deps' => $deps ); - $pageData['listviews'][] = array( + $pageData['lv'][] = array( 'file' => 'event', 'data' => $events->getListviewData(), 'params' => ['tabs' => '$myTabs'] ); - $pageData['listviews'][] = array( + $pageData['lv'][] = array( 'file' => 'calendar', 'data' => array_filter($events->getListviewData(), function($x) {return $x['id'] > 0;}), 'params' => array( @@ -67,13 +65,11 @@ if (!$smarty->loadCache($cacheKey, $pageData)) ) ); - $events->addGlobalsToJScript($smarty); - $smarty->saveCache($cacheKey, $pageData); } // recalculate dates with now(); can't be cached, obviously -foreach ($pageData['listviews'] as &$views) +foreach ($pageData['lv'] as &$views) { foreach ($views['data'] as &$data) { @@ -81,27 +77,24 @@ foreach ($pageData['listviews'] as &$views) if (!empty($pageData['deps'][$data['id']])) { $data['startDate'] = $data['endDate'] = false; + unset($data['_date']); continue; } - $updated = WorldEventList::updateDates($data['startDate'], $data['endDate'], $data['rec']); - $data['startDate'] = $updated['start'] ? date(Util::$dateFormatLong, $updated['start']) : false; - $data['endDate'] = $updated['end'] ? date(Util::$dateFormatLong, $updated['end']) : false; + $updated = WorldEventList::updateDates($data['_date']); + unset($data['_date']); + $data['startDate'] = $updated['start'] ? date(Util::$dateFormatInternal, $updated['start']) : false; + $data['endDate'] = $updated['end'] ? date(Util::$dateFormatInternal, $updated['end']) : false; + $data['rec'] = $updated['rec']; } } -// menuId 11: Event g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]", - '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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/faction.php b/pages/faction.php index 92989e5e..eb4ff67f 100644 --- a/pages/faction.php +++ b/pages/faction.php @@ -6,7 +6,8 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 7]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_FACTION, $_id, -1, User::$localeId]); @@ -14,12 +15,17 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $faction = new FactionList(array(['id', $_id])); if ($faction->error) - $smarty->notFound(Lang::$game['faction']); + $smarty->notFound(Lang::$game['faction'], $_id); + + if ($_ = $faction->getField('cat2')) + $_path[] = $_; + + if ($_ = $faction->getField('cat')) + $_path[] = $_; /***********/ /* Infobox */ /***********/ - $infobox = []; // Quartermaster if any @@ -51,29 +57,36 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 7: Faction g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $faction->getField('name', true), - 'path' => [0, 7], - 'relTabs' => [], - 'spillover' => null, - 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true - ), - 'page' => array( - 'name' => $faction->getField('name', true), - 'id' => $_id + 'page' => array( + 'title' => $faction->getField('name', true)." - ".Util::ucfirst(Lang::$game['faction']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_FACTION, + 'typeId' => $_id, + 'extraText' => '', + 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true + ), + 'name' => $faction->getField('name', true) ), + 'relTabs' => [] ); - if ($_ = $faction->getField('cat2')) - $pageData['path'][] = $_; - - if ($_ = $faction->getField('cat')) - $pageData['path'][] = $_; - // Spillover Effects + /* todo (low): also check on reputation_spillover_template (but its data is identical to calculation below + $rst = DB::Aowow()->selectRow('SELECT + CONCAT_WS(" ", faction1, faction2, faction3, faction4) AS faction, + CONCAT_WS(" ", rate_1, rate_2, rate_3, rate_4) AS rate, + CONCAT_WS(" ", rank_1, rank_2, rank_3, rank_4) AS rank + FROM reputation_spillover_template WHERE faction = ?d', $_id); + */ + + $conditions = array( ['id', $_id, '!'], // not self ['reputationIndex', -1, '!'] // only gainable @@ -93,7 +106,36 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $buff[] = '[tr][td][faction='.$spillId.'][/td][td][span class=q'.($val > 0 ? '2]+' : '10]').$val.'%[/span][/td][td]'.Lang::$game['rep'][$spillover->getField('spilloverMaxRank')].'[/td][/tr]'; if ($buff) - $pageData['spillover'] = '[h3 class=clear]'.Lang::$faction['spillover'].'[/h3][div margin=15px]'.Lang::$faction['spilloverDesc'].'[/div][table class=grid width=400px][tr][td width=150px][b]'.Util::ucFirst(Lang::$game['faction']).'[/b][/td][td width=100px][b]'.Lang::$spell['_value'].'[/b][/td][td width=150px][b]'.Lang::$faction['maxStanding'].'[/b][/td][/tr]'.implode('', $buff).'[/table]'; + $pageData['page']['extraText'] .= '[h3 class=clear]'.Lang::$faction['spillover'].'[/h3][div margin=15px]'.Lang::$faction['spilloverDesc'].'[/div][table class=grid width=400px][tr][td width=150px][b]'.Util::ucFirst(Lang::$game['faction']).'[/b][/td][td width=100px][b]'.Lang::$spell['_value'].'[/b][/td][td width=150px][b]'.Lang::$faction['maxStanding'].'[/b][/td][/tr]'.implode('', $buff).'[/table]'; + + + // reward rates + if ($rates = DB::Aowow()->selectRow('SELECT * FROM reputation_reward_rate WHERE faction = ?d', $_id)) + { + $buff = '[h3 class=clear][Custom Reward Rate][/h3][table width=100px]'; + + foreach ($rates as $k => $v) + { + if ($v == 1) + continue; + + switch ($k) + { + case 'quest_rate': $buff .= '[tr][td]Quests:[/td]'; break; + case 'quest_daily_rate': $buff .= '[tr][td]Daily Quests:[/td]'; break; + case 'quest_weekly_rate': $buff .= '[tr][td]Weekly Quests:[/td]'; break; + case 'quest_monthly_rate': $buff .= '[tr][td]Monthly Quests:[/td]'; break; + case 'creature_rate': $buff .= '[tr][td]Creatures:[/td]'; break; + case 'spell_rate': $buff .= '[tr][td]Spells:[/td]'; break; + } + + $buff .= '[td]x'.number_format($v, 1).'[/td][/tr]'; + } + + $buff .= '[/table]'; + + $pageData['page']['extraText'] .= $buff; + } /**************/ /* Extra Tabs */ @@ -119,25 +161,32 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } // tab: creatures with onKill reputation - $cIds = DB::Aowow()->selectCol('SELECT DISTINCT creature_id FROM creature_onkill_reputation cor, ?_factions f WHERE - (RewOnKillRepValue1 > 0 AND (RewOnKillRepFaction1 = ?d OR (cor.RewOnKillRepFaction1 = f.id AND f.parentFactionId = ?d AND IsTeamAward1 <> 0))) OR - (RewOnKillRepValue2 > 0 AND (RewOnKillRepFaction2 = ?d OR (cor.RewOnKillRepFaction2 = f.id AND f.parentFactionId = ?d AND IsTeamAward2 <> 0)))', - $_id, $faction->getField('parentFactionId'), - $_id, $faction->getField('parentFactionId') - ); - $killCreatures = new CreatureList(array(['id', $cIds])); - if (!$killCreatures->error) + if ($faction->getField('reputationIndex') != -1) // only if you can actually gain reputation by kills { - $killCreatures->addGlobalsToJscript($smarty); - - $pageData['relTabs'][] = array( - 'file' => 'npc', - 'data' => $killCreatures->getListviewData(), - 'showRep' => true, - 'params' => array( - 'tabs' => '$tabsRelated', - ) + $cIds = DB::Aowow()->selectCol('SELECT DISTINCT cor.creature_id FROM creature_onkill_reputation cor, ?_factions f WHERE + (cor.RewOnKillRepValue1 > 0 AND (cor.RewOnKillRepFaction1 = ?d OR (cor.RewOnKillRepFaction1 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward1 <> 0))) OR + (cor.RewOnKillRepValue2 > 0 AND (cor.RewOnKillRepFaction2 = ?d OR (cor.RewOnKillRepFaction2 = f.id AND f.parentFactionId = ?d AND cor.IsTeamAward2 <> 0)))', + $_id, $faction->getField('parentFactionId'), + $_id, $faction->getField('parentFactionId') ); + + if ($cIds) + { + $killCreatures = new CreatureList(array(['id', $cIds])); + if (!$killCreatures->error) + { + $killCreatures->addGlobalsToJscript($smarty); + + $pageData['relTabs'][] = array( + 'file' => 'creature', + 'data' => $killCreatures->getListviewData(), + 'showRep' => true, + 'params' => array( + 'tabs' => '$tabsRelated', + ) + ); + } + } } // tab: members @@ -153,12 +202,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $killCreatures->addGlobalsToJscript($smarty); $pageData['relTabs'][] = array( - 'file' => 'npc', + 'file' => 'creature', 'data' => $killCreatures->getListviewData(), 'showRep' => true, 'params' => array( 'id' => 'member', - 'name' => '$LANG.tab_member', + 'name' => '$LANG.tab_members', 'tabs' => '$tabsRelated', ) ); @@ -216,21 +265,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 7: Faction 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_FACTION, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_FACTION, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, [Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page -$smarty->display('faction.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/factions.php b/pages/factions.php index 39806000..b8a580bf 100644 --- a/pages/factions.php +++ b/pages/factions.php @@ -22,7 +22,7 @@ if (!$smarty->loadCache($cacheKey, $pageData)) { $conditions = []; - if (User::isInGroup(U_GROUP_STAFF)) + if (!User::isInGroup(U_GROUP_STAFF)) $conditions[] = ['reputationIndex', -1, '!']; // unlisted factions if (isset($cats[0]) && empty($cats[1])) @@ -48,10 +48,15 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $factions = new FactionList($conditions); + // menuId 7: Faction 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' => 'faction', 'data' => $factions->getListviewData(), @@ -64,17 +69,11 @@ if (!$smarty->loadCache($cacheKey, $pageData)) } -// menuId 7: Faction 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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/item.php b/pages/item.php index db439edd..793a8a84 100644 --- a/pages/item.php +++ b/pages/item.php @@ -9,7 +9,8 @@ if (isset($_GET['xml'])) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 0]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_ITEM, $_id, -1, User::$localeId]); @@ -247,65 +248,80 @@ 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'); - $pageData = array( - 'infobox' => $quickInfo ? '[ul][li]'.implode('[/li][li]', $quickInfo).'[/li][/ul]' : null, - 'relTabs' => [], - 'tooltip' => $item->renderTooltip([], true), - 'path' => [0, 0], - 'title' => [$item->getField('name', true), Util::ucFirst(Lang::$game['item'])], - 'pageText' => [], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => ['color' => 'ff'.Util::$rarityColorStings[$item->getField('quality')], 'linkId' => 'item:'.$_id.':0:0:0:0:0:0:0:0'], - BUTTON_VIEW3D => $view3D ? ['displayId' => $item->getField('displayId'), 'slot' => $_slot, 'type' => TYPE_ITEM, 'typeId' => $_id] : false, - BUTTON_COMPARE => $cmpUpg, // bool required - BUTTON_UPGRADE => $cmpUpg ? ['class' => $_class, 'slot' => $_slot] : false - ), - 'page' => array( - 'quality' => $item->getField('quality'), - 'icon' => $item->getField('iconString'), - 'name' => $item->getField('name', true), - 'stack' => $item->getField('stackable'), - ) - ); - // path if (in_array($_class, [5, 8, 14])) { - $pageData['path'][] = 15; // misc. + $_path[] = 15; // misc. if ($_class == 5) // reagent - $pageData['path'][] = 1; + $_path[] = 1; else - $pageData['path'][] = 4; // other + $_path[] = 4; // other } else { - $pageData['path'][] = $_class; + $_path[] = $_class; if (!in_array($_class, [ITEM_CLASS_MONEY, ITEM_CLASS_QUEST, ITEM_CLASS_KEY])) - $pageData['path'][] = $_subClass; + $_path[] = $_subClass; if ($_class == ITEM_CLASS_ARMOR && in_array($_subClass, [1, 2, 3, 4])) { if ($_ = $_slot); - $pageData['path'][] = $_; + $_path[] = $_; } else if (($_class == ITEM_CLASS_CONSUMABLE && $_subClass == 2) || $_class == ITEM_CLASS_GLYPH) - $pageData['path'][] = $item->getField('subSubClass'); + $_path[] = $item->getField('subSubClass'); } // pageText + $pageText = []; if ($next = $item->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']; - $pageData['pageText'][] = Util::parseHtmlText(Util::localizedString($row, 'Text')); + $pageText[] = Util::parseHtmlText(Util::localizedString($row, 'Text')); } } + // menuId 0: Item g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'quality' => $item->getField('quality'), + 'headIcons' => [$item->getField('iconString'), $item->getField('stackable')], + 'name' => $item->getField('name', true), + 'infobox' => $quickInfo ? '[ul][li]'.implode('[/li][li]', $quickInfo).'[/li][/ul]' : null, + 'tooltip' => $item->renderTooltip([], true), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'title' => $item->getField('name', true).' - '.Util::ucFirst(Lang::$game['item']), + 'pageText' => $pageText, + 'tab' => 0, + 'type' => TYPE_ITEM, + 'typeId' => $_id, + 'reqJS' => array( + $pageText ? 'template/js/Book.js' : null, + 'template/js/swfobject.js', + 'template/js/profile.js', + 'template/js/filters.js', + '?data=weight-presets' + ), + 'reqCSS' => array( + $pageText ? ['path' => 'template/css/Book.css'] : null, + ), + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => ['color' => 'ff'.Util::$rarityColorStings[$item->getField('quality')], 'linkId' => 'item:'.$_id.':0:0:0:0:0:0:0:0'], + BUTTON_VIEW3D => $view3D ? ['displayId' => $item->getField('displayId'), 'slot' => $_slot, 'type' => TYPE_ITEM, 'typeId' => $_id] : false, + BUTTON_COMPARE => $cmpUpg, // bool required + BUTTON_UPGRADE => $cmpUpg ? ['class' => $_class, 'slot' => $_slot] : false + ), + ), + 'relTabs' => [] + ); + // subItems $item->initSubItems(); if (!empty($item->subItems[$_id])) @@ -686,7 +702,7 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) // tab: same model as if (($model = $item->getField('model')) && $_slot) { - $sameModel = new ItemList(array(['model', $model], ['id', $_id, '!'])); + $sameModel = new ItemList(array(['model', $model], ['id', $_id, '!'], ['slot', $_slot])); if (!$sameModel->error) { $sameModel->addGlobalsToJscript($smarty, GLOBALINFO_SELF); @@ -731,42 +747,38 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) $currency[] = [-$id, $qty]; } - if ($_ = $vendors[$k]['event']) + $row['stock'] = $vendors[$k]['maxcount']; + $row['cost'] = [$item->getField('buyPrice')]; + + if ($e = $vendors[$k]['eventId']) { - if (count($extraCols) == 3) // not already pushed + if (count($extraCols) == 3) $extraCols[] = 'Listview.extraCols.condition'; - $holidays[$_] = 0; // applied as back ref. - + Util::$pageTemplate->extendGlobalIds(TYPE_WORLDEVENT, $e); $row['condition'] = array( 'type' => TYPE_WORLDEVENT, - 'typeId' => &$holidays[$_], + 'typeId' => -$e, 'status' => 1 ); } - $row['stock'] = $vendors[$k]['stock']; - $row['stack'] = $item->getField('buyCount'); - $row['cost'] = [$this->getField('buyPrice')]; if ($currency || $tokens) // fill idx:3 if required $row['cost'][] = $currency; if ($tokens) $row['cost'][] = $tokens; + + if ($x = $item->getField('buyPrice')) + $row['buyprice'] = $x; + + if ($x = $item->getField('sellPrice')) + $row['sellprice'] = $x; + + if ($x = $item->getField('buyCount')) + $row['stack'] = $x; } - if ($holidays) - { - $hObj = new WorldEventList(array(['id', array_keys($holidays)])); - $hObj->addGlobalsToJscript($smarty); - foreach ($hObj->iterate() as $id => $tpl) - { - if ($_ = $tpl['holidayId']) - $holidays[$tpl['eventBak']] = $_; - else - $holidays[-$id] = $id; - } - } $pageData['relTabs'][] = array( 'file' => 'creature', @@ -872,29 +884,11 @@ if (!$smarty->loadCache($cacheKeyPage, $item)) $smarty->saveCache($cacheKeyPage, $pageData); } -// menuId 0: Item g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $pageData['title']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_ITEM, - 'typeId' => $_id, - 'reqJS' => array( - $pageData['pageText'] ? 'template/js/Book.js' : null, - 'template/js/swfobject.js', - 'template/js/profile.js', - 'template/js/filters.js', - '?data=weight-presets' - ), - 'reqCSS' => array( - $pageData['pageText'] ? ['path' => 'template/css/Book.css'] : null, - ) -)); -$smarty->assign('redButtons', $pageData['buttons']); + +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_ITEM, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('item.tpl'); diff --git a/pages/items.php b/pages/items.php index fd43c1df..aabb3463 100644 --- a/pages/items.php +++ b/pages/items.php @@ -76,12 +76,12 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) $visibleCols = []; $hiddenCols = []; - if ($cats[0] !== null) + if ($cats) $path = array_merge($path, $cats); // display available submenu and slot, if applicable $type = $slot = [[], null]; - if ($cats[0] === null) + if (!$cats) { $slot = [Lang::$item['inventoryType'], null]; asort($slot[0]); @@ -172,7 +172,8 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) if (preg_match('/gb\=(1|2|3)/i', $_SERVER['QUERY_STRING'], $match)) $filter['gb'] = $match[1]; - $conditions[] = ['i.class', $cats[0]]; + if (isset($cats[0])) + $conditions[] = ['i.class', $cats[0]]; if (isset($cats[1])) $conditions[] = ['i.subClass', $cats[1]]; if (isset($cats[2])) @@ -197,21 +198,33 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) if (array_intersect([63, 64], $xCols)) // 63:buyPrice; 64:sellPrice $infoMask |= ITEMINFO_VENDOR; + // menuId 0: Item g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'page' => [], - 'data' => $items->getListviewData($infoMask), - 'title' => $title, - 'path' => $path, - 'params' => [] + 'page' => array( + 'title' => implode(' - ', $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'subCat' => $pageParam !== null ? '='.$pageParam : '', + 'reqJS' => array( + 'template/js/filters.js', + 'template/js/swfobject.js', + '?data=weight-presets' + ) + ), + 'lv' => array( + 'data' => $items->getListviewData($infoMask), + 'params' => [] + ) ); if ($items->filterGetError()) - $pageData['params']['_errors'] = '$1'; + $pageData['lv']['params']['_errors'] = '$1'; if (!empty($filter['upg'])) { // upgrade-item got deleted by filter - if (empty($pageData['data'][$filter['upg']])) + if (empty($pageData['lv']['data'][$filter['upg']])) { $w = $items->filterGetForm('setWeights', true); $upgItem = new ItemList(array(['id', $filter['upg']]), false, ['wt' => $w[0], 'wtv' => $w[1]]); @@ -220,14 +233,14 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) if (!$upgItem->error) { $upgItem->addGlobalsToJScript($smarty); - $pageData['data'][$filter['upg']] = $upgItem->getListviewData($infoMask)[$filter['upg']]; + $pageData['lv']['data'][$filter['upg']] = $upgItem->getListviewData($infoMask)[$filter['upg']]; } } if (!empty($filter['gb'])) - $pageData['params']['customFilter'] = '$fi_filterUpgradeListview'; + $pageData['lv']['params']['customFilter'] = '$fi_filterUpgradeListview'; - $pageData['params']['_upgradeIds'] = "$[".$filter['upg']."]"; + $pageData['lv']['params']['_upgradeIds'] = "$[".$filter['upg']."]"; } /* by level: max 10 itemlevel steps (Level X) +1x Other|Autre|Anderes|Otros|Другое levels @@ -272,14 +285,14 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { $gem = empty($filter['gm']) ? 0 : $filter['gm']; $cost = array_intersect([63], $xCols) ? 1 : 0; - $pageData['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.$gem.', '.$cost.')'; + $pageData['lv']['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, '.$gem.', '.$cost.')'; } if (!empty($filter['fi']['setWeights'])) { if (!empty($filter['gm'])) { - $pageData['params']['computeDataFunc'] = '$fi_scoreSockets'; + $pageData['lv']['params']['computeDataFunc'] = '$fi_scoreSockets'; $w = $items->filterGetForm('setWeights', true); $q = intVal($filter['gm']); @@ -310,9 +323,9 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) $pageData['page']['gemScores'] = json_encode($pageData['page']['gemScores'], JSON_NUMERIC_CHECK); } - $pageData['params']['onBeforeCreate'] = '$fi_initWeightedListview'; - $pageData['params']['onAfterCreate'] = '$fi_addUpgradeIndicator'; - $pageData['params']['sort'] = "$['-score', 'name']"; + $pageData['lv']['params']['onBeforeCreate'] = '$fi_initWeightedListview'; + $pageData['lv']['params']['onAfterCreate'] = '$fi_addUpgradeIndicator'; + $pageData['lv']['params']['sort'] = "$['-score', 'name']"; if ($items->hasSetFields(['armor'])) $visibleCols[] = 'armor'; @@ -323,15 +336,15 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) // create note if search limit was exceeded; overwriting 'note' is intentional if ($items->getMatches() > SQL_LIMIT_DEFAULT && empty($filter['upg'])) { - $pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), SQL_LIMIT_DEFAULT); - $pageData['params']['_truncated'] = 1; + $pageData['lv']['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsfound', $items->getMatches(), SQL_LIMIT_DEFAULT); + $pageData['lv']['params']['_truncated'] = 1; } if ($hiddenCols) - $pageData['params']['hiddenCols'] = '$'.json_encode($hiddenCols); + $pageData['lv']['params']['hiddenCols'] = '$'.json_encode($hiddenCols); if ($visibleCols) - $pageData['params']['visibleCols'] = '$'.json_encode($visibleCols); + $pageData['lv']['params']['visibleCols'] = '$'.json_encode($visibleCols); $smarty->saveCache($cacheKey, $pageData, $filter); } @@ -341,22 +354,10 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) asort(Lang::$game['ra']); asort(Lang::$game['cl']); -// menuId 0: Item g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(' - ', $pageData['title']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'subCat' => $pageParam !== null ? '='.$pageParam : '', - 'reqJS' => array( - 'template/js/filters.js', - 'template/js/swfobject.js', - '?data=weight-presets' - ) -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('filter', $filter); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$item, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['lv']); // load the page $smarty->display('items.tpl'); diff --git a/pages/itemset.php b/pages/itemset.php index 60914b70..ca0cceb3 100644 --- a/pages/itemset.php +++ b/pages/itemset.php @@ -15,7 +15,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $iSet = new ItemsetList(array(['id', $_id])); if ($iSet->error) - $smarty->notFound(Lang::$game['itemset']); + $smarty->notFound(Lang::$game['itemset'], $_id); $_ta = $iSet->getField('contentGroup'); $_ty = $iSet->getField('type'); @@ -169,36 +169,43 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $skill = ''; if ($_sk) { - // todo (med): kill this Lang::monstrosity with Skills $spellLink = sprintf('%s (%s)', $_sk, Lang::$spell['cat'][11][$_sk][0], $iSet->getField('skillLevel')); $skill = ' – '.sprintf(Lang::$game['requires'], $spellLink).''; } + // menuId 2: Itemset g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => $_na, // for header - 'path' => $path, - 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, - 'relTabs' => [], - 'pieces' => $pieces, - 'spells' => $spells, - 'buttons' => array( - BUTTON_WOWHEAD => $_id > 0, // bool only - BUTTON_LINKS => ['color' => '', 'linkId' => ''], - BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $_id, 'equipList' => $eqList], - BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt] - ), - 'compare' => array( - 'qty' => $_cnt, - 'items' => $compare, - 'level' => $_lvl - ), 'page' => array( 'name' => $_na, // for page content - 'id' => $_id, 'bonusExt' => $skill, 'description' => $_ta ? sprintf(Lang::$itemset['_desc'], $_na, Lang::$itemset['notes'][$_ta], $_cnt) : sprintf(Lang::$itemset['_descTagless'], $_na, $_cnt), - 'unavailable' => (bool)($iSet->getField('cuFlags') & CUSTOM_UNAVAILABLE) - ) + 'unavailable' => (bool)($iSet->getField('cuFlags') & CUSTOM_UNAVAILABLE), + 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'title' => $_na." - ".Util::ucfirst(Lang::$game['itemset']), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_ITEMSET, + 'typeId' => $_id, + 'reqJS' => array( + 'template/js/Summary.js', + 'template/js/swfobject.js' + ), + 'pieces' => $pieces, + 'spells' => $spells, + 'redButtons' => array( + BUTTON_WOWHEAD => $_id > 0, // bool only + BUTTON_LINKS => ['color' => '', 'linkId' => ''], + BUTTON_VIEW3D => ['type' => TYPE_ITEMSET, 'typeId' => $_id, 'equipList' => $eqList], + BUTTON_COMPARE => ['eqList' => implode(':', $compare), 'qty' => $_cnt] + ), + 'compare' => array( + 'qty' => $_cnt, + 'items' => $compare, + 'level' => $_lvl + ), + ), + 'relTabs' => [] ); $iSet->addGlobalsToJscript($smarty); @@ -263,23 +270,10 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 2: Itemset g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['itemset']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_ITEMSET, - 'typeId' => $_id, - 'reqJS' => array( - 'template/js/Summary.js', - 'template/js/swfobject.js' - ) -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_ITEMSET, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$itemset, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('itemset.tpl'); diff --git a/pages/itemsets.php b/pages/itemsets.php index 2fd3288f..fa52beb0 100644 --- a/pages/itemsets.php +++ b/pages/itemsets.php @@ -12,12 +12,6 @@ $cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_ITEMSET, -1, $filterHash, User: if (!$smarty->loadCache($cacheKey, $pageData, $filter)) { $itemsets = new ItemsetList([], true); // class selection is via filter, nothing applies here - - $pageData = array( - 'data' => $itemsets->getListviewData(), // listview content - 'params' => [] - ); - $itemsets->addGlobalsToJscript($smarty); // recreate form selection @@ -25,21 +19,44 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; $filter['fi'] = $itemsets->filterGetForm(); - if (!empty($filter['fi']['extraCols'])) - $pageData['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; - if (isset($filter['cl'])) $path[] = $filter['cl']; + // menuId 2: Itemset g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'title' => Util::ucFirst(Lang::$game['itemsets']), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'subCat' => $pageParam ? '='.$pageParam : '', + 'reqJS' => array( + 'template/js/filters.js', + '?data=weight-presets' + ) + ), + 'lv' => [] + ); + + $lv = array( + 'data' => $itemsets->getListviewData(), // listview content + 'params' => [] + ); + + if (!empty($filter['fi']['extraCols'])) + $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; + // create note if search limit was exceeded if ($itemsets->getMatches() > SQL_LIMIT_DEFAULT) { - $pageData['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), SQL_LIMIT_DEFAULT); - $pageData['params']['_truncated'] = 1; + $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_itemsetsfound', $itemsets->getMatches(), SQL_LIMIT_DEFAULT); + $lv['params']['_truncated'] = 1; } if ($itemsets->filterGetError()) - $pageData['params']['_errors'] = '$1'; + $lv['params']['_errors'] = '$1'; + + $pageData['lv'] = $lv; $smarty->saveCache($cacheKey, $pageData, $filter); } @@ -49,21 +66,10 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) asort(Lang::$itemset['notes'], SORT_NATURAL); asort(Lang::$game['cl']); -// menuId 2: Itemset g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => Util::ucFirst(Lang::$game['itemsets']), - 'path' => json_encode($path, JSON_NUMERIC_CHECK), - 'tab' => 0, - 'subCat' => $pageParam ? '='.$pageParam : '', - 'reqJS' => array( - 'template/js/filters.js', - '?data=weight-presets' - ) -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('filter', $filter); $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$itemset, Lang::$item, ['colon' => lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['lv']); // load the page $smarty->display('itemsets.tpl'); diff --git a/pages/miscTools.php b/pages/miscTools.php index aea76704..095f6e80 100644 --- a/pages/miscTools.php +++ b/pages/miscTools.php @@ -105,7 +105,7 @@ switch ($pageCall) $lv = []; break; default: - $smarty->notFound(); + $smarty->error(); } if (strstr($pageCall, 'latest') || $pageCall == 'most-comments') diff --git a/pages/npc.php b/pages/npc.php index 7baf7e9f..5e784de0 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -6,7 +6,10 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 4]; +$_altIds = []; +$_altNPCs = null; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_NPC, $_id, -1, User::$localeId]); $cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_NPC, $_id, -1, User::$localeId]); @@ -43,475 +46,549 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $npc = new CreatureList(array(['ct.id', $_id])); if ($npc->error) - $smarty->notFound(Lang::$game['npc']); + $smarty->notFound(Lang::$game['npc'], $_id); + // reconstruct path + $_path[] = $npc->getField('type'); + $_typeFlags = $npc->getField('typeFlags'); + $_name = $npc->getField('name', true); + + if ($_ = $npc->getField('family')) + $_path[] = $_; + + $position = null; + + // difficulty entrys of self + if ($npc->getField('cuFlags') & NPC_CU_DIFFICULTY_DUMMY) + { + // find and create link to regular creature + $regNPC = new CreatureList(array(['OR', ['difficultyEntry1', $_id], ['difficultyEntry2', $_id], ['difficultyEntry3', $_id]])); + $position = [$regNPC->id, $regNPC->getField('name', true)]; + } + else + { + for ($i = 1; $i < 4; $i++) + if ($_ = $npc->getField('difficultyEntry'.$i)) + $_altIds[$_] = $i; + + if ($_altIds) + $_altNPCs = new CreatureList(array(['id', array_keys($_altIds)])); + } + + // map mode + $mapType = 0; + $maps = DB::Aowow()->selectCol('SELECT DISTINCT map from creature WHERE id = ?d', $_id); + if (count($maps) == 1) // should only exist in one instance + { + $map = new ZoneList(array(1, ['mapId', $maps[0]])); + // $mapType = $map->getField('areaType'); + } + + /***********/ + /* Infobox */ + /***********/ + + $infobox = []; + + // Level + if ($npc->getField('rank') != NPC_RANK_BOSS) + { + $level = $npc->getField('minLevel'); + $maxLvl = $npc->getField('maxLevel'); + if ($level < $maxLvl) + $level .= ' - '.$maxLvl; + } + else // Boss Level + $level = '??'; + + $infobox[] = Lang::$game['level'].Lang::$colon.$level; + + // Classification + if ($_ = $npc->getField('rank')) // != NPC_RANK_NORMAL + { + $str = $_typeFlags & 0x4 ? '[span class=boss-icon]'.Lang::$npc['rank'][$_].'[/span]' : Lang::$npc['rank'][$_]; + $infobox[] = Lang::$npc['classification'].Lang::$colon.$str; + } + + // Reaction + $_ = function ($r) + { + if ($r == 1) return 2; + if ($r == -1) return 10; + return; + }; + $infobox[] = Lang::$npc['react'].Lang::$colon.'[color=q'.$_($npc->getField('A')).']A[/color] [color=q'.$_($npc->getField('H')).']H[/color]'; + + // Faction + Util::$pageTemplate->extendGlobalIds(TYPE_FACTION, $npc->getField('factionId')); + $infobox[] = Util::ucFirst(Lang::$game['faction']).Lang::$colon.'[faction='.$npc->getField('factionId').']'; + + // Wealth + if ($_ = intVal(($npc->getField('minGold') + $npc->getField('maxGold')) / 2)) + $infobox[] = Lang::$npc['worth'].Lang::$colon.'[tooltip=tooltip_avgmoneydropped][money='.$_.'][/tooltip]'; + + // AI + if (User::isInGroup(U_GROUP_STAFF)) + { + if ($_ = $npc->getField('aiName')) + $infobox[] = 'AI'.Lang::$colon.$_; + else if ($_ = $npc->getField('scriptName')) + $infobox[] = 'Script'.Lang::$colon.$_; + } + + $_nf = function ($num) { return number_format($num, 0, '', '.'); }; + + // Health + $health = $npc->getField('healthMin'); + $maxHealth = $npc->getField('healthMax'); + $health = $health < $maxHealth ? $_nf($health).' - '.$_nf($maxHealth) : $_nf($health); + + $modes = []; + $tipp = '[tooltip name=healthModes][table cellspacing=10][tr]%s[/tr][/table][/tooltip][span class=tip tooltip=healthModes]%s[/span]'; + if ($mapType == 1 || $mapType == 2) // Dungeon or Raid + { + foreach ($_altIds as $mode => $id) + { + foreach ($_altNPCs->iterate() as $dId => $__) + { + if ($dId != $id) + continue; + + $hp = $_altNPCs->getField('healthMin'); + $hpMax = $_altNPCs->getField('healthMax'); + $hp = $hp < $hpMax ? $_nf($hp).' - '.$_nf($hpMax) : $_nf($hp); + + $modes[] = '[tr][td]'.Lang::$npc['modes'][$mapType][$mode].'  [/td][td]'.$hp.'[/td][/tr]'; + break; + } + } + + if ($modes) + $health = Lang::$spell['powerTypes'][-2].' ('.Lang::$npc['modes'][$mapType][0].')'.Lang::$colon.$health; + } + + if ($modes) + $infobox[] = sprintf($tipp, implode('[/tr][tr]', $modes), $health); + else + $infobox[] = Lang::$spell['powerTypes'][-2].Lang::$colon.$health; + + // Mana + $mana = $npc->getField('manaMin'); + $maxMana = $npc->getField('manaMax'); + if ($maxMana) + { + $mana = $mana < $maxMana ? $_nf($mana).' - '.$_nf($maxMana) : $_nf($mana); + $infobox[] = Lang::$spell['powerTypes'][0].Lang::$colon.$mana; + } - // not yet implemented -> chicken out - $smarty->error(); /* - - - -
{#Quick_Facts#}
-
    -
  • {#Level#}: {if $npc.minlevel<>$npc.maxlevel}{$npc.minlevel} - {/if}{$npc.maxlevel}
  • -
  • {#Classification#}: {$npc.rank}
  • -
  • {#React#}: A H
  • -
  • {#Faction#}: {$npc.faction}
  • -
  • {#Health#}: {if $npc.minhealth<>$npc.maxhealth}{$npc.minhealth} - {/if}{$npc.maxhealth}
  • -{if ($npc.minmana or $npc.maxmana)} -
  • {#Mana#}: {if $npc.minmana<>$npc.maxmana}{$npc.minmana} - {/if}{$npc.maxmana}
  • -{/if} -{if ($npc.moneysilver>0) or ($npc.moneygold>0) or ($npc.moneycopper>0)} -
  • {#Wealth#}:{if ($npc.moneygold>0)} - {$npc.moneygold}{/if} -{if ($npc.moneysilver>0)} - {$npc.moneysilver}{/if} -{if ($npc.moneycopper>0)} - {$npc.moneycopper}{/if} -
  • -{/if} -{if $npc.mindmg > 0 and $npc.maxdmg > 0} -
  • {#Damage#}: {$npc.mindmg} - {$npc.maxdmg}
  • -{/if} -{if $npc.armor > 0} -
  • {#Armor#}: {$npc.armor}
  • -{/if} -
-
+ if damage +
  • {#Damage#}: {$npc.mindmg} - {$npc.maxdmg}
  • + + if armor +
  • {#Armor#}: {$npc.armor}
  • */ - unset($npc); - // Ищем NPC: - $npc = array(); - $path = [0, 4, $npc['type']]; + /****************/ + /* Main Content */ + /****************/ - $row = $DB->selectRow(' - SELECT - ?#, c.entry, c.name, - { - l.name_loc'.$_SESSION['locale'].' as `name_loc`, - l.subname_loc'.$_SESSION['locale'].' as `subname_loc`, - ?, - } - f.name_loc'.$_SESSION['locale'].' as `faction-name`, ft.factionID as `factionID`, - ((CASE exp WHEN 0 THEN mincls.basehp0 WHEN 1 THEN mincls.basehp1 WHEN 2 THEN mincls.basehp2 END)*Health_mod) AS minhealth, - ((CASE exp WHEN 0 THEN maxcls.basehp0 WHEN 1 THEN maxcls.basehp1 WHEN 2 THEN maxcls.basehp2 END)*Health_mod) AS maxhealth, - (mincls.basemana*Mana_mod) AS minmana, - (maxcls.basemana*Mana_mod) AS maxmana, - (maxcls.basearmor*Armor_mod) AS armor - FROM ?_factiontemplate ft, ?_factions f, creature_template c - LEFT JOIN creature_classlevelstats mincls ON mincls.level=minlevel AND mincls.class=unit_class - LEFT JOIN creature_classlevelstats maxcls ON maxcls.level=maxlevel AND maxcls.class=unit_class + // reputations (by mode) + $spilledParents = []; + $reputation = []; + $_repFunc = function ($entries, &$spillover) + { + $q = 'SELECT f.id, f.parentFactionId, cor.creature_id AS npc, + IF(f.id = RewOnKillRepFaction1, RewOnKillRepValue1, RewOnKillRepValue2) AS qty, + IF(f.id = RewOnKillRepFaction1, MaxStanding1, MaxStanding2) AS maxRank, + IF(f.id = RewOnKillRepFaction1, isTeamAward1, isTeamAward2) AS spillover + FROM aowow_factions f JOIN creature_onkill_reputation cor ON f.Id = cor.RewOnKillRepFaction1 OR f.Id = cor.RewOnKillRepFaction2 WHERE cor.creature_id IN (?a)'; + + $result = []; + $repData = DB::Aowow()->select($q, (array)$entries); + + foreach ($repData as $_) { - LEFT JOIN (locales_creature l) - ON l.entry = c.entry AND ? + $set = array( + 'id' => $_['id'], + 'qty' => $_['qty'], + 'name' => FactionList::getName($_['id']), // << this sucks .. maybe format this whole table with markdown and add name via globals? + 'npc' => $_['npc'], + 'cap' => $_['maxRank'] && $_['maxRank'] < REP_EXALTED ? Lang::$game['rep'][$_['maxRank']] : null + ); + + if ($_['spillover']) + { + $spillover[$_['parentFactionId']] = [intVal($_['qty'] / 2), $_['maxRank']]; + $set['spillover'] = $_['parentFactionId']; + } + + $result[] = $set; } - WHERE - c.entry = ? - AND ft.factiontemplateID = c.faction_A - AND f.factionID = ft.factionID - LIMIT 1 - ', - $npc_cols[1], - ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP, - ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP, - $_id + + return $result; + }; + + // base NPC + if ($base = $_repFunc($_id, $spilledParents)) + $reputation[] = [Lang::$npc['modes'][1][0], $base]; + + // difficulty dummys + if ($_altIds) + { + $alt = []; + $rep = $_repFunc(array_keys($_altIds), $spilledParents); + + // order by difficulty + foreach ($rep as $r) + $alt[$_altIds[$r['npc']]][] = $r; + + // apply by difficulty + foreach ($alt as $mode => $dat) + $reputation[] = [Lang::$npc['modes'][$mapType][$mode], $dat]; + } + + // get spillover factions and apply + if ($spilledParents) + { + $spilled = new FactionList(array(['parentFactionId', array_keys($spilledParents)])); + + foreach($reputation as &$sets) + { + foreach ($sets[1] as &$row) + { + if (empty($row['spillover'])) + continue; + + foreach ($spilled->iterate() as $spId => $__) + { + // find parent + if ($spilled->getField('parentFactionId') != $row['spillover']) + continue; + + // don't readd parent + if ($row['id'] == $spId) + continue; + + $spMax = $spilledParents[$row['spillover']][1]; + + $sets[1][] = array( + 'id' => $spId, + 'qty' => $spilledParents[$row['spillover']][0], + 'name' => $spilled->getField('name', true), + 'cap' => $spMax && $spMax < REP_EXALTED ? Lang::$game['rep'][$spMax] : null + ); + } + } + } + } + + // Quotes + $quotes = []; + if ($texts = DB::Aowow()->select('SELECT ct.*, ct.groupid AS ARRAY_KEY, ct.id as ARRAY_KEY2, lct.text_loc2, lct.text_loc3, lct.text_loc6, lct.text_loc8 FROM creature_text ct LEFT JOIN locales_creature_text lct ON ct.entry = lct.entry AND ct.groupid = lct.groupid AND ct.id = lct.id WHERE ct.entry = ?d', $_id)) + { + $nQuotes = 0; + foreach ($texts as $text) + { + $group = []; + foreach ($text as $t) + { + // 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) + $text = '%s '.$text; + + $line = array( + 'type' => 2, // [type: 0, 12] say: yellow-ish + 'lang' => !empty($t['language']) ? Lang::$game['languages'][$t['language']] : null, + 'text' => sprintf(Util::parseHtmlText(htmlentities($text)), $_name), + ); + + switch ($t['type']) + { + case 1: // yell: + case 14: $line['type'] = 1; break; // - dark red + case 2: // emote: + case 16: // " + case 3: // boss emote: + case 41: $line['type'] = 4; break; // - orange + case 4: // whisper: + case 15: // " + case 5: // boss whisper: + case 42: $line['type'] = 3; break; // - pink-ish + } + + $nQuotes++; + $group[] = $line; + } + $quotes[] = $group; + } + $quotes = [$quotes, $nQuotes]; + } + + + // get spawns and such + + + // menuId 4: NPC g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'name' => $_name, + 'subname' => $npc->getField('subname', true), + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'difficultyPH' => isset($difficultyPH) ? $difficultyPH : null, + // 'mapper' => true, + 'position' => $position, + 'quotes' => $quotes, + 'reputation' => $reputation, + 'title' => $_name.' - '.Util::ucFirst(Lang::$game['npc']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_NPC, + 'typeId' => $_id, + 'reqJS' => ['template/js/swfobject.js'], + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true, + BUTTON_VIEW3D => ['type' => TYPE_NPC, 'typeId' => $_id, 'displayId' => $npc->getRandomModelId()] + ) + ), + 'relTabs' => [] ); - if($row) + /**************/ + /* Extra Tabs */ + /**************/ + + // tab: SAI + // hmm, how should this loot like + + // tab: abilities + // for spell in template and smartScripts if set + + // tab: teaches + // pet spells, class spells, trade spells + + // 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)) { - $npc = $row; - $npc['name'] = localizedName($row); - $npc['subname'] = localizedName($row, 'subname'); - if($npc['rank'] == 3) + $soldItems = new ItemList(array(['id', $sells])); + if (!$soldItems->error) { - $npc['minlevel'] = '??'; - $npc['maxlevel'] = '??'; - } - $npc['mindmg'] = round(($row['mindmg'] + $row['attackpower']) * $row['dmg_multiplier']); - $npc['maxdmg'] = round(($row['maxdmg'] + $row['attackpower']) * $row['dmg_multiplier']); + $soldItems->addGlobalsToJscript(Util::$pageTemplate); - $toDiv = array('minhealth', 'maxmana', 'minmana', 'maxhealth', 'armor', 'mindmg', 'maxdmg'); - // Разделяем на тысячи (ххххххххх => ххх,ххх,ххх) - foreach($toDiv as $e) - $npc[$e] = number_format($npc[$e]); - - $npc['rank'] = $smarty->get_config_vars('rank'.$npc['rank']); - // faction_A = faction_H - $npc['faction_num'] = $row['factionID']; - $npc['faction'] = $row['faction-name']; - // Деньги - $money = ($row['mingold']+$row['maxgold']) / 2; - $npc = array_merge($npc, money2coins($money)); - // Героик/нормал копия НПС - if($npc['difficulty_entry_1']) - { - // это нормал НПС, ищем героика - if($tmp = creatureinfo($npc['difficulty_entry_1'])) - { - $npc['heroic'] = array( - 'type' => 0, - 'entry' => $tmp['entry'], - 'name' => str_replace(LOCALE_HEROIC, '', $tmp['name']) - ); - - unset($tmp); - } - } - else - { - // А может быть героик НПС одним для нескольких нормалов? - // считаем что нет - $tmp = $DB->selectRow(' - SELECT c.entry, c.name - { - , l.name_loc?d as `name_loc` - } - FROM creature_template c - { - LEFT JOIN (locales_creature l) - ON l.entry = c.entry AND ? - } - WHERE - c.difficulty_entry_1 = ?d - LIMIT 1 - ', - ($_SESSION['locale']>0)? $_SESSION['locale']: DBSIMPLE_SKIP, - ($_SESSION['locale']>0)? 1: DBSIMPLE_SKIP, - $npc['entry'] + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $soldItems->getListviewData(ITEMINFO_VENDOR, [TYPE_NPC => $_id]), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_sells', + 'id' => 'currency-for', + 'extraCols' => "$[Listview.extraCols.condition, Listview.funcBox.createSimpleCol('stack', 'stack', '10%', 'stack'), Listview.extraCols.cost]" + ] ); - if($tmp) - { - $npc['heroic'] = array( - 'type' => 1, - 'entry' => $tmp['entry'], - 'name' => localizedName($tmp) - ); - $npc['name'] = str_replace(' (1)', '', $npc['name']); - $normal_entry = $tmp['entry']; - unset($tmp); - } } - // Дроп - $lootid=$row['lootid']; - $skinid=$row['skinloot']; - $pickpocketid=$row['pickpocketloot']; - // Используемые спеллы - $npc['ablities'] = array(); - $tmp = array(); - for($j=0;$j<=4;++$j) + } + + // tabs: this creature contains.. + $skinTab = ['tab_skinning', 'skinned-from']; + if ($_typeFlags & NPC_TYPEFLAG_HERBLOOT) + $skinTab = ['tab_gatheredfromnpc', 'gathered-from-npc']; + else if ($_typeFlags & NPC_TYPEFLAG_MININGLOOT) + $skinTab = ['tab_minedfromnpc', 'mined-from-npc']; + else if ($_typeFlags & NPC_TYPEFLAG_ENGINEERLOOT) + $skinTab = ['tab_salvagedfrom', 'salvaged-from-npc']; + +/* + extraCols: [Listview.extraCols.count, Listview.extraCols.percent, Listview.extraCols.mode], + _totalCount: 22531, + computeDataFunc: Listview.funcBox.initLootTable, + onAfterCreate: Listview.funcBox.addModeIndicator, + + modes:{"mode":1,"1":{"count":4408,"outof":16013},"4":{"count":4408,"outof":22531}} +*/ + + $sourceFor = array( + [LOOT_CREATURE, $npc->getField('lootId'), '$LANG.tab_drops', 'drops', ['Listview.extraCols.percent'], [] , []], + [LOOT_PICKPOCKET, $npc->getField('pickpocketLootId'), '$LANG.tab_pickpocketing', 'pickpocketing', ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []], + [LOOT_SKINNING, $npc->getField('skinLootId'), '$LANG.'.$skinTab[0], $skinTab[1], ['Listview.extraCols.percent'], ['side', 'slot', 'reqlevel'], []] + ); + + // temp: manually add loot for difficulty-versions + $langref = array( + "-2" => '$LANG.tab_heroic', + "-1" => '$LANG.tab_normal', + 1 => '$$WH.sprintf(LANG.tab_normalX, 10)', + 2 => '$$WH.sprintf(LANG.tab_normalX, 25)', + 3 => '$$WH.sprintf(LANG.tab_heroicX, 10)', + 4 => '$$WH.sprintf(LANG.tab_heroicX, 25)' + ); + + if ($_altIds) + { + $sourceFor[0][2] = $langref[1]; + foreach ($_altNPCs->iterate() as $id => $__) { - if($row['spell'.$j] && !in_array($row['spell'.$j], $tmp)) - { - $tmp[] = $row['spell'.$j]; - if($data = spellinfo($row['spell'.$j], 0)) - { - if($data['name']) - $npc['abilities'][] = $data; - } - } + $mode = $_altIds[$id]; + array_splice($sourceFor, 1, 0, [[LOOT_CREATURE, $_altNPCs->getField('lootId'), $langref[$mode + 1], 'drops-'.$mode, ['Listview.extraCols.percent'], [], []]]); } - for($j=1;$j<4;$j++) + } + + $reqQuest = []; + foreach ($sourceFor as $sf) + { + if ($itemLoot = Util::handleLoot($sf[0], $sf[1], User::isInGroup(U_GROUP_STAFF), $sf[4])) { - $tmp2 = $DB->select(' - SELECT action?d_param1 - FROM creature_ai_scripts - WHERE - creature_id=?d - AND action?d_type=11 - ', - $j, - $npc['entry'], - $j + foreach ($itemLoot as $l => $lv) + { + if (!$lv['quest']) + continue; + + $sf[4][] = 'Listview.extraCols.condition'; + + $reqQuest[$lv['id']] = 0; + + $itemLoot[$l]['condition'] = ['type' => TYPE_QUEST, 'typeId' => &$reqQuest[$lv['id']], 'status' => 1]; + } + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $itemLoot, + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => $sf[2], + 'id' => $sf[3], + 'extraCols' => $sf[4] ? "$[".implode(', ', array_unique($sf[4]))."]" : null, + 'hiddenCols' => $sf[5] ? "$".json_encode($sf[5]) : null, + 'visibleCols' => $sf[6] ? '$'.json_encode($sf[6]) : null, + 'sort' => "$['-percent', 'name']", + ] ); - if($tmp2) - foreach($tmp2 as $i=>$tmp3) - if(!in_array($tmp2[$i]['action'.$j.'_param1'], $tmp)) - { - $tmp[] = $tmp2[$i]['action'.$j.'_param1']; - if($data = spellinfo($tmp2[$i]['action'.$j.'_param1'], 0)) - { - if($data['name']) - $npc['abilities'][] = $data; - } - } } - if(!$npc['ablities']) - unset($npc['ablities']); + } - // Обучает: - // Если это пет со способностью: - /* // Временно закомментировано - $row = $DB->selectRow(' - SELECT Spell1, Spell2, Spell3, Spell4 - FROM petcreateinfo_spell - WHERE - entry=?d - ', - $npc['entry'] + 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] ); - if($row) + + $reqQuests = new QuestList($conditions); + $reqQuests->addGlobalsToJscript($smarty); + + foreach ($reqQuests->iterate() as $qId => $__) { - $npc['teaches'] = array(); - for($j=1;$j<=4;$j++) - if($row['Spell'.$j]) - for($k=1;$k<=3;$k++) - { - $spellrow = $DB->selectRow(' - SELECT ?#, spellID - FROM ?_spell, ?_spellicons - WHERE - spellID=(SELECT effect'.$k.'triggerspell FROM ?_spell WHERE spellID=?d AND (effect'.$k.'id IN (36,57))) - AND id=spellicon - LIMIT 1 - ', - $spell_cols[2], - $row['Spell'.$j] - ); - if($spellrow) - { - $num = count($npc['teaches']); - $npc['teaches'][$num] = array(); - $npc['teaches'][$num] = spellinfo2($spellrow); - } - } - } - unset ($row);*/ + if (empty($reqQuests->requires[$qId][TYPE_ITEM])) + continue; - // Если это просто тренер - $teachspells = $DB->select(' - SELECT ?#, spellID - FROM npc_trainer, ?_spell, ?_spellicons - WHERE - ( - -entry IN (SELECT spell FROM npc_trainer WHERE entry = ?) - OR (entry = ? AND npc_trainer.spell > 0) - ) - AND spellID = npc_trainer.spell - AND id=spellicon - ', - $spell_cols[2], - $npc['entry'], - $npc['entry'] - ); - if($teachspells) + foreach ($reqIds as $rId) + if (in_array($rId, $reqQuests->requires[$qId][TYPE_ITEM])) + $reqQuest[$rId] = $reqQuests->id; + } + } + + // tab: starts quest (questrelation) + if ($starts = DB::Aowow()->selectCol('SELECT quest FROM creature_questrelation WHERE id = ?d', $_id)) + { + $started = new QuestList(array(['id', $starts])); + if (!$started->error) { - if(!(IsSet($npc['teaches']))) - $npc['teaches'] = array(); - foreach($teachspells as $teachspell) - { - $num = count($npc['teaches']); - $npc['teaches'][$num] = array(); - $npc['teaches'][$num] = spellinfo2($teachspell); - } - } - unset ($teachspells); + $started->addGlobalsToJScript(Util::$pageTemplate); - // Продает: - $rows_s = $DB->select(' - SELECT ?#, i.entry, i.maxcount, n.`maxcount` as `drop-maxcount`, n.ExtendedCost - {, l.name_loc?d AS `name_loc`} - FROM npc_vendor n, ?_icons, item_template i - {LEFT JOIN (locales_item l) ON l.entry=i.entry AND ?d} - WHERE - n.entry=? - AND i.entry=n.item - AND id=i.displayid - ', - $item_cols[2], - ($_SESSION['locale'])? $_SESSION['locale']: DBSIMPLE_SKIP, - ($_SESSION['locale'])? 1: DBSIMPLE_SKIP, - $_id - ); - if($rows_s) - { - $npc['sells'] = array(); - foreach($rows_s as $numRow=>$row) - { - $npc['sells'][$numRow] = array(); - $npc['sells'][$numRow] = iteminfo2($row); - $npc['sells'][$numRow]['maxcount'] = $row['drop-maxcount']; - $npc['sells'][$numRow]['cost'] = array(); - if($row['ExtendedCost']) - { - $extcost = $DB->selectRow('SELECT * FROM ?_item_extended_cost WHERE extendedcostID=?d LIMIT 1', abs($row['ExtendedCost'])); - if($extcost['reqhonorpoints']>0) - $npc['sells'][$numRow]['cost']['honor'] = (($npc['A']==1)? 1: -1) * $extcost['reqhonorpoints']; - if($extcost['reqarenapoints']>0) - $npc['sells'][$numRow]['cost']['arena'] = $extcost['reqarenapoints']; - $npc['sells'][$numRow]['cost']['items'] = array(); - for($j=1;$j<=5;$j++) - if(($extcost['reqitem'.$j]>0) and ($extcost['reqitemcount'.$j]>0)) - { - allitemsinfo($extcost['reqitem'.$j], 0); - $npc['sells'][$numRow]['cost']['items'][] = array('item' => $extcost['reqitem'.$j], 'count' => $extcost['reqitemcount'.$j]); - } - } - if($row['BuyPrice']>0) - $npc['sells'][$numRow]['cost']['money'] = $row['BuyPrice']; - } - unset ($row); - unset ($numRow); - unset ($extcost); - } - unset ($rows_s); - - // Дроп - if(!($npc['drop'] = loot('creature_loot_template', $lootid))) - unset ($npc['drop']); - - // Кожа - if(!($npc['skinning'] = loot('skinning_loot_template', $skinid))) - unset ($npc['skinning']); - - // Воруеццо - if(!($npc['pickpocketing'] = loot('pickpocketing_loot_template', $pickpocketid))) - unset ($npc['pickpocketing']); - - // Начиниают квесты... - $rows_qs = $DB->select(' - SELECT q.?# - FROM quest_template q - LEFT JOIN creature_questrelation c on q.id = c.quest - WHERE - c.id=? - ', - $quest_cols[2], - $_id + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $started->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_starts', + 'id' => 'starts' + ] ); - if($rows_qs) - { - $npc['starts'] = array(); - foreach($rows_qs as $numRow=>$row) { - $npc['starts'][] = GetQuestInfo($row, 0xFFFFFF); - } } - unset ($rows_qs); + } - // Начиниают event-only квесты... - $rows_qse = event_find(array('quest_creature_id' => $_id)); - if($rows_qse) + // tab: ends quest (involvedrelation) + if ($ends = DB::Aowow()->selectCol('SELECT quest FROM creature_involvedrelation WHERE id = ?d', $_id)) + { + $ended = new QuestList(array(['id', $ends])); + if (!$ended->error) { - if (!isset($npc['starts'])) - $npc['starts'] = array(); - foreach($rows_qse as $event) - foreach($event['creatures_quests_id'] as $ids) - $npc['starts'][] = GetDBQuestInfo($ids['quest'], 0xFFFFFF); - } - unset ($rows_qse); + $ended->addGlobalsToJScript(Util::$pageTemplate); - // Заканчивают квесты... -$rows_qe = $DB->select(' - SELECT q.?# - FROM quest_template q - LEFT JOIN creature_involvedrelation c on q.id = c.quest - WHERE - c.id=? - ', - $quest_cols[2], - $_id + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $ended->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_ends', + 'id' => 'ends' + ] + ); + } + } + + // tab: objective of quest + $conditions = array( + 'OR', + ['AND', ['RequiredNpcOrGo1', $_id], ['RequiredNpcOrGoCount1', 0, '>']], + ['AND', ['RequiredNpcOrGo2', $_id], ['RequiredNpcOrGoCount2', 0, '>']], + ['AND', ['RequiredNpcOrGo3', $_id], ['RequiredNpcOrGoCount3', 0, '>']], + ['AND', ['RequiredNpcOrGo4', $_id], ['RequiredNpcOrGoCount4', 0, '>']], + ); + + $objectiveOf = new QuestList($conditions); + if (!$objectiveOf->error) + { + $objectiveOf->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $objectiveOf->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_objectiveof', + 'id' => 'objective-of' + ] ); - if($rows_qe) - { - $npc['ends'] = array(); - foreach($rows_qe as $numRow=>$row) { - $npc['ends'][] = GetQuestInfo($row, 0xFFFFFF); - } - } - unset ($rows_qe); + } - // Необходимы для квеста.. - $rows_qo = $DB->select(' - SELECT ?# - FROM quest_template - WHERE - RequiredNpcOrGo1=? - OR RequiredNpcOrGo2=? - OR RequiredNpcOrGo3=? - OR RequiredNpcOrGo4=? - ', - $quest_cols[2], - $_id, $_id, $_id, $_id + // tab: criteria of [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE have no data set to check for] + $conditions = array( + ['ac.type', [ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE, ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE]], + ['ac.value1', $_id] + ); + + $crtOf = new AchievementList($conditions); + if (!$crtOf->error) + { + $crtOf->addGlobalsToJScript(Util::$pageTemplate); + + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $crtOf->getListviewData(), + 'params' => [ + 'tabs' => '$tabsRelated', + 'name' => '$LANG.tab_criteriaof', + 'id' => 'criteria-of' + ] ); - if($rows_qo) - { - $npc['objectiveof'] = array(); - foreach($rows_qo as $numRow=>$row) - $npc['objectiveof'][] = GetQuestInfo($row, 0xFFFFFF); - } - unset ($rows_qo); - - // Цель критерии - $rows = $DB->select(' - SELECT a.id, a.faction, a.name_loc?d AS name, a.description_loc?d AS description, a.category, a.points, s.iconname, z.areatableID - FROM ?_spellicons s, ?_achievementcriteria c, ?_achievement a - LEFT JOIN (?_zones z) ON a.map != -1 AND a.map = z.mapID - WHERE - a.icon = s.id - AND a.id = c.refAchievement - AND c.type IN (?a) - AND c.value1 = ?d - GROUP BY a.id - ORDER BY a.name_loc?d - ', - $_SESSION['locale'], - $_SESSION['locale'], - array(ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE), - $npc['entry'], - $_SESSION['locale'] - ); - if($rows) - { - $npc['criteria_of'] = array(); - foreach($rows as $row) - { - allachievementsinfo2($row['id']); - $npc['criteria_of'][] = achievementinfo2($row); - } - } - - // Положения созданий божих (для героик НПС не задана карта, юзаем из нормала): - if($normal_entry) - // мы - героик НПС, определяем позицию по нормалу - $npc['position'] = position($normal_entry, 'creature', 2); - else - // мы - нормал НПС или НПС без сложности - $npc['position'] = position($npc['entry'], 'creature', 1); - - // Исправить type, чтобы подсвечивались event-овые NPC - if ($npc['position']) - foreach ($npc['position'] as $z => $zone) - foreach ($zone['points'] as $p => $pos) - if ($pos['type'] == 0 && ($events = event_find(array('creature_guid' => $pos['guid'])))) - { - $names = array_select_key(event_name($events), 'name'); - $npc['position'][$z]['points'][$p]['type'] = 4; - $npc['position'][$z]['points'][$p]['events'] = implode(", ", $names); - } - } $smarty->saveCache($cacheKeyPage, $pageData); } - -// menuId 4: NPC g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'mapper' => true, - 'title' => implode(" - ", $pageData['title']), - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_NPC, - 'typeId' => $_id -)); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_NPC, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game, Lang::$npc, ['colon' => Lang::$colon])); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page $smarty->display('npc.tpl'); diff --git a/pages/npcs.php b/pages/npcs.php new file mode 100644 index 00000000..0d77e99a --- /dev/null +++ b/pages/npcs.php @@ -0,0 +1,88 @@ +error(); + +if (!$smarty->loadCache($cacheKey, $pageData, $filter)) +{ + $conditions = []; + if ($cats) + { + $conditions[] = ['type', $cats[0]]; + $path[] = $cats[0]; + array_unshift($title, Lang::$npc['cat'][$cats[0]]); + } + + $npcs = new CreatureList($conditions, true); // beast subtypes are selected via filter + + // recreate form selection + $filter = array_merge($npcs->filterGetForm('form'), $filter); + $filter['query'] = isset($_GET['filter']) ? $_GET['filter'] : NULL; + $filter['fi'] = $npcs->filterGetForm(); + + if (isset($filter['fa'])) + $path[] = $filter['fa']; + + // menuId 4: NPC g_initPath() + // tabId 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'petFamPanel' => ($cats && $cats[0] == 1), + 'title' => implode(' - ', $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'subCat' => $pageParam ? '='.$pageParam : '', + 'reqJS' => array( + 'template/js/filters.js' + ) + ), + 'lv' => [] + ); + + $lv = array( + 'data' => $npcs->getListviewData(), // listview content + 'params' => [] + ); + + if (!empty($filter['fi']['extraCols'])) + $lv['params']['extraCols'] = '$fi_getExtraCols(fi_extraCols, 0, 0)'; + + // create note if search limit was exceeded + if ($npcs->getMatches() > SQL_LIMIT_DEFAULT) + { + $lv['params']['note'] = sprintf(Util::$tryFilteringString, 'LANG.lvnote_npcsfound', $npcs->getMatches(), SQL_LIMIT_DEFAULT); + $lv['params']['_truncated'] = 1; + } + + if ($npcs->filterGetError()) + $lv['params']['_errors'] = '$1'; + + $pageData['lv'] = $lv; + + $smarty->saveCache($cacheKey, $pageData); +} + +// sort for dropdown-menus +asort(Lang::$game['fa']); + +$smarty->updatePageVars($pageData['page']); +$smarty->assign('filter', $filter); +$smarty->assign('lang', array_merge(Lang::$main, Lang::$npc, Lang::$game, ['colon' => lang::$colon])); +$smarty->assign('lvData', $pageData['lv']); + +// load the page +$smarty->display('npcs.tpl'); + +?> diff --git a/pages/object.php b/pages/object.php index 3f195f01..7847c9d3 100644 --- a/pages/object.php +++ b/pages/object.php @@ -43,7 +43,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $object = new GameObjectList(array(['entry', $_id])); if ($object->error) - $smarty->notFound(Lang::$game['gameObject']); + $smarty->notFound(Lang::$game['gameObject'], $_id); /* ListView for fishing holes diff --git a/pages/pet.php b/pages/pet.php index 73fa1d61..bbef4a69 100644 --- a/pages/pet.php +++ b/pages/pet.php @@ -14,7 +14,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $pet = new PetList(array(['id', $_id])); if ($pet->error) - $smarty->notFound(Lang::$game['pet']); + $smarty->notFound(Lang::$game['pet'], $_id); /***********/ /* Infobox */ @@ -33,22 +33,28 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 8: Pets g_initPath() + // tabid 0: Database g_initHeader() $pageData = array( - 'title' => $pet->getField('name', true), - 'path' => '[0, 8, '.$pet->getField('type').']', - 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', - 'relTabs' => [], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true, - BUTTON_TALENT => ['href' => '?petcalc#'.Util::$tcEncoding[(int)($_id / 10)] . Util::$tcEncoding[(2 * ($_id % 10) + ($pet->getField('exotic') ? 1 : 0))], 'pet' => true] - ), - 'page' => array( - 'name' => $pet->getField('name', true), - 'id' => $_id, - 'icon' => $pet->getField('iconString'), - 'expansion' => Util::$expansionString[$pet->getField('expansion')] + 'page' => array( + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'headIcons' => [$pet->getField('iconString')], + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true, + BUTTON_TALENT => ['href' => '?petcalc#'.Util::$tcEncoding[(int)($_id / 10)] . Util::$tcEncoding[(2 * ($_id % 10) + ($pet->getField('exotic') ? 1 : 0))], 'pet' => true] + ), + 'name' => $pet->getField('name', true), + 'id' => $_id, + 'expansion' => Util::$expansionString[$pet->getField('expansion')], + 'title' => $pet->getField('name', true)." - ".Util::ucfirst(Lang::$game['pet']), + 'path' => '[0, 8, '.$pet->getField('type').']', + 'tab' => 0, + 'type' => TYPE_PET, + 'typeId' => $_id, + 'reqJS' => ['template/js/swfobject.js'] ), + 'relTabs' => [] ); /**************/ @@ -190,24 +196,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 8: Pets g_initPath() -// tabid 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['pet']), - 'path' => $pageData['path'], - 'tab' => 0, - 'type' => TYPE_PET, - 'typeId' => $_id, - 'reqJS' => array( - 'template/js/swfobject.js' - ) -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_PET, $_id)); // comments, screenshots, videos $smarty->assign('lang', array_merge(Lang::$main, Lang::$game)); -$smarty->assign('lvData', $pageData); +$smarty->assign('lvData', $pageData['relTabs']); // load the page -$smarty->display('pet.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/pets.php b/pages/pets.php index fbce77df..3373fc25 100644 --- a/pages/pets.php +++ b/pages/pets.php @@ -4,27 +4,25 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; +$cat = Util::extractURLParams($pageParam); $path = [0, 8]; $validCats = [0, 1, 2]; $title = [Util::ucFirst(Lang::$game['pets'])]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_PET, -1, isset($cat) ? $cat : -1, User::$localeId]); +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_PET, -1, $cat ? $cat[0] : -1, User::$localeId]); if (!Util::isValidPage($validCats, $cat)) $smarty->error(); -$path[] = $cat; // should be only one parameter anyway - -if (isset($cat)) - array_unshift($title, Lang::$pet['cat'][$cat]); +if ($cat) +{ + $path[] = $cat; + array_unshift($title, Lang::$pet['cat'][$cat[0]]); +} if (!$smarty->loadCache($cacheKey, $pageData)) { - $pets = new PetList(isset($cat) ? array(['type', (int)$cat]) : []); - - $pageData = array( - 'listviews' => [] - ); + $pets = new PetList($cat ? array(['type', (int)$cat[0]]) : []); + $pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED); $lvPet = array( 'file' => 'pet', @@ -34,28 +32,29 @@ if (!$smarty->loadCache($cacheKey, $pageData)) ) ); - if (($mask = $pets->hasDiffFields(['type'])) == 0x0) + if (!$pets->hasDiffFields(['type'])) $lvPet['params']['hiddenCols'] = "$['type']"; - $pageData['listviews'][] = $lvPet; - - $pets->addGlobalsToJscript($smarty, GLOBALINFO_RELATED); + // menuId 8: Pets g_initPath() + // tabid 0: Database g_initHeader() + $pageData = array( + 'page' => array( + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0 + ), + 'lv' => [$lvPet] + ); $smarty->saveCache($cacheKey, $pageData); } -// menuId 8: Pets g_initPath() -// tabid 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]", - '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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/quest.php b/pages/quest.php index ee0ad388..6ea32ae5 100644 --- a/pages/quest.php +++ b/pages/quest.php @@ -40,7 +40,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $quest = new QuestList(array(['qt.id', $_id])); if ($quest->error) - $smarty->notFound(Lang::$game['quest']); + $smarty->notFound(Lang::$game['quest'], $_id); diff --git a/pages/race.php b/pages/race.php index a761c225..38bc9945 100644 --- a/pages/race.php +++ b/pages/race.php @@ -31,7 +31,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $race = new CharRaceList(array(['id', $_id])); // should this be limited to playable races..? if ($race->error) - $smarty->notFound(Lang::$game['race']); + $smarty->notFound(Lang::$game['race'], $_id); /***********/ /* Infobox */ @@ -68,20 +68,28 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 13: Race g_initPath() + // tabId 0: Database g_initHeader() $pageData = array ( - 'title' => $race->getField('name', true).' - '.Util::ucFirst(Lang::$game['race']), - 'path' => $_path, - 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', - 'relTabs' => [], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true - ), 'page' => array( - 'name' => $race->getField('name', true), - 'icon' => strtolower($race->getField('fileString')), - 'expansion' => Util::$expansionString[$race->getField('expansion')] - ) + 'name' => $race->getField('name', true), + 'expansion' => Util::$expansionString[$race->getField('expansion')], + 'title' => $race->getField('name', true).' - '.Util::ucFirst(Lang::$game['race']), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), + 'tab' => 0, + 'type' => TYPE_RACE, + 'typeId' => $_id, + 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', + 'headIcons' => array( + 'race_'.strtolower($race->getField('fileString')).'_male', + 'race_'.strtolower($race->getField('fileString')).'_female' + ), + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true + ) + ), + 'relTabs' => [] ); /**************/ @@ -187,21 +195,12 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } -// menuId 13: Race g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title'], - 'path' => json_encode($pageData['path'], JSON_NUMERIC_CHECK), - 'tab' => 0, - 'type' => TYPE_RACE, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_RACE, $_id)); // comments, screenshots, videos $smarty->assign('lang', Lang::$main); $smarty->assign('lvData', $pageData); // load the page -$smarty->display('race.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/races.php b/pages/races.php index 2e9746f7..b7c08e4d 100644 --- a/pages/races.php +++ b/pages/races.php @@ -10,8 +10,15 @@ if (!$smarty->loadCache($cacheKey, $pageData)) { $races = new CharRaceList(array(['side', 0, '!'])); // only playable + // menuId 13: Race g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'listviews' => array( + 'page' => array( + 'title' => Util::ucFirst(Lang::$game['races']), + 'path' => "[0, 13]", + 'tab' => 0 + ), + 'lv' => array( array( 'file' => 'race', 'data' => $races->getListviewData(), @@ -24,17 +31,11 @@ if (!$smarty->loadCache($cacheKey, $pageData)) } -// menuId 13: Race g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => Util::ucFirst(Lang::$game['races']), - 'path' => "[0, 13]", - '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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/skill.php b/pages/skill.php index d652b41b..35a44ca2 100644 --- a/pages/skill.php +++ b/pages/skill.php @@ -14,7 +14,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $skill = new SkillList(array(['id', $_id])); if ($skill->error) - $smarty->notFound(Lang::$game['skill']); + $smarty->notFound(Lang::$game['skill'], $_id); $_cat = $skill->getField('typeCat'); @@ -26,13 +26,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) '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), - 'icon' => $skill->getField('iconString'), 'id' => $_id ), ); @@ -364,6 +364,6 @@ $smarty->assign('lang', array_merge(Lang::$main)); $smarty->assign('lvData', $pageData); // load the page -$smarty->display('skill.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/skills.php b/pages/skills.php index bd2c0eb8..682a913a 100644 --- a/pages/skills.php +++ b/pages/skills.php @@ -52,6 +52,6 @@ $smarty->assign('lang', Lang::$main); $smarty->assign('lvData', $pageData); // load the page -$smarty->display('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/spell.php b/pages/spell.php index d2591ffc..313db37c 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -6,7 +6,8 @@ if (!defined('AOWOW_REVISION')) require 'includes/community.class.php'; -$_id = intVal($pageParam); +$_id = intVal($pageParam); +$_path = [0, 1]; $cacheKeyPage = implode('_', [CACHETYPE_PAGE, TYPE_SPELL, $_id, -1, User::$localeId]); $cacheKeyTooltip = implode('_', [CACHETYPE_TOOLTIP, TYPE_SPELL, $_id, -1, User::$localeId]); @@ -53,15 +54,15 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $spell = new SpellList(array(['s.id', $_id])); if ($spell->error) - $smarty->notFound(Lang::$game['spell']); + $smarty->notFound(Lang::$game['spell'], $_id); $spell->addGlobalsToJScript($smarty, GLOBALINFO_ANY); $_cat = $spell->getField('typeCat'); - $path = [0, 1, $_cat]; $l = [null, 'A', 'B', 'C']; + $_path[] = $_cat; - // reconstruct path / title + // reconstruct path switch($_cat) { case -2: @@ -74,7 +75,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { if ($cl & (1 << ($i - 1))) { - $path[] = $i; + $_path[] = $i; break; } $i++; @@ -82,32 +83,32 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if ($_cat == -13) { - $path[] = ($spell->getField('cuFlags') & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6; + $_path[] = ($spell->getField('cuFlags') & (SPELL_CU_GLYPH_MAJOR | SPELL_CU_GLYPH_MINOR)) >> 6; break; } case 9: case -3: case 11: - $path[] = $spell->getField('skillLines')[0]; + $_path[] = $spell->getField('skillLines')[0]; if ($_cat == 11) if ($_ = $spell->getField('reqSpellId')) - $path[] = $_; + $_path[] = $_; break; case -11: foreach (SpellList::$skillLines as $line => $skills) if (in_array($spell->getField('skillLines')[0], $skills)) - $path[] = $line; + $_path[] = $line; break; case -7: // only spells unique in skillLineAbility will always point to the right skillLine :/ $_ = $spell->getField('cuFlags'); if ($_ & SPELL_CU_PET_TALENT_TYPE0) - $path[] = 411; // Ferocity + $_path[] = 411; // Ferocity else if ($_ & SPELL_CU_PET_TALENT_TYPE1) - $path[] = 409; // Tenacity + $_path[] = 409; // Tenacity else if ($_ & SPELL_CU_PET_TALENT_TYPE2) - $path[] = 410; // Cunning + $_path[] = 410; // Cunning } // has difficulty versions of itself @@ -400,7 +401,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) $pageData = array( 'title' => $spell->getField('name', true), - 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'path' => json_encode($_path, JSON_NUMERIC_CHECK), 'infobox' => $infobox, 'relTabs' => [], 'buttons' => array( @@ -1073,6 +1074,25 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) unset($foo); // clear reference + // factionchange-equivalent +/* nyi + $pendant = DB::Aowow()->selectCell('SELECT IF(horde_id = ?d, alliance_id, -horde_id) FROM player_factionchange_items WHERE alliance_id = ?d OR horde_id = ?d', $_id, $_id, $_id); + if ($pendant) + { + $altiSpell = new SpellList(array(['id', abs($pendant)])); + if (!$altSpell->error) + { + $pageData['page']['transfer'] = array( + 'id' => $altItem->id, + 'icon' => $altItem->getField('iconString'), + 'name' => $altItem->getField('name', true), + 'facInt' => $pendant > 0 ? 'alliance' : 'horde', + 'facName' => $pendant > 0 ? Lang::$game['si'][1] : Lang::$game['si'][2] + ); + ) + } +*/ + /**************/ /* Extra Tabs */ /**************/ @@ -1195,7 +1215,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) if (!$saSpells->error) { $data = $saSpells->getListviewData(); - if ($difficulties) // needs a way to distinguish between dungeon and raid :x + if ($difficulties) // needs a way to distinguish between dungeon and raid :x; creature using this -> map -> areaType { $saE = '$[Listview.extraCols.mode]'; diff --git a/pages/spells.php b/pages/spells.php index 42b8e860..81ae81ec 100644 --- a/pages/spells.php +++ b/pages/spells.php @@ -255,7 +255,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) array_unshift($title, Lang::$game['cl'][$cats[1]]); $conditions[] = ['s.typeCat', [7, -2]]; - $conditions[] = [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | SPELL_CU_EXCLUDE_CATEGORY_SEARCH), '&'], 0]; + $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) @@ -378,7 +378,7 @@ if (!$smarty->loadCache($cacheKey, $pageData, $filter)) $conditions[] = array( 'OR', ['s.typeCat', 0], - ['s.cuFlags', SPELL_CU_EXCLUDE_CATEGORY_SEARCH, '&'] + ['s.cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'] ); break; diff --git a/pages/title.php b/pages/title.php index 601393cd..17b68e37 100644 --- a/pages/title.php +++ b/pages/title.php @@ -14,7 +14,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) { $title = new TitleList(array(['id', $_id])); if ($title->error) - $smarty->notFound(Lang::$game['title']); + $smarty->notFound(Lang::$game['title'], $_id); /***********/ /* Infobox */ @@ -38,25 +38,31 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) /* Main Content */ /****************/ + // menuId 10: Title g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'title' => Util::ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true))))), - 'path' => '[0, 10, '.$title->getField('category').']', - 'infobox' => '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]', - 'relTabs' => [], - 'buttons' => array( - BUTTON_WOWHEAD => true, - BUTTON_LINKS => true - ), 'page' => array( - 'name' => $title->getHtmlizedName(), - 'expansion' => Util::$expansionString[$title->getField('expansion')] - ) + 'title' => Util::ucFirst(trim(str_replace('%s', '', str_replace(',', '', $title->getField('male', true)))))." - ".Util::ucfirst(Lang::$game['title']), + 'path' => '[0, 10, '.$title->getField('category').']', + 'tab' => 0, + 'type' => TYPE_TITLE, + 'typeId' => $_id, + 'name' => $title->getHtmlizedName(), + 'infobox' => $infobox ? '[ul][li]'.implode('[/li][li]', $infobox).'[/li][/ul]' : null, + 'expansion' => Util::$expansionString[$title->getField('expansion')], + 'redButtons' => array( + BUTTON_WOWHEAD => true, + BUTTON_LINKS => true + ), + ), + 'relTabs' => [] ); /**************/ /* Extra Tabs */ /**************/ + // tab: sources if (!empty($title->sources[$_id])) { foreach ($title->sources[$_id] as $type => $entries) @@ -101,25 +107,18 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } + // tab: criteria of (to be added by TC) + $smarty->saveCache($cacheKeyPage, $pageData); } -// menuId 10: Title g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => $pageData['title']." - ".Util::ucfirst(Lang::$game['title']), - 'path' => $pageData['path'], - 'tab' => 0, - 'type' => TYPE_TITLE, - 'typeId' => $_id -)); -$smarty->assign('redButtons', $pageData['buttons']); +$smarty->updatePageVars($pageData['page']); $smarty->assign('community', CommunityContent::getAll(TYPE_TITLE, $_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('title.tpl'); +$smarty->display('detail-page-generic.tpl'); ?> diff --git a/pages/titles.php b/pages/titles.php index 9fbd09aa..352e9d7c 100644 --- a/pages/titles.php +++ b/pages/titles.php @@ -4,26 +4,34 @@ if (!defined('AOWOW_REVISION')) die('illegal access'); -$cat = Util::extractURLParams($pageParam)[0]; +$cat = Util::extractURLParams($pageParam); $path = [0, 10]; $validCats = [0, 1, 2, 3, 4, 5, 6]; $title = [Util::ucFirst(Lang::$game['titles'])]; -$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, -1, isset($cat) ? $cat : -1, User::$localeId]); +$cacheKey = implode('_', [CACHETYPE_PAGE, TYPE_TITLE, -1, $cat ? $cat[0] : -1, User::$localeId]); -if (!in_array($cat, $validCats)) - $smarty->error(); +if ($cat) +{ + if (!in_array($cat[0], $validCats)) + $smarty->error(); -$path[] = $cat; // should be only one parameter anyway - -if (isset($cat)) - array_unshift($title, Lang::$title['cat'][$cat]); + $path[] = $cat[0]; // should be only one parameter anyway + array_unshift($title, Lang::$title['cat'][$cat[0]]); +} if (!$smarty->loadCache($cacheKey, $pageData)) { - $titles = new TitleList(isset($cat) ? array(['category', (int)$cat]) : []); + $titles = new TitleList($cat ? array(['category', (int)$cat[0]]) : []); + // menuId 10: Title g_initPath() + // tabId 0: Database g_initHeader() $pageData = array( - 'listviews' => [] + 'page' => array( + 'title' => implode(" - ", $title), + 'path' => json_encode($path, JSON_NUMERIC_CHECK), + 'tab' => 0 + ), + 'lv' => [] ); $lvTitles = array( @@ -38,23 +46,17 @@ if (!$smarty->loadCache($cacheKey, $pageData)) if (!$titles->hasAnySource()) $lvTitles['params']['hiddenCols'] = "$['source']"; - $pageData['listviews'][] = $lvTitles; + $pageData['lv'][] = $lvTitles; $smarty->saveCache($cacheKey, $pageData); } -// menuId 10: Title g_initPath() -// tabId 0: Database g_initHeader() -$smarty->updatePageVars(array( - 'title' => implode(" - ", $title), - 'path' => "[".implode(", ", $path)."]", - '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('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/pages/zones.php b/pages/zones.php index ac743ba4..95c04179 100644 --- a/pages/zones.php +++ b/pages/zones.php @@ -146,6 +146,6 @@ $smarty->assign('lang', Lang::$main); $smarty->assign('lvData', $pageData); // load the page -$smarty->display('generic-no-filter.tpl'); +$smarty->display('list-page-generic.tpl'); ?> diff --git a/search.php b/search.php index 6277f0f3..d42625d4 100644 --- a/search.php +++ b/search.php @@ -238,9 +238,11 @@ if ($searchMask & 0x8) foreach ($data as &$d) { - $updated = WorldEventList::updateDates($d['startDate'], $d['endDate'], $d['rec']); - $d['startDate'] = date(Util::$dateFormatLong, $updated['start']); - $d['endDate'] = date(Util::$dateFormatLong, $updated['end']); + $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( diff --git a/template/404.tpl b/template/404.tpl index 8b1e1127..7609b8c4 100644 --- a/template/404.tpl +++ b/template/404.tpl @@ -12,8 +12,8 @@
    -

    {$page.subject} #{$page.id}

    -
    {$page.notFound}
    +

    {$subject} #{$id}

    +
    {$notFound}
    diff --git a/template/achievement.tpl b/template/achievement.tpl index 2f8fe8cd..a58824ab 100644 --- a/template/achievement.tpl +++ b/template/achievement.tpl @@ -12,34 +12,31 @@ -{include file='bricks/infobox.tpl' info=$lvData.infobox series=$lvData.series} +{include file='bricks/infobox.tpl' info=$infobox series=$series}
    +{include file='bricks/headIcons.tpl'} + {include file='bricks/redButtons.tpl'} -
    - + {$name}{else}>{$name}{/if} -

    {$lvData.page.name}

    + {$description} - {$lvData.page.description} - - {if !empty($lvData.page.criteria)}

    {$lang.criteria}{if $lvData.page.count} – {$lang.requires} {$lvData.page.count} {$lang.outOf} {$lvData.page.nCriteria}{/if}

    {/if} + {if !empty($criteria)}

    {$lang.criteria}{if $count} – {$lang.reqNumCrt} {$count} {$lang.outOf} {$nCriteria}{/if}

    {/if}
    {strip} -{foreach from=$lvData.page.criteria item=cr name=criteria} +{foreach from=$criteria item=cr name=criteria} {* for reference and standard entries *} - {if !isset($cr.icon) && (isset($cr.link) || $cr.standard)} + {if !isset($cr.icon) && (isset($cr.link) || isset($cr.standard))}
    •  
    {/if} @@ -52,7 +49,7 @@
    {* If the first column is over (it may be a greater element) *} - {if $smarty.foreach.criteria.index+1 == round(count($lvData.page.criteria) / 2)} + {if $smarty.foreach.criteria.index+1 == round(count($criteria) / 2)}
    @@ -64,22 +61,22 @@
    - {if $lvData.page.itemReward} {* for items *} + {if $itemReward} {* for items *}

    {$lang.rewards}

    {$lang.itemReward} -{foreach from=$lvData.page.itemReward item=i name=item key=id} +{foreach from=$itemReward item=i name=item key=id} {/foreach} @@ -87,27 +84,26 @@
    {$i.name}
    {/if} - {if $lvData.page.titleReward} {* for titles *} + {if $titleReward} {* for titles *}

    {$lang.gains}

      -{foreach from=$lvData.page.titleReward item=i} +{foreach from=$titleReward item=i}
    • {$i}
    • {/foreach}
    {/if} - {if !$lvData.page.titleReward && !$lvData.page.itemReward && $lvData.page.reward} + {if !$titleReward && !$itemReward && $reward}

    {$lang.rewards}

      -
    • {$lvData.page.reward}
    • +
    • {$reward}
    {/if} - -

    {$lang.related}

    +

    {$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/achievements.tpl b/template/achievements.tpl index 3ba0fb5d..d9235f00 100644 --- a/template/achievements.tpl +++ b/template/achievements.tpl @@ -11,14 +11,14 @@ {/if}
    -
    + diff --git a/template/bricks/headIcons.tpl b/template/bricks/headIcons.tpl new file mode 100644 index 00000000..632d3882 --- /dev/null +++ b/template/bricks/headIcons.tpl @@ -0,0 +1,10 @@ +{if !empty($headIcons)} + {foreach from=$headIcons key='k' item='v'} +
    + {/foreach} + +{/if} \ No newline at end of file diff --git a/template/bricks/infobox.tpl b/template/bricks/infobox.tpl index 6cabb614..4ec8d31c 100644 --- a/template/bricks/infobox.tpl +++ b/template/bricks/infobox.tpl @@ -1,5 +1,5 @@
    {$lang.name|ucFirst}{$lang.colon}
    -{if !empty($info)} +{if !empty($infobox)} {/if} @@ -14,7 +14,7 @@ - +
    {$lang.quickFacts}
    {foreach name=itemItr from=$itr item='i'} {if $i.side == 1}{elseif $i.side == 2}{/if} - {if ($i.typeId == $page.typeId)} + {if ($i.typeId == $typeId)} {$i.name} {else} {$i.name} @@ -39,8 +39,8 @@ {if $user.id > 0} {/if} -{if !empty($info)} +{if !empty($infobox)} {/if} \ No newline at end of file diff --git a/template/bricks/listviews/event.tpl b/template/bricks/listviews/event.tpl index aa887817..e7a2745b 100644 --- a/template/bricks/listviews/event.tpl +++ b/template/bricks/listviews/event.tpl @@ -14,14 +14,12 @@ data:[ {foreach name=i from=$data item=curr} {ldelim} - {if $curr.rec} - rec:{$curr.rec}, - {/if} - category:{$curr.category}, - id:{$curr.id}, - name:'{$curr.name|escape:"javascript"}', - startDate:'{$curr.startDate}', - endDate:'{$curr.endDate}' + {foreach from=$curr key='name' item=val} + {if $name != 'id'} + {$name}:{$val|@json_encode:$smarty.const.JSON_NUMERIC_CHECK}, + {/if} + {/foreach} + id:{$curr.id} {rdelim} {if $smarty.foreach.i.last}{else},{/if} {/foreach} diff --git a/template/bricks/redButtons.tpl b/template/bricks/redButtons.tpl index da37c6e5..0a31a476 100644 --- a/template/bricks/redButtons.tpl +++ b/template/bricks/redButtons.tpl @@ -3,14 +3,6 @@ found this button(?) in item.tpl .. no script, data or style found for this id
    *} -{if isset($redButtons[$smarty.const.BUTTON_LINKS])} - {assign var='b' value=$redButtons[$smarty.const.BUTTON_LINKS]} - {if $b} - {$lang.links}{$lang.links} - {else} - {$lang.links}{$lang.links} - {/if} -{/if} {if isset($redButtons[$smarty.const.BUTTON_WOWHEAD])} {assign var='b' value=$redButtons[$smarty.const.BUTTON_WOWHEAD]} {if $b} @@ -19,6 +11,14 @@ found this button(?) in item.tpl .. no script, data or style found for this id WowheadWowhead {/if} {/if} +{if isset($redButtons[$smarty.const.BUTTON_LINKS])} + {assign var='b' value=$redButtons[$smarty.const.BUTTON_LINKS]} + {if $b} + {$lang.links}{$lang.links} + {else} + {$lang.links}{$lang.links} + {/if} +{/if} {if isset($redButtons[$smarty.const.BUTTON_VIEW3D])} {assign var='b' value=$redButtons[$smarty.const.BUTTON_VIEW3D]} {if $b} @@ -30,7 +30,7 @@ found this button(?) in item.tpl .. no script, data or style found for this id {if isset($redButtons[$smarty.const.BUTTON_COMPARE])} {assign var='b' value=$redButtons[$smarty.const.BUTTON_COMPARE]} {if $b} - {$lang.compare}{$lang.compare} + {$lang.compare}{$lang.compare} {else} {$lang.compare}{$lang.compare} {/if} @@ -38,7 +38,7 @@ found this button(?) in item.tpl .. no script, data or style found for this id {if isset($redButtons[$smarty.const.BUTTON_UPGRADE])} {assign var='b' value=$redButtons[$smarty.const.BUTTON_UPGRADE]} {if $b} - {$lang.findUpgrades}{$lang.findUpgrades} + {$lang.findUpgrades}{$lang.findUpgrades} {else} {$lang.findUpgrades}{$lang.findUpgrades} {/if} diff --git a/template/bricks/tooltip.tpl b/template/bricks/tooltip.tpl index b272af67..037c1869 100644 --- a/template/bricks/tooltip.tpl +++ b/template/bricks/tooltip.tpl @@ -1,28 +1,28 @@ -
    -
    +
    +
    -
    -
    +
    +
    {if !empty($jsGlobals[6][2].buff)} {* not set with items *}

    {$lang._aura}

    -
    +
    {/if} diff --git a/template/class.tpl b/template/class.tpl deleted file mode 100644 index 4e4195c7..00000000 --- a/template/class.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} - - - -{include file='bricks/infobox.tpl' info=$lvData.infobox} - -
    -
    - - -{include file='bricks/redButtons.tpl'} - -

    {if $lvData.page.expansion}{$lvData.page.name}{else}{$lvData.page.name}{/if}

    - -{include file='bricks/article.tpl'} - -

    {$lang.related}

    -
    - -{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} - -{include file='bricks/contribute.tpl'} - -
    -
    - -{include file='footer.tpl'} diff --git a/template/compare.tpl b/template/compare.tpl index 3d093b86..86588f7d 100644 --- a/template/compare.tpl +++ b/template/compare.tpl @@ -13,10 +13,10 @@
    diff --git a/template/css/basic.css b/template/css/basic.css index f9bfe389..9be94d7b 100644 --- a/template/css/basic.css +++ b/template/css/basic.css @@ -141,6 +141,7 @@ a span.moneyitem, a span.moneysocketmeta, a span.moneysocketred, a span.moneysoc .s1 { color: #ff3f40 !important } /* Yell */ .s2 { color: #fffb9f !important } /* Say */ .s3 { color: #ffb2eb !important } /* Whisper */ +.s4 { color: #ff8040 !important } /* Emote */ /*****************/ /* SOCKETS ICONS */ diff --git a/template/css/global.css b/template/css/global.css index ba599335..72b17084 100644 --- a/template/css/global.css +++ b/template/css/global.css @@ -190,6 +190,12 @@ a.selected, a.selected:hover color: #909090; } +.text span.rep-difficulty { + font-weight: bold; + text-shadow: 0 0 6px gray; + filter: dropshadow(color=gray,offx=0,offy=0); +} + h1 a, h2 a, h3 a, h4 a, h5 a, h1 a.icontiny span, h2 a.icontiny span, h3 a.icontiny span, h4 a.icontiny span, h5 a.icontiny span { text-decoration:none !important; @@ -3407,6 +3413,11 @@ a:hover, a.open, .infobox li div, .text b padding-left: 26px; } +.text ol ul, .text ol ol, .text ul ol, .text ul ul { + margin-bottom: 0px; + margin-top: 0px; +} + .text ul.first, .text ol.first, .comment-body h3.first { margin-top: 0; @@ -3419,7 +3430,7 @@ a:hover, a.open, .infobox li div, .text b .text ul li, .comment-body ul li { - color: #c3030b; + /* color: #c3030b; */ list-style-type: square; } @@ -3827,6 +3838,11 @@ div.modelviewer, div.screenshotviewer border-radius: 6px; } +.reputation-negative-amount span { + color: red; + font-weight: bold; +} + div.announcement-pagetop div.announcement-inner { margin-top: 10px; } diff --git a/template/faction.tpl b/template/detail-page-generic.tpl similarity index 58% rename from template/faction.tpl rename to template/detail-page-generic.tpl index 6cee67b9..e802d632 100644 --- a/template/faction.tpl +++ b/template/detail-page-generic.tpl @@ -12,24 +12,25 @@ -{include file='bricks/infobox.tpl' info=$lvData.infobox} +{include file='bricks/infobox.tpl'}
    +{include file='bricks/headIcons.tpl'} {include file='bricks/redButtons.tpl'} -

    {$lvData.page.name}

    + {$name}{else}>{$name}{/if} {include file='bricks/article.tpl'} -{if $lvData.spillover} -
    +{if isset($extraText)} +
    - -
    - - - -
    -
    -
    - -{include file='footer.tpl'} diff --git a/template/generic-no-filter.tpl b/template/generic-no-filter.tpl deleted file mode 100644 index 2e083ae2..00000000 --- a/template/generic-no-filter.tpl +++ /dev/null @@ -1,55 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} -{if !empty($lvData.map)} - {include file='bricks/mapper.tpl' map=$lvData.map som=$lvData.som} -{/if} - - - -{if !empty($lvData.page.name) || !empty($lvData.page.h1Links)} -
    -{if !empty($lvData.page.h1Links)} - -{/if} -{if !empty($lvData.page.name)} -

    {$lvData.page.name}

    -{/if} -
    -{/if} - -{if !empty($lvData.listviews)} - {if count($lvData.listviews) > 1} -
    - {/if} -
    - -
    -{/if} - -
    -
    - -{include file='footer.tpl'} diff --git a/template/head.tpl b/template/head.tpl index 0a9656a3..3cfa2bf9 100644 --- a/template/head.tpl +++ b/template/head.tpl @@ -1,4 +1,4 @@ - {if $page.title}{$page.title|escape:"html"} - {/if}{$appName} + {if $title}{$title|escape:"html"} - {/if}{$appName} @@ -8,7 +8,7 @@ -{foreach from=$page.reqCSS item=css} +{foreach from=$reqCSS item=css} {if isset($css.string)} {else} @@ -25,7 +25,7 @@ -{foreach from=$page.reqJS item=file} +{foreach from=$reqJS item=file} {/foreach} -{include file='bricks/infobox.tpl' info=$lvData.infobox} +{include file='bricks/infobox.tpl'}
    - {include file='bricks/redButtons.tpl'} -

    {$lvData.page.name}

    + {$name}{else}>{$name}{/if} {include file='bricks/tooltip.tpl'} -{if !empty($lvData.page.disabled)} +{include file='bricks/article.tpl'} + +{if !empty($disabled)}
    {$lang._unavailable} {/if} -{if !empty($lvData.page.transfer)} +{if !empty($transfer)}
    - {$lang._transfer|sprintf:$lvData.page.transfer.id:$lvData.page.transfer.quality:$lvData.page.transfer.icon:$lvData.page.transfer.name:$lvData.page.transfer.facInt:$lvData.page.transfer.facName} + {$transfer} {/if} -{if !empty($lvData.page.subItems)} +{if !empty($subItems)}

    {$lang._rndEnchants}

      - {foreach from=$lvData.page.subItems item=i key=k}{if $k < (count($lvData.page.subItems) / 2)} + {foreach from=$subItems item=i key=k}{if $k < (count($subItems) / 2)}
    • - ...{$i.name} + ...{$i.name} {$lang._chance|@sprintf:$i.chance}
      {$i.enchantment}
    • @@ -50,12 +51,12 @@
    - {if count($lvData.page.subItems) > 1} + {if count($subItems) > 1}
      - {foreach from=$lvData.page.subItems item=i key=k}{if $k >= (count($lvData.page.subItems) / 2)} + {foreach from=$subItems item=i key=k}{if $k >= (count($subItems) / 2)}
    • - ...{$i.name} + ...{$i.name} {$lang._chance|@sprintf:$i.chance}
      {$i.enchantment}
    • @@ -64,14 +65,14 @@
    {/if} {/if} -{if !empty($lvData.pageText)} +{if !empty($pageText)}

    {$lang.content}

    -
    - +
    +
    {$lang._quality}{$lang.colon}
    @@ -63,7 +63,7 @@
     
    Level{$lang.colon}{$lang.level}{$lang.colon}   - @@ -176,7 +176,7 @@ {/if}
    -{include file='bricks/infobox.tpl' info=$lvData.infobox} +{include file='bricks/infobox.tpl'}
    +{include file='bricks/headIcons.tpl'} {include file='bricks/redButtons.tpl'} -

    {$lvData.page.name}

    + {$name}{else}>{$name}{/if} {include file='bricks/article.tpl'} -{$lvData.page.description} +{$description}
    -{section name=i loop=$lvData.pieces} - +{section name=i loop=$pieces} + {/section}
    {$lvData.pieces[i].name}
    {$pieces[i].name}
    -{if $lvData.page.unavailable} -
    {$lang._unavailable} +{if $unavailable} +
    + {$lang._unavailable} {/if} -

    {$lang._setBonuses}{$lvData.page.bonusExt}

    +

    {$lang._setBonuses}{$bonusExt}

    {$lang._conveyBonus}
      -{section name=i loop=$lvData.spells} -
    • {$lvData.spells[i].bonus} {$lang._pieces}{$lang.colon}{$lvData.spells[i].desc}
    • +{section name=i loop=$spells} +
    • {$spells[i].bonus} {$lang._pieces}{$lang.colon}{$spells[i].desc}
    • {/section}
    -

    Summary

    +

    {$lang.summary}

    {$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/itemsets.tpl b/template/itemsets.tpl index 47438ab4..f84ba9c7 100644 --- a/template/itemsets.tpl +++ b/template/itemsets.tpl @@ -11,7 +11,7 @@ {/if}
    - - + + {include file='footer.tpl'} diff --git a/template/js/filters.js b/template/js/filters.js index 59350c85..a165e4b1 100644 --- a/template/js/filters.js +++ b/template/js/filters.js @@ -246,7 +246,7 @@ var fi_filters = { { id: 31, name: 'hasscreenshots', type: 'yn' }, { id: 40, name: 'hasvideos', type: 'yn' }, - { id: 1, name: 'sepstaffonly', staffonly: true }, + { id: 999, name: 'sepstaffonly', staffonly: true }, { id: 41, name: 'haslocation', type: 'yn', staffonly: true } ], @@ -833,9 +833,9 @@ function fi_criterionChange(_this, crs, crv) { } if (n) { - _.maxLength = 7; + _.maxLength = 8; _.style.textAlign = 'center'; - _.style.width = '4.5em'; + _.style.width = '5.0em'; } else { _.type = 'hidden'; @@ -858,9 +858,9 @@ function fi_criterionChange(_this, crs, crv) { _ = $WH.ce('input'); _.type = 'text'; if (criteriaParams.indexOf('small') != -1) { - _.maxLength = 7; + _.maxLength = 8; _.style.textAlign = 'center'; - _.style.width = '4.5em'; + _.style.width = '5.0em'; } else { _.maxLength = 50; @@ -1659,9 +1659,15 @@ function fi_getExtraCols(wt, gm, pu) { }; // Fix display of decimal columns - if (/dps|speed/i.test(a.name)) { + if (a.name == 'speed') { b.compute = function (item, td) { - return (item[a.name] || 0).toFixed(2); + return (item.speed || 0).toFixed(2); + } + } + + if (/dps/i.test(a.name)) { // mledps|rngdps|dps + b.compute = function (item, td) { + return (item.dps || 0).toFixed(1); } } diff --git a/template/js/global.js b/template/js/global.js index 5f964a7a..e3d028fe 100644 --- a/template/js/global.js +++ b/template/js/global.js @@ -5621,15 +5621,25 @@ Listview.extraCols = { var a = $WH.ce('a'); a.href = cnd.url; - if (cnd.icon) { - a.className = 'icontiny tinyspecial'; - a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + cnd.icon + '.gif)'; - } - if (cnd.quality) { - a.className += ' q' + cnd.quality; - } a.style.whiteSpace = 'nowrap'; - $WH.st(a, cnd.name); + + if (g_pageInfo.typeId == row.condition.typeId) { // ponts to self + a.className = 'q1'; + $WH.st(a, 'This'); + } + else { + $WH.st(a, cnd.name); + + if (cnd.icon) { + a.className = 'icontiny tinyspecial'; + a.style.backgroundImage = 'url(' + g_staticUrl + '/images/icons/tiny/' + cnd.icon + '.gif)'; + } + + if (cnd.quality) { + a.className += ' q' + cnd.quality; + } + } + $WH.ae(td, a); }, getVisibleText: function(row) { @@ -5743,17 +5753,23 @@ Listview.extraCols = { item = g_holidays[cond.typeId]; cnd.icon = item.icon.toLowerCase(); - cnd.state = cond.status ? $WH.ct('active') : $WH.ct('inactive'); - cnd.color = cond.status ? 'q2' : 'q10'; + cnd.state = cond.status == 1 ? $WH.ct('active') : cond.status == 2 ? $WH.ct(LANG.pr_note_complete) : $WH.ct('inactive'); + cnd.color = cond.status == 1 ? 'q1' : cond.status == 2 ? 'q2' : 'q10'; cnd.name = item['name_' + g_locale.name]; cnd.url = '?event=' + cond.typeId; return cnd; }, sortFunc: function(a, b, col) { - if (a.condition.status && b.condition.status) { + if (a.condition && b.condition) { return $WH.strcmp(a.condition.status, b.condition.status); } + else if (a.condition) + return -1; + else if (b.condition) + return 1; + else + return 0; } }, }; @@ -9000,6 +9016,12 @@ Listview.templates = { a.style.fontFamily = 'Verdana, sans-serif'; a.href = this.getItemLink(npc); $WH.ae(a, $WH.ct(npc.name)); + + if (npc.hasQuests != null) { + a.className += " icontiny tinyspecial"; + a.style.backgroundImage = "url(" + g_staticUrl + "/images/icons/quest_start.gif)"; + } + $WH.ae(td, a); if (npc.tag != null) { @@ -9020,7 +9042,7 @@ Listview.templates = { return buff; }, sortFunc: function(a, b, col) { - return $WH.strcmp(b.boss, a.boss) || $WH.strcmp(a.name, b.name); + return $WH.strcmp(b.boss, a.boss) || $WH.strcmp(a.name, b.name) || $WH.strcmp(a.hasQuests, b.hasQuests); } }, { diff --git a/template/js/locale_dede.js b/template/js/locale_dede.js index c81877fa..f3da2af5 100644 --- a/template/js/locale_dede.js +++ b/template/js/locale_dede.js @@ -259,7 +259,10 @@ var mn_npcs = [ [7,"Humanoide"], [9,"Mechanisch"], [6,"Untot"], - [10,"Nicht kategorisiert"] + [10,"Nicht kategorisiert"], + [11,"Totem"], + [12,"Haustier"], + [13,"Gaswolke"] ]; var mn_objects = [ [9,"Bücher"], diff --git a/template/js/locale_enus.js b/template/js/locale_enus.js index 7a9521bd..75d63155 100644 --- a/template/js/locale_enus.js +++ b/template/js/locale_enus.js @@ -259,7 +259,10 @@ var mn_npcs = [ [7,"Humanoids"], [9,"Mechanicals"], [6,"Undead"], - [10,"Uncategorized"] + [10,"Uncategorized"], + [11,"Totem"], + [12,"Non-combat Pet"], + [13,"Gas Cloud"] ]; var mn_objects = [ [9,"Books"], diff --git a/template/js/locale_eses.js b/template/js/locale_eses.js index a5646e20..f4bed794 100644 --- a/template/js/locale_eses.js +++ b/template/js/locale_eses.js @@ -259,7 +259,10 @@ var mn_npcs = [ [7,"Humanoide"], [9,"Mecánico"], [6,"No-muerto"], - [10,"Sin categoría"] + [10,"Sin categoría"], + [11,"Tótem"], + [12,"Mascota mansa"], + [13,"Nube de gas"] ]; var mn_objects = [ [9,"Libros"], diff --git a/template/js/locale_frfr.js b/template/js/locale_frfr.js index 76b88c1b..d4a3300d 100644 --- a/template/js/locale_frfr.js +++ b/template/js/locale_frfr.js @@ -259,7 +259,10 @@ var mn_npcs = [ [7,"Humanoïdes"], [9,"Mécaniques"], [6,"Mort-vivant"], - [10,"Non classés"] + [10,"Non classés"], + [11,"Totem"], + [12,"Familier pacifique"], + [13,"Nuage de gaz"] ]; var mn_objects = [ [9,"Livres"], diff --git a/template/js/locale_ruru.js b/template/js/locale_ruru.js index 51d20edb..6f34b787 100644 --- a/template/js/locale_ruru.js +++ b/template/js/locale_ruru.js @@ -259,7 +259,10 @@ var mn_npcs = [ [7,"Гуманоиды"], [9,"Механизмы"], [6,"Нежить"], - [10,"Разное"] + [10,"Разное"], + [11,"Тотем"], + [12,"Спутник"], + [13,"Облако газа"] ]; var mn_objects = [ [9,"Книги"], diff --git a/template/list-page-generic.tpl b/template/list-page-generic.tpl new file mode 100644 index 00000000..f81a83fb --- /dev/null +++ b/template/list-page-generic.tpl @@ -0,0 +1,55 @@ +{include file='header.tpl'} + +
    +
    +
    + +{if !empty($announcements)} + {foreach from=$announcements item=item} + {include file='bricks/announcement.tpl' an=$item} + {/foreach} +{/if} +{if !empty($map)} + {include file='bricks/mapper.tpl' map=$map.data som=$map.som} +{/if} + + + +{if !empty($name) || !empty($h1Links)} +
    +{if !empty($h1Links)} + +{/if} +{if !empty($name)} +

    {$name}

    +{/if} +
    +{/if} + +{if !empty($lvData)} + {if count($lvData) > 1} +
    + {/if} +
    + +
    +{/if} + +
    +
    + +{include file='footer.tpl'} diff --git a/template/npc.tpl b/template/npc.tpl new file mode 100644 index 00000000..02681177 --- /dev/null +++ b/template/npc.tpl @@ -0,0 +1,128 @@ +{include file='header.tpl'} + +
    +
    +
    + +{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'} + +

    {$name}{if $subname} <{$subname}>{/if}

    + +{include file='bricks/article.tpl'} + +{if is_array($position)} +
    {$lang.difficultyPH} {$position[1]}.
    +
    +{elseif $position} +
    {#This_NPC_can_be_found_in#} {strip} + {foreach from=$position item=zone name=zone} + +
    ',type:'{$point.type}' + {rdelim}] + {if !$smarty.foreach.point.last},{/if} + {/foreach} + ] + {/if} + {rdelim}); + $WH.ge('mapper-generic').style.display='block'; + {else} + $WH.ge('mapper-generic').style.display='none'; + {/if} + g_setSelectedLink(this, 'mapper'); return false" onmousedown="return false"> + {$zone.name}{if $zone.population > 1} ({$zone.population}){/if}{if $smarty.foreach.zone.last}.{else}, {/if} + {/foreach} +
    +{/strip} +
    +
    + + +{else} + {$lang.unkPosition} +{/if} + +{if $quotes} +

    {$lang.quotes} ({$quotes[1]})

    + +{/if} + +{if $reputation} +

    {$lang.gains}

    + +{$lang.gainsDesc}{$lang.colon} +{foreach from=$reputation item=set} + {if $reputation|@count > 1}
    • {$set[0]}
    • {/if} +
        + {foreach from=$set[1] item=itr} +
      • {$itr.qty} {$lang.repWith} {$itr.name}{if $itr.cap && $itr.qty > 0} ({$lang.stopsAt|@sprintf:$itr.cap}){/if}
    + {/foreach} + + {if $reputation|@count > 1}{/if} +{/foreach} + +{/if} +

    {$lang.related}

    +
    + +{include file='bricks/tabsRelated.tpl' tabs=$lvData} + +{include file='bricks/contribute.tpl'} + + + + +{include file='footer.tpl'} diff --git a/template/npcs.tpl b/template/npcs.tpl new file mode 100644 index 00000000..1dfec53b --- /dev/null +++ b/template/npcs.tpl @@ -0,0 +1,112 @@ +{include file='header.tpl'} + +
    +
    +
    + +{if !empty($announcements)} + {foreach from=$announcements item=item} + {include file='bricks/announcement.tpl' an=$item} + {/foreach} +{/if} + + + +
    + +
    +
    {$lang.classification}{$lang.colon}
    + {$lang.clear} +
    + +
    +{if $petFamPanel} +
    +
    {$lang.petFamily}{$lang.colon}
    {$lang.clear} +
    + +
    +{/if} + + + + + + + + + +
    {$lang.name|ucFirst}{$lang.colon} + + + + +
      
    +
    {$lang.level}{$lang.colon}  - + + + +
       {$lang.react}{$lang.colon}  + +
    +
    + +
    + + +
    +
    {$lang.refineSearch}
    + {$lang.match}{$lang.colon} +
    + +
    + +
    + + +
    + + +
    +
    + + + +
    + + +
    +
    +
    + +{include file='footer.tpl'} diff --git a/template/pet.tpl b/template/pet.tpl deleted file mode 100644 index 3e3d12d3..00000000 --- a/template/pet.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} - - - -{include file='bricks/infobox.tpl' info=$lvData.infobox} - -
    - -{include file='bricks/redButtons.tpl'} - -
    - - - -

    {if isset($lvData.page.expansion)}{$lvData.page.name}{else}{$lvData.page.name}{/if}

    - -{include file='bricks/article.tpl'} - -

    {$lang.related}

    -
    - -{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} - -{include file='bricks/contribute.tpl'} - -
    -
    - -{include file='footer.tpl'} diff --git a/template/race.tpl b/template/race.tpl deleted file mode 100644 index 4e03bfe2..00000000 --- a/template/race.tpl +++ /dev/null @@ -1,45 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} - - - -{include file='bricks/infobox.tpl' info=$lvData.infobox} - -
    -
    -
    - - -{include file='bricks/redButtons.tpl'} - -

    {if $lvData.page.expansion}{$lvData.page.name}{else}{$lvData.page.name}{/if}

    - -{include file='bricks/article.tpl'} - -

    {$lang.related}

    -
    - -{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} - -{include file='bricks/contribute.tpl'} - -
    -
    - -{include file='footer.tpl'} diff --git a/template/search.tpl b/template/search.tpl index 78d140cd..e1d1a619 100644 --- a/template/search.tpl +++ b/template/search.tpl @@ -9,7 +9,7 @@ {/foreach} {/if}
    - WowheadWowhead + WowheadWowhead {if !empty($found)}

    {$lang.foundResult} {$search|escape:"html"}

    diff --git a/template/skill.tpl b/template/skill.tpl deleted file mode 100644 index 3e81aeff..00000000 --- a/template/skill.tpl +++ /dev/null @@ -1,44 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{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'} - -

    {$lvData.page.name}

    - -{include file='bricks/article.tpl'} - -

    {$lang.related}

    -
    - -{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} - -{include file='bricks/contribute.tpl'} - -
    -
    - -{include file='footer.tpl'} diff --git a/template/spell.tpl b/template/spell.tpl index 07d5ea4a..dd12e8e3 100644 --- a/template/spell.tpl +++ b/template/spell.tpl @@ -1,8 +1,8 @@ {include file='header.tpl'}
    -
    -
    +
    +
    {if !empty($announcements)} {foreach from=$announcements item=item} @@ -12,15 +12,18 @@ -{include file='bricks/infobox.tpl' info=$lvData.infobox} +{include file='bricks/infobox.tpl'}
    +{include file='bricks/headIcons.tpl' icons=$lvData.icons} + {include file='bricks/redButtons.tpl'} -

    {$lvData.page.name}

    + + {$lvData.page.name}{else}>{$lvData.page.name}{/if} {include file='bricks/tooltip.tpl'} @@ -50,6 +53,18 @@ {include file='bricks/article.tpl'} +{* +if !empty($lvData.page.transfer)} +
    + {$lang._transfer|sprintf:$lvData.page.transfer.id:´´:$lvData.page.transfer.icon:$lvData.page.transfer.name:$lvData.page.transfer.facInt:$lvData.page.transfer.facName} +{/if} +*} + +{if isset($lvData.page.unavailable)} +
    + {$lang._unavailable} +{/if} +

    {$lang._spellDetails}

    @@ -160,7 +175,7 @@ {/section}
    -

    {$lang.related}

    +

    {$lang.related}

    {include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} diff --git a/template/title.tpl b/template/title.tpl deleted file mode 100644 index b1d745cb..00000000 --- a/template/title.tpl +++ /dev/null @@ -1,39 +0,0 @@ -{include file='header.tpl'} - -
    -
    -
    - -{if !empty($announcements)} - {foreach from=$announcements item=item} - {include file='bricks/announcement.tpl' an=$item} - {/foreach} -{/if} - - - -{include file='bricks/infobox.tpl' info=$lvData.infobox} - -
    - -{include file='bricks/redButtons.tpl'} - -

    {if isset($lvData.page.expansion)}{$lvData.page.name}{else}{$lvData.page.name}{/if}

    - -{include file='bricks/article.tpl'} - -

    {$lang.related}

    -
    - -{include file='bricks/tabsRelated.tpl' tabs=$lvData.relTabs} - -{include file='bricks/contribute.tpl'} - -
    -
    - -{include file='footer.tpl'}