Module:Weapon

local p = {} local gameShortened = require("Module:GameShortened")

-- Local function for switch-like behavior to get full name local function getFullName(name) local case_table = { ["Bomb Rush"] = "Bomb Rush Splat Bomb", ["Bomb Rush (Burst Bomb)"] = "Bomb Rush Burst Bomb", ["Bomb Rush (Splat Bomb)"] = "Bomb Rush Splat Bomb", ["Bomb Rush (Suction Bomb)"] = "Bomb Rush Suction Bomb", ["Bomb Rush (Seeker)"] = "Bomb Rush Seeker", ["Bomb Launcher"] = "Splat-Bomb Launcher", ["Hero Gear"] = "Hero Shot Level 1", ["?"] = "Random", ["??"] = "Random 2", ["Unknown"] = "Not Found" }   return case_table[name] or name end

-- Local function for switch-like behavior to get link local function getLink(name, gameShort) -- If name starts with Bomb Rush if name:find("^Bomb Rush") then return "Bomb Rush" end

local case_table = { ["Bomb Launcher"] = "Splat-Bomb Launcher", ["Smallfry"] = "Smallfry (character)|Smallfry", ["Unarmed"] = "List of unarmed missions", ["?"] = gameShort == "S3" and "Salmon_Run_Next_Wave#Wildcard_rotation|Random" or "Salmon_Run#Wildcard_rotation|Random", ["??"] = gameShort == "S3" and "Salmon_Run_Next_Wave#Wildcard_rotation|Random Rare" or "Salmon_Run#Rare_weapon-only_rotation|Random Rare" }   return case_table[name] or name end

-- Main function function p.main(frame) local args = frame:getParent.args local game = args['game'] or args[1] or "" local category = args['category'] or args[2] or "" local name = args['name'] or args[3] or "" local icononly = args['icononly'] or args[4] == "icononly" or args[5] == "icononly" or false local size = args['size'] or (args[4] ~= "icononly" and args[4]) or (args[5] ~= "icononly" and args[5]) or "24" local variant = args['var'] or "" local gameShort = gameShortened.getGame(game)

-- Construct the file name using getFullName local fileName = string.format("%s_Weapon_%s_%s%s.png", gameShort, category, getFullName(name), variant ~= "" and ("_" .. variant) or "")

-- Construct the output local output = string.format('', fileName, size, getLink(name, gameShort))

if not icononly then -- Add textual representation output = output .. " " .. getLink(name, gameShort) .. "" end

return output end

return p