From 2d1cec0892ed53fcecef109d80038a62c547688f Mon Sep 17 00:00:00 2001 From: hjpalpha Date: Sat, 19 Oct 2024 19:26:27 +0200 Subject: [PATCH] chore(publishertier): clean up some publisher tier stuff in customs --- .../infobox/wikis/brawlstars/infobox_league_custom.lua | 10 ++-------- .../infobox/wikis/callofduty/infobox_league_custom.lua | 2 +- .../wikis/clashofclans/infobox_league_custom.lua | 10 ++-------- .../infobox/wikis/crossfire/infobox_league_custom.lua | 8 +------- .../infobox/wikis/fortnite/infobox_league_custom.lua | 8 +------- .../infobox/wikis/halo/infobox_league_custom.lua | 8 +------- .../wikis/mobilelegends/infobox_league_custom.lua | 8 +------- .../infobox/wikis/pokemon/infobox_league_custom.lua | 8 +------- .../infobox/wikis/pubg/infobox_league_custom.lua | 8 +------- .../infobox/wikis/pubgmobile/infobox_league_custom.lua | 8 +------- .../wikis/rocketleague/infobox_league_custom.lua | 8 +------- .../infobox/wikis/starcraft2/infobox_league_custom.lua | 8 +------- .../infobox/wikis/stormgate/infobox_league_custom.lua | 8 +------- .../infobox/wikis/wildrift/infobox_league_custom.lua | 8 +------- 14 files changed, 16 insertions(+), 94 deletions(-) diff --git a/components/infobox/wikis/brawlstars/infobox_league_custom.lua b/components/infobox/wikis/brawlstars/infobox_league_custom.lua index a091d053e76..7b299fdca88 100644 --- a/components/infobox/wikis/brawlstars/infobox_league_custom.lua +++ b/components/infobox/wikis/brawlstars/infobox_league_custom.lua @@ -63,21 +63,15 @@ function CustomInjector:parse(id, widgets) return widgets end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args['supercell-sponsored']) -end - ---@param args table ---@return string function CustomLeague:appendLiquipediatierDisplay(args) - return Logic.readBool(args['supercell-sponsored']) and (' ' .. SUPERCELL_SPONSORED_ICON) or '' + return self.data.publishertier and (' ' .. SUPERCELL_SPONSORED_ICON) or '' end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args['supercell-sponsored'] + self.data.publishertier = Logic.readBool(args['supercell-sponsored']) end ---@param args table diff --git a/components/infobox/wikis/callofduty/infobox_league_custom.lua b/components/infobox/wikis/callofduty/infobox_league_custom.lua index 463e1a96904..d2821957652 100644 --- a/components/infobox/wikis/callofduty/infobox_league_custom.lua +++ b/components/infobox/wikis/callofduty/infobox_league_custom.lua @@ -74,7 +74,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args['atvi-sponsored'] + self.data.publishertier = Logic.readBool(args['atvi-sponsored']) self.data.mode = args.player_number and 'solo' or self.data.mode end diff --git a/components/infobox/wikis/clashofclans/infobox_league_custom.lua b/components/infobox/wikis/clashofclans/infobox_league_custom.lua index aa09e06f0b8..4329c8cd0dd 100644 --- a/components/infobox/wikis/clashofclans/infobox_league_custom.lua +++ b/components/infobox/wikis/clashofclans/infobox_league_custom.lua @@ -46,21 +46,15 @@ function CustomInjector:parse(id, widgets) return widgets end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args['supercell-sponsored']) -end - ---@param args table ---@return string function CustomLeague:appendLiquipediatierDisplay(args) - return Logic.readBool(args['supercell-sponsored']) and (' ' .. SUPERCELL_SPONSORED_ICON) or '' + return self.data.publishertier and (' ' .. SUPERCELL_SPONSORED_ICON) or '' end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = Logic.readBool(args['supercell-sponsored']) and 'true' or nil + self.data.publishertier = Logic.readBool(args['supercell-sponsored']) end return CustomLeague diff --git a/components/infobox/wikis/crossfire/infobox_league_custom.lua b/components/infobox/wikis/crossfire/infobox_league_custom.lua index ecf28d1c9c0..2cd3c6d0f0f 100644 --- a/components/infobox/wikis/crossfire/infobox_league_custom.lua +++ b/components/infobox/wikis/crossfire/infobox_league_custom.lua @@ -60,12 +60,6 @@ function CustomInjector:parse(id, widgets) return widgets end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.cfpremier) -end - ---@param lpdbData table ---@param args table ---@return table @@ -77,7 +71,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args.cfpremier + self.data.publishertier = Logic.readBool(args.cfpremier) end ---@param args table diff --git a/components/infobox/wikis/fortnite/infobox_league_custom.lua b/components/infobox/wikis/fortnite/infobox_league_custom.lua index cce77203a22..88604c72aa2 100644 --- a/components/infobox/wikis/fortnite/infobox_league_custom.lua +++ b/components/infobox/wikis/fortnite/infobox_league_custom.lua @@ -49,7 +49,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args.epicpremier + self.data.publishertier = Logic.readBool(args.epicpremier) end ---@param args table @@ -58,10 +58,4 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_edate', self.data.endDate) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.epicpremier) -end - return CustomLeague diff --git a/components/infobox/wikis/halo/infobox_league_custom.lua b/components/infobox/wikis/halo/infobox_league_custom.lua index e8a60a58b14..d472d9ec2b1 100644 --- a/components/infobox/wikis/halo/infobox_league_custom.lua +++ b/components/infobox/wikis/halo/infobox_league_custom.lua @@ -102,7 +102,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) self.data.mode = args.player_number and 'solo' or self.data.mode - self.data.publishertier = args['hcs-sponsored'] + self.data.publishertier = Logic.readBool(args['hcs-sponsored']) end ---@param args table @@ -113,12 +113,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_tiertype', args.liquipediatiertype) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args['hcs-sponsored']) -end - ---@return string[] function CustomLeague:_makeMapList() local date = self.data.endDate or self.data.startDate or os.date('%Y-%m-%d') --[[@as string]] diff --git a/components/infobox/wikis/mobilelegends/infobox_league_custom.lua b/components/infobox/wikis/mobilelegends/infobox_league_custom.lua index 05789a46617..6c9b429f8a6 100644 --- a/components/infobox/wikis/mobilelegends/infobox_league_custom.lua +++ b/components/infobox/wikis/mobilelegends/infobox_league_custom.lua @@ -60,7 +60,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = Logic.readBool(args['moonton-sponsored']) and 'true' or nil + self.data.publishertier = Logic.readBool(args['moonton-sponsored']) end ---@param args table @@ -73,12 +73,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_edate', self.data.endDate) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args['moonton-sponsored']) -end - ---@param args table ---@return string? function CustomLeague._getPatchVersion(args) diff --git a/components/infobox/wikis/pokemon/infobox_league_custom.lua b/components/infobox/wikis/pokemon/infobox_league_custom.lua index b81497407a8..cc747aae1d2 100644 --- a/components/infobox/wikis/pokemon/infobox_league_custom.lua +++ b/components/infobox/wikis/pokemon/infobox_league_custom.lua @@ -73,7 +73,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args.pokemonpremier + self.data.publishertier = Logic.readBool(args.pokemonpremier) self.data.mode = self:_getGameMode() end @@ -84,12 +84,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_edate', self.data.endDate) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.pokemonpremier) -end - ---@return string? function CustomLeague:_getGameMode() return MODES[string.lower(self.args.mode or '')] diff --git a/components/infobox/wikis/pubg/infobox_league_custom.lua b/components/infobox/wikis/pubg/infobox_league_custom.lua index a0b84234c01..12327d0028d 100644 --- a/components/infobox/wikis/pubg/infobox_league_custom.lua +++ b/components/infobox/wikis/pubg/infobox_league_custom.lua @@ -113,7 +113,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args.pubgpremier + self.data.publishertier = Logic.readBool(args.pubgpremier) end ---@param args table @@ -122,12 +122,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_edate', self.data.endDate) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.pubgpremier) -end - ---@param args table ---@return string? function CustomLeague:_getGameMode(args) diff --git a/components/infobox/wikis/pubgmobile/infobox_league_custom.lua b/components/infobox/wikis/pubgmobile/infobox_league_custom.lua index 131ac360206..524d062ae70 100644 --- a/components/infobox/wikis/pubgmobile/infobox_league_custom.lua +++ b/components/infobox/wikis/pubgmobile/infobox_league_custom.lua @@ -98,7 +98,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = args.pubgpremier + self.data.publishertier = Logic.readBool(args.pubgpremier) end ---@param args table @@ -107,12 +107,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_edate', self.data.endDate) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.pubgpremier) -end - ---@param args table ---@return string? function CustomLeague._getGameMode(args) diff --git a/components/infobox/wikis/rocketleague/infobox_league_custom.lua b/components/infobox/wikis/rocketleague/infobox_league_custom.lua index 42e0470e036..2c360f772a2 100644 --- a/components/infobox/wikis/rocketleague/infobox_league_custom.lua +++ b/components/infobox/wikis/rocketleague/infobox_league_custom.lua @@ -102,16 +102,10 @@ function CustomLeague:createLiquipediaTierDisplay(args) return tierDisplay .. self:appendLiquipediatierDisplay(args) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(self.data.publishertier) -end - ---@param args table function CustomLeague:customParseArguments(args) self.data.rlcsPremier = args.series == SERIES_RLCS and 1 or 0 - self.data.publishertier = tostring(args.series == SERIES_RLCS and tonumber(self.data.liquipediatier) == TIER_1) + self.data.publishertier = args.series == SERIES_RLCS and tonumber(self.data.liquipediatier) == TIER_1 end ---@param args table diff --git a/components/infobox/wikis/starcraft2/infobox_league_custom.lua b/components/infobox/wikis/starcraft2/infobox_league_custom.lua index 6c0ae89c95a..c654f1fe84b 100644 --- a/components/infobox/wikis/starcraft2/infobox_league_custom.lua +++ b/components/infobox/wikis/starcraft2/infobox_league_custom.lua @@ -66,7 +66,7 @@ function CustomLeague:customParseArguments(args) args.number = tonumber(args.number) self.data.mode = args.mode or DEFAULT_MODE self.data.game = (args.game or ''):lower() == GAME_MOD and GAME_MOD or self.data.game - self.data.publishertier = tostring(Logic.readBool(args.featured)) + self.data.publishertier = Logic.readBool(args.featured) self.data.status = self:_getStatus(args) self.data.startTime = Logic.wrapTryOrLog(CustomLeague._readStartTime)(self) @@ -411,10 +411,4 @@ function CustomLeague:getWikiCategories(args) return {betaPrefix .. Game.abbreviation{game = self.data.game} .. ' Competitions'} end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.featured) -end - return CustomLeague diff --git a/components/infobox/wikis/stormgate/infobox_league_custom.lua b/components/infobox/wikis/stormgate/infobox_league_custom.lua index 1e37583adf2..eebea02f375 100644 --- a/components/infobox/wikis/stormgate/infobox_league_custom.lua +++ b/components/infobox/wikis/stormgate/infobox_league_custom.lua @@ -49,7 +49,7 @@ function CustomLeague:customParseArguments(args) args.player_number = args.raceBreakDown.total args.maps = self:_getMaps(args) self.data.status = self:_getStatus(args) - self.data.publishertier = tostring(Logic.readBool(args.publishertier)) + self.data.publishertier = Logic.readBool(args.publishertier) self.data = PatchAuto.run(self.data, args) end @@ -190,10 +190,4 @@ function CustomLeague:_createNoWrappingSpan(content) :node(content) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.publishertier) -end - return CustomLeague diff --git a/components/infobox/wikis/wildrift/infobox_league_custom.lua b/components/infobox/wikis/wildrift/infobox_league_custom.lua index 50c8d58ae91..80f9bff5b6f 100644 --- a/components/infobox/wikis/wildrift/infobox_league_custom.lua +++ b/components/infobox/wikis/wildrift/infobox_league_custom.lua @@ -60,7 +60,7 @@ end ---@param args table function CustomLeague:customParseArguments(args) - self.data.publishertier = Logic.readBool(args.riotpremier) and 'true' or nil + self.data.publishertier = Logic.readBool(args.riotpremier) end ---@param args table @@ -74,12 +74,6 @@ function CustomLeague:defineCustomPageVariables(args) Variables.varDefine('tournament_riot_premier', args.riotpremier) end ----@param args table ----@return boolean -function CustomLeague:liquipediaTierHighlighted(args) - return Logic.readBool(args.riotpremier) -end - ---@return string? function CustomLeague:_getPatchVersion() if String.isEmpty(self.args.patch) then return nil end