Module:Magic: Difference between revisions

_getSpellTable: Sort rows by level requirement
(_getSpellTemplateData: Fix for AoD spells which produce bone items)
(_getSpellTable: Sort rows by level requirement)
Line 652: Line 652:
end
end


local spellListSorted = Shared.shallowClone(spellList)
table.sort(spellListSorted, function(a, b) return a.level < b.level end)
local resultPart = {p._getSpellHeader(includeSpellbook, includeItems, includeDamage, includeExperience)}
local resultPart = {p._getSpellHeader(includeSpellbook, includeItems, includeDamage, includeExperience)}
for i, spell in ipairs(spellList) do
for i, spell in ipairs(spellListSorted) do
table.insert(resultPart, p._getSpellRow(spell, includeSpellbook, includeItems, includeDamage, includeExperience))
table.insert(resultPart, p._getSpellRow(spell, includeSpellbook, includeItems, includeDamage, includeExperience))
end
end