Module:GenericIcon

From Corsair Cove Official Wiki
Revision as of 12:41, 3 August 2026 by Dorce (talk | contribs)

This module displays an icon and a link for miscellaneous concepts in the game.

It uses data from the Module:GenericIconData and is used in the Template:GenericIcon.


local p = {}
local gData = mw.loadData("Module:GenericIconData")

local sizeMap = {
	xs = 16,
	sm = 32,
	md = 64,
	lg = 96,
	xl = 128,
}

function p.icon_link(frame)
	local args = frame.args
	local obj = args[1] or args.obj or ""
	local size = args.size or "xs"
	local px = sizeMap[size] or sizeMap.xs

	local filename = gData[obj]
	local filename = filename or "T Button SelectionBorder Default.png"

	return string.format(
		"[[File:%s|x%dpx|link=%s|%s]] [[%s]]",
		filename, px, obj, obj, obj
	)
end

return p