Module:Pets: Difference between revisions

Pet Navbox now has separate section for boss pets
m (Fix acquired by links for boss pets in pet table)
(Pet Navbox now has separate section for boss pets)
Line 155: Line 155:


   local skillPetList = {}
   local skillPetList = {}
  local bossPetList = {}
   local otherPetList = {}
   local otherPetList = {}
   for i, petData in Shared.skpairs(PetData.Pets) do
   for i, petData in Shared.skpairs(PetData.Pets) do
     if petData.skill ~= nil and petData.skill >= 0 and petData.name ~= "Ty" then
     if petData.skill ~= nil and petData.skill >= 0 and petData.name ~= "Ty" then
       table.insert(skillPetList, Icons.Icon({petData.name, type='pet'}))
       table.insert(skillPetList, Icons.Icon({petData.name, type='pet'}))
    elseif petData.obtained ~= nil and petData.obtained.dungeonCompletion ~= nil then
      table.insert(bossPetList, Icons.Icon({petData.name, type='pet'}))
     else
     else
       table.insert(otherPetList, Icons.Icon({petData.name, type='pet'}))
       table.insert(otherPetList, Icons.Icon({petData.name, type='pet'}))
Line 164: Line 167:
   end
   end
   table.sort(skillPetList, function(a, b) return a < b end)
   table.sort(skillPetList, function(a, b) return a < b end)
  table.sort(bossPetList, function(a, b) return a < b end)
   table.sort(otherPetList, function(a, b) return a < b end)
   table.sort(otherPetList, function(a, b) return a < b end)
   result = result..'\r\n|-\r\n!Skill Pets\r\n|'..table.concat(skillPetList, ' • ')
   result = result..'\r\n|-\r\n!Skill Pets\r\n|'..table.concat(skillPetList, ' • ')
  result = result..'\r\n|-\r\n!Boss Pets\r\n|'..table.concat(bossPetList, ' • ')
   result = result..'\r\n|-\r\n!Other Pets\r\n|'..table.concat(otherPetList, ' • ')
   result = result..'\r\n|-\r\n!Other Pets\r\n|'..table.concat(otherPetList, ' • ')
   result = result..'\r\n|}'
   result = result..'\r\n|}'