Module:Skills: Difference between revisions

getSkillUnlockCostTable: Fix to include all skills, even if they don't have an explicitly defined unlock cost
(Added npcId to getThievingSourcesForItem)
(getSkillUnlockCostTable: Fix to include all skills, even if they don't have an explicitly defined unlock cost)
Line 325: Line 325:
local advMode = GameData.getEntityByID('gamemodes', 'melvorF:Adventure')
local advMode = GameData.getEntityByID('gamemodes', 'melvorF:Adventure')
if advMode ~= nil then
if advMode ~= nil then
local unlockCount = Shared.tableCount(GameData.skillData) - Shared.tableCount(advMode.startingSkills)
local costLength = Shared.tableCount(advMode.skillUnlockCost)
local returnPart = {}
local returnPart = {}
table.insert(returnPart, '{| class="wikitable stickyHeader"\r\n|- class="headerRow-0"\r\n!Unlock!!Cost!!Cumulative Cost')
table.insert(returnPart, '{| class="wikitable stickyHeader"\r\n|- class="headerRow-0"\r\n!Unlock!!Cost!!Cumulative Cost')


local accCost = 0
local accCost = 0
for i, cost in ipairs(advMode.skillUnlockCost) do
for i = 1, unlockCount, 1 do
local cost = advMode.skillUnlockCost[math.min(i, costLength)]
accCost = accCost + cost
accCost = accCost + cost
table.insert(returnPart, '|-')
table.insert(returnPart, '|-')