View Single Post
11-22-20, 05:47 PM   #9
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
I'd honestly convert it to a loop.
Lua Code:
  1. function BattleDex.RecordBattle()
  2.     if not C_PetBattles.IsWildBattle() then return; end
  3.  
  4.     local primary=0;
  5.     for i=1,C_PetBattles.GetNumPets(2) do
  6.         local species=C_PetBattles.GetPetSpeciesID(2,i);
  7.         BattleDex.RecordPet(
  8.             species
  9.             ,C_PetBattles.GetLevel(2,i)
  10.             ,C_PetBattles.GetBreedQuality(2,i)
  11.             ,primary--  Passes zero for the first iteration
  12.         );
  13.         if i==1 then primary=species; end-- Sets the primary species for following iterations
  14.     end
  15. end
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote