Editing Module:FoodDetails
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 5: | Line 5: | ||
-- import the required modules | -- import the required modules | ||
local itemData = | local itemData = require( "Module:ItemData" ) | ||
local recipeData = | local recipeData = require( "Module:CraftingRecipes" ) | ||
local plantData = | local plantData = require( "Module:PlantData" ) | ||
-- assign modules for use | -- assign modules for use | ||
Line 29: | Line 29: | ||
header = header .. "<th>Skill Needed</th> \n " | header = header .. "<th>Skill Needed</th> \n " | ||
header = header .. "<th>Skill Level</th> \n " | header = header .. "<th>Skill Level</th> \n " | ||
header = header .. "<th data-sort-type=\"number\"> | header = header .. "<th data-sort-type=\"number\">Minutes Crafting</th> \n " | ||
header = header .. "</tr> \n " | header = header .. "</tr> \n " | ||
Line 59: | Line 59: | ||
local baseCraftTime = '' | local baseCraftTime = '' | ||
local baseLaborCost = '' | local baseLaborCost = '' | ||
local recipe = '' | local recipe = '' | ||
local plant = '' | local plant = '' | ||
if recipes[item] ~= nil then | if recipes[item] ~= nil then | ||
recipe = recipes[item] -- implies food item is created via a recipe with the item's name | recipe = recipes[item] -- implies food item is created via a recipe with the item's name | ||
else | |||
for key,val in pairs(recipes) do | |||
for numx = 1, #val.products do | |||
if val.products[numx][1] == item then | |||
recipe = val -- implies food item is created via a differently named recipe (issue: selects the first found recipe) | |||
end | |||
end | |||
end | |||
end | end | ||
if recipe ~= '' then | if recipe ~= '' then | ||
created = recipe.craftStn | created = recipe.craftStn[1] | ||
if recipe.skillNeeds[1] == nil then | if recipe.skillNeeds[1] == nil then | ||
skill = "none" -- implies a basic recipe like Campfire Beans | skill = "none" -- implies a basic recipe like Campfire Beans |