No edit summary |
No edit summary |
||
| Line 5: | Line 5: | ||
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%" | ||
! colspan="4" |]] .. '[[File:' .. name .. '.png' .. '{{!}}40x40px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. name .. '.png' .. [=[{{!}} | ! colspan="4" |]] .. '[[File:' .. name .. '.png' .. '{{!}}40x40px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. name .. '.png' .. [=[{{!}}40x40px{{!}}link=]] | ||
{{!}}- | {{!}}- | ||
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}} | {{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}} | ||
Latest revision as of 04:23, 25 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' .. '{{!}}40x40px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. name .. '.png' .. [=[{{!}}40x40px{{!}}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 return result .. [[
22 {{!}}}
23 {{!}}}
24 ''* Can only be obtained once.'']]
25 end
26
27 function p.loot_table_row(loot)
28
29 return [[{{!}}- class="]] .. u.r(loot[4]) .. [["
30 {{!}}]] .. '[[File:' .. loot[1] .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[
31
32 {{!}}]] .. '[[' .. u.formatName(loot[1]) .. ']]' .. [[
33
34 {{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[
35
36 {{!}}]] .. (loot[4] == 1 and 'Always' or ('1/' .. loot[4])) .. (loot[5] and loot[5] ~= '' and '*' or '') .. [[
37
38 ]]
39
40 end
41
42 p.lt = p.loot_table
43 p.ltr = p.loot_table_row
44
45 return p
