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