fix(Core/PetHandler): Allow PetAI to handle flags (#19446)

When a pet ability was cast, PetHandler reset all CharmInfo flags before
calling PetAI methods, setting the attack flag to true every time.
This commands the pet to go and chase the target which is not correct
when the state is COMMAND_STAY.

PetAI already handles the scenario, it just wasn't getting the actual
pet attack state.
This commit is contained in:
Saqra1
2024-08-19 11:15:39 -05:00
committed by GitHub
parent 337135bf9e
commit 087acc58bf
2 changed files with 0 additions and 12 deletions

View File

@@ -754,17 +754,12 @@ void Pet::Update(uint32 diff)
GetMotionMaster()->Clear(false);
GetMotionMaster()->MoveIdle();
bool oldCmdAttack = GetCharmInfo()->IsCommandAttack();
GetCharmInfo()->SetIsCommandAttack(false);
GetCharmInfo()->SetIsAtStay(true);
GetCharmInfo()->SetIsCommandFollow(false);
GetCharmInfo()->SetIsFollowing(false);
GetCharmInfo()->SetIsReturning(false);
GetCharmInfo()->SaveStayPosition(true);
GetCharmInfo()->SetIsCommandAttack(oldCmdAttack);
AddSpellCooldown(tempspell, 0, spellInfo->IsCooldownStartedOnEvent() ? infinityCooldownDelay : 0);
CastSpell(tempspellTarget, tempspell, false);

View File

@@ -355,13 +355,6 @@ void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint32 spe
return;
}
// Clear the flags as if owner clicked 'attack'. AI will reset them
// after AttackStart, even if spell failed
charmInfo->SetIsAtStay(false);
charmInfo->SetIsCommandAttack(true);
charmInfo->SetIsReturning(false);
charmInfo->SetIsFollowing(false);
TriggerCastFlags triggerCastFlags = TRIGGERED_NONE;
if (spellInfo->IsPassive())