Anonymous

Module:SkillUnlocks: Difference between revisions

From Melvor Idle
no edit summary
No edit summary
No edit summary
Line 24: Line 24:
['Prayer'] = {'prayers'},
['Prayer'] = {'prayers'},
['Slayer'] = {'areas'},
['Slayer'] = {'areas'},
['Farming'] = {},
['Farming'] = {'gathering'},
['Township'] = {},
['Township'] = {},
['Woodcutting'] = {'gathering'},
['Woodcutting'] = {'gathering'},
['Fishing'] = {'gathering'},
['Fishing'] = {'gathering'},
['Firemaking'] = {},
['Firemaking'] = {'firemaking'},
['Cooking'] = {'artisan'},
['Cooking'] = {'artisan'},
['Mining'] = {'gathering'},
['Mining'] = {'gathering'},
Line 88: Line 88:
['melvorD:Bars'] = 'Smelt',
['melvorD:Bars'] = 'Smelt',
['melvorF:SkillPotions'] = 'Brew',
['melvorF:SkillPotions'] = 'Brew',
['melvorF:CombatPotions'] = 'Brew'
['melvorF:CombatPotions'] = 'Brew',
['log'] = 'Burn'
}
}
local SUBTYPE_OVERRIDES = {
local SUBTYPE_OVERRIDES = {
Line 107: Line 108:
}
}
local SUBTYPE_SORT_OVERRIDES = {
local SUBTYPE_SORT_OVERRIDES = {
['melvorF:StandardRunes'] = '1'
['melvorF:StandardRunes'] = '1',
['log'] = '1'
}
}
local GEAR_SETS = {
local GEAR_SETS = {
Line 965: Line 967:
processed.subType = 'prayer'
processed.subType = 'prayer'
processed.skillLevel = prayer.level
processed.skillLevel = prayer.level
processed.otherReqs = {}
table.insert(entityList, processed)
end
return entityList
end
function p._addFiremakingActionsWithSkillRequirement(entityList, skillName)
for i, fireLog in ipairs(SkillData.Firemaking.logs) do
local processed = {}
local logItem = Items.getItemByID(fireLog.logID)
processed.entityName = logItem.name
processed.entityType = 'item'
processed.subType = 'log'
processed.skillLevel = fireLog.level
processed.otherReqs = {}
processed.otherReqs = {}
table.insert(entityList, processed)
table.insert(entityList, processed)
Line 975: Line 992:
-- Figure out what to look up based on the skill
-- Figure out what to look up based on the skill
local sourceData = {}
local sourceData = {}
local processedData = {}
local subType = ''
local subType = ''
if skillName == 'Woodcutting' then
if skillName == 'Woodcutting' then
Line 985: Line 1,001:
elseif skillName == 'Mining' then
elseif skillName == 'Mining' then
sourceData = SkillData.Mining.rockData
sourceData = SkillData.Mining.rockData
elseif skillName == 'Farming' then
sourceData = SkillData.Farming.recipes
end
end
for i, node in ipairs(sourceData) do
for i, node in ipairs(sourceData) do
local gatherable = Items.getItemByID(node.productId)
local gatherable = Items.getItemByID(node.productId)
local processedItem = {
local processed = {
['level'] = node.level,
['entityName'] = node.name,
['node'] = node,
['entityType'] = 'gathering',
['subType'] = subType,
['skillLevel'] = node.level,
['item'] = gatherable
['item'] = gatherable
}
}
-- Skill-specific overrides
if skillName == 'Fishing' then
if skillName == 'Fishing' then
processedItem['name'] = gatherable.name
processed['entityName'] = gatherable.name
else
elseif skillName == 'Mining' then
processedItem['name'] = node.name
processed['subType'] = node.type
elseif skillName == 'Farming' then
processed['entityName'] = gatherable.name
processed['subType'] = node.categoryID
processed['seed'] = Items.getItemByID(node.seedCost.id)
end
end
table.insert(processedData, processedItem)
end
processed['otherReqs'] = p._getGatherableReqs(node, skillName)
 
for i, entity in ipairs(processedData) do
local processed = {}
processed.entity = entity
processed.item = entity.item
processed.entityName = entity.name
processed.entityType = 'gathering'
if skillName == 'Mining' then
processed.subType = entity.node.type
else
processed.subType = subType
end
processed.skillLevel = entity.level
processed.otherReqs = p._getGatherableReqs(entity.node, skillName)
table.insert(entityList, processed)
table.insert(entityList, processed)
end
end
Line 1,024: Line 1,037:
-- Figure out what to look up based on the skill
-- Figure out what to look up based on the skill
local sourceData = SkillData[skillName].recipes
local sourceData = SkillData[skillName].recipes
local processedData = {}
local sameRecipeAndProduct = false
local sameRecipeAndProduct = false
if skillName == 'Herblore' then
if skillName == 'Herblore' then
Line 1,035: Line 1,047:
product = Items.getItemByID(recipe.productID)
product = Items.getItemByID(recipe.productID)
end
end
local processedItem = {
local processed = {
['name'] = product.name,
['entityName'] = product.name,
['level'] = recipe.level,
['entityType'] = 'artisan',
['recipe'] = recipe,
['subType'] = recipe.categoryID,
['skillLevel'] = recipe.level,
['item'] = product
['item'] = product
}
}
table.insert(processedData, processedItem)
end
for i, entity in ipairs(processedData) do
local processed = {}
processed.entity = entity
processed.item = entity.item
processed.entityName = entity.name
processed.entityType = 'artisan'
processed.subType = entity.recipe.categoryID
processed.skillLevel = entity.level
--processed.otherReqs = p._getGatherableReqs(entity.node, skillName)
table.insert(entityList, processed)
table.insert(entityList, processed)
end
end
Line 1,065: Line 1,066:
['prayers'] = p._addPrayersWithSkillRequirement,
['prayers'] = p._addPrayersWithSkillRequirement,
['gathering'] = p._addGatherablesWithSkillRequirement,
['gathering'] = p._addGatherablesWithSkillRequirement,
['artisan'] = p._addRecipesWithSkillRequirement
['artisan'] = p._addRecipesWithSkillRequirement,
['firemaking'] = p._addFiremakingActionsWithSkillRequirement
}
}


Line 1,116: Line 1,118:
end
end


function p._prepareSingleEntity(entity)
function p._prepareSingleEntity(entity, skillName)
-- Farming crops are...special
if skillName == 'Farming' and entity.seed then
return 'Plant ' .. Icons.Icon({entity.seed.name, type='item'}) .. ' to grow ' .. Icons.Icon({entity.entityName, type='item'})
    end
-- What are you doing with the thing you unlock? ("verbs")
-- What are you doing with the thing you unlock? ("verbs")
local verb = ''
local verb = ''
Line 1,252: Line 1,259:
table.insert(processedSets, entityGearSet.name)
table.insert(processedSets, entityGearSet.name)
else  
else  
toInsert = p._prepareSingleEntity(entity)
toInsert = p._prepareSingleEntity(entity, skillName)
end
end
73

edits