Module:Shop: Difference between revisions
From Inkipedia, the Splatoon wiki
(added display text (which can be different from given name) and support for S3 Inkopolis Ammo Knights (Donny & Shelly)) |
(added Crab-N-Go) |
||
Line 7: | Line 7: | ||
}, | }, | ||
["S3"] = { | ["S3"] = { | ||
["Crab-N-Go"] = "S3 Icon Staff.png", | |||
["SplatNet 3"] = "SplatNet 3 Shop.svg", | ["SplatNet 3"] = "SplatNet 3 Shop.svg", | ||
["Ammo Knights (Splatsville)"] = "S3 Icon Ammo Knights.png", | ["Ammo Knights (Splatsville)"] = "S3 Icon Ammo Knights.png", |
Revision as of 16:48, 5 February 2024
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
Script error: The function "invokeFromTemplate" does not exist.
Script error: The function "invokeFromTemplate" does not exist.
Script error: The function "invokeFromTemplate" does not exist.
Script error: The function "invokeFromTemplate" does not exist.
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 (Splatsville)"] = "S3 Icon Ammo Knights.png", ["Ammo Knights (Inkopolis)"] = "S3 Icon Ammo Knights Inkopolis.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.main(frame) local args = frame:getParent().args local game = args["game"] local name = args["name"] local icononly = args["icononly"] local size = args["size"] return p.getShopIcon(game, name, icononly, size) end function p.getShopIcon(game, name, icononly, size) 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 if not size then size = 24 end 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