From 3a25c2390f8c93b15a05515b92f00e75553e1f22 Mon Sep 17 00:00:00 2001 From: Sarjuuk Date: Sun, 26 Oct 2025 17:24:27 +0100 Subject: [PATCH] Listviews/AddIns * AddIns must be output directly before the listview it is used by --- .../components/frontend/listview.class.php | 5 +-- includes/game/loot.class.php | 35 ++++++++++++++++++ template/bricks/lvTabs.tpl.php | 18 +++++----- template/listviews/itemStandingCol.tpl | 36 ------------------- 4 files changed, 47 insertions(+), 47 deletions(-) diff --git a/includes/components/frontend/listview.class.php b/includes/components/frontend/listview.class.php index 9520d306..f9913354 100644 --- a/includes/components/frontend/listview.class.php +++ b/includes/components/frontend/listview.class.php @@ -164,10 +164,11 @@ class Listview implements \JsonSerializable public function __toString() : string { + $addIn = ''; if ($this->__addIn) - include($this->__addIn); + $addIn = file_get_contents($this->__addIn).PHP_EOL; - return "new Listview(".Util::toJSON($this).");\n"; + return $addIn.'new Listview('.Util::toJSON($this).');'.PHP_EOL; } } diff --git a/includes/game/loot.class.php b/includes/game/loot.class.php index 1102fd24..56acb2e0 100644 --- a/includes/game/loot.class.php +++ b/includes/game/loot.class.php @@ -19,6 +19,41 @@ if (!defined('AOWOW_REVISION')) quest_mail_loot_template entry quest_template RewMailTemplateId reference_loot_template entry many <- many *_loot_template reference */ +/* 4.3 loot-example + + template: 'item', + id: 'drops', + name: LANG.tab_drops, + tabs: tabsRelated, + parent: 'lkljbjkb574', + extraCols: [Listview.extraCols.count, Listview.extraCols.percent], + sort:['-percent', 'name'], + _totalCount: 448092, // total # creature killed/looted + computeDataFunc: Listview.funcBox.initLootTable, + onAfterCreate: Listview.funcBox.addModeIndicator, + data: [ + { + "classs":15, // Tab Type + "commondrop":true, // loot filtered as "not noteworthy" + "id":25445, + "level":1, + "name":"7Wretched Ichor", + "slot":0, + "source":[2], + "sourcemore":[{"z":3520}], + "subclass":0, // Tab:Type + modes:{ + "mode":4, // &1: heroic; &4: noteworthy(?); &8: reg10; &16: reg25; &32: hc10; &64: hc25; &128: RaidFinder + "4":{"count":363318,"outof":448092} // calculate pct chance + }, + count:363318, + stack:[1,1], + pctstack:'{1: 50.0123, 2: 49.9877}' + } + ] + }); +*/ + class Loot { diff --git a/template/bricks/lvTabs.tpl.php b/template/bricks/lvTabs.tpl.php index f336fe6c..8ed8e9bd 100644 --- a/template/bricks/lvTabs.tpl.php +++ b/template/bricks/lvTabs.tpl.php @@ -14,7 +14,7 @@ if (($this->lvTabs && count($this->lvTabs)) || $this->charactersLvData || $this-
lvTabs?->getDataContainer() ?? [] as $container): - echo ' '.$container."\n"; + echo ' '.$container.PHP_EOL; endforeach; ?>
@@ -23,31 +23,31 @@ if (($this->lvTabs && count($this->lvTabs)) || $this->charactersLvData || $this- // seems like WH keeps their modules separated, as fi_gemScores should be with the other fi_ items but are here instead and originally the dbtype globals used by the listviews were also here) // May 2025: WH no longer calculates gems into item scores. Dude .. why? if ($this->gemScores) // set by ItemsBaseResponse - echo ' var fi_gemScores = '.$this->json($this->gemScores).";\n"; + echo ' var fi_gemScores = '.$this->json($this->gemScores).';'.PHP_EOL; // g_items, g_spells, etc required by the listviews used to be here echo $this->lvTabs; if ($this->charactersLvData): - echo ' us_addCharactersTab('.$this->json('charactersLvData').");\n"; + echo ' us_addCharactersTab('.$this->json('charactersLvData').');'.PHP_EOL; endif; if ($this->profilesLvData): - echo ' us_addProfilesTab('.$this->json('profilesLvData').");\n"; + echo ' us_addProfilesTab('.$this->json('profilesLvData').');'.PHP_EOL; endif; if ($this->contribute & CONTRIBUTE_CO): - echo " new Listview({template: 'comment', id: 'comments', name: LANG.tab_comments".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_comments});\n"; + echo " new Listview({template: 'comment', id: 'comments', name: LANG.tab_comments".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_comments});".PHP_EOL; endif; if ($this->contribute & CONTRIBUTE_SS): - echo " new Listview({template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_screenshots});\n"; + echo " new Listview({template: 'screenshot', id: 'screenshots', name: LANG.tab_screenshots".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_screenshots});".PHP_EOL; endif; if ($this->contribute & CONTRIBUTE_VI): - echo " if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))\n"; - echo " new Listview({template: 'video', id: 'videos', name: LANG.tab_videos".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_videos});\n"; + echo " if (lv_videos.length || (g_user && g_user.roles & (U_GROUP_ADMIN | U_GROUP_BUREAU | U_GROUP_VIDEO)))".PHP_EOL; + echo " new Listview({template: 'video', id: 'videos', name: LANG.tab_videos".($this->lvTabs ? ", tabs: ".$this->lvTabs->__tabVar : '').", parent: 'lv-generic', data: lv_videos});".PHP_EOL; endif; if ($flushTabs = $this->lvTabs?->getFlush()): - echo " ".$flushTabs."\n"; + echo " ".$flushTabs.PHP_EOL; endif; ?> //]]> diff --git a/template/listviews/itemStandingCol.tpl b/template/listviews/itemStandingCol.tpl index 2b6440f6..86114660 100644 --- a/template/listviews/itemStandingCol.tpl +++ b/template/listviews/itemStandingCol.tpl @@ -16,39 +16,3 @@ var _ = [ } } ]; -