Anonymous

Module:Navboxes: Difference between revisions

From Melvor Idle
getFoodNavbox: Actually hide lemon cake as intended
(Update for v1.0.3)
(getFoodNavbox: Actually hide lemon cake as intended)
Line 21: Line 21:
local tier = item.tier
local tier = item.tier
if seedsTable[tier] == nil then
if seedsTable[tier] == nil then
-- Initialise tier tables
-- Initialize tier tables
seedsTable[tier] = {}
seedsTable[tier] = {}
produceTable[tier] = {}
produceTable[tier] = {}
Line 82: Line 82:
-- Cooked food
-- Cooked food
for i, recipe in ipairs(SkillData.Cooking.Recipes) do
for i, recipe in ipairs(SkillData.Cooking.Recipes) do
foundIDs[recipe.itemID] = true
if not foundIDs[recipe.itemID] then
local cookedItem = Items.getItemByID(recipe.itemID)
foundIDs[recipe.itemID] = true
if cookedItem ~= nil then
local cookedItem = Items.getItemByID(recipe.itemID)
local catIdx = recipe.category + 1
if cookedItem ~= nil then
-- Initialize category if it doesn't already exist
local catIdx = recipe.category + 1
if cookedFood[catIdx] == nil then
-- Initialize category if it doesn't already exist
cookedFood[catIdx] = {}
if cookedFood[catIdx] == nil then
end
cookedFood[catIdx] = {}
 
end
local perfectName = nil
if recipe.perfectCookID ~= nil then
local perfectName = nil
local perfectItem = Items.getItemByID(recipe.perfectCookID)
if recipe.perfectCookID ~= nil then
if perfectItem ~= nil then
local perfectItem = Items.getItemByID(recipe.perfectCookID)
perfectName = perfectItem.name
if perfectItem ~= nil then
foundIDs[recipe.perfectCookID] = true
perfectName = perfectItem.name
foundIDs[recipe.perfectCookID] = true
end
end
end
table.insert(cookedFood[catIdx], { ["name"] = cookedItem.name, ["order"] = recipe.level, ["perfectName"] = perfectName })
end
end
table.insert(cookedFood[catIdx], { ["name"] = cookedItem.name, ["order"] = recipe.level, ["perfectName"] = perfectName })
end
end
end
end
Line 398: Line 400:
local addCatData = function(cat, catLink, itemName, itemOrder)
local addCatData = function(cat, catLink, itemName, itemOrder)
if categoryItems[cat] == nil then
if categoryItems[cat] == nil then
-- Initialise category
-- Initialize category
table.insert(categoryHeader, { ["name"] = cat, ["link"] = catLink })
table.insert(categoryHeader, { ["name"] = cat, ["link"] = catLink })
categoryItems[cat] = {}
categoryItems[cat] = {}