diff --git a/includes/defines.php b/includes/defines.php index c24a21e0..84a1a099 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -136,6 +136,7 @@ define('CUSTOM_HAS_VIDEO', 0x04000000); define('CUSTOM_DISABLED', 0x08000000); define('CUSTOM_SERVERSIDE', 0x10000000); define('CUSTOM_UNAVAILABLE', 0x20000000); +define('CUSTOM_EXCLUDE_FOR_LISTVIEW', 0x40000000); // will not show up in search or on listPage (override for staff) // Custom Flags (per type) define('SPELL_CU_TALENT', 0x0001); // passive talent @@ -147,7 +148,7 @@ define('SPELL_CU_PET_TALENT_TYPE2', 0x0020); // Cunning define('SPELL_CU_GLYPH_MAJOR', 0x0040); define('SPELL_CU_GLYPH_MINOR', 0x0080); define('SPELL_CU_QUALITY_MASK', 0x0F00); // set if spell creates an item: (7 - Quality) << 8 -define('SPELL_CU_EXCLUDE_CATEGORY_SEARCH', 0x1000); // only display, when searching for spells in general (!cat || cat = 0) +// define('SPELL_CU_EXCLUDE_CATEGORY_SEARCH', 0x1000); // migrate to CUSTOM_EXCLUDE_FOR_LISTVIEW define('SPELL_CU_FIRST_RANK', 0x2000); // used by filter define('SPELL_CU_LAST_RANK', 0x4000); diff --git a/includes/types/faction.class.php b/includes/types/faction.class.php index 920e660a..b4d35bab 100644 --- a/includes/types/faction.class.php +++ b/includes/types/faction.class.php @@ -6,7 +6,33 @@ if (!defined('AOWOW_REVISION')) class FactionList extends BaseType { - public static $type = TYPE_FACTION; + public static $type = TYPE_FACTION; + + protected $queryBase = 'SELECT f1.*, f1.id AS ARRAY_KEY, f1.parentFactionId AS cat FROM ?_factions f1'; + protected $queryOpts = array( + 'f1' => [['f2']], + 'f2' => ['j' => ['?_factions f2 ON f1.parentFactionId = f2.id', true], 's' => ', IFNULL(f2.parentFactionId, 0) AS cat2'] + ); + + public function __construct($conditions = []) + { + parent::__construct($conditions); + + if ($this->error) + return; + + // post processing + foreach ($this->iterate() as &$_curTpl) + { + // prepare factionTemplates + if ($_curTpl['templateIds']) + $_curTpl['templateIds'] = explode(' ', $_curTpl['templateIds']); + + // prepare quartermaster + if ($_curTpl['qmNpcIds']) + $_curTpl['qmNpcIds'] = explode(' ', $_curTpl['qmNpcIds']); + } + } public static function getName($id) { @@ -20,24 +46,37 @@ class FactionList extends BaseType FROM ?_factions WHERE - factionID = ?d', + id = ?d', $id ); return Util::localizedString($n, 'name'); } - public function reactsAgainst($faction) + public function getListviewData() { - // see factionTemplate - /* - 1: friendly - 0: neutral - -1: hostile - */ + $data = []; + + foreach ($this->iterate() as $__) + { + $data[$this->id] = array( + 'category' => $this->curTpl['cat'], + 'category2' => $this->curTpl['cat2'], + 'expansion' => $this->curTpl['expansion'], + 'id' => $this->id, + 'side' => $this->curTpl['side'], + 'name' => $this->getField('name', true) + ); + } + + return $data; + } + + public function addGlobalsToJScript(&$template, $addMask = 0) + { + foreach ($this->iterate() as $__) + $template->extendGlobalData(self::$type, [$this->id => ['name' => $this->getField('name', true)]]); } - public function getListviewData() { } - public function addGlobalsToJScript(&$template, $addMask = 0) { } public function renderTooltip() { } } diff --git a/includes/types/item.class.php b/includes/types/item.class.php index b9b7980e..0852c6a6 100644 --- a/includes/types/item.class.php +++ b/includes/types/item.class.php @@ -316,7 +316,10 @@ class ItemList extends BaseType $data[$this->id]['reqfaction'] = $x; if ($x = $this->curTpl['requiredFactionRank']) - $data[$this->id]['reqrep'] = $x; + { + $data[$this->id]['reqrep'] = $x; + $data[$this->id]['standing'] = $x; // used in /faction item-listing + } if ($x = $this->curTpl['slots']) $data[$this->id]['nslots'] = $x; @@ -1237,6 +1240,9 @@ class ItemList extends BaseType { $this->ssd[$this->id] = DB::Aowow()->selectRow("SELECT * FROM ?_scalingstatdistribution WHERE id = ?", $this->curTpl['scalingStatDistribution']); + if (!$this->ssd[$this->id]) + return; + // stats and ratings for ($i = 1; $i <= 10; $i++) { diff --git a/includes/types/quest.class.php b/includes/types/quest.class.php index 29befa21..d39a9b15 100644 --- a/includes/types/quest.class.php +++ b/includes/types/quest.class.php @@ -112,7 +112,7 @@ class QuestList extends BaseType return $data; } - public function getListviewData() + public function getListviewData($extraFactionId = 0) // i should formulate a propper parameter.. { $data = []; @@ -170,6 +170,7 @@ class QuestList extends BaseType $data[$this->id]['weekly'] = true; // flags & 64: Hostile - there are quests, that flag the player for pvp when taken .. where is that set..? + // wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) if ($this->curTpl['Flags'] & 0x4000) // Unavailable (todo (med): get disables) { $data[$this->id]['historical'] = true; // post 5.0 @@ -179,7 +180,23 @@ class QuestList extends BaseType if ($this->curTpl['Flags'] & 0x80000) // Auto Accept $data[$this->id]['wflags'] |= 0x20; - // todo reprewards .. accesses QuestFactionReward.dbc + $data[$this->id]['reprewards'] = []; + for ($i = 1; $i < 6; $i++) + { + $foo = $this->curTpl['RewardFactionId'.$i]; + $bar = $this->curTpl['RewardFactionValueIdOverride'.$i] / 100; + + if (!$bar && ($_ = $this->curTpl['RewardFactionValueId'.$i])) + $bar = Util::$questFactionReward[abs($_)] * ($_ < 0 ? -1 : 1); + + if ($foo && $bar) + { + $data[$this->id]['reprewards'][] = [$foo, $bar]; + + if ($extraFactionId == $foo) + $data[$this->id]['reputation'] = $bar; + } + } } return $data; diff --git a/includes/types/skill.class.php b/includes/types/skill.class.php index f82ffe2c..5580c43e 100644 --- a/includes/types/skill.class.php +++ b/includes/types/skill.class.php @@ -53,7 +53,6 @@ class SkillList extends BaseType foreach ($this->iterate() as $__) { - $data[$this->id] = array( 'category' => $this->curTpl['typeCat'], 'categorybak' => $this->curTpl['categoryId'], diff --git a/includes/utilities.php b/includes/utilities.php index 4d317864..12974b9e 100644 --- a/includes/utilities.php +++ b/includes/utilities.php @@ -18,6 +18,7 @@ class Lang public static $class; public static $currency; public static $event; + public static $faction; public static $item; public static $itemset; public static $maps; @@ -344,7 +345,7 @@ class SmartyAoWoW extends Smarty if ($article) { - $tv['article'] = ['text' => $article['article']]; + $tv['article'] = ['text' => Util::jsEscape($article['article'])]; if (empty($tv['infobox']) && !empty($article['quickInfo'])) $tv['infobox'] = $article['quickInfo']; @@ -493,7 +494,7 @@ class SmartyAoWoW extends Smarty case TYPE_NPC: (new CreatureList(array(['ct.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; case TYPE_OBJECT: (new GameobjectList(array(['gt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; case TYPE_ITEM: (new ItemList(array(['i.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; - case TYPE_QUEST: (new QuestList(array(['qt.entry', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; + case TYPE_QUEST: (new QuestList(array(['qt.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; case TYPE_SPELL: (new SpellList(array(['s.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; case TYPE_ZONE: (new ZoneList(array(['z.id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; case TYPE_FACTION: (new FactionList(array(['id', $ids], 0)))->addGlobalsToJscript($this, GLOBALINFO_SELF); break; @@ -638,6 +639,11 @@ class Util 10 => [ 65, 66, 67, 210, 394, 495, 3537, 3711, 4024, 4197, 4395] ); + public static $questFactionReward = array( // from QuestFactionReward.dbc + 0, 10, 25, 75, 150, 250, 350, 500, 1000, 5 + ); + + /* why: Because petSkills (and ranged weapon skills) are the only ones with more than two skillLines attached. Because Left Joining ?_spell with ?_skillLineAbility causes more trouble than it has uses. Because this is more or less the only reaonable way to fit all that information into one database field, so.. @@ -750,8 +756,7 @@ class Util null, 4, 10, 9, 8, 6, 15, 11, 3, 5, null, 7 ); - // from DurabilityQuality.dbc - public static $itemDurabilityQualityMod = array( + public static $itemDurabilityQualityMod = array( // from DurabilityQuality.dbc null, 1.0, 0.6, 1.0, 0.8, 1.0, 1.0, 1.2, 1.25, 1.44, 2.5, 1.728, 3.0, 0.0, 0.0, 1.2, 1.25 ); diff --git a/localization/locale_dede.php b/localization/locale_dede.php index 4c2703de..b8e4236a 100644 --- a/localization/locale_dede.php +++ b/localization/locale_dede.php @@ -330,6 +330,12 @@ $lang = array( 'exotic' => "Exotisch", 'cat' => ["Wildheit", "Hartnäckigkeit", "Gerissenheit"] ), + 'faction' => array( + 'spillover' => "Reputationsüberlauf", + 'spilloverDesc' => "Für diese Fraktion erhaltener Ruf wird zusätzlich mit den unten aufgeführten Fraktionen anteilig verrechnet.", + 'maxStanding' => "Max. Ruf", + 'quartermaster' => "Rüstmeister" + ), 'itemset' => array( '_desc' => "%s ist das %s. Es enthält %s Teile.", '_descTagless' => "%s ist ein Ausrüstungsset, das %s Teile enthält.", diff --git a/localization/locale_enus.php b/localization/locale_enus.php index 3220596b..50ba6838 100644 --- a/localization/locale_enus.php +++ b/localization/locale_enus.php @@ -317,6 +317,12 @@ $lang = array( 'exotic' => "Exotic", 'cat' => ["Ferocity", "Tenacity", "Cunning"] ), + 'faction' => array( + 'spillover' => "Reputation Spillover", + 'spilloverDesc' => "Gaining Reputation with this faction also yields a proportional gain with the factions listed below.", + 'maxStanding' => "Max. Standing", + 'quartermaster' => "Quartermaster" + ), 'itemset' => array( '_desc' => "%s is the %s. It contains %s pieces.", '_descTagless' => "%s is an item set that contains %s pieces.", diff --git a/localization/locale_eses.php b/localization/locale_eses.php index b388aa58..f6db132c 100644 --- a/localization/locale_eses.php +++ b/localization/locale_eses.php @@ -288,6 +288,12 @@ $lang = array( 'exotic' => "Exótica", 'cat' => ["Ferocidad", "Tenacidad", "Astucia"] ), + 'faction' => array( + 'spillover' => "[Reputation Spillover]", + 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", + 'maxStanding' => "Posición máxima", + 'quartermaster' => "Intendente" + ), 'itemset' => array( '_desc' => "%s es el %s. Contiene %s piezas.", '_descTagless' => "%s es un conjunto de objetos que tiene %s piezas.", diff --git a/localization/locale_frfr.php b/localization/locale_frfr.php index 8a03f206..d8c0617e 100644 --- a/localization/locale_frfr.php +++ b/localization/locale_frfr.php @@ -288,6 +288,12 @@ $lang = array( 'exotic' => "Exotique", 'cat' => ["Férocité", "Tenacité", "Ruse"] ), + 'faction' => array( + 'spillover' => "[Reputation Spillover]", + 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", + 'maxStanding' => "Niveau maximum", + 'quartermaster' => "Intendant" + ), 'itemset' => array( '_desc' => "%s est le %s. Il contient %s pièces.", '_descTagless' => "%s est un ensemble d'objet qui contient %s pièces.", diff --git a/localization/locale_ruru.php b/localization/locale_ruru.php index b25ec4f5..97270c1b 100644 --- a/localization/locale_ruru.php +++ b/localization/locale_ruru.php @@ -288,6 +288,12 @@ $lang = array( 'exotic' => "Экзотический", 'cat' => ["Свирепость", "Упорство", "Хитрость"] ), + 'faction' => array( + 'spillover' => "[Reputation Spillover]", + 'spilloverDesc' => "[Gaining Reputation with this faction also yields a proportional gain with the factions listed below.]", + 'maxStanding' => "Макс Уровень", + 'quartermaster' => "Интендант" + ), 'itemset' => array( '_desc' => "%s — %s. Он состоит из %s предметов.", '_descTagless' => "%s — набор из %s предметов.", diff --git a/pages/achievement.php b/pages/achievement.php index 2db11bff..0c659e12 100644 --- a/pages/achievement.php +++ b/pages/achievement.php @@ -88,13 +88,13 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) switch ($acv->getField('faction')) { case 1: - $infobox[] = Lang::$main['side'].': [span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; + $infobox[] = Lang::$main['side'].Lang::$colon.'[span class=alliance-icon]'.Lang::$game['si'][SIDE_ALLIANCE].'[/span]'; break; case 2: - $infobox[] = Lang::$main['side'].': [span class=horde-icon]'.Lang::$game['si'][SIDE_HORDE].'[/span]'; + $infobox[] = Lang::$main['side'].Lang::$colon.'[span class=horde-icon]'.Lang::$game['si'][SIDE_HORDE].'[/span]'; break; default: // case 3 - $infobox[] = Lang::$main['side'].': '.Lang::$game['si'][SIDE_BOTH]; + $infobox[] = Lang::$main['side'].Lang::$colon.Lang::$game['si'][SIDE_BOTH]; } // todo (low): crosslink with charactersDB to check if realmFirsts are still available diff --git a/pages/faction.php b/pages/faction.php new file mode 100644 index 00000000..92989e5e --- /dev/null +++ b/pages/faction.php @@ -0,0 +1,236 @@ +loadCache($cacheKeyPage, $pageData)) +{ + $faction = new FactionList(array(['id', $_id])); + if ($faction->error) + $smarty->notFound(Lang::$game['faction']); + + /***********/ + /* Infobox */ + /***********/ + + $infobox = []; + + // Quartermaster if any + if ($ids = $faction->getField('qmNpcIds')) + { + Util::$pageTemplate->extendGlobalIds(TYPE_NPC, $ids); + + $qmStr = Lang::$faction['quartermaster'].Lang::$colon; + + if (count($ids) == 1) + $qmStr .= '[npc='.$ids[0].']'; + else if (count($ids) > 1) + { + $qmStr .= '[ul]'; + foreach ($ids as $id) + $qmStr .= '[li][npc='.$id.'][/li]'; + + $qmStr .= '[/ul]'; + } + + $infobox[] = $qmStr; + } + + // side if any + if ($_ = $faction->getField('side')) + $infobox[] = Lang::$main['side'].Lang::$colon.'[span class='.($_ == 1 ? 'alliance' : 'horde').'-icon]'.Lang::$game['si'][$_].'[/span]'; + + /****************/ + /* Main Content */ + /****************/ + + $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 + ), + ); + + if ($_ = $faction->getField('cat2')) + $pageData['path'][] = $_; + + if ($_ = $faction->getField('cat')) + $pageData['path'][] = $_; + + // Spillover Effects + $conditions = array( + ['id', $_id, '!'], // not self + ['reputationIndex', -1, '!'] // only gainable + ); + + if ($p = $faction->getField('parentFactionId')) // linked via parent + $conditions[] = ['OR', ['id', $p], ['parentFactionId', $p]]; + else + $conditions[] = ['parentFactionId', $_id]; // self as parent + + $spillover = new FactionList($conditions); + $spillover->addGlobalsToJscript(Util::$pageTemplate); + $buff = []; + + foreach ($spillover->iterate() as $spillId => $__) + if ($val = ($spillover->getField('spilloverRateIn') * $faction->getField('spilloverRateOut') * 100)) + $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]'; + + /**************/ + /* Extra Tabs */ + /**************/ + + // tab: items + $items = new ItemList(array(['requiredFaction', $_id])); + if (!$items->error) + { + $items->addGlobalsToJscript($smarty, GLOBALINFO_SELF); + + $pageData['relTabs'][] = array( + 'file' => 'item', + 'data' => $items->getListviewData(), + 'showRep' => true, + 'params' => array( + 'tabs' => '$tabsRelated', + 'extraCols' => '$_', + 'sort' => "$['standing', 'name']", + 'note' => sprintf(Util::$filterResultString, '?items&filter=cr=17;crs='.$_id.';crv=0') + ) + ); + } + + // 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) + { + $killCreatures->addGlobalsToJscript($smarty); + + $pageData['relTabs'][] = array( + 'file' => 'npc', + 'data' => $killCreatures->getListviewData(), + 'showRep' => true, + 'params' => array( + 'tabs' => '$tabsRelated', + ) + ); + } + + // tab: members + $conditions = array( + ['factionA', $faction->getField('templateIds')], + ['factionH', $faction->getField('templateIds')], + 'OR' + ); + + $killCreatures = new CreatureList($conditions); + if (!$killCreatures->error) + { + $killCreatures->addGlobalsToJscript($smarty); + + $pageData['relTabs'][] = array( + 'file' => 'npc', + 'data' => $killCreatures->getListviewData(), + 'showRep' => true, + 'params' => array( + 'id' => 'member', + 'name' => '$LANG.tab_member', + 'tabs' => '$tabsRelated', + ) + ); + } + + // tab: quests + $conditions = array( + ['AND', ['RewardFactionId1', $_id], ['OR', ['RewardFactionValueId1', 0, '>'], ['RewardFactionValueIdOverride1', 0, '>']]], + ['AND', ['RewardFactionId2', $_id], ['OR', ['RewardFactionValueId2', 0, '>'], ['RewardFactionValueIdOverride2', 0, '>']]], + ['AND', ['RewardFactionId3', $_id], ['OR', ['RewardFactionValueId3', 0, '>'], ['RewardFactionValueIdOverride3', 0, '>']]], + ['AND', ['RewardFactionId4', $_id], ['OR', ['RewardFactionValueId4', 0, '>'], ['RewardFactionValueIdOverride4', 0, '>']]], + ['AND', ['RewardFactionId5', $_id], ['OR', ['RewardFactionValueId5', 0, '>'], ['RewardFactionValueIdOverride5', 0, '>']]], + 'OR' + ); + $quests = new QuestList($conditions); + if (!$quests->error) + { + $quests->addGlobalsToJscript($smarty, GLOBALINFO_ANY); + + $pageData['relTabs'][] = array( + 'file' => 'quest', + 'data' => $quests->getListviewData($_id), + 'showRep' => true, + 'params' => array( + 'tabs' => '$tabsRelated', + 'extraCols' => '$_', + 'note' => sprintf(Util::$filterResultString, '?quests?filter=cr=1;crs='.$_id.';crv=0') + ) + ); + } + + // tab: achievements + $conditions = array( + ['ac.type', ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION], + ['ac.value1', $_id] + ); + $acvs = new AchievementList($conditions); + if (!$acvs->error) + { + $acvs->addGlobalsToJscript($smarty, GLOBALINFO_ANY); + + $pageData['relTabs'][] = array( + 'file' => 'achievement', + 'data' => $acvs->getListviewData(), + 'params' => array( + 'id' => 'criteria-of', + 'name' => '$LANG.tab_criteriaof', + 'tabs' => '$tabsRelated', + 'visibleCols' => "$['category']" + ) + ); + } + + $smarty->saveCache($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->assign('community', CommunityContent::getAll(TYPE_FACTION, $_id)); // comments, screenshots, videos +$smarty->assign('lang', array_merge(Lang::$main, [Lang::$colon])); +$smarty->assign('lvData', $pageData); + +// load the page +$smarty->display('faction.tpl'); + +?> diff --git a/pages/factions.php b/pages/factions.php new file mode 100644 index 00000000..39806000 --- /dev/null +++ b/pages/factions.php @@ -0,0 +1,80 @@ + [469, 891, 67, 892, 169], + 980 => [936], + 1097 => [1037, 1052, 1117], + 0 => true +); + +if (!Util::isValidPage($validCats, $cats)) + $smarty->error(); + +if (!$smarty->loadCache($cacheKey, $pageData)) +{ + $conditions = []; + + if (User::isInGroup(U_GROUP_STAFF)) + $conditions[] = ['reputationIndex', -1, '!']; // unlisted factions + + if (isset($cats[0]) && empty($cats[1])) + { + if (!$cats[0]) + $conditions[] = ['f1.parentFactionId', [1118, 980, 1097, 469, 891, 67, 892, 169, 1037, 1052, 1117, 936], '!']; + else + { + $subs = DB::Aowow()->selectCol('SELECT id FROM ?_factions WHERE parentFactionId = ?d', $cats[0]); + $conditions[] = ['OR', ['f1.parentFactionId', $subs], ['f1.id', $subs]]; + } + + $path[] = $cats[0]; + // array_unshift($title, Lang::$factions['cat'][$cats[0]]); + } + else if (!empty($cats[1])) + { + $conditions[] = ['f1.parentFactionId', $cats[1]]; + $path[] = $cats[0]; + $path[] = $cats[1]; + // array_unshift($title, Lang::$factions['cat'][$cats[1]]); + } + + $factions = new FactionList($conditions); + + $pageData = array( + 'title' => $title, + 'path' => $path, + 'listviews' => array( + array( + 'file' => 'faction', + 'data' => $factions->getListviewData(), + 'params' => [] + ) + ) + ); + + $smarty->saveCache($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->assign('lang', Lang::$main); +$smarty->assign('lvData', $pageData); + +// load the page +$smarty->display('generic-no-filter.tpl'); + +?> diff --git a/pages/skill.php b/pages/skill.php index e4344060..d652b41b 100644 --- a/pages/skill.php +++ b/pages/skill.php @@ -71,7 +71,8 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } // 2 recipe Items [items] (Books) - $conditions = array( + $skill2Filter = [null, 171, 164, 185, 333, 202, 129, 755, 165, 186, 197, null, null, 356, 182, 773]; + $conditions = array( ['requiredSkill', $_id], ['class', ITEM_CLASS_RECIPE], 0 @@ -89,7 +90,7 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) 'id' => 'recipe-items', 'name' => '$LANG.tab_recipeitems', 'tabs' => '$tabsRelated', - // 'note' => sprintf(Util::$filterResultString, "?items=9.subClass") // todo (med): after items + 'note' => !empty(array_flip($skill2Filter)[$_id]) ? sprintf(Util::$filterResultString, "?items=9.".array_flip($skill2Filter)[$_id]) : null ) ); } @@ -345,7 +346,6 @@ if (!$smarty->loadCache($cacheKeyPage, $pageData)) } } - $smarty->saveCache($cacheKeyPage, $pageData); } diff --git a/pages/skills.php b/pages/skills.php index 7a8bc10c..bd2c0eb8 100644 --- a/pages/skills.php +++ b/pages/skills.php @@ -26,6 +26,8 @@ if (!$smarty->loadCache($cacheKey, $pageData)) $skills = new SkillList($conditions); $pageData = array( + 'title' => $title, + 'path' => $path, 'listviews' => array( array( 'file' => 'skill', diff --git a/search.php b/search.php index 483fe915..6277f0f3 100644 --- a/search.php +++ b/search.php @@ -39,7 +39,7 @@ if (!defined('AOWOW_REVISION')) 18: Listview - template: 'achievement', id: 'statistics', name: LANG.tab_statistics, 19: Listview - template: 'zone', id: 'zones', name: LANG.tab_zones, 20: Listview - template: 'object', id: 'objects', name: LANG.tab_objects, -todo 21: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions, + 21: Listview - template: 'faction', id: 'factions', name: LANG.tab_factions, 22: Listview - template: 'skill', id: 'skills', name: LANG.tab_skills, 23: Listview - template: 'pet', id: 'pets', name: LANG.tab_pets, 24: Listview - template: 'spell', id: 'npc-abilities', name: LANG.tab_npcabilities, @@ -379,7 +379,7 @@ if ($searchMask & 0x80) { $conditions = array( // hmm, inclued classMounts..? ['s.typeCat', [7, -2, -3]], - [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | SPELL_CU_EXCLUDE_CATEGORY_SEARCH), '&'], 0], + [['s.cuFlags', (SPELL_CU_TRIGGERED | SPELL_CU_TALENT | CUSTOM_EXCLUDE_FOR_LISTVIEW), '&'], 0], [['s.attributes0', 0x80, '&'], 0], ['s.name_loc'.User::$localeId, $query], $maxResults @@ -861,7 +861,7 @@ if ($searchMask & 0x80000) { $objects->addGlobalsToJScript($smarty); - $found['zone'] = array( + $found['object'] = array( 'type' => TYPE_OBJECT, 'appendix' => ' (Object)', 'matches' => $objects->getMatches(), @@ -874,14 +874,43 @@ if ($searchMask & 0x80000) if ($objects->getMatches() > $maxResults) { - $found['zone']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_objectsfound', $objects->getMatches(), $maxResults); - $found['zone']['params']['_truncated'] = 1; + $found['object']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_objectsfound', $objects->getMatches(), $maxResults); + $found['object']['params']['_truncated'] = 1; } } } // 21 Factions -// if ($searchMask & 0x100000) +if ($searchMask & 0x100000) +{ + $conditions = array( + ['name_loc'.User::$localeId, $query], + [['cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&'], 0], + $maxResults + ); + + $factions = new FactionList($conditions); + + if ($data = $factions->getListviewData()) + { + $found['faction'] = array( + 'type' => TYPE_FACTION, + 'appendix' => ' (Faction)', + 'matches' => $factions->getMatches(), + 'file' => 'faction', + 'data' => $data, + 'params' => [ + 'tabs' => '$myTabs' + ] + ); + + if ($factions->getMatches() > $maxResults) + { + $found['faction']['params']['note'] = sprintf(Util::$tryNarrowingString, 'LANG.lvnote_factionsfound', $factions->getMatches(), $maxResults); + $found['faction']['params']['_truncated'] = 1; + } + } +} // 22 Skills if ($searchMask & 0x200000) @@ -985,7 +1014,7 @@ if ($searchMask & 0x1000000) { $conditions = array( ['s.name_loc'.User::$localeId, $query], - ['OR', ['s.typeCat', [0, -9]], ['s.cuFlags', SPELL_CU_EXCLUDE_CATEGORY_SEARCH, '&']], + ['OR', ['s.typeCat', [0, -9]], ['s.cuFlags', CUSTOM_EXCLUDE_FOR_LISTVIEW, '&']], $maxResults ); diff --git a/template/bricks/listviews/faction.tpl b/template/bricks/listviews/faction.tpl new file mode 100644 index 00000000..4d14e1d3 --- /dev/null +++ b/template/bricks/listviews/faction.tpl @@ -0,0 +1,28 @@ +{strip} + new Listview({ldelim} + template:'faction', + {if !isset($params.id)}id:'factions',{/if} + {if !isset($params.name)}name:LANG.tab_factions,{/if} + {if !isset($params.parent)}parent:'lv-generic',{/if} + {foreach from=$params key=k item=v} + {if $v[0] == '$'} + {$k}:{$v|substr:1}, + {else if $v} + {$k}:'{$v}', + {/if} + {/foreach} + data:[ + {foreach name=i from=$data item=curr} + {ldelim} + {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} + ] + {rdelim}); +{/strip} diff --git a/template/bricks/listviews/item.tpl b/template/bricks/listviews/item.tpl index 33676547..808bacb4 100644 --- a/template/bricks/listviews/item.tpl +++ b/template/bricks/listviews/item.tpl @@ -1,3 +1,24 @@ +{if !empty($tab.showRep)} +var _ = [ + {ldelim} + id: 'standing', + after: 'reqlevel', + name: LANG.standing, + width: '12%', + value: 'standing', + type: 'text', + getValue: function(item) + {ldelim} + return g_reputation_standings[item.standing]; + {rdelim}, + compute: function(item, td) + {ldelim} + return g_reputation_standings[item.standing]; + {rdelim} + {rdelim} +]; +{/if} + {strip} new Listview({ldelim} template:'item', diff --git a/template/bricks/listviews/quest.tpl b/template/bricks/listviews/quest.tpl index b482ea55..e4523ea7 100644 --- a/template/bricks/listviews/quest.tpl +++ b/template/bricks/listviews/quest.tpl @@ -1,3 +1,16 @@ +{if !empty($tab.showRep)} +var _ = [ + {ldelim} + id: 'reputation', + after: 'rewards', + name: LANG.rep, + tooltip: LANG.tooltip_repgain, + width: '8%', + value: 'reputation' + {rdelim} +]; +{/if} + {strip} new Listview({ldelim} template:'quest', @@ -14,62 +27,12 @@ data:[ {foreach name=i from=$data item=curr} {ldelim} - id:'{$curr.id}', - name:'{$curr.name|escape:"quotes"}', - level:'{$curr.level}', - {if isset($curr.reqlevel)} - reqlevel:{$curr.reqlevel}, - {/if} - {if isset($curr.reqclass)} - reqclass:{$curr.reqclass}, - {/if} - {if isset($curr.reqrace)} - reqrace:{$curr.reqrace}, - {/if} - side:'{$curr.side}' - {if isset($curr.itemrewards)} - ,itemrewards:[ - {section name=j loop=$curr.itemrewards} - [{$curr.itemrewards[j][0]},{$curr.itemrewards[j][1]}] - {if $smarty.section.j.last}{else},{/if} - {/section} - ] - {/if} - {if isset($curr.itemchoices)} - ,itemchoices:[ - {section name=j loop=$curr.itemchoices} - [{$curr.itemchoices[j][0]},{$curr.itemchoices[j][1]}] - {if $smarty.section.j.last}{else},{/if} - {/section} - ] - {/if} - {if $curr.xp} - ,xp:{$curr.xp} - {/if} - {if isset($curr.titlereward)} - ,titlereward:{$curr.titlereward} - {/if} - {if isset($curr.money)} - ,money:{$curr.money} - {/if} - {if isset($curr.category)} - ,category:{$curr.category} - {/if} - {if isset($curr.category2)} - ,category2:{$curr.category2} - {/if} - {if isset($curr.type)} - ,type:{$curr.type} - {/if} - {if isset($curr.daily)} - ,daily:1 - {/if} - {if isset($curr.weekly)} - ,weekly:1 - {/if} - {if $curr.wflags} - ,wflags:{$curr.wflags} {* wflags: &1: disabled/historical; &32: AutoAccept; &64: Hostile(?) *} - {/if} + {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/tooltip.tpl b/template/bricks/tooltip.tpl new file mode 100644 index 00000000..b272af67 --- /dev/null +++ b/template/bricks/tooltip.tpl @@ -0,0 +1,28 @@ +
+ + + + + +{if !empty($jsGlobals[6][2].buff)} {* not set with items *} +