Module:Sandbox/Exaskliri/GearInfo
This a future Lua module to replace following gear info templates:
- Template:GearIntroText (referred to as template 1)
- Template:Infobox/Gear (template 2)
- Template:GearAbilityAndBrandInfo (template 3)
Purposes
- Since this is a Lua module, it will be faster than MediaWiki templates it replaces.
- Variables (price, star, etc.) only needs to be assigned once in each page, instead of repeating them for each template in the same page.
- DPL3 support.
- Data of each gear item only needs to be defined once in the entire wiki, in their respective page.
- Pages that collate their data (e.g., Template:Gear/S3 Clothing) then uses DPL to refer to gear pages, instead of having their own duplicate data.
- Sentence restructuring for readability, including but not limited to:
- Move gear acquisition info from template 1 to under each game header (near template 3). Since more games are added, said info starts clogging template 1.
Currently | Goal (abridged) |
---|---|
The SV925 Circle Shades are headgear in the Splatoon series. In Splatoon 2, they are a 3-star item produced by Rockenberg and come with the primary ability Swim Speed Up. They can be purchased from Headspace for 11,000 or from SplatNet 2 Gear Shop for 16,500. In Splatoon 3, they are a 2-star item produced by Rockenberg and come with the primary ability Swim Speed Up. They can be obtained through leveling up the Chill Season 2022 Catalog to level 5, or they can be purchased from Naut Couture for 11,000 from SplatNet 3 Shop for 16,500. |
The SV925 Circle Shades are headgear in the Splatoon series. Splatoon 2Acquisition
Splatoon 3Acquisition
|
- Change template 3 from a long paragraph to bullet points.
Currently (abridged) | Goal (also abridged) |
---|---|
The White Tee comes with Ink Saver (Sub) as the primary ability. As a 0-star item, the White Tee comes with one additional slot for secondary abilities. Since it is made by the SquidForce gear brand, it has a higher chance of rolling Ink Resistance Up and a lower chance of rolling Ink Saver (Main) to fill its secondary ability slots. |
|
Where to collaborate?
- First, join the Inkipedia Discord guild if you haven't already.
- This is the link to the thread.
local p = {} local numberToTextModule = require("Module:NumberToText") local gameFullNameModule = require("Module:GameFromAbbreviation") local brandAbilityModule = require("Module:AbilityFromBrand") local abilityIconModule = require("Module:Ability") local costModule = require("Module:Cost") local function getTextFromNumber(number) return numberToTextModule.textFromNumber(number) end local function getGameFullName(game) return gameFullNameModule.getFullName(game) end local function getAbilityFromBrand(game, brand, preference) return brandAbilityModule.getAbility(game, brand, preference) end local function getAbilityIcon(game, ability) return abilityIconModule.getAbilityIcon(game, ability) end local function getCost(game, quantity, currency) return costModule.getCost(game, quantity, currency) end local function sectionPerGame(allText, args, game) if args[game] then local sentenceVar = {} --If name differs from page title. Unused otherwise. local name = args[game .. "_name"] or args["name"] or mw.title.getCurrentTitle() local an = args[game .. "_an"] or args["an"] local price = args[game .. "_price"] local currency = args[game .. "_currency"] --by default, assume "cash" on Module:Cost's end if currency == "" or not currency then currency = "cash" end local sn_price = args[game .. "_sn_price"] --splatnet (changed from sn2_price and sn3_price) local catalog = {} --it now requires catalog parameter to be numbered local catalogFetchIndex = 1 --CHANGE TO for i, v in pairs( t ) do while(args[game.."_catalog_"..catalogFetchIndex]) do catalog[catalogFetchIndex] = args[game.."_catalog_"..catalogFetchIndex] catalogFetchIndex = catalogFetchIndex + 1 end local catalog_only = args['catalog_only'] --renamed from catalogonly local availability = args[game .. "_availability"] local avail_text = args[game .. "_avail_text"] local can_order = args[game .. "_can_order"] --can be ordered from another player (changed from unused canorder) local stars = args[game .. "_stars"] local brand = args[game .. "_brand"] or args["brand"] local ability = args[game .. "_ability"] --Header for game title. table.insert(allText, string.format("==''%s''==\n", getGameFullName(game))) --Infobox, 0% progress --Availability table.insert(allText, "===Availability===\n") if availability then if avail_text then --I'll add more later. table.insert(allText, avail_text) end elseif not (price or sn_price) then table.insert(allText, string.format("* The %s cannot be obtained.", name)) end if price or sn_price then if currency == "cash" or (sn_price and game == "s2") then can_order = true end table.insert(allText, string.format("* The %s can be purchased from the following shop(s):\n", name)) table.insert(allText, string.format("{| class=\"wikitable sitecolor-%s\"\n|-\n! Shop !! Cost", game)) if price then local shopName = { ["s"] = { ["Headgear"] = {"Cooler Heads"}, ["Clothing"] = {"Jelly Fresh"}, ["Shoes"] = {"Shrimp Kicks"}, }, ["s2"] = { ["Headgear"] = {"Headspace"}, ["Clothing"] = {"Ye Olde Cloth Shoppe"}, ["Shoes"] = {"Shella Fresh"}, }, ["s3"] = { ["Headgear"] = {"Naut Couture", "Cooler Heads"}, ["Clothing"] = {"Man-o'-Wardrobe", "Jelly Fresh"}, ["Shoes"] = {"Crush Station", "Shrimp Kicks"}, }, } for i, v in ipairs( shopName[game][category] ) do table.insert(allText, "") end end table.insert(allText, "|}") end if can_order then sentenceVar[1] = "" else sentenceVar[1] = "not" end sentenceVar["s"] = "[[Spyke]]" sentenceVar["s2"] = "[[Murch]]" sentenceVar["s3"] = "[[Murch]] or [[Spyke]]" table.insert(allText, string.format("* The %s can%s be ordered from another player via %s.", name, sentenceVar[1], sentenceVar[game])) --Gear data (ability, stars, brand) table.insert(allText, "===Data===") --Primary ability if not ability or ability == "" then table.insert(allText, string.format("* The %s lacks a default primary [[Gear ability|ability]].", name)) else --No alternate primary ability in S1. if game == 's' then sentenceVar[1] = "" else sentenceVar[1] = "default " end --Link to [[Recon (ability)]] instead of disambig. if ability == "Recon" then sentenceVar[2] = ability .. " (ability)|" else sentenceVar[2] = "" end table.insert(allText, string.format("* The %s's %sprimary [[Gear ability|ability]] is [[%s%s]].", name, sentenceVar[1], sentenceVar[2], ability)) end --Star power if not stars or stars == "" then table.insert(allText, string.format("* The %s lacks a default star power.", name)) else if game == 's' or game == 's2' then sentenceVar[1] = "" sentenceVar[2] = stars elseif game == 's3' then sentenceVar[1] = "default " sentenceVar[2] = stars + 1 end table.insert(allText, string.format("* The %s's %sstar power is %s, meaning it has %s secondary ability slots by default.", name, sentenceVar[1], stars, getTextFromNumber(sentenceVar[2]))) end --Brand if getAbilityFromBrand(game, brand) ~= nil then table.insert(allText, string.format("* The %s's brand is [[%s]], which alters the chance of obtaining these secondary abilities via experience points:", name, brand)) table.insert(allText, string.format("** %s (5×)", getAbilityIcon(game, getAbilityFromBrand(game, brand, "common")))) table.insert(allText, string.format("** %s (0.5×)", getAbilityIcon(game, getAbilityFromBrand(game, brand, "uncommon")))) elseif not brand or brand == "" then table.insert(allText, string.format("* The %s is [[Gear brand|brandless]].", name)) else table.insert(allText, string.format("* The %s's brand is [[%s]], which has equal chances of rolling any secondary ability.", name, brand)) end end end function p.main(frame) local args = frame:getParent().args return p.gearInfo(args) end function p.gearInfo(args) local allText = {} --local category = args['category'] or nil --local plural = args['plural'] or false sectionPerGame(allText, args, "s") sectionPerGame(allText, args, "s2") sectionPerGame(allText, args, "s3") return table.concat(allText, "\n") end return p