Module:GameInputs: Difference between revisions

Content deleted Content added
No edit summary
Tag: Reverted
mNo edit summary
 
(5 intermediate revisions by one other user not shown)
Line 14:
ptnultimate = '<span style="background-color:#a12932; color:white; font-size:12px; padding:3px 5px; font-family:Roboto Slab;">Ultimate</span>',
ptnpassive = '<span style="background-color:#4e699e; color:white; font-size:12px; padding:3px 5px; font-family:Roboto Slab;">Passive</span>',
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 = '<imgspan srcstyle="%s"background-color:#624a1e; alt="Energycolor:white; Icon" style="heightfont-size:12px; verticalborder-alignradius:middle5px; margin-rightpadding:3px 5px; font-family:Roboto Slab;">Cost' .. '%sCore Dmg %s</span>',
ptncore = '<span style="background-color:#624a1e; color:white; font-size:12px; border-radius:5px; padding:3px 5px; font-family:Roboto Slab;">' ..
'<img src="%s" alt="Core Icon" style="height:12px; vertical-align:middle; margin-right:3px;">Core Dmg %s</span>',
}
 
-- Function to getgenerate thea full`[[File:...]]` URLtag for athe localgiven file
local function getFileUrlgetFileTag(fileName, size)
size = size or "20"
local file = mw.title.makeTitle("File", fileName):file()
return mw.text.tag("span", {
if file then
return["class"] file:getUrl()= "image",
'<img src=["%sstyle"] alt="Core Icon" style="heightdisplay:12pxinline-block; vertical-align:middle; margin-right:3px;">Core Dmg %s</span>',
else
}, '[[File:' .. fileName .. '|' .. size .. 'px|link=|alt=]]')
return "" -- Return an empty string if the file does not exist
end
end
 
Line 35 ⟶ 31:
local output = {}
-- GetGenerate URLsthe forfile thetags for local images
local energyIcon = getFileUrlgetFileTag("PtN Energy Icon.png")
local coreIcon = getFileUrlgetFileTag("PtN Core Icon.png")
 
-- Loop through user inputs
Line 47 ⟶ 43:
local number = args[i + 1] or ""
table.insert(output, inputStyles[value]:format(coreIcon, number))
elseif inputStyles[value] then
-- Handle inputs without numbers
table.insert(output, inputStyles[value])
end
end