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

(cherrypicked from 0fa38d0ae0)
This commit is contained in:
xinef1
2017-02-04 19:38:36 +01:00
committed by Shauren
parent 2dcc2d0f05
commit d1cbd8a837
5 changed files with 35 additions and 24 deletions
+16 -4
View File
@@ -5605,6 +5605,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)
@@ -7804,10 +7808,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)->AddUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
Unit* controlled = *itr;
++itr;
controlled->SetInCombatState(PvP, enemy);
}
ProcSkillsAndAuras(enemy, PROC_FLAG_ENTER_COMBAT, PROC_FLAG_NONE, PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_NONE, PROC_HIT_NONE, nullptr, nullptr, nullptr);
@@ -7838,10 +7844,16 @@ void Unit::ClearInCombat()
else
ToPlayer()->OnCombatExit();
RemoveUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LEAVE_COMBAT);
}
void Unit::ClearInPetCombat()
{
RemoveUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
if (Unit* owner = GetOwner())
owner->RemoveUnitFlag(UNIT_FLAG_PET_IN_COMBAT);
}
bool Unit::isTargetableForAttack(bool checkFakeDeath) const
{
if (!IsAlive())