Module:Skills/Agility: Difference between revisions

Added Pillar table
(Remporarily removing XP/s and Gp/s to reduce total column count.)
(Added Pillar table)
Line 76: Line 76:
function p.getPassivePillarTable(frame)
function p.getPassivePillarTable(frame)
   local result = ''
   local result = ''
  result = '{| class="wikitable sortable stickyHeader"'
  result = result..'\r\n|- class="headerRow-0"'
  result = result..'\r\n!Name!!Bonuses!!Cost'
  for i, pill in Shared.skpairs(SkillData.Agility.Pillars) do
    result = result..'\r\n|-'
    result = result..'\r\n|'..pill.name
    --After that, adding the bonuses
    local bonuses = {}
    for bonusName, bonusValue in pairs(pill.modifiers) do
      if type(bonusValue) == 'table' then
        for j, trueBonus in pairs(bonusValue) do
          table.insert(bonuses, Constants.getModifierText(bonusName, trueBonus))
        end
      else
        table.insert(bonuses, Constants.getModifierText(bonusName, bonusValue))
      end
    end
    if Shared.tableCount(bonuses) == 0 then
      table.insert(bonuses, '<span style="color:red">None :(</span>')
    end
    result = result..'||'..table.concat(bonuses, '<br/>')
    --Finally, the cost
    local costs = {}
    if pill.cost.gp > 0 then table.insert(costs, Icons.GP(pill.cost.gp)) end
    if pill.cost.slayerCoins > 0 then table.insert(costs, Icons.SC(pill.cost.slayerCoins)) end
    for j, itemCost in Shared.skpairs(pill.cost.items) do
      local item = Items.getItemByID(itemCost[1])
      table.insert(costs, Icons.Icon({item.name, type='item', qty = itemCost[2], notext=true}))
    end
    result = result..'|| data-sort-value="'..pill.cost.gp..'"|'..table.concat(costs, '<br/>')
  end
  result = result..'\r\n|}'
   return result
   return result
end
end


return p
return p