Module:SalmonRunWildCard

local p = {} local weaponModule = require('Module:Weapon') -- rares are in order of release; needed for correct "Any" handling local grizzcoRares = {"Grizzco Blaster", "Grizzco Brella", "Grizzco Charger", "Grizzco Slosher", "Grizzco Stringer", "Grizzco Splatana", "Grizzco Dualies"}

function p.main(frame) -- Pull out args from frame local args = frame:getParent.args -- Pass to getRow return p.getRow(args) end

-- Determine if the row should be included based on rare_weapon and rare_weapon_filter local function shouldIncludeRow(rare_weapon, rare_weapon_filter) return rare_weapon_filter == nil or rare_weapon == "Any" or rare_weapon_filter == rare_weapon end

function p.getRow(args) local rare_weapon = args["rare_weapon"] or "Any" local rare_weapon_filter = args["rare_weapon_filter"] -- or nil local number_of_rares = tonumber(args["number_of_rares"]) or #grizzcoRares -- Default to the length of the grizzcoRares array

if shouldIncludeRow(rare_weapon, rare_weapon_filter) then local row = {}

table.insert(row, "|-") table.insert(row, "|" .. args["time"]) table.insert(row, "|" .. args["stage"] .. "")

-- Insert weapon cells here for i = 1, 4 do           local weapon_args = { game = "S2", category = "Main", name = args["weapon_"..i], icononly = "icononly" }           table.insert(row, weaponModule.getWeapon(weapon_args)) end

-- If rare_weapon is Any, list multiple weapons, else list the given rare_weapon if rare_weapon == "Any" then for i = 1, math.min(number_of_rares, #grizzcoRares) do -- Loop only up to number_of_rares or the total available, whichever is smaller local weapon_args = { game = "S2", category = "Main", name = grizzcoRares[i], icononly = "icononly" }               table.insert(row, weaponModule.getWeapon(weapon_args)) end table.insert(row, "Any") else local weapon_args = { game = "S2", category = "Main", name = rare_weapon, icononly = "icononly" }           table.insert(row, weaponModule.getWeapon(weapon_args)) end

return table.concat(row, "\n") else return "" end end

return p