Module:Pets: Difference between revisions

Separated Pet navbox into Skill Pets and Other Pets (with plans to add a Boss Pets section when v0.19.0 drops)
(getPetNavbox)
(Separated Pet navbox into Skill Pets and Other Pets (with plans to add a Boss Pets section when v0.19.0 drops))
Line 150: Line 150:
   --•
   --•
   local result = '{| class="wikitable" style="margin:auto; text-align:center; clear:both; width: 100%"'
   local result = '{| class="wikitable" style="margin:auto; text-align:center; clear:both; width: 100%"'
   result = result..'\r\n|-\r\n!Pets\r\n|-\r\n'
   result = result..'\r\n|-\r\n!colspan="2"|[[Pets]]'


   local PetList = {}
   local skillPetList = {}
  local otherPetList = {}
   for i, petData in Shared.skpairs(PetData.Pets) do
   for i, petData in Shared.skpairs(PetData.Pets) do
     table.insert(PetList, Icons.Icon({petData.name, type='pet'}))
     if petData.skill ~= nil and petData.skill >= 0 and petData.name ~= "Ty" then
      table.insert(skillPetList, Icons.Icon({petData.name, type='pet'}))
    else
      table.insert(otherPetList, Icons.Icon({petData.name, type='pet'}))
    end
   end
   end
 
 
   result = result..'|'..table.concat(PetList, ' • ')
   result = result..'\r\n|-\r\n!Skill Pets\r\n|'..table.concat(skillPetList, ' • ')
  result = result..'\r\n|-\r\n!Other Pets\r\n|'..table.concat(otherPetList, ' • ')
   result = result..'\r\n|}'
   result = result..'\r\n|}'
   return result
   return result