12,721
edits
(getSkillUnlockCostTable: Fix to include all skills, even if they don't have an explicitly defined unlock cost) |
(Use printError function) |
||
(One intermediate revision by the same user not shown) | |||
Line 68: | Line 68: | ||
local npc = p.getThievingNPC(npcName) | local npc = p.getThievingNPC(npcName) | ||
if npc == nil then | if npc == nil then | ||
return | return Shared.printError('Invalid Thieving NPC ' .. npcName) | ||
end | end | ||
Line 231: | Line 231: | ||
local skillID = Constants.getSkillID(skillName) | local skillID = Constants.getSkillID(skillName) | ||
if skillID == nil then | if skillID == nil then | ||
return | return Shared.printError('Failed to find a skill ID for ' .. skillName) | ||
end | end | ||
local _, localSkillID = GameData.getLocalID(skillID) | local _, localSkillID = GameData.getLocalID(skillID) | ||
local unlockTable = SkillData[localSkillID].masteryLevelUnlocks | -- Clone so that we can sort by level | ||
local unlockTable = Shared.clone(SkillData[localSkillID].masteryLevelUnlocks) | |||
if unlockTable == nil then | if unlockTable == nil then | ||
return ' | return Shared.printError('Failed to find Mastery Unlock data for ' .. skillName) | ||
end | end | ||
table.sort(unlockTable, function(a, b) return (a.level == b.level and a.descriptionID < b.descriptionID) or a.level < b.level end) | |||
local result = '{|class="wikitable"\r\n!Level!!Unlock' | local result = '{|class="wikitable"\r\n!Level!!Unlock' | ||
Line 253: | Line 255: | ||
local skillID = Constants.getSkillID(skillName) | local skillID = Constants.getSkillID(skillName) | ||
if skillID == nil then | if skillID == nil then | ||
return | return Shared.printError('Failed to find a skill ID for ' .. skillName) | ||
end | end | ||
Line 259: | Line 261: | ||
local checkpoints = SkillData[localSkillID].masteryCheckpoints | local checkpoints = SkillData[localSkillID].masteryCheckpoints | ||
if checkpoints == nil then | if checkpoints == nil then | ||
return ' | return Shared.printError('Failed to find Mastery Unlock data for ' .. skillName) | ||
end | end | ||
Line 352: | Line 354: | ||
local category = GameData.getEntityByName(SkillData.Smithing.categories, tableType) | local category = GameData.getEntityByName(SkillData.Smithing.categories, tableType) | ||
if category == nil then | if category == nil then | ||
return ' | return Shared.printError('Invalid Smithing category: "' .. tableType .. '"') | ||
end | end | ||