Anonymous

Module:Navboxes: Difference between revisions

From Melvor Idle
Changed Ores & Bars nav to show all ores and bars and sorted by (abyssalLevel+120 or level) to push ItA items to the end
(Move stronghold and abyss depth pets into "Boss" category instead of "Other")
(Changed Ores & Bars nav to show all ores and bars and sorted by (abyssalLevel+120 or level) to push ItA items to the end)
 
Line 491: Line 491:
local barOreIDs = {}
local barOreIDs = {}
-- Compile list of bars
-- Compile list of bars
-- Also compile a list of ores used to create these bars, used to filter out non-bar ores later
for i, recipe in ipairs(SkillData.Smithing.recipes) do
for i, recipe in ipairs(SkillData.Smithing.recipes) do
if Shared.contains({'melvorD:Bars','melvorItA:AbyssalBars'}, recipe.categoryID) then
if Shared.contains({'melvorD:Bars','melvorItA:AbyssalBars'}, recipe.categoryID) then
Line 497: Line 496:
if item ~= nil then
if item ~= nil then
local displayName = string.gsub(item.name, ' Bar$', '')
local displayName = string.gsub(item.name, ' Bar$', '')
table.insert(categoryItems['Bars'], { ["name"] = item.name, ["display"] = displayName, ["order"] = recipe.level })
local level = recipe.level
end
if recipe.abyssalLevel then
-- Add to barOreIDs list
level = recipe.abyssalLevel + 120
for j, costDef in ipairs(recipe.itemCosts) do
if barOreIDs[costDef.id] == nil then
barOreIDs[costDef.id] = true
end
end
table.insert(categoryItems['Bars'], { ["name"] = item.name, ["display"] = displayName, ["order"] = level })
end
end
end
end
Line 509: Line 506:
-- Compile list of ores
-- Compile list of ores
for i, recipe in ipairs(SkillData.Mining.rockData) do
for i, recipe in ipairs(SkillData.Mining.rockData) do
if barOreIDs[recipe.productId] then
local item = Items.getItemByID(recipe.productId)
local item = Items.getItemByID(recipe.productId)
if item ~= nil then
if item ~= nil then
local level = recipe.level
table.insert(categoryItems['Ores'], { ["name"] = item.name, ["display"] = recipe.name, ["order"] = recipe.level })
if recipe.abyssalLevel then
end
level = recipe.abyssalLevel + 120
end
table.insert(categoryItems['Ores'], { ["name"] = item.name, ["display"] = recipe.name, ["order"] = level })
end
end
end
end