Anonymous

Module:Pets: Difference between revisions

From Melvor Idle
Added new getPets function for use in the new ModifierTables module that's in progress
(Tweaked formatting on dungeon pet text)
(Added new getPets function for use in the new ModifierTables module that's in progress)
(One intermediate revision by the same user not shown)
Line 47: Line 47:
       result.id = i - 1
       result.id = i - 1
       break
       break
    end
  end
  return result
end
function p.getPets(checkFunc)
  local result = {}
  for i, pet in Shared.skpairs(PetData.Pets) do
    if checkFunc(pet) then
      local newPet = Shared.clone(pet)
      newPet.id = i - 1
      table.insert(result, newPet)
     end
     end
   end
   end
Line 183: Line 195:
   local pet = p.getPetByID(dung.petID)
   local pet = p.getPetByID(dung.petID)
   if pet ~= nil then
   if pet ~= nil then
     result = "\r\n|-\r\n|'''Pet:'''<br/>"
     result = "\r\n|-\r\n|'''[[Pets#Boss Pets|Pet]]:'''<br/>"
     result = result..Icons.Icon({pet.name, type='pet'})
     result = result..Icons.Icon({pet.name, type='pet'})