Module:Ss

local getArgs = require('Module:Arguments').getArgs local Wdstt = require('Module:Wdstt').main local p = {}

function p.main(frame) local args = getArgs(frame) return p._main(args) end

function has_key(table, key) -- https://stackoverflow.com/a/43108438 return table[key] ~= nil end

function p._main(args) local result = {} local unnamed = { ['sr'] = Wdstt({'SR', 'Secret Room'}), ['er'] = Wdstt({'ER', 'end room'}), ['plusle'] = Wdstt({'ID', 'Plusle ID'}), ['minun'] = Wdstt({'ID', 'Minun ID'}), ['ks'] = Wdstt({'KS', 'Kecleon Shop'}), ['box'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/2/20/Treasure_Chest_S_Yellow_Black.png', 'Secret Room and end room boxes'}), ['srer'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/2/20/Treasure_Chest_S_Yellow_Black.png', 'Secret Room and end room boxes'}), ['ersr'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/2/20/Treasure_Chest_S_Yellow_Black.png', 'Secret Room and end room boxes'}), ['h'] = Wdstt({'H', 'hidden'}), ['b'] = Wdstt({'B', "boss drop"}), ['srbox'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/4/43/Treasure_Chest_S_Yellow.png', 'Secret Room boxes'}), ['erbox'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/5/5a/Treasure_Chest_S_Black.png', 'end room boxes'}), ['honey'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/7/7b/Honey_S.png', "spawn using Honey"}), }

local named = { ['box'] = { ['srer'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/2/20/Treasure_Chest_S_Yellow_Black.png', 'Secret Room and end room boxes'}), ['ersr'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/2/20/Treasure_Chest_S_Yellow_Black.png', 'Secret Room and end room boxes'}), ['sr'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/4/43/Treasure_Chest_S_Yellow.png', 'Secret Room boxes'}), ['er'] = Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/5/5a/Treasure_Chest_S_Black.png', 'end room boxes'}), },	}

for k, v in pairs(args) do		if type(k) == "number" then v = string.lower(v) table.insert(result, unnamed[v]) elseif type(k) == "string" then k = string.lower(k) if k == "b" then table.insert(result, Wdstt({'B', v.." boss drop"})) elseif k == "tc" then table.insert(result, Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/5/5a/Treasure_Chest_S_Black.png', table.concat(mw.text.split(v, ", ", True), " ")})) elseif k == "box" and not has_key(named["box"], v) then table.insert(result, Wdstt({'https://static.wikia.nocookie.net/pmysteryuniverse/images/5/5a/Treasure_Chest_S_Black.png', v})) else table.insert(result, named[k][v]) end end end

return table.concat(result, "")

end

return p