Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(Infobox): add Character for Marvel Rivals #5185

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all 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
69 changes: 69 additions & 0 deletions components/infobox/wikis/marvelrivals/infobox_character_custom.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
-- @Liquipedia
-- wiki=marvelrivals
-- page=Module:Infobox/Character/Custom
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Array = require('Module:Array')
local Class = require('Module:Class')

local Lua = require('Module:Lua')

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

local Widgets = require('Module:Widget/All')
local Cell = Widgets.Cell

---@class MarvelRivalsHeroInfobox: CharacterInfobox
local CustomHero = Class.new(Character)
local CustomInjector = Class.new(Injector)

---@param frame Frame
---@return Html
function CustomHero.run(frame)
local character = CustomHero(frame)
character:setWidgetInjector(CustomInjector(character))
character.args.informationType = 'Hero'

return character:createInfobox()
end

---@param id string
---@param widgets Widget[]
---@return Widget[]
function CustomInjector:parse(id, widgets)
local args = self.caller.args
if id == 'custom' then
Array.appendWith(
widgets,
Cell{name = 'Health', content = {args.health}},
Cell{name = 'Movespeed', content = {args.movespeed}},
Cell{name = 'Difficulty', content = {args.difficulty}},
Cell{name = 'Affiliation', content = {args.affiliation}},
Cell{name = 'Voice Actor(s)', content = {args.voiceactor}}
)
return widgets
end

return widgets
end

---@param lpdbData table
---@param args table
function CustomHero:addToLpdb(lpdbData, args)
lpdbData.information = args.name
lpdbData.image = args.image
lpdbData.date = args.released
lpdbData.extradata = {
health = args.health,
movespeed = args.movespeed,
dificulty = args.difficulty,
}

return lpdbData
end

return CustomHero
Loading