Anonymous

Module:Skills/Summoning: Difference between revisions

From Melvor Idle
Added first pass at getSynergyTable
No edit summary
(Added first pass at getSynergyTable)
Line 102: Line 102:


     table.insert(rowArray, rowText)
     table.insert(rowArray, rowText)
  end
  result = result..'\r\n'..table.concat(rowArray, '\r\n')
  result = result..'\r\n|}'
  return result
end
function p.getSynergyTable(frame)
  local result = ''
  result = result..'{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!colspan="2"|Familiar 1!!colspan="2"|Familiar 2!!Effect!!Requirements'
  local Familiars = p.getFamiliars()
  local FamArrayByID = {}
  for i, Fam in Shared.skpairs(Familiars) do
    FamArrayByID[Fam.summoningID + 1] = Fam
  end
  local rowArray = {}
  for i, SynCat in Shared.skpairs(SkillData.Summoning.Synergies) do
    local Fam1 = FamArrayByID[i]
    for j, Syn in Shared.skpairs(SynCat) do
      local Fam2 = FamArrayByID[j]
      local rowText = '|-'
      rowText = rowText..'\r\n|data-sort-value="'..Fam1.name..'"|'..Icons.Icon({Fam1.name, type='item', notext=true, size='30'})..'||[['..Fam1.name..']]'
      rowText = rowText..'||data-sort-value="'..Fam2.name..'"|'..Icons.Icon({Fam2.name, type='item', notext=true, size='30'})..'||[['..Fam2.name..']]'
      rowText = rowText..'||'..Syn.description
      local reqArray = {}
      local reqLvl = math.max(Fam1.summoningLevel, Fam2.summoningLevel)
      table.insert(reqArray, Icons._SkillReq('Summoning', reqLvl))
      table.insert(reqArray, Fam1.name..' Mark Level '..(Fam2.summoningTier + 1))
      table.insert(reqArray, Fam2.name..' Mark Level '..(Fam1.summoningTier + 1))
      rowText = rowText..'||data-sort-value="'..reqLvl..'"||'..table.concat(reqArray, '<br/>')
      table.insert(rowArray, rowText)
    end
   end
   end