Documentation for this module may be created at Module:Loot Table/doc

u = require("Module:Util")

local p = {}

function p.floor(number)
    return number - number % 1
end

function p.loot_table(frame)
    result = [[<div class="loot-table" style="display:inline"]] .. (frame.args['name'] and (frame.args['name'] ~= '') and (' title="'.. frame.args['name'] .. '"') or '') .. [[>
]] .. '<div style="display:flex">' .. (frame.args['area'] and frame.args['area'] ~= '' and frame.args['area'] ~= 'Special' and '<div>[[File: EmptyLootingRing.png|30px|link=]]</div> <div>[[File: ' .. frame.args['area']:gsub(' ', ''):gsub('%(', ''):gsub('%)', '') .. 'LootingRing.png|30px|link=]]</div> ' or '<div></div><div></div>') .. '<div>[[File: SadIcon_grey.png|30px|link=]]</div> <div>[[File: SadIcon.png|30px|link=]]</div> <div>[[File: NeutralIcon_grey.png|30px|link=]]</div> <div>[[File: NeutralIcon.png|30px|link=]]</div> <div>[[File: HappyIcon_grey.png|30px|link=]]</div> <div>[[File: HappyIcon.png|30px|link=]]</div> <div>[[File: VeryHappyIcon_grey.png|30px|link=]]</div> <div>[[File: VeryHappyIcon.png|30px|link=]]</div></div>' .. [[

{{{!}} class="article-table" style="text-align:center"
!Item
!Amount
!Rarity
]] .. frame.args[1] .. [[
{{!}}}
</div>]]
    if string.match(result, '*') then
        result = result .. [[

''* Can only be obtained once.'']]
    end
    return result
end

function p.loot_table_row(frame)
    return [[{{!}}- class="rarity-]] .. u.r(frame.args[3]) .. [["
{{!}}]] .. '[[' .. [[File: ]] .. (frame.args['image'] or frame.args[1]:gsub(' ', ''):gsub('%(', ''):gsub('%)', '')) .. [[.png{{!}}40px{{!}}link=]] .. frame.args[1] .. ']]' .. [[

{{!}}]] .. frame.args[2] .. [[

{{!}}data-base="]] .. frame.args[3] .. [["{{!}}1/]] .. frame.args[3] .. (frame.args[4] and frame.args[4] ~= '' and '*' or '') .. (frame.args[5] and frame.args[5] ~= '' and ([[

{{!}}]] .. '[[' .. [[File: ]] .. frame.args[5]:gsub(' ', ''):gsub('%(', ''):gsub('%)', '') .. [[LootingRing.png{{!}}20px{{!}}link=]] .. frame.args[5] .. [[ Looting Ring{{!}}1/]] .. p.floor(tonumber(frame.args[3]) / 2) .. [[ with ]] .. frame.args[5] .. [[ Looting Ring]] .. ']]') or '') .. [[

]]
end

p.lt = p.loot_table
p.ltr = p.loot_table_row

return p
Community content is available under CC-BY-SA unless otherwise noted.