Module:Shop
From Inkipedia, the Splatoon wiki
Displays an inline shop icon with a link text.
Parameters
game |
Named, required. | The abbreviation of icon's game of origin. Must be one of the following:
|
name |
Named, required. | The English name of the shop.
|
icononly |
Named, optional. | If present and "true", the link text will be omitted. |
size |
Named, optional. | The width of the icon in pixels (do not include px ). Defaults to 24 if absent.
|
Examples
Markup
{{Shop|game=S|name=Ammo Knights}}<br /> {{Shop|game=S3|name=Naut Couture}}<br /> {{Shop|game=S3|name=Ammo Knights|icononly=true|size=64}}<br /> {{Shop|game=S3|name=Ammo Knights (Inkopolis)|size=48}}
Output
Ammo Knights
Naut Couture
Ammo Knights
local p = {} local specificFileName = { ["S"] = {}, ["S2"] = { ["SplatNet 2"] = "S2 Icon SplatNet Gear Shop.png", }, ["S3"] = { ["Crab-N-Go"] = "S3 Icon Staff.png", ["SplatNet 3"] = "SplatNet 3 Shop.svg", ["Ammo Knights (Inkopolis)"] = "S3 Icon Shelly Donny Solo.png", ["Ammo Knights (Duo)"] = "S3 Icon Shelly Donny Duo.png", }, } local specificLink = { ["Ammo Knights (Splatsville)"] = "Ammo Knights", ["Ammo Knights (Inkopolis)"] = "Ammo Knights", ["SplatNet 2"] = "SplatNet 2#Shop", ["SplatNet 3"] = "SplatNet 3#Shop", } local specificDisplayText = { ["Ammo Knights (Splatsville)"] = "Ammo Knights", ["Ammo Knights (Inkopolis)"] = "Ammo Knights", } function p.requireFromModule(frame) return p.getShopIcon( frame.game, frame.name, frame.icononly, frame.size or 24 ) end function p.invokeFromTemplate(frame) local game = frame:getParent().args.game local name = frame:getParent().args.name local icononly = frame:getParent().args.icononly local size = frame:getParent().args.size or 24 return p.getShopIcon(game, name, icononly, size) end function p.getShopIcon(game, name, icononly, size) game = string.upper(game) local fileName = specificFileName[game][name] or string.format("%s Icon %s.png", game, name) local link = specificLink[name] or name local displayText = specificDisplayText[name] or name local result result = string.format("[[File:%s|%dpx|link=%s]]", fileName, size, link) if not icononly then result = result..string.format(" [[%s|%s]]", link, displayText) end return result end return p