Anonymous
×
Create a new article
Write your page title here:
We currently have 496 articles on WIKI - Idle Pixel. Type your article name above or click on one of the titles below and start writing!



WIKI - Idle Pixel

Module:Loot Table: Difference between revisions

(Created page with "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 '') .. [[> {{{!}} class="loot-table" style="text-align:center" ! style="text-align:center" {{!}} Item ! style="text-align:center" {{!}} Amount ! style="text-align:center" {{!...")
 
No edit summary
 
(22 intermediate revisions by the same user not shown)
Line 2: Line 2:
   
   
local p = {}
local p = {}
function p.formatName(name)
return name:gsub(' ', ''):gsub('%(', ''):gsub('%)', '')
end
   
   
function p.floor(number)
function p.loot_table(name,loot)
     return number - number % 1
     result = [[{{{!}} class="article-table" style="width:45%"
! colspan="4" |]] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]]
{{!}}-
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
{{{!}} class="article-table"
! Item
! Item Name
! Amount Dropped
! Rarity
]=]
 
for _, l in ipairs(loot) do
result = result .. p.loot_table_row(l)
end
 
result = result .. [[
{{!}}}
{{!}}}
''* Can only be obtained once.''
]]
return result
end
end
 
function p.loot_table(frame)
function p.loot_table_row(loot)
    result = [[<div class="loot-table" style="display:inline"]] .. (frame.args['name'] and (frame.args['name'] ~= '') and (' title="'.. frame.args['name'] .. '"') or '') .. [[>
 
{{{!}} class="loot-table" style="text-align:center"
return [[{{!}}- class="]] .. u.r(loot[4]) .. [["
! style="text-align:center" {{!}} Item
{{!}}]] .. '[[File:' .. p.formatName(loot[1]) .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[
! style="text-align:center" {{!}} Amount
 
! style="text-align:center" {{!}} Rarity
{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[
]] .. frame.args[1] .. [[
 
{{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[
 
{{!}}]] .. (loot[4] == 1 and 'Always' or ('1/' .. loot[4])) .. (loot[5] and loot[5] ~= '' and '*' or '') .. [[
 
]]
 
end
 
 
function p.breeding_loot_table(name,loot)
    result = [[{{{!}} class="article-table" style="width:45%"
! colspan="4" |]] .. '[[File:Breeding' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:Breeding' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]]
{{!}}-
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
{{{!}} class="article-table"
! Item
! Item Name
]=]  
 
for _, l in ipairs(loot) do
result = result .. p.breeding_loot_table_row(l)
end
 
result = result .. [[
{{!}}}
{{!}}}
{{!}}}
</div>]]
]]
    if string.match(result, '*') then
return result
        result = result .. [[
''* Can only be obtained once.'']]
    end
    return result
end
end
 
function p.loot_table_row(frame)
function p.breeding_loot_table_row(loot)
    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] .. ']]' .. [[
return [[{{!}}- class=common"]] .. [["
{{!}}]] .. '[[File:' .. p.formatName(loot[1]) .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[
{{!}}]] .. frame.args[2] .. [[
 
{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[
{{!}}data-base="]] .. frame.args[3] .. [["{{!}}1/]] .. frame.args[3] .. (frame.args[4] and frame.args[4] ~= '' and '*' or '') .. [[
 
]]
]]
end
end
   
   
p.lt = p.loot_table
p.lt = p.loot_table
p.ltr = p.loot_table_row
p.ltr = p.loot_table_row
p.blt = p.breeding_loot_table
p.bltr = p.breeding_loot_table_row
   
   
return p
return p

Latest revision as of 20:03, 19 January 2025

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

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:' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]]
{{!}}-
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
{{{!}} class="article-table"
! Item
! Item Name
! Amount Dropped
! Rarity
]=] 

	for _, l in ipairs(loot) do
		result = result .. p.loot_table_row(l)
	end

	result = result .. [[
{{!}}}
{{!}}}
''* Can only be obtained once.''
]]
	return result
end

function p.loot_table_row(loot)

	return [[{{!}}- class="]] .. u.r(loot[4]) .. [["
{{!}}]] .. '[[File:' .. p.formatName(loot[1]) .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[

{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[

{{!}}]] .. (loot[2] == loot[3] and u.c(loot[2]) or (u.c(loot[2]) .. ' - ' .. u.c(loot[3]))) .. [[

{{!}}]] .. (loot[4] == 1 and 'Always' or ('1/' .. loot[4])) .. (loot[5] and loot[5] ~= '' and '*' or '') .. [[

]]

end


function p.breeding_loot_table(name,loot)
    result = [[{{{!}} class="article-table" style="width:45%"
! colspan="4" |]] .. '[[File:Breeding' .. p.formatName(name) .. 'Monster.png' .. '{{!}}30px{{!}}link=]]' .. [['''Loot Table''']] .. '[[File:Breeding' .. p.formatName(name) .. 'Monster.png' .. [=[{{!}}30px{{!}}link=]]
{{!}}-
{{!}} style="border: 0.6px solid black; border-radius: 2px; box-shadow:0px 2px 2px rgba(0, 0, 0, 0.1); color: #000;" {{!}}
{{{!}} class="article-table"
! Item
! Item Name
]=] 

	for _, l in ipairs(loot) do
		result = result .. p.breeding_loot_table_row(l)
	end

	result = result .. [[
{{!}}}
{{!}}}
]]
	return result
end

function p.breeding_loot_table_row(loot)

	return [[{{!}}- class=common"]] .. [["
{{!}}]] .. '[[File:' .. p.formatName(loot[1]) .. [[.png{{!}}40px{{!}}link=]] .. loot[1] .. ']]' .. [[

{{!}}]] .. '[[' .. loot[1] .. ']]' .. [[

]]

end
 
p.lt = p.loot_table
p.ltr = p.loot_table_row
p.blt = p.breeding_loot_table
p.bltr = p.breeding_loot_table_row
 
return p