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 |
||
| (3 intermediate revisions by the same user not shown) | |||
| 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%" | ||
! colspan="4" |]] .. '[[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;" {{!}} | ||
| Line 23: | Line 19: | ||
end | end | ||
return result .. [[ | |||
{{!}}} | {{!}}} | ||
{{!}}} | {{!}}} | ||
''* Can only be obtained once.'' | ''* Can only be obtained once.'']] | ||
]] | |||
end | end | ||
| Line 36: | Line 30: | ||
{{!}}]] .. '[[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]))) .. [[ | ||
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
