Anonymous

Module:Magic: Difference between revisions

From Melvor Idle
Removed normal levels from abyssal spellbook table; Sort by AbyssaLevel or Level
(Remove extra Superheat requirements into _getSpellRequirements())
(Removed normal levels from abyssal spellbook table; Sort by AbyssaLevel or Level)
Line 142: Line 142:
function p._getSpellRequirements(spell)
function p._getSpellRequirements(spell)
-- All spells have a Magic level requirement
-- All spells have a Magic level requirement
local extraReqs = {
local extraReqs = {}
{
['type'] = 'SkillLevel',
['skillID'] = 'melvorD:Magic',
['level'] = spell.level
}
}
if spell.abyssalLevel ~= nil and spell.abyssalLevel > 0 then
if spell.abyssalLevel ~= nil and spell.abyssalLevel > 0 then
table.insert(extraReqs, {
table.insert(extraReqs, {
Line 154: Line 148:
['skillID'] = 'melvorD:Magic',
['skillID'] = 'melvorD:Magic',
['level'] = spell.abyssalLevel
['level'] = spell.abyssalLevel
})
else
table.insert(extraReqs, {
['type'] = 'SkillLevel',
['skillID'] = 'melvorD:Magic',
['level'] = spell.level
})
})
end
end
Line 483: Line 483:
end
end


table.sort(spellList, function(a, b) return a.level < b.level end)
table.sort(spellList, function(a, b) return (a.abyssalLevel or a.level) < (b.abyssalLevel or b.level) end)
return spellList
return spellList
end
end
Line 581: Line 581:
return bookA.id < bookB.id
return bookA.id < bookB.id
else
else
return a.level < b.level
return (a.abyssalLevel or a.level) < (b.abyssalLevel or b.level)
end
end
end)
end)
Line 640: Line 640:


local spellListSorted = Shared.shallowClone(spellList)
local spellListSorted = Shared.shallowClone(spellList)
table.sort(spellListSorted, function(a, b) return a.level < b.level end)
table.sort(spellListSorted, function(a, b) return (a.abyssalLevel or a.level) < (b.abyssalLevel or b.level) end)
---- Header stuff ----
---- Header stuff ----
Line 688: Line 688:


row:tag('td'):wikitext(p._getSpellRequirements(spell))
row:tag('td'):wikitext(p._getSpellRequirements(spell))
    :attr('data-sort-value', spell.level)
    :attr('data-sort-value', (spell.abyssalLevel or spell.level))
row:tag('td'):wikitext(Icons.getDLCColumnIcon(spell.id))
row:tag('td'):wikitext(Icons.getDLCColumnIcon(spell.id))
:attr('data-sort-value', Icons.getExpansionID(spell.id))
:attr('data-sort-value', Icons.getExpansionID(spell.id))