Content deleted Content added
Paisley Park (talk | contribs) Created page with "local p = {} local inputStyles = { normal = '<font face="Roboto Slab" color="#b566ff" style="border:1px solid #b566ff; font-size:12px; border-radius: 5px; padding-left:1px; padding-right:1px;">NORMAL</font>', stand = '<font face="Roboto Slab" color="#91b704" style="border:1px solid #91b704; font-size:12px; border-radius: 5px; padding-left:1px; padding-right:1px;">STAND</font>', chargeable = '<font face="Roboto Slab" color="#8d7cff" style="border:1px solid #8..." |
mNo edit summary |
||
(15 intermediate revisions by one other user not shown) | |||
Line 2:
local inputStyles = {
normal = '<
stand = '<
chargeable = '<
["on ground"] = '<
["when downed"] = '<
["in air ok"] = '<
["ex skill"] = '<
trap = '<
["switch mode"] = '<
ptnnormal = '<
ptnultimate = '<
ptnpassive = '<
ptnenergy = '<span style="background-color:#552a58; color:white; font-size:12px; border-radius:5px; padding:3px 5px; font-family:Roboto Slab;">' .. '%sCost %s</span>',
ptncore = '<span style="background-color:#624a1e; color:white; font-size:12px; border-radius:5px; padding:3px 5px; font-family:Roboto Slab;">' .. '%sCore Dmg %s</span>'
}
-- Function to generate a `[[File:...]]` tag for the given file
local function getFileTag(fileName, size)
size = size or "20"
return mw.text.tag("span", {
["class"] = "image",
["style"] = "display:inline-block; vertical-align:middle; margin-right:3px;",
}, '[[File:' .. fileName .. '|' .. size .. 'px|link=|alt=]]')
end
function p.renderInputs(frame)
local args = frame.args
local output = {}
-- Generate the file tags for local images
local energyIcon = getFileTag("PtN Energy Icon.png")
local coreIcon = getFileTag("PtN Core Icon.png")
-- Loop through user inputs
for
if inputStyles[value] then▼
if value
local number = args[i + 1] or ""
table.insert(output, inputStyles[value]:format(energyIcon, number))
elseif value == "ptncore" and inputStyles[value] then
local number = args[i + 1] or ""
table.insert(output, inputStyles[value]:format(coreIcon, number))
-- Handle inputs without numbers
table.insert(output, inputStyles[value])
end
end
return table.concat(output, " ")
end
|