Anonymous

Module:Items/SourceTables: Difference between revisions

From Melvor Idle
m
Fix lua error if the first unlockRequirement for a township trade was not a skill level requirement
m (Fix parameters for standalone creation tables being reversed)
m (Fix lua error if the first unlockRequirement for a township trade was not a skill level requirement)
 
Line 1,549: Line 1,549:
local resName = (res ~= nil and res.name) or 'Unknown'
local resName = (res ~= nil and res.name) or 'Unknown'
local resQty = math.max(item.sellsFor, 2)
local resQty = math.max(item.sellsFor, 2)
local townshipReq = GameData.getEntityByProperty(tradeDef.unlockRequirements, 'skillID', 'melvorD:Township')
local lvl = nil
local lvl = townshipReq.level + (townshipReq.type == 'AbyssalLevel' and 120 or 0)
local townshipReq = GameData.getEntities(tradeDef.unlockRequirements, function(req) return req.skillID == 'melvorD:Township' end)
if townshipReq ~= nil and townshipReq[1] ~= nil then
lvl = townshipReq[1].level + (townshipReq[1].type == 'AbyssalLevel' and 120 or 0)
end


table.insert(tableData, {
table.insert(tableData, {