Module:Gates to Infinity Dungeon Items table: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 21: | Line 21: | ||
header | header | ||
:tag('tr') | :tag('tr') | ||
:tag('th'):attr("colspan", "3"):wikitext(frame:expandTemplate{title = "GatesToInfinitySprite", args = {frame:preprocess('{{#switch:' .. categoryArg .. ' | Berry=Oran Berry | Projectile=Gravelerock | Food=Apple | Health Drink=Max Elixir | Recruitment Item=Black Key | Evolution Item|Link Box=Link Box | Equipment=Scarf | Miscellaneous Item=Gold Bar | Device=Normal Device | #default={{{category|}}} }}'), size = "32x32px"}} .. '<br>' .. frame:expandTemplate{title = "GatesToInfinity", args = {(categoryArg or "")}}):done() | :tag('th'):attr("colspan", "3"):wikitext(frame:expandTemplate{title = "GatesToInfinitySprite", args = {frame:preprocess('{{#switch:' .. categoryArg .. ' | Berry=Oran Berry | Projectile=Gravelerock | Food=Apple | Health Drink=Max Elixir | Recruitment Item=Black Key | Evolution Item|Link Box=Link Box | Equipment=Scarf | Miscellaneous Item=Gold Bar | Device=Normal Device | #default={{{category|}}} }} Icon'), size = "32x32px"}} .. '<br>' .. frame:expandTemplate{title = "GatesToInfinity", args = {(categoryArg or "")}}):done() | ||
:tag('tr') | :tag('tr') | ||
if string.lower(categoryArg) == "poké" then | if string.lower(categoryArg) == "poké" then |
Latest revision as of 02:45, 26 June 2025
This template generates a list of items present in a dungeon for Gates to Infinity.
Usage
{{#invoke:Gates to Infinity Dungeon Items table|main | category = | item_1 = | floor_1 = | frequency_1 = ... | item_n = | floor_n = | frequency_n = }}
Example
{{#invoke:Gates to Infinity Dungeon Items table|main | category = Berry | item_1 = Oran Berry | floor_1 = 1 - 3 | frequency_1 = 25.00% | item_2 = Oran Berry | floor_2 = 4 - 6 | frequency_2 = 50.00% }}
![]() Berry | ||
---|---|---|
English | Japanese | Floors |
Oran Berry | オレンのみ | [Research required] |
Oran Berry | オレンのみ | [Research required] |
--------------------------------------------------------------------------------
--
-- Module:Gates to Infinity Dungeon Items table
--
--------------------------------------------------------------------------------
local p = {}
local mw = require('mw')
function p.main(frame)
local data = require("Module:Gates to Infinity Item Data Cell")
local metatable = {__index = function () return "" end}
setmetatable(data, metatable)
local args = frame.args
local output = mw.html.create()
local header = mw.html.create()
local categoryArg = args["category"]
-- Header row
header
:tag('tr')
:tag('th'):attr("colspan", "3"):wikitext(frame:expandTemplate{title = "GatesToInfinitySprite", args = {frame:preprocess('{{#switch:' .. categoryArg .. ' | Berry=Oran Berry | Projectile=Gravelerock | Food=Apple | Health Drink=Max Elixir | Recruitment Item=Black Key | Evolution Item|Link Box=Link Box | Equipment=Scarf | Miscellaneous Item=Gold Bar | Device=Normal Device | #default={{{category|}}} }} Icon'), size = "32x32px"}} .. '<br>' .. frame:expandTemplate{title = "GatesToInfinity", args = {(categoryArg or "")}}):done()
:tag('tr')
if string.lower(categoryArg) == "poké" then
header
:tag('th'):cssText("width: 33%"):wikitext("Lowest amount"):done()
:tag('th'):cssText("width: 33%"):wikitext("Highest amount"):done()
else
header
:tag('th'):cssText("width: 33%"):wikitext("English"):done()
:tag('th'):cssText("width: 33%"):wikitext("Japanese"):done()
end
header
:tag('th'):cssText("width: 34%"):wikitext("Floors"):done()
-- Data rows
local rows = mw.html.create()
local i = 1
while true do
local row = mw.html.create()
local itemArg = args["item_" .. i]
local lowAmountArg = args["low_amount_" .. i]
local highAmountArg = args["high_amount_" .. i]
local floorsArg = args["floors_" .. i]
if not itemArg and not floorsArg and not lowAmountArg and not highAmountArg then
break -- exit loop when no more rows are found
end
row
:tag("tr")
if string.lower(categoryArg) == "poké" then
row
:tag("td"):wikitext((lowAmountArg or frame:expandTemplate{title = "Research"})):done()
:tag("td"):wikitext((highAmountArg or frame:expandTemplate{title = "Research"})):done()
else
row
:tag("td"):wikitext(frame:expandTemplate{title = "GatesToInfinity", args = {(itemArg or "")}}):done()
:tag("td"):wikitext(data[itemArg]["ja"]):done()
end
row
:tag("td"):wikitext((floorsArg or frame:expandTemplate{title = "Research"})):done()
rows
:node(row)
:allDone()
i = i + 1
end
output
:tag('table'):addClass("wikitable"):cssText("text-align: center; width: 100%;")
:node(header)
:node(rows)
return tostring(output)
end
return p