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



WIKI - Idle Pixel

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

cdb = require("Module:Crafting_DB")
edb = require("Module:Enemy_DB")
cbdb = require("Module:CooksBook_DB")
pdb = require("Module:Potions_DB")
idb = require("Module:Tablette_DB")
u = require("Module:Util")
 
local p = {}
 
function p.used_in_table(name)
    recipes = {}
    for _, e in ipairs(cdb) do
        for _, f in ipairs(e[5]) do
            if f[1] == name then
                table.insert(recipes, {e[1], e[2], e[3], f[2]})
            end
        end
    end
    result = [[
{| class="wikitable sortable"
! colspan="2"|Item
!Crafting level
!Amount needed
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[
 
|]] .. e[3] .. [[
 
|]] .. u.c(e[4]) .. [[
 
]]
    end
    return result .. [[
|}
]]
end
 
 function p.cooked_in_table(name)
    recipes = {}
    for _, e in ipairs(cbdb) do
        for _, f in ipairs(e[6]) do
            if f[1] == name then
                table.insert(recipes, {e[1], e[2], e[3], f[2]})
            end
        end
    end
    result = [[
{| class="wikitable"
! colspan="2"|Recipe
!Cooking level
!Amount needed
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[
 
|]] .. e[3] .. [[
 
|]] .. u.c(e[4]) .. [[
 
]]
    end
    return result .. [[
|}
]]
end
 
function p.brewed_in_table(name)
    recipes = {}
    for _, e in ipairs(pdb) do
        for _, f in ipairs(e[5]) do
            if f[1] == name then
                table.insert(recipes, {e[1], e[2], e[3], f[2], e[6]})
            end
        end
    end
    result = [[
{| class="wikitable"
! colspan="2"|Potion
!Brewing Level
!Amount Needed
!Potion Effect
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[
 
|]] .. e[3] .. [[
 
|]] .. u.c(e[4]) .. [[

|]] .. e[5] .. [[
 
]]
    end
    return result .. [[
|}
]]
end

function p.bloodify_table(name)
    recipes = {}
	for _, e in ipairs(idb) do
		local added = false
		for _, f in ipairs(e[7]) do
			if f[1] == name then
				table.insert(recipes, {e[1], e[2], f[2]})
				added = true
			end
		end
		if added then
			for _, s in ipairs(e[8]) do
				if s[1] == name then
					recipes[#recipes][4] = s[2]
				else
					recipes[#recipes][4] = ''
				end
			end
		else
			for _, s in ipairs(e[8]) do
				if s[1] == name then
					table.insert(recipes, {e[1], e[2], '', s[2]})
				end
			end
		end
	end

    result = [[
{| class="wikitable"
! colspan="2"|Tablette
! colspan="2"|How many needed to Bloodify
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[
 
|style="width: 30%;"|]] .. u.c(e[3]) .. [[
 
|style="width: 30%;"|]] .. u.c(e[4]) .. [[
 
]]
    end
    return result .. [[
|}
]]
end
 
function p.dropped_from_table(name)
    recipes = {}
    for _, e in ipairs(edb) do
		if e[2] ~= "Fields2" then
	        for _, f in ipairs(e[8]) do
    	        if f[1] == name then
        	        table.insert(recipes, {e[1], e[1] .. ' Monster', f[2], f[3], f[4], f[6], f[5] and e[2]})
            	end
	        end
		end
    end
    result = [[
{| class="wikitable"
! colspan="2"|Monster
!Amount dropped
!Drop chance
]]
    for _, e in ipairs(recipes) do
        result = result .. [[
|- class="]] .. u.r(e[5]) .. [["
|]] .. '[[File: ' .. e[2]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[
 
|]] .. (e[3] == e[4] and u.c(e[3]) or u.c(e[3]) .. ' - ' .. u.c(e[4])) .. [[
 
|1/]] .. e[5] .. (e[6] and e[6] ~= '' and '*' or '') .. [[
 
]]
    end
    return result .. [[
|}
]]
end
 
function p.tuit(frame)
    return p.used_in_table(frame.args[1] or frame:getParent():getTitle())
end
 
 function p.tcit(frame)
	return p.cooked_in_table(frame.args[1] or frame:getParent():getTitle())
end
 
 function p.tbit(frame)
	return p.brewed_in_table(frame.args[1] or frame:getParent():getTitle())
 end
 function p.tbt(frame)
	return p.bloodify_table(frame.args[1] or frame:getParent():getTitle())
 end
 
function p.tdft(frame)
    return p.dropped_from_table(frame.args[1] or frame:getParent():getTitle())
end
 
return p