So this is a very small profile I made that I use to power level my pets.
I have the profile set up to only fight the Strider pets which are aquatic so it is highly recommended that you use Flying against them or pets that have good self healing abilities so the bot can run for as long as it possibly can.
The LUA code that you absolutely need is:
local PetAlly = 1;
local PetEnemy = 2;
local activePetEnemy = C_PetBattles.GetActivePet(PetEnemy);
local typePetEnemy = C_PetBattles.GetPetType(PetEnemy, activePetEnemy);
local activePetAlly = C_PetBattles.GetActivePet(PetAlly);
local typePetAlly = C_PetBattles.GetPetType(PetAlly, activePetAlly);
if activePetAlly == 1 and not (C_PetBattles.GetHealth(PetEnemy, activePetEnemy) == C_PetBattles.GetMaxHealth(PetEnemy, activePetEnemy) ) then
for i = 1, NUM_BATTLE_PETS_IN_BATTLE do
if C_PetBattles.GetHealth(PetAlly, i) > 0 and not ( i == activePetAlly) then
C_PetBattles.ChangePet(i);
break;
end
end
end
What this does is that it will make the pet that is first in your party swap out after it takes damage.
The pet you want the power level absolutely needs to be in slot 1. And from personal experience I highly highly recommend that you do a few battles yourself to level it up to 7+ so that it is able to take a hit or two if the LUA code bugs out or something.
If there's anything wrong with it just lemme know!