Module:Magic: Difference between revisions

_getSpellRequirements: Fix regressions
(_getSpellRequirements: Refactor)
(_getSpellRequirements: Fix regressions)
Line 144: Line 144:
{ ['type'] = 'SkillLevel', ['skillID'] = 'melvorD:Magic', ['level'] = spell.level }
{ ['type'] = 'SkillLevel', ['skillID'] = 'melvorD:Magic', ['level'] = spell.level }
}
}
if spell.itemRequiredID ~= nil then
if spell.requiredItemID ~= nil then
table.insert(extraReqs, { ['type'] = 'SlayerItem', ['itemID'] = spell.itemRequiredID })
table.insert(extraReqs, { ['type'] = 'SlayerItem', ['itemID'] = spell.requiredItemID })
end
end


local resultPart = {}
local resultPart = {}
for i, reqs in ipairs({ extraReqs, spell.requirements }) do
for i, reqs in ipairs({ extraReqs, spell.requirements }) do
local reqStr = Common.getRequirementString(extraReqs)
local reqStr = Common.getRequirementString(reqs)
if reqStr ~= nil then
if reqStr ~= nil then
table.insert(resultPart, reqStr)
table.insert(resultPart, reqStr)