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:Items: Difference between revisions

No edit summary
No edit summary
Line 51: Line 51:
     result = [[
     result = [[
{| class="wikitable"
{| class="wikitable"
!Recipe
! colspan="2"|Recipe
!Cooking level
!Cooking level
!Amount needed
!Amount needed
Line 59: Line 59:
|-
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
   
   
|]] .. e[3] .. [[
|]] .. e[3] .. [[
Line 82: Line 84:
     result = [[
     result = [[
{| class="wikitable"
{| class="wikitable"
!Potion
! colspan="2"|Potion
!Brewing Level
!Brewing Level
!Amount Needed
!Amount Needed
Line 91: Line 93:
|-
|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[' .. e[1] .. ']]' .. [[
   
   
|]] .. e[3] .. [[
|]] .. e[3] .. [[
Line 108: Line 112:
     recipes = {}
     recipes = {}
     for _, e in ipairs(edb) do
     for _, e in ipairs(edb) do
         for _, f in ipairs(e[10]) do
         for _, f in ipairs(e[8]) do
             if f[1] == name then
             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]})
                 table.insert(recipes, {e[1], e[1] .. ' Monster', f[2], f[3], f[4], f[6], f[5] and e[2]})
Line 116: Line 120:
     result = [[
     result = [[
{| class="wikitable"
{| class="wikitable"
!Source
! colspan="2"|Source
!Amount dropped
!Amount dropped
!Drop chance
!Drop chance
Line 124: Line 128:
|- class="]] .. u.r(e[5]) .. [["
|- class="]] .. u.r(e[5]) .. [["
|]] .. '[[File: ' .. e[2]:gsub(' ', '') .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[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])) .. [[
|]] .. (e[3] == e[4] and u.c(e[3]) or u.c(e[3]) .. ' - ' .. u.c(e[4])) .. [[

Revision as of 05:20, 16 April 2024

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")
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.dropped_from_table(name)
    recipes = {}
    for _, e in ipairs(edb) do
        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
    result = [[
{| class="wikitable"
! colspan="2"|Source
!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.tdft(frame)
    return p.dropped_from_table(frame.args[1] or frame:getParent():getTitle())
end
 
return p