Anonymous

Module:Skills/Agility: Difference between revisions

From Melvor Idle
no edit summary
(Show Abyssal XP in table)
No edit summary
Line 68: Line 68:
--- Gets all required levels to build the given obstacle.
--- Gets all required levels to build the given obstacle.
function p.getObstacleRequirements(obstacle)
function p.getObstacleRequirements(obstacle)
local realmRequirements = p.getObstacleRequirementsRealm(obstacle)
local levelRequirements = {}
for skillName, skillReq in pairs(realmRequirements) do
levelRequirements[skillName] = skillReq.level
end
return levelRequirements
end
--- Gets all required levels to build the given obstacle.
function p.getObstacleRequirementsRealm(obstacle)
local levelRequirements = {}
local levelRequirements = {}
-- Add agility level requirement.
-- Add agility level requirement.
levelRequirements['Agility'] = Skills.getRecipeLevel('Agility', obstacle)
local agilityLevelRequirement, isAbyssal = Skills.getRecipeLevelRealm('Agility', obstacle)
levelRequirements['Agility'] = {
level = agilityLevelRequirement,
isAbyssal = isAbyssal
}


-- Add other level requirements.
-- Add other level requirements.
Line 78: Line 94:
local skillName = Constants.getSkillName(skillReq.skillID)
local skillName = Constants.getSkillName(skillReq.skillID)
if skillName ~= nil then
if skillName ~= nil then
levelRequirements[skillName] = skillReq.level
levelRequirements[skillName] = {
level = skillReq.level,
isAbyssal = skillReq.type == 'AbyssalLevel'
}
end
end
end
end
Line 85: Line 104:
return levelRequirements
return levelRequirements
end
end


-- Gets all items and gp/sc costs required to build the given obstacle.
-- Gets all items and gp/sc costs required to build the given obstacle.
Line 114: Line 134:
function p._getObstacleRequirements(obstacle)
function p._getObstacleRequirements(obstacle)
local resultPart = {}
local resultPart = {}
local requirements = p.getObstacleRequirements(obstacle)
local requirements = p.getObstacleRequirementsRealm(obstacle)
for skill, level in pairs(requirements) do
for skill, req in pairs(requirements) do
table.insert(resultPart, Icons._SkillReq(skill, level))
local icon
if req.isAbyssal then
icon = Icons._AbyssalSkillReq(skill, req.level)
else
icon = Icons._SkillReq(skill, req.level)
end
table.insert(resultPart, icon)
end
end


5

edits