mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 12:47:07 +00:00
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:
@@ -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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user