-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathCustom.lua
More file actions
65 lines (56 loc) · 1.86 KB
/
Custom.lua
File metadata and controls
65 lines (56 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
-- @Liquipedia
-- page=Module:Infobox/Map/Custom
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--
local Lua = require('Module:Lua')
local Array = Lua.import('Module:Array')
local Class = Lua.import('Module:Class')
local Injector = Lua.import('Module:Infobox/Widget/Injector')
local Map = Lua.import('Module:Infobox/Map')
local Widgets = Lua.import('Module:Infobox/Widget/All')
local Cell = Widgets.Cell
local Title = Widgets.Title
local HtmlWidgets = Lua.import('Module:Widget/Html/All')
local WidgetImage = Lua.import('Module:Widget/Image/Icon/Image')
---@class ArenafpsMapInfobox: MapInfobox
local CustomMap = Class.new(Map)
---@class ArenafpsMapInfoboxWidgetInjector: WidgetInjector
---@field caller ArenafpsMapInfobox
local CustomInjector = Class.new(Injector)
---@param frame Frame
---@return Widget
function CustomMap.run(frame)
local map = CustomMap(frame)
map:setWidgetInjector(CustomInjector(map))
return map:createInfobox()
end
---@param widgetId string
---@param widgets Widget[]
---@return Widget[]
function CustomInjector:parse(widgetId, widgets)
local caller = self.caller
local args = caller.args
if widgetId == 'custom' then
Array.appendWith(widgets,
Cell{name = 'Game', children = {args.game}},
Cell{name = 'Health Items', children = {args['health-items']}},
Cell{name = 'Armor Items', children = {args['armor-items']}},
Cell{name = 'Cooldown Items', children = {args['cooldown-items']}},
Cell{name = 'Spawns', children = {args.spawns}},
Cell{name = 'Starting Spawns', children = {args['starting-spawns']}},
args.minimap and Title{children = {'Minimap'}} or nil,
args.minimap and HtmlWidgets.Div{
classes = {'infobox-image'},
children = {WidgetImage{
imageLight = args.minimap,
size = '350px',
horizontalAlignment = 'center',
}}
} or nil
)
end
return widgets
end
return CustomMap