Skip to content

Commit

Permalink
chore(publishertier): clean up some publisher tier stuff in customs
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpalpha committed Oct 19, 2024
1 parent cf34b77 commit 2d1cec0
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 94 deletions.
10 changes: 2 additions & 8 deletions components/infobox/wikis/brawlstars/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 2 additions & 8 deletions components/infobox/wikis/clashofclans/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 1 addition & 7 deletions components/infobox/wikis/crossfire/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
8 changes: 1 addition & 7 deletions components/infobox/wikis/fortnite/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 1 addition & 7 deletions components/infobox/wikis/halo/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
8 changes: 1 addition & 7 deletions components/infobox/wikis/pokemon/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 '')]
Expand Down
8 changes: 1 addition & 7 deletions components/infobox/wikis/pubg/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
8 changes: 1 addition & 7 deletions components/infobox/wikis/stormgate/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
8 changes: 1 addition & 7 deletions components/infobox/wikis/wildrift/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 2d1cec0

Please sign in to comment.