Module:Magic: Difference between revisions

getAltSpellsTable
(I think I fixed the problems with spells)
(getAltSpellsTable)
Line 135: Line 135:
   local result = ''
   local result = ''
   if spell.description ~= nil then
   if spell.description ~= nil then
     result = spell.description
     if p.getSpellTypeIndex(spell.type) == 4 then
      result = string.sub(spell.description, 0, string.find(spell.description, "<br>")-1)
    else
      result = spell.description
    end
   elseif spell.modifiers ~= nil then
   elseif spell.modifiers ~= nil then
     result = Constants.getModifiersText(spell.modifiers, false)
     result = Constants.getModifiersText(spell.modifiers, false)
Line 291: Line 295:
   --8/20/21: Changed to just getting the spell's description outright
   --8/20/21: Changed to just getting the spell's description outright
   rowTxt = rowTxt..'||'..p._getSpellStat(spell, 'description')
   rowTxt = rowTxt..'||'..p._getSpellStat(spell, 'description')
  if p.getSpellTypeIndex(spell.type) == 4 then
    rowTxt = rowTxt..'||'..spell.magicXP
  end
   rowTxt = rowTxt..'||style="text-align:center"|'
   rowTxt = rowTxt..'||style="text-align:center"|'
   rowTxt = rowTxt..p._getSpellRunes(spell)
   rowTxt = rowTxt..p._getSpellRunes(spell)
Line 344: Line 351:
   for i, spell in Shared.skpairs(MagicData.Ancient) do
   for i, spell in Shared.skpairs(MagicData.Ancient) do
     local rowTxt = p._getSpellRow(processSpell('Ancient', i), false)
     local rowTxt = p._getSpellRow(processSpell('Ancient', i), false)
    result = result..rowTxt
  end
  result = result..'\r\n|}'
  return result
end
function p.getAltSpellsTable(frame)
  local result = '{|class="wikitable sortable"\r\n!colspan="2"|Spell'
  result = result..'!!Requirements'
  result = result..'!!style="width:275px"|Description'
  result = result..'!!Experience'
  result = result..'!!Runes'
  local spellList = {}
  for i, spell in Shared.skpairs(MagicData.AltMagic) do
    local rowTxt = p._getSpellRow(processSpell('AltMagic', i), false)
     result = result..rowTxt
     result = result..rowTxt
   end
   end
285

edits