Last week I posted this:
After a battle, when a hurted team pet gets replaced by a fresh one, the fresh one does not have the correct abilities set. Only when I click on the team (in the list) again, the abilities are adjusted to what is saved in the team.
This is still true, but yesterday I found another bug which is probably the trigger for the messed up abilities:
To reproduce:
1. Have a team with one leveler slot, and have at least 2 sets of healthy carry (non-leveling) pets for that team.
2. Enable "Load Healthiest Pet" and "After Battles Or Heals Too".
3. In the leveler slot, put a species where you have already two lv25.
4. Do the battle.
After the battle, Rematch swaps in an uninjured set of carry pets. This is fine and is what "After Battles Or Heals Too" is supposed to do. But:
It also replaces the injured leveler with one of your lv25 of the species.
Now, the presence of a lv25 at the position of the leveler slot seems to "invalidate" the team (since the team has a leveler slot, and a lv25 cannot go into a leveler slot). Thus, the now "teamless" pets regain the abilities they had before (off-team). Well, that's my theory
The problem with the swapped lv25 in the leveler slot seems to be in the `AssertHealthiestPet` function in
loadTeam.lua, line 80:
For the
second for loop in the function, I traced the variable values and got this:
Code: Select all
loadedPetID: BattlePet-0-0000074559C5
petInfo.idType: pet
loadedPetID: BattlePet-0-000009534611
petInfo.idType: pet
loadedPetID: BattlePet-0-00000B52AAED
petInfo.idType: pet
The third pair is slot 3, which was my leveler slot. The idType is "pet", since `loadedPetID` is derived from `GetLoadoutInfo` which always returns the pet GUID. With that, the `if petInfo.idType=="pet"` conditional (line 96) will always evaluate to true, even for the leveler in slot 3.
Now, when I change
line 94 loadTeam.lua to…
Code: Select all
-- local loadedPetID = rematch.loadouts:GetLoadoutInfo(i)
local loadedPetID = team.pets[i]
…in order to get the "petId" from the team function (instead of `GetLoadoutInfo`), then I get the seemingly more useful values:
Code: Select all
loadedPetID: BattlePet-0-000007474549
petInfo.idType: pet
loadedPetID: BattlePet-0-00000B3F6EDE
petInfo.idType: pet
loadedPetID: 0
petInfo.idType: leveling
The leveler (slot 3) is now idType "leveling" (instead of "pet") and therefore is excluded from getting replaced by a "healthy" lv25.
Since I don't have a picture of the whole addon, this is certainly not the cleanest solution. But you get the idea.