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

(Created page with "u = require("Module:Util") db = require("Module:Crafting_DB") local p = {} function p.furnace() recipes = {} for _, e in ipairs(db) do for _, f in ipairs(e[5]) do if e[6] == 1 then table.insert(recipes, {e[1],e[2],e[3],e[4],e[7],f[1],f[2]}) end end end result = [[ {| class="wikitable" ! colspan="2" style="width: 30%" |Item !Level Required ! style="width: 20%" |Materials ! style="width: 25%" |Description !XP ]] for _...")
 
No edit summary
Line 9: Line 9:


     for _, e in ipairs(db) do
     for _, e in ipairs(db) do
local itemName = e[1]
if not recipes[itemName] then
recipes[itemName] = {
item = itemName,
itemImage = e[2],
level = e[3],
description = e[7],
xp = e[4],
materials = {}
}
end
     for _, f in ipairs(e[5]) do
     for _, f in ipairs(e[5]) do
if e[6] == 1 then
table.insert(recipes[itemName].materials, f)
table.insert(recipes, {e[1],e[2],e[3],e[4],e[7],f[1],f[2]})
end
         end
         end
     end
     end
Line 33: Line 42:


     for _, e in ipairs(recipes) do
     for _, e in ipairs(recipes) do
 
local materialsStr = table.concat(recipes.material, ", ")
         result = result .. [[
         result = result .. [[


|-
|-
{'Stone Furnace','StoneFurnace',2,24,{{'Stone',10}},1,'Allow you to smelt Ores into Bars'},
{'Bronze Furnace','BronzeFurnace',12,155,{{'Stone',1000},{'Bronze Bars',30}},1,'Allow you to smelt Ores into Bars'},
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[


Line 45: Line 52:
|]] .. e[3] .. '[[File:CraftingSigil.png|20px|link=]]' .. [[
|]] .. e[3] .. '[[File:CraftingSigil.png|20px|link=]]' .. [[
   
   
|]] .. e[6] .. [[
|]] .. materialsStr .. [[


|]] .. e[5] .. [[
|]] .. e[5] .. [[

Revision as of 14:21, 16 April 2024

This module uses the data from Module:Crafting_DB to create a exhibition of all the craftable items of the game

{{#invoke:Lua|crafting}}

Lua error in Module:Lua at line 100: attempt to call field 'craftingTable' (a nil value).


u = require("Module:Util")
db = require("Module:Crafting_DB")

local p = {}

function p.furnace()

    recipes = {}

    for _, e in ipairs(db) do
		local itemName = e[1]
		if not recipes[itemName] then
			recipes[itemName] = {
				item = itemName,
				itemImage = e[2],
				level = e[3],
				description = e[7],
				xp = e[4],
				materials = {}
			}
		end
    	for _, f in ipairs(e[5]) do
				table.insert(recipes[itemName].materials, f)
        end
    end

    result = [[

{| class="wikitable"

! colspan="2" style="width: 30%" |Item

!Level Required

! style="width: 20%" |Materials

! style="width: 25%" |Description

!XP

]]

    for _, e in ipairs(recipes) do
		local materialsStr = table.concat(recipes.material, ", ")
        result = result .. [[

|-
|]] .. '[[File: ' .. e[2] .. '.png|35px|link=' .. e[1] .. ']]' .. [[

|]] .. '[[' .. e[1] .. ']]' .. [[

|]] .. e[3] .. '[[File:CraftingSigil.png|20px|link=]]' .. [[
 
|]] .. materialsStr .. [[

|]] .. e[5] .. [[

|]] .. e[4] .. 'xp' .. [[
 
]]
    end
    return result .. [[
|}
]]
end
return p