Anonymous

Module:Skills/Agility: Difference between revisions

From Melvor Idle
Okay hopefully fixed the second issue I hit with Agility obstacles
(Hopefully fixed issue with new agility obstacles not fitting into the table properly)
(Okay hopefully fixed the second issue I hit with Agility obstacles)
Line 49: Line 49:
   local Obstacles = Shared.clone(SkillData.Agility.Obstacles)
   local Obstacles = Shared.clone(SkillData.Agility.Obstacles)
   table.sort(Obstacles, function(a, b) return a.category < b.category end)
   table.sort(Obstacles, function(a, b) return a.category < b.category end)
  local catCounts = {}
  for i, obst in Shared.skpairs(Obstacles) do
    if catCounts[obst.category] == nil then
      catCounts[obst.category] = 1
    else
      catCounts[obst.category] = catCounts[obst.category] + 1
    end
  end


   for i, obst in Shared.skpairs(Obstacles) do
   for i, obst in Shared.skpairs(Obstacles) do
Line 54: Line 63:
     result = result..'\r\n|'
     result = result..'\r\n|'
     if catLog[obst.category] == nil then
     if catLog[obst.category] == nil then
       local rowspan = obst.category > 1 and 5 or 3
       local rowspan = catCounts[obst.category]
       result = result..'rowspan="'..rowspan..'" style="border:1px solid black"|'..(obst.category + 1)..'||'
       result = result..'rowspan="'..rowspan..'" style="border:1px solid black"|'..(obst.category + 1)..'||'
       catLog[obst.category] = true
       catLog[obst.category] = true