Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/definitions/liquipedia_db.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ local lpdb = {}
---@field placement string
---@field prizemoney number
---@field individualprizemoney number
---@field playershare number
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this file is just for the vscode extensions
you can not actually add lpdb fields
you will have to push it into extradata

---@field prizepoolindex integer
---@field weight number
---@field mode string
Expand Down
1 change: 1 addition & 0 deletions lua/wikis/commons/Mock/Lpdb.lua
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ dbStructure.placement = {
placement = 'number|string|nil',
prizemoney = 'number?',
individualprizemoney = 'number?',
playershare = 'number?',
prizepoolindex = 'number?',
weight = 'number?',
mode = 'string?',
Expand Down
5 changes: 4 additions & 1 deletion lua/wikis/commons/PrizePool/Award/Placement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local _tbd_index = 0

local PRIZE_TYPE_BASE_CURRENCY = 'BASE_CURRENCY'
local PRIZE_TYPE_POINTS = 'POINTS'
local PRIZE_TYPE_PLAYER_SHARE = 'PLAYER_SHARE'

--- An AwardPlacement is a set of opponents who all share the same award in the tournament.
--- Its input is generally a table created by `Template:Slot`.
Expand Down Expand Up @@ -75,10 +76,12 @@ function AwardPlacement:_getLpdbData(...)
local prizeMoney = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_BASE_CURRENCY .. 1)) or 0
local pointsReward = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 1)
local pointsReward2 = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 2)
local playerShare = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_PLAYER_SHARE .. 1))
local lpdbData = {
date = opponent.date,
prizemoney = prizeMoney,
individualprizemoney = Opponent.typeIsParty(opponentType) and (prizeMoney / Opponent.partySize(opponentType)) or 0,
individualprizemoney = Opponent.typeIsParty(opponentType) and ((playerShare or prizeMoney) / Opponent.partySize(opponentType)) or 0,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need playershare for non teams?
i would think for those cases it is just always 100%

playerShare = not Opponent.typeIsParty(opponentType) and playerShare or nil,
mode = 'award_individual',
weight = 0,
extradata = {
Expand Down
25 changes: 25 additions & 0 deletions lua/wikis/commons/PrizePool/Base.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ local PRIZE_TYPE_QUALIFIES = 'QUALIFIES'
local PRIZE_TYPE_POINTS = 'POINTS'
local PRIZE_TYPE_PERCENTAGE = 'PERCENT'
local PRIZE_TYPE_FREETEXT = 'FREETEXT'
local PRIZE_TYPE_PLAYER_SHARE = 'PLAYER_SHARE'

BasePrizePool.config = {
showBaseCurrency = {
Expand Down Expand Up @@ -357,6 +358,30 @@ BasePrizePool.prizeTypes = {
end
end,
},
[PRIZE_TYPE_PLAYER_SHARE] = {
sortOrder = 55,

header = 'playershare',
headerParse = function (prizePool, input, context, index)
return {title = 'Player Share'}
end,
headerDisplay = function (data)
return TableCell{children = {data.title}}
end,

row = 'playershare',
rowParse = function (placement, input, context, index)
return BasePrizePool._parseInteger(input)
end,
rowDisplay = function (headerData, data)
if data > 0 then
return TableCell{children = {
Currency.display(BASE_CURRENCY, data,
{formatValue = true, formatPrecision = headerData.roundPrecision, displayCurrencyCode = false})
}}
end
end,
},
[PRIZE_TYPE_FREETEXT] = {
sortOrder = 60,

Expand Down
3 changes: 3 additions & 0 deletions lua/wikis/commons/PrizePool/Placement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ local DASH = '-'
local PRIZE_TYPE_BASE_CURRENCY = 'BASE_CURRENCY'
local PRIZE_TYPE_POINTS = 'POINTS'
local PRIZE_TYPE_QUALIFIES = 'QUALIFIES'
local PRIZE_TYPE_PLAYER_SHARE = 'PLAYER_SHARE'

-- Allowed none-numeric score values.
local SPECIAL_SCORES = {'W', 'FF' , 'L', 'DQ', 'D'}
Expand Down Expand Up @@ -235,6 +236,7 @@ function Placement:_getLpdbData(...)
local pointsReward = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 1)
local pointsReward2 = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_POINTS .. 2)
local isQualified = self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_QUALIFIES .. '1')
local playerShare = tonumber(self:getPrizeRewardForOpponent(opponent, PRIZE_TYPE_PLAYER_SHARE .. 1)) or 0
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why or 0?


local lpdbData = {
image = image,
Expand Down Expand Up @@ -262,6 +264,7 @@ function Placement:_getLpdbData(...)
participantteam = (opponentType == Opponent.solo and players.p1team)
and Opponent.toName{template = players.p1team, type = 'team', extradata = {}}
or nil,
playershare = playerShare and tostring(playerShare) or nil,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
playershare = playerShare and tostring(playerShare) or nil,
playershare = playerShare

},
qualified = isQualified and 1 or 0
-- TODO: We need to create additional LPDB Fields
Expand Down
7 changes: 7 additions & 0 deletions lua/wikis/commons/TeamParticipants/Repository.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ function TeamParticipantsRepository.save(participant)
lpdbData.individualprizemoney = lpdbData.prizemoney / numberOfPlayersOnTeam
end

-- Calculate individual playerShare
if lpdbData.playershare then
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you stored it into extradata

if activeOpponent.type ~= Opponent.team then
lpdbData.individualprizemoney = lpdbData.playershare
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too extradata

end
end

mw.ext.LiquipediaDB.lpdb_placement(lpdbData.objectName, Json.stringifySubTables(lpdbData))
end

Expand Down
3 changes: 3 additions & 0 deletions lua/wikis/counterstrike/Infobox/League/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@ local VALVE_TIERS = {
['tier 1 qualifier'] = {meta = 'Valve Tier 1 qualifier', name = 'Tier 1 Qualifier', link = 'Valve Tier 1 Events'},
['tier 2'] = {meta = 'Valve Tier 2 event', name = 'Tier 2', link = 'Valve Tier 2 Events'},
['tier 2 qualifier'] = {meta = 'Valve Tier 2 qualifier', name = 'Tier 2 Qualifier', link = 'Valve Tier 2 Events'},
['tier 2 open sign ups'] = {meta = 'Valve Tier 2 open sign-up', name = 'Tier 2 Open Sign-up', link = 'Valve Tier 2 Events'},
['wildcard'] = {meta = 'Valve Wildcard event', name = 'Wildcard', link = 'Valve Wildcard Events'},
['tier 1 wildcard'] = {meta = 'Valve Tier 1 Wildcard event', name = 'Tier 1 Wildcard', link = 'Valve Wildcard Events'},
['tier 2 wildcard'] = {meta = 'Valve Tier 2 Wildcard event', name = 'Tier 2 Wildcard', link = 'Valve Wildcard Events'},
}

local RESTRICTIONS = {
Expand Down
19 changes: 17 additions & 2 deletions lua/wikis/counterstrike/MainPageLayout/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ local FilterButtonsWidget = Lua.import('Module:Widget/FilterButtons')
local ThisDayWidgets = Lua.import('Module:Widget/MainPage/ThisDay')
local TransfersList = Lua.import('Module:Widget/MainPage/TransfersList')
local WantToHelp = Lua.import('Module:Widget/MainPage/WantToHelp')
local VRSStandings = Lua.import('Module:Widget/VRSStandings')


local CONTENT = {
Expand Down Expand Up @@ -74,6 +75,16 @@ local CONTENT = {
padding = true,
boxid = MainPageLayoutUtil.BoxId.TOURNAMENTS_TICKER,
},
vrsStandings = {
heading = 'Valve Regional Standings',
body = VRSStandings{
shouldFetch = 1,
fetchLimit = 5,
mainpage = 1,
},
padding = false,
boxid = 1521,
}
}

return {
Expand Down Expand Up @@ -151,13 +162,17 @@ return {
mobileOrder = 1,
content = CONTENT.specialEvents,
},
{
mobileOrder = 3,
content = CONTENT.vrsStandings,
},
{
mobileOrder = 4,
content = CONTENT.thisDay,
content = CONTENT.transfers,
},
{
mobileOrder = 5,
content = CONTENT.transfers,
content = CONTENT.thisDay,
},
{
mobileOrder = 7,
Expand Down
Loading
Loading