Module:Skills/Summoning: Difference between revisions

Added SkillSummoningBonusTable
(getTabletTable: Add max hit column, right align cost columns to improve appearance)
(Added SkillSummoningBonusTable)
Line 218: Line 218:
   end
   end
   return p._getFamiliarSynergyTable(familiar)
   return p._getFamiliarSynergyTable(familiar)
end
function p._getSkillSummoningBonusTable(skill)
  local rowArray = {}
  local Familiars = p.getFamiliars()
  local FamArrayByID = {}
  for i, Fam in Shared.skpairs(Familiars) do
    FamArrayByID[Fam.summoningID + 1] = Fam
    local famSkills = Constants.getModifierSkills(Fam.modifiers)
    for k, skillName in Shared.skpairs(famSkills) do
      if skillName == skill then
        table.insert(rowArray, {Fam1 = Fam.name, Fam2 = nil, Descrip = Constants.getModifiersText(Fam.modifiers, false)})
      end
    end
  end
  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 skills = Constants.getModifierSkills(Syn.modifiers)
      for k, skillName in Shared.skpairs(skills) do
        if skillName == skill then
          table.insert(rowArray, {Fam1 = Fam1.name, Fam2 = Fam2.name, Descrip = Syn.description})
        end
      end
    end
  end
  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'
  for i, rowItem in Shared.skpairs(rowArray) do
    result = result..'\r\n|-'
    result = result..'\r\n|data-sort-value="'..rowItem.Fam1..'"|'..Icons.Icon({rowItem.Fam1, type='item', notext=true, size='30'})..'||[['..rowItem.Fam1..']]'
    if rowItem.Fam2 ~= nil then
      result = result..'||data-sort-value="'..rowItem.Fam2..'"|'..Icons.Icon({rowItem.Fam2, type='item', notext=true, size='30'})..'||[['..rowItem.Fam2..']]'
    else
      result = result..'|| || '
    end
    if rowItem.Descrip == nil then
      if rowItem.Fam2 == nil then
        mw.log(rowItem.Fam1)
      else
        mw.log(rowItem.Fam1..' + '..rowItem.Fam2)
      end
    else
      result = result..'||'..rowItem.Descrip
    end
  end
  result = result..'\r\n|}'
  return result
end
function p.getSkillSummoningBonusTable(frame)
  local skillName = frame.args ~= nil and frame.args[1] or frame
  return p._getSkillSummoningBonusTable(skillName)
end
end


return p
return p