Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
1a97c2c
Add fetchPowerRanking function for team power rankings
Mehdi9120310391 Jun 9, 2026
b9efab2
Add power ranking fetching functionality to Custom.lua
Mehdi9120310391 Jun 9, 2026
c5cf87d
Update lua/wikis/fortnite/Infobox/Team/Custom.lua
Mehdi9120310391 Jun 9, 2026
cfad681
Update lua/wikis/fortnite/Infobox/Person/Player/Custom.lua
Mehdi9120310391 Jun 9, 2026
7531cd2
Update lua/wikis/fortnite/Infobox/Person/Player/Custom.lua
Mehdi9120310391 Jun 9, 2026
80faf8e
Update lua/wikis/fortnite/Infobox/Person/Player/Custom.lua
Mehdi9120310391 Jun 9, 2026
612d1f1
Refactor fetchPowerRanking function and imports
Mehdi9120310391 Jun 9, 2026
b11e795
Refactor power ranking link in Custom.lua
Mehdi9120310391 Jun 9, 2026
3ccf9bf
Add PowerRankings module for Fortnite
Mehdi9120310391 Jun 9, 2026
4be4212
Add Lua module for Fortnite organization power rankings
Mehdi9120310391 Jun 9, 2026
ad6d5fd
Update PowerRankings.lua
Mehdi9120310391 Jun 9, 2026
b87d42f
Update Orgs.lua
Mehdi9120310391 Jun 9, 2026
05eb714
Update Orgs.lua
Mehdi9120310391 Jun 9, 2026
05e400d
Update Custom.lua
Mehdi9120310391 Jun 9, 2026
8c9144e
Update PowerRankings.lua
Mehdi9120310391 Jun 10, 2026
b6a93b2
Update Orgs.lua
Mehdi9120310391 Jun 10, 2026
6fd34f0
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 10, 2026
c6c5682
Update Orgs.lua
Mehdi9120310391 Jun 11, 2026
cb220f7
Update PowerRankings.lua
Mehdi9120310391 Jun 11, 2026
43fc5be
Update PowerRankings.lua
Mehdi9120310391 Jun 11, 2026
f4091bd
Update Orgs.lua
Mehdi9120310391 Jun 11, 2026
92979cb
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 11, 2026
ad3f911
Update Orgs.lua
Mehdi9120310391 Jun 11, 2026
fd753d8
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 12, 2026
dc963ea
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 12, 2026
f4b0ffd
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 12, 2026
ca33e7a
Update Orgs.lua
Mehdi9120310391 Jun 17, 2026
f0bb9e5
Update lua/wikis/fortnite/PowerRankings/Orgs.lua
hjpalpha Jun 18, 2026
6cacbbd
Apply suggestion from @hjpalpha
hjpalpha Jun 18, 2026
1a7d1a4
Update Custom.lua
Mehdi9120310391 Jun 18, 2026
83454ec
Update Custom.lua
Mehdi9120310391 Jun 18, 2026
4c7f8b8
Update PowerRankings.lua
Mehdi9120310391 Jun 18, 2026
80e46da
Update Orgs.lua
Mehdi9120310391 Jun 18, 2026
497a22f
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 18, 2026
c240bbd
Merge branch 'main' into patch-10
Mehdi9120310391 Jun 19, 2026
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
6 changes: 6 additions & 0 deletions lua/wikis/fortnite/Infobox/Person/Player/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ local PlayerAchievements = Lua.import('Module:Infobox/Extension/Achievements')

local Widgets = Lua.import('Module:Widget/All')
local Cell = Widgets.Cell
local Link = Lua.import('Module:Widget/Basic/Link')

local CURRENT_YEAR = tonumber(os.date('%Y'))
local PowerRankings = Lua.import('Module:PowerRankings')

local CustomPlayer = Class.new(Player)
local CustomInjector = Class.new(Injector)
Expand Down Expand Up @@ -64,6 +66,10 @@ function CustomInjector:parse(id, widgets)
},
children = {args.creatorcode}
},
Cell{
name = Link{link = 'Fortnite Power Rankings', children = 'Fortnite PR'},
children = PowerRankings.queryForInfobox(caller.pagename, 'FTN_PR'),
},
}
elseif id == 'region' then return {}
end
Expand Down
8 changes: 8 additions & 0 deletions lua/wikis/fortnite/Infobox/Team/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,18 @@ local Info = Lua.import('Module:Info', {loadData = true})
local Lpdb = Lua.import('Module:Lpdb')
local Math = Lua.import('Module:MathUtil')
local Namespace = Lua.import('Module:Namespace')
local Page = Lua.import('Module:Page')
local Table = Lua.import('Module:Table')

local Injector = Lua.import('Module:Widget/Injector')
local Team = Lua.import('Module:Infobox/Team')

local Opponent = Lua.import('Module:Opponent/Custom')
local PowerRankings = Lua.import('Module:PowerRankings')

local Widgets = Lua.import('Module:Widget/All')
local Cell = Widgets.Cell
local Link = Lua.import('Module:Widget/Basic/Link')

local Condition = Lua.import('Module:Condition')
local ConditionTree = Condition.Tree
Expand Down Expand Up @@ -61,6 +64,11 @@ function CustomInjector:parse(id, widgets)
name = PLAYER_EARNINGS_ABBREVIATION,
children = {playerEarnings ~= 0 and ('$' .. mw.getContentLanguage():formatNum(Math.round(playerEarnings))) or nil}
})
elseif id == 'custom' then
table.insert(widgets, Cell{
name = Link{link = 'Fortnite Power Rankings/Organizations', children = 'Fortnite Org PR'},
children = PowerRankings.queryForInfobox(Page.pageifyLink(self.caller.pagename), 'FTN_ORG_PR'),
})
end

return widgets
Expand Down
178 changes: 178 additions & 0 deletions lua/wikis/fortnite/PowerRankings.lua
Comment thread
Mehdi9120310391 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
---
-- @Liquipedia
-- page=Module:PowerRankings
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Lua = require('Module:Lua')

local Arguments = Lua.import('Module:Arguments')
local Array = Lua.import('Module:Array')
local Currency = Lua.import('Module:Currency')
local DateExt = Lua.import('Module:Date/Ext')
local Icon = Lua.import('Module:Icon')
local Logic = Lua.import('Module:Logic')
local Lpdb = Lua.import('Module:Lpdb')
local Opponent = Lua.import('Module:Opponent/Custom')
local OpponentDisplay = Lua.import('Module:OpponentDisplay/Custom')
local PlayerDisplay = Lua.import('Module:Player/Display/Custom')
local PlayerExt = Lua.import('Module:Player/Ext/Custom')
local PowerRankingsData = Lua.import('Module:PowerRankings/Data', {loadData = true})

local Condition = Lua.import('Module:Condition')
local ConditionTree = Condition.Tree
local ConditionNode = Condition.Node
local Comparator = Condition.Comparator
local BooleanOperator = Condition.BooleanOperator
local ColumnName = Condition.ColumnName

local HtmlWidgets = Lua.import('Module:Widget/Html')
local Link = Lua.import('Module:Widget/Basic/Link')
local TableWidgets = Lua.import('Module:Widget/Table2/All')
local WidgetUtil = Lua.import('Module:Widget/Util')

local PLAYER_DATAPOINT_TYPE = 'FTN_PR'

local PowerRankings = {}

---@param updated string?
---@return Renderable
local function buildTitle(updated)
return HtmlWidgets.Div{
classes = {'ranking-table__top-row'},
children = {
HtmlWidgets.Div{
children = WidgetUtil.collect(
HtmlWidgets.B{children = 'Fortnite Power Rankings'},
Logic.isNotEmpty(updated) and HtmlWidgets.Span{children = {'Last updated: ', updated}} or nil
),
classes = {'ranking-table__top-row-text'},
},
HtmlWidgets.Div{
children = {HtmlWidgets.Span{children = 'Data by Epic Games'}},
classes = {'ranking-table__top-row-logo-container'},
},
},
}
end
Comment thread
Mehdi9120310391 marked this conversation as resolved.

---@return Renderable
local function buildFooter()
Comment thread
Mehdi9120310391 marked this conversation as resolved.
return Link{
link = 'Fortnite Power Rankings',
linktype = 'internal',
children = {
HtmlWidgets.Div{
children = {'See Rankings Page', Icon.makeIcon{iconName = 'goto'}},
classes = {'ranking-table__footer-button'},
},
},
}
end

---@param frame Frame
---@return VNode
function PowerRankings.main(frame)
local args = Arguments.getArgs(frame)
local limit = tonumber(args.limit)
local showMore = Logic.readBool(args.showMore)

local players = PowerRankingsData.players or {}
if limit then
players = Array.sub(players, 1, limit)
end

local updated, updatedIso
if Logic.isNotEmpty(PowerRankingsData.updated) then
updated = PowerRankingsData.updated .. ' ' .. DateExt.defaultTimezone
updatedIso = DateExt.toYmdInUtc(PowerRankingsData.updated)
end

local rows = Array.map(players, function(entry)
local player = {
displayName = entry.name,
pageName = Logic.nilIfEmpty(entry.link) or entry.name,
}
PlayerExt.syncPlayer(player)
local teamTemplate = PlayerExt.syncTeam(player.pageName, nil, {date = updatedIso})

PowerRankings._store(player, entry)

return TableWidgets.Row{children = {
TableWidgets.Cell{children = HtmlWidgets.B{children = entry.rank}},
TableWidgets.Cell{children = HtmlWidgets.B{children = Currency.formatMoney(entry.points, 0)}},
TableWidgets.Cell{children = PlayerDisplay.BlockPlayer{player = player}},
TableWidgets.Cell{children = teamTemplate and OpponentDisplay.BlockOpponent{opponent = {
type = Opponent.team,
template = teamTemplate,
extradata = {},
}} or nil},
}}
end)

return TableWidgets.Table{
title = buildTitle(updated),
sortable = false,
columns = {
{align = 'center', sortType = 'number'},
{align = 'center', sortType = 'number'},
{align = 'left'},
{align = 'left'},
},
footer = showMore and buildFooter() or nil,
css = {width = '100%'},
children = {
TableWidgets.TableHeader{children = {
TableWidgets.Row{children = {
TableWidgets.CellHeader{children = 'Rank'},
TableWidgets.CellHeader{children = 'Points'},
TableWidgets.CellHeader{children = 'Player'},
TableWidgets.CellHeader{children = 'Organization'},
}},
}},
TableWidgets.TableBody{children = rows},
},
}
end

---@param player standardPlayer
---@param entry {rank: integer, points: number}
function PowerRankings._store(player, entry)
if Lpdb.isStorageDisabled() then return end
mw.ext.LiquipediaDB.lpdb_datapoint(PLAYER_DATAPOINT_TYPE .. '_' .. player.pageName, {
type = PLAYER_DATAPOINT_TYPE,
name = player.pageName,
information = entry.rank,
extradata = {score = entry.points},
})
end

---@param pageName string
---@param datapointType string
---@return string?
function PowerRankings.queryForInfobox(pageName, datapointType)
local conditions = ConditionTree(BooleanOperator.all):add{
ConditionNode(ColumnName('type'), Comparator.eq, datapointType),
ConditionNode(ColumnName('name'), Comparator.eq, pageName),
}

local data = mw.ext.LiquipediaDB.lpdb('datapoint', {
limit = 1,
order = 'date DESC',
conditions = tostring(conditions),
query = 'information, extradata',
})[1]

if not data then return end

local points = data.extradata.score
local rank = data.information
if not points or not rank then return end

points = Currency.formatMoney(points, datapointType == PLAYER_DATAPOINT_TYPE and 0 or 1)

return points .. ' (Rank #' .. rank .. ')'
end

return PowerRankings
Loading
Loading