Skip to content

Commit

Permalink
doc(prize pool): annotate half of ppt customs (#4071)
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpalpha authored Mar 14, 2024
1 parent e0c01b2 commit f2c8b88
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ local IS_AWARD = true
local PRIZE_TYPE_POINTS = 'POINTS'

-- Template entry point
---@param frame Frame
---@return Html
function CustomAwardPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.localcurrency = args.localcurrency or Variables.varDefault('tournament_currency')
Expand All @@ -38,6 +40,10 @@ function CustomAwardPrizePool.run(frame)
return awardsPrizePool:build(IS_AWARD)
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.extradata.patch = Variables.varDefault('tournament_patch')

Expand Down
11 changes: 11 additions & 0 deletions components/prize_pool/wikis/ageofempires/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ local QUALIFIER = 'Qualifier'
local TIER_VALUE = {10, 6, 4, 2}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.syncPlayers = true
Expand All @@ -43,6 +45,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand Down Expand Up @@ -88,6 +94,11 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
return lpdbData
end

---@param prizeMoney number
---@param tier string?
---@param place integer
---@param type string?
---@return integer
function CustomPrizePool.calculateWeight(prizeMoney, tier, place, type)
if Logic.isEmpty(tier) then
return 0
Expand Down
6 changes: 6 additions & 0 deletions components/prize_pool/wikis/apexlegends/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ local CustomPrizePool = {}


-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
local prizePool = PrizePool(args):create()
Expand All @@ -30,6 +32,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = Weight.calc(
lpdbData.prizemoney,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ local Lua = require('Module:Lua')
local PrizePoolLegacy = Lua.import('Module:PrizePool/Legacy')

local CustomLegacyPrizePool = {}
-- Template entry point

-- Template entry point
---@return Html
function CustomLegacyPrizePool.run()
return PrizePoolLegacy.run(CustomLegacyPrizePool)
end

---@param newArgs table
---@param data table
---@param header table
---@return table
function CustomLegacyPrizePool.customHeader(newArgs, data, header)
if Logic.readBool(header.seed) then
PrizePoolLegacy.assignType(newArgs, 'seed', 'seed')
Expand Down
10 changes: 10 additions & 0 deletions components/prize_pool/wikis/arenaofvalor/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ local CustomPrizePool = {}
local TIER_VALUE = {8, 4, 3, 2}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
local prizePool = PrizePool(args):create()
Expand All @@ -31,6 +33,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand All @@ -46,6 +52,10 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
return lpdbData
end

---@param prizeMoney number
---@param tier string?
---@param place integer
---@return integer
function CustomPrizePool.calculateWeight(prizeMoney, tier, place)
if Logic.isEmpty(tier) then
return 0
Expand Down
6 changes: 6 additions & 0 deletions components/prize_pool/wikis/brawlstars/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ local TIER_VALUE = {16, 8, 4, 2, Monthly = 2}
local TYPE_MODIFIER = {offline = 1, ['offline/online'] = 0.75, ['online/offline'] = 0.75, default = 0.65}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)

Expand All @@ -48,6 +50,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ local IS_AWARD = true
local HEADER_DATA = {}

-- Template entry point
---@param frame Frame
---@return Html
function CustomAwardPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.localcurrency = args.localcurrency or Variables.varDefault('tournament_currency')
Expand All @@ -50,6 +52,10 @@ function CustomAwardPrizePool.run(frame)
return awardsPrizePool:build(IS_AWARD)
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.extradata.scorename = HEADER_DATA.resultName
lpdbData.tournament = HEADER_DATA.tournamentName or lpdbData.tournament
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ local TYPE_MODIFIER = {offline = 1, ['offline/online'] = 0.75, ['online/offline'
local HEADER_DATA = {}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)

Expand Down Expand Up @@ -62,6 +64,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
if not placement.specialStatuses.DQ.active(placement.args) then
lpdbData.weight = CustomPrizePool.calculateWeight(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ local PrizePoolLegacy = Lua.import('Module:PrizePool/Legacy')
local CustomLegacyPrizePool = {}

-- Template entry point
---@return Html
function CustomLegacyPrizePool.run()
return PrizePoolLegacy.run(CustomLegacyPrizePool)
end

---@param newArgs table
---@param CACHED_DATA table
---@param header table
---@return table
function CustomLegacyPrizePool.customHeader(newArgs, CACHED_DATA, header)
newArgs.qualifier = header.qualifier
newArgs['tournamentName'] = header['tournament name']
Expand All @@ -27,6 +32,10 @@ function CustomLegacyPrizePool.customHeader(newArgs, CACHED_DATA, header)
return newArgs
end

---@param newData table
---@param CACHED_DATA table
---@param slot table
---@return table
function CustomLegacyPrizePool.customSlot(newData, CACHED_DATA, slot)
-- Requested by CS so they can do cleanup of tables with incorrect data
if newData.localprize then
Expand All @@ -43,6 +52,11 @@ function CustomLegacyPrizePool.customSlot(newData, CACHED_DATA, slot)
return newData
end

---@param opponentData table
---@param CACHED_DATA table
---@param slot table
---@param opponentIndex integer
---@return table
function CustomLegacyPrizePool.customOpponent(opponentData, CACHED_DATA, slot, opponentIndex)
-- CS didn't support multiple points (etc), however they supported points (etc) per opponent

Expand All @@ -64,6 +78,9 @@ function CustomLegacyPrizePool.customOpponent(opponentData, CACHED_DATA, slot, o
return opponentData
end

---@param opponentData table
---@param param string
---@param value string
function CustomLegacyPrizePool._setOpponentReward(opponentData, param, value)
if param == 'seed' then
PrizePoolLegacy.handleSeed(opponentData, value, 1)
Expand Down
6 changes: 6 additions & 0 deletions components/prize_pool/wikis/dota2/prize_pool_award_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ local CustomAwardPrizePool = {}
local IS_AWARD = true

-- Template entry point
---@param frame Frame
---@return Html
function CustomAwardPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.localcurrency = args.localcurrency or Variables.varDefault('tournament_currency')
Expand All @@ -37,6 +39,10 @@ function CustomAwardPrizePool.run(frame)
return awardsPrizePool:build(IS_AWARD)
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.extradata.series2 = Variables.varDefault('tournament_series2', '')

Expand Down
10 changes: 10 additions & 0 deletions components/prize_pool/wikis/dota2/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ local CustomPrizePool = {}
local TIER_VALUE = {8, 4, 2}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
local prizePool = PrizePool(args):create()
Expand All @@ -31,6 +33,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand All @@ -54,6 +60,10 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
return lpdbData
end

---@param prizeMoney number
---@param tier string?
---@param place integer
---@return integer
function CustomPrizePool.calculateWeight(prizeMoney, tier, place)
if Logic.isEmpty(tier) then
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ local PrizePoolLegacy = Lua.import('Module:PrizePool/Legacy')
local CustomLegacyPrizePool = {}

-- Template entry point
---@return Html
function CustomLegacyPrizePool.run()
return PrizePoolLegacy.run(CustomLegacyPrizePool)
end

---@param newArgs table
---@param data table
---@param header table
---@return table
function CustomLegacyPrizePool.customHeader(newArgs, data, header)
newArgs.prizesummary = header.prizenote and true or newArgs.prizesummary

Expand Down
10 changes: 10 additions & 0 deletions components/prize_pool/wikis/formula1/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ local CustomPrizePool = {}
local TIER_VALUE = {8, 4, 2}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
local prizePool = PrizePool(args):create()
Expand All @@ -73,6 +75,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand All @@ -89,6 +95,10 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
return lpdbData
end

---@param prizeMoney number
---@param tier string?
---@param place integer
---@return integer
function CustomPrizePool.calculateWeight(prizeMoney, tier, place)
if Logic.isEmpty(tier) then
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ local CustomAwardPrizePool = {}
local IS_AWARD = true

-- Template entry point
---@param frame Frame
---@return Html
function CustomAwardPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.localcurrency = args.localcurrency or Variables.varDefault('tournament_currency')
Expand Down
10 changes: 10 additions & 0 deletions components/prize_pool/wikis/fortnite/prize_pool_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ local CustomPrizePool = {}
local TIER_VALUE = {8, 4, 2}

-- Template entry point
---@param frame Frame
---@return Html
function CustomPrizePool.run(frame)
local args = Arguments.getArgs(frame)
args.localcurrency = args.localcurrency or Variables.varDefault('tournament_currency')
Expand All @@ -32,6 +34,10 @@ function CustomPrizePool.run(frame)
return prizePool:build()
end

---@param lpdbData placement
---@param placement PrizePoolPlacement
---@param opponent BasePlacementOpponent
---@return placement
function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
lpdbData.weight = CustomPrizePool.calculateWeight(
lpdbData.prizemoney,
Expand All @@ -50,6 +56,10 @@ function CustomLpdbInjector:adjust(lpdbData, placement, opponent)
return lpdbData
end

---@param prizeMoney number
---@param tier string?
---@param place integer
---@return integer
function CustomPrizePool.calculateWeight(prizeMoney, tier, place)
if Logic.isEmpty(tier) then
return 0
Expand Down
Loading

0 comments on commit f2c8b88

Please sign in to comment.