No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
local p = {} | local p = {} | ||
function p.formatName(name) | function p.formatName(name) | ||
| Line 11: | Line 7: | ||
end | end | ||
function p.loot_table | function p.loot_table(name,loot) | ||
result = [[{{{!}} class="article-table" style="width:45%" | result = [[{{{!}} class="article-table" style="width:45%" | ||
! colspan="4" |]] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]] | ! colspan="4" |]] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]] | ||
| Line 52: | Line 31: | ||
end | end | ||
function p. | function p.loot_table_row(loot) | ||
return [[{{!}}- class="]] .. u.r(loot[4]) .. [[" | return [[{{!}}- class="]] .. u.r(loot[4]) .. [[" | ||
| Line 65: | Line 44: | ||
]] | ]] | ||
end | end | ||
p.lt = p.loot_table | p.lt = p.loot_table | ||
p.ltr = p.loot_table_row | p.ltr = p.loot_table_row | ||
return p | return p | ||
Revision as of 18:53, 19 January 2025
Documentation for this module may be created at Module:Loot Table/doc
u = require("Module:Util")
local p = {}
function p.formatName(name)
return name:gsub(' ', ''):gsub('%(', ''):gsub('%)', '')
end
function p.loot_table(name,loot)
result = [[{{{!}} class="article-table" style="width:45%"
! colspan="4" |]] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]]
{{!}}-
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
{{{!}} class="article-table"
! Item
! Item Name
! Amount Dropped
! Rarity
]=]
for _, l in ipairs(loot) do
result = result .. p.loot_table_row2(l)
end
result = result .. [[
{{!}}}
{{!}}}
''* Can only be obtained once.''
]]
return result
end
function p.loot_table_row(loot)
return [[{{!}}- class="]] .. u.r(loot[4]) .. [["
{{!}}]] .. '[[File:' .. p.formatName(loot[1]) .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[
{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[
{{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[
{{!}}]] .. (loot[4] == 1 and 'Always' or ('1/' .. loot[4])) .. (loot[5] and loot[5] ~= '' and '*' or '') .. [[
]]
end
p.lt = p.loot_table
p.ltr = p.loot_table_row
return p