Module:Magic: Difference between revisions

I think I fixed the problems with spells
(Added getStandardSpellsTable)
(I think I fixed the problems with spells)
Line 7: Line 7:
local Icons = require('Module:Icons')
local Icons = require('Module:Icons')
local Items = require('Module:Items')
local Items = require('Module:Items')
local Constants = require('Module:Constants')


function processSpell(section, index)
function processSpell(section, index)
Line 129: Line 130:
   end
   end
   return p._getSpellRunes(spell)
   return p._getSpellRunes(spell)
end
function p._getSpellDescription(spell)
  local result = ''
  if spell.description ~= nil then
    result = spell.description
  elseif spell.modifiers ~= nil then
    result = Constants.getModifiersText(spell.modifiers, false)
  elseif spell.type == 'Spells' then
    result = 'Combat spell with a max hit of '..(spell.maxHit * 10)
  end
  return result
end
end


Line 134: Line 148:
   if stat == 'bigIcon' then
   if stat == 'bigIcon' then
     return p._getSpellIcon(spell, 250)
     return p._getSpellIcon(spell, 250)
  elseif stat == 'description' then
    return p._getSpellDescription(spell)
   elseif stat == 'icon' then
   elseif stat == 'icon' then
     return p._getSpellIcon(spell)
     return p._getSpellIcon(spell)
Line 164: Line 180:


   local result = ''
   local result = ''
   if spell.type == 'Spells' then
 
    result = result.."|-\r\n|'''Max Hit:''' "..(spell.maxHit * 10)
   --8/20/21: Changed to using the new getSpellDescription function
  end
   result = result.."\r\n|-\r\n|'''Description:'''<br/>"..p._getSpellStat(spell, 'description')
   if spell.description ~= nil then
    result = result.."\r\n|-\r\n|'''Description:'''<br/>"..spell.description
  end


   return result
   return result
Line 276: Line 289:
     rowTxt = rowTxt..p.getSpellTypeLink(spell.type)
     rowTxt = rowTxt..p.getSpellTypeLink(spell.type)
   end
   end
   if spell.type == 'Spells' then
   --8/20/21: Changed to just getting the spell's description outright
    rowTxt = rowTxt..'||data-sort-value="'..spell.maxHit..'"|Combat spell with a max hit of '..(spell.maxHit * 10)
  rowTxt = rowTxt..'||'..p._getSpellStat(spell, 'description')
  else
    rowTxt = rowTxt..'||'..spell.description
  end
   rowTxt = rowTxt..'||style="text-align:center"|'
   rowTxt = rowTxt..'||style="text-align:center"|'
   rowTxt = rowTxt..p._getSpellRunes(spell)
   rowTxt = rowTxt..p._getSpellRunes(spell)