Module:SalmonRunWildCard
From Inkipedia, the Splatoon wiki
This is a single item in a Salmon Run and Salmon Run Next Wave Wildcard rotation. It is used by Template:Salmon Run/Wildcard rotations and Template:Salmon Run Next Wave/Wildcard rotations.
The Module takes the following arguments:
Parameter | Type | Status | Description |
---|---|---|---|
game | Named | Optional, defaults to "S2" | The game that the weapons belong to. At time of writing, this is either "S2" or "S3". |
time | Named | Required | The date value of when the rotation happened. Something like |
stage | Named | Required | The stage the rotation was played on. |
weapon_i | Named | Required | The ith weapon in this rotation: weapon_1 to weapon_4 inclusive. Can be ? or ?? to indicate random or random rare, respectively.
|
rare_weapon | Named | Optional | The Rare weapon, if applicable. Can be Any for a random rare rotation. For regular random rotations, set to Multiple and use available_rares .
|
bigrun | Named | Optional | If this rotation is a Big Run rotation. Any non-empty value sets this to true (e.g. 'yes'). |
number_of_rares | Named | Optional | The number of Rare weapons available during rotation. The argument determines which weapons will be shown in "Any", and is necessary to display multiple rares in normal wildcard rotations. For the Salmon Run, there are 4 rare weapons in all the Any rotations. For Salmon Run Next Wave, it should be set to the number of rare weapons that were available during the rotation, with :Any" rotations that occurred before the addition of the Grizzco Dualies having 6 available weapons. |
available_rares | Named | Optional | The number of rare weapons available during a regular random rotation. The parser checks the string for "Grizzco" (case-sensitive), followed by a single space, followed by zero or more letters. For consistency, the argument should be formatted as "Grizzco Weapon, Grizzco Weapon, Grizzco Weapon". |
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", ["Grizzco Blaster"]=1, ["Grizzco Brella"]=2, ["Grizzco Charger"]=3, ["Grizzco Slosher"]=4, ["Grizzco Stringer"]=5, ["Grizzco Splatana"]=6, ["Grizzco Dualies"]=7 } 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, available_rares, number_of_rares) return rare_weapon_filter == nil or rare_weapon_filter == "" or rare_weapon_filter == rare_weapon or (available_rares[rare_weapon_filter] ~= nil and available_rares[rare_weapon_filter] <= number_of_rares) end function p.getRow(args) local number_of_rares = tonumber(args["number_of_rares"]) or #grizzcoRares -- Default to half the length of the grizzcoRares array/map local rare_weapon = args["rare_weapon"] or "Any" local available_rares = {} if rare_weapon == "Any" then available_rares = grizzcoRares elseif rare_weapon == "Multiple" then local n = 1 for i in string.gmatch(args["available_rares"], "Grizzco [%a]*") do -- Match Grizzco followed by a single space followed by letters table.insert(available_rares, i) available_rares[i] = n -- Map representation n = n + 1 end end local rare_weapon_filter = args["rare_weapon_filter"] -- or nil local game = args["game"] or "S2" local bigrun = args["bigrun"] and args["bigrun"] ~= "" or false local stage = args["stage"] or "" if shouldIncludeRow(rare_weapon, rare_weapon_filter, available_rares, number_of_rares) then local row = {} table.insert(row, "|-") table.insert(row, "|" .. args["time"]) table.insert(row, "|[[" .. stage .. (bigrun and "#Big_Run" or "") .. "|" .. stage .. "]]" .. (bigrun and " ([[Big Run]])" or "")) -- Insert weapon cells here for i = 1, 4 do local weapon_args = { game = game, category = "Main", name = args["weapon_"..i], icononly = "icononly" } table.insert(row, "|" .. weaponModule.getWeapon(weapon_args)) end -- If rare_weapon is Any, list all available grizzco weapons, if rare_weapon is Multiple, list all weapons in available_rares, otherwise just list rare_weapon rares_cell = {} 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 = game, category = "Main", name = available_rares[i], icononly = "icononly" } table.insert(rares_cell, weaponModule.getWeapon(weapon_args)) end table.insert(rares_cell, "[[Salmon_Run#Rare_weapon-only_rotation|Any]]") elseif rare_weapon == "Multiple" then for i = 1, number_of_rares do local weapon_args = { game = game, category = "Main", name = available_rares[i], icononly = "icononly" } table.insert(rares_cell, weaponModule.getWeapon(weapon_args)) end table.insert(rares_cell, "Multiple") elseif rare_weapon == "TBA" then table.insert(rares_cell, "TBA") else local weapon_args = { game = game, category = "Main", name = rare_weapon } table.insert(rares_cell, weaponModule.getWeapon(weapon_args)) end table.insert(row, "|" .. table.concat(rares_cell, " ") .. "\n") return table.concat(row, "\n") else return "" end end return p