Module:Magic: Difference between revisions

m
Fix typo
(_getSpellTemplateData: Fix for AoD spells which produce bone items)
m (Fix typo)
 
(2 intermediate revisions by the same user not shown)
Line 411: Line 411:
local item = Items.getItemByID(itemID)
local item = Items.getItemByID(itemID)
if item ~= nil then
if item ~= nil then
isBar = item.type == 'Bar'
isBar = not Shared.tableIsEmpty(GameData.getEntities(SkillData.Smithing.recipes,
function(recipe)
return recipe.categoryID == 'melvorD:Bars' and recipe.productID == item.id
end))
isShard = GameData.getEntityByProperty(SkillData.Magic.randomShards, 'itemID', item.id) ~= nil
isShard = GameData.getEntityByProperty(SkillData.Magic.randomShards, 'itemID', item.id) ~= nil
isGem = GameData.getEntityByProperty('randomGems', 'itemID', itemID) ~= nil
isGem = GameData.getEntityByProperty('randomGems', 'itemID', itemID) ~= nil
Line 652: Line 655:
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