Fixing Beastmastery Talents Not Applying To Pets

I’m working on fixing this issue:

https://github.com/T…ore/issues/5429

but so far what I’ve tried had no effect. You still have to log out and back in to see the Beastmastery talents modify your pet’s stats.


diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp

index 87f207e..85c8f13 100755

--- a/src/server/game/Entities/Player/Player.cpp

+++ b/src/server/game/Entities/Player/Player.cpp

@@ -23988,6 +23988,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank)


	 // update free talent points

	 SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));

+

+	// Check for pet and apply player talents that modify pet stats

+	if (GetPet() && GetPet()->isAlive() && GetPet()->IsInWorld())

+	{

+		GetPet()->UpdateAllStats();

+	}

}


void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)

After picking talents like thick hide which increases your pet’s armor by x, UpdateAllStats() didn’t modify the armor stat based on the new aura.

Any advice as to which area I should be looking at would be appreciated. I was thinking of copying some of the calls in LoadPetFromDB() to reload the auras but thought that might double them rather than replace them. Also I’m not sure exactly where the player auras are applied to the pet.

No need for those brackets.

You mean like this:


+       if (GetPet() && GetPet()->isAlive() && GetPet()->IsInWorld())

+               GetPet()->UpdateAllStats();

Ok, so that’s a style issue but doesn’t lead me in a new direction /emoticons/default_smile.png

Ok, that helps a little.

We don’t need to reapply the mods every tick, they just need to be replaced/updated when the talent is learned. As it stands now, the auras are applied correctly when the pet is loaded so we could duplicate that by removing the auras and reapplying them when the talent is learned/unlearned.

I just wasn’t sure how the auras were applied is all. Are they considered casted by the player or pet?

I was wondering about this as well, But I think It’s casted by the owner

My guess in Pet::CastPetAuras

[CODE]

for (PetAuraSet::const_iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end()

{

    PetAura const* pa = *itr;

    ++itr;

    if (!current && pa->IsRemovedOnChangePet())

	    owner->RemovePetAura(pa);

    else

	    CastPetAura(pa);

[/code][/CODE]

An example if you cast 6562 (Heroic presence) the pet inherits it, or is that handled by ->GetVisibleAura ?

BTW thanks for the fix for Call Pet on dead pets causing a server crash.

Right, see when I was reviewing the code, I took “Pet Auras” to mean the auras cast by the pet (ie: from the pet talent tree) and “Player Auras” to mean those cast by the player (Beastmastery tree). I think however that it considers any aura that effects the pet a “Pet Aura” which is a bit misleading.

I don’t want to muck up the aura handlers but I think anything that is learned by the player should be a player aura, regardless of who it effects.