Anonymous

Module:Skills: Difference between revisions

From Melvor Idle
getMasteryCheckpointTable: Revise implementation of realm handling
(getAncientRelicsTable: Support 'abyssal' parameter, for choosing display of abyssal or non-abyssal relics only)
(getMasteryCheckpointTable: Revise implementation of realm handling)
Line 358: Line 358:


function p.getMasteryCheckpointTable(frame)
function p.getMasteryCheckpointTable(frame)
local skillName = frame.args ~= nil and frame.args[1]
local args = frame.args ~= nil and frame.args or frame
local realmName = frame.args ~= nil and frame.args[2]
local skillName = args[1]
local realmName = args.realm
 
local realm = Skills.getRealmFromName(realmName)
if realm == nil then
return Shared.printError('Failed to find a realm with name ' .. (realmName or 'nil'))
end
local skillID = Constants.getSkillID(skillName)
local skillID = Constants.getSkillID(skillName)
local realm = nil
if realmName ~= nil then
realm = GameData.getEntityByName('realms', realmName)
else
realm = GameData.getEntityByID('realms', 'melvorD:Melvor')
end
if skillID == nil then
if skillID == nil then
return Shared.printError('Failed to find a skill ID for ' .. skillName)
return Shared.printError('Failed to find a skill ID for ' .. skillName)
elseif realm == nil then
return Shared.printError('Failed to find a realm with name ' .. (realmName or 'nil'))
end
end