Core/Pets: Fixed flashing pet attack button (#18906)

This commit is contained in:
xinef1 authored and Aokromes committed 2017-02-05 01:57:37 +01:00
1 parent 7a8d9c2ece
commit 01b43b3da0
5 files changed
+35 -25

No files matched your search

+16 -4
View File
@@ -7862,6 +7862,10 @@ void Unit::CombatStop(bool includingCast)
if (GetTypeId() == TYPEID_PLAYER)
ToPlayer()->SendAttackSwingCancelAttack(); // melee and ranged forced attack cancel
ClearInCombat();
// just in case
if (IsPetInCombat() && GetTypeId() != TYPEID_PLAYER)
ClearInPetCombat();
}
void Unit::CombatStopWithPets(bool includingCast)
@@ -10422,10 +10426,12 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
Dismount();
}
for (Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
for (Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
{
(*itr)->SetInCombatState(PvP, enemy);
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
Unit* controlled = *itr;
++itr;
controlled->SetInCombatState(PvP, enemy);
}
}
@@ -10464,10 +10470,16 @@ void Unit::ClearInCombat()
else
ToPlayer()->UpdatePotionCooldown();
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LEAVE_COMBAT);
}
void Unit::ClearInPetCombat()
{
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
if (Unit* owner = GetOwner())
owner->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
}
bool Unit::isTargetableForAttack(bool checkFakeDeath) const
{
if (!IsAlive())