Created page with "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:' .. name .. '.png' .. '{{!}}30px{{!}}link=]]' .. '''Loot Table''' .. '[[File:' .. name .. '.png' .. [=[{{!}}30px{{!}}link=]] {{!}}- {{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2..." |
No edit summary |
||
| Line 3: | Line 3: | ||
local p = {} | local p = {} | ||
function p.loot_table(name,loot) | function p.loot_table(name,loot) | ||
result = [[{{{!}} class="article-table" style="width:45%" | result = [[{{{!}} class="article-table" style="width:45%" | ||
| Line 36: | Line 32: | ||
{{!}}]] .. '[[File:' .. loot[1] .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[ | {{!}}]] .. '[[File:' .. loot[1] .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[ | ||
{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[ | {{!}}]] .. '[[' .. u.formatName(loot[1]) .. ']]' .. [[ | ||
{{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[ | {{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[ | ||
Revision as of 03:05, 1 October 2025
Documentation for this module may be created at Module:Loot Table/doc
1 u = require("Module:Util")
2
3 local p = {}
4
5 function p.loot_table(name,loot)
6 result = [[{{{!}} class="article-table" style="width:45%"
7 ! colspan="4" |]] .. '[[File:' .. name .. '.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. name .. '.png' .. [=[{{!}}30px{{!}}link=]]
8 {{!}}-
9 {{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
10 {{{!}} class="article-table"
11 ! Item
12 ! Item Name
13 ! Amount Dropped
14 ! Rarity
15 ]=]
16
17 for _, l in ipairs(loot) do
18 result = result .. p.loot_table_row(l)
19 end
20
21 result = result .. [[
22 {{!}}}
23 {{!}}}
24 ''* Can only be obtained once.''
25 ]]
26 return result
27 end
28
29 function p.loot_table_row(loot)
30
31 return [[{{!}}- class="]] .. u.r(loot[4]) .. [["
32 {{!}}]] .. '[[File:' .. loot[1] .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[
33
34 {{!}}]] .. '[[' .. u.formatName(loot[1]) .. ']]' .. [[
35
36 {{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[
37
38 {{!}}]] .. (loot[4] == 1 and 'Always' or ('1/' .. loot[4])) .. (loot[5] and loot[5] ~= '' and '*' or '') .. [[
39
40 ]]
41
42 end
43
44 p.lt = p.loot_table
45 p.ltr = p.loot_table_row
46
47 return p
