4,980
edits
(Add recipe categories to Sources/Creation table; Add Harvesting creation data) |
(Allow Harvesting to show up in ItemBox Item Sources) |
||
Line 18: | Line 18: | ||
['melvorAoD:EarthGolem'] = 'Earth Golem (AoD)' | ['melvorAoD:EarthGolem'] = 'Earth Golem (AoD)' | ||
} | } | ||
local function doesRecipeHaveItemID(recipe, itemID) | |||
if recipe.productId == itemID then | |||
return true, nil | |||
elseif type(recipe.products) == 'table' then | |||
for i, product in ipairs(recipe.products) do | |||
if product.itemID == itemID then | |||
local specialReq = nil | |||
if recipe.products[i].minIntensityPercent ~= nil then | |||
specialReq = recipe.products[i].minIntensityPercent .. '% Intensity' | |||
end | |||
return true, specialReq | |||
end | |||
end | |||
end | |||
return false, nil | |||
end | |||
function p._getCreationTable(item) | function p._getCreationTable(item) | ||
Line 61: | Line 78: | ||
local lvl, isAbyssal, xp, qty, req, category, time, maxTime = 0, false, 0, 0, nil, nil, 0, nil | local lvl, isAbyssal, xp, qty, req, category, time, maxTime = 0, false, 0, 0, nil, nil, 0, nil | ||
for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | ||
local hasProduct = | local hasProduct, specialReq = doesRecipeHaveItemID(recipe, itemID) | ||
if hasProduct then | if hasProduct then | ||
lvl, isAbyssal = Skills.getRecipeLevelRealm(localSkillID, recipe) | lvl, isAbyssal = Skills.getRecipeLevelRealm(localSkillID, recipe) | ||
Line 473: | Line 479: | ||
['Fishing'] = { recipeKey = 'fish' }, | ['Fishing'] = { recipeKey = 'fish' }, | ||
['Mining'] = { recipeKey = 'rockData' }, | ['Mining'] = { recipeKey = 'rockData' }, | ||
['Farming'] = { recipeKey = 'recipes' } | ['Farming'] = { recipeKey = 'recipes' }, | ||
['Harvesting'] = { recipeKey = 'veinData' } | |||
}, | }, | ||
['Artisan'] = { | ['Artisan'] = { | ||
Line 491: | Line 498: | ||
local skill = skillData.name | local skill = skillData.name | ||
for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | for i, recipe in ipairs(skillData[dataProp.recipeKey]) do | ||
local hasProduct = doesRecipeHaveItemID(recipe, item.id) | |||
if hasProduct then | |||
if localSkillID == 'Farming' and recipe.seedCost ~= nil then | if localSkillID == 'Farming' and recipe.seedCost ~= nil then | ||
local seedItem = Items.getItemByID(recipe.seedCost.id) | local seedItem = Items.getItemByID(recipe.seedCost.id) |