mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[8867] Implement expected combat stop with friendly faction
In case force reaction apply/remove.
This commit is contained in:
parent
670a2dbb4c
commit
e6efe02020
6 changed files with 69 additions and 3 deletions
|
|
@ -12822,3 +12822,43 @@ void Unit::SendThreatRemove(HostileReference* pHostileReference)
|
|||
data.appendPackGUID(pHostileReference->getUnitGuid());
|
||||
SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
void Unit::StopAttackFaction(uint32 faction_id)
|
||||
{
|
||||
if (Unit* victim = getVictim())
|
||||
{
|
||||
if (victim->getFactionTemplateEntry()->faction==faction_id)
|
||||
{
|
||||
AttackStop();
|
||||
if (IsNonMeleeSpellCasted(false))
|
||||
InterruptNonMeleeSpells(false);
|
||||
|
||||
// melee and ranged forced attack cancel
|
||||
if (GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)this)->SendAttackSwingCancelAttack();
|
||||
}
|
||||
}
|
||||
|
||||
AttackerSet const& attackers = getAttackers();
|
||||
for(AttackerSet::const_iterator itr = attackers.begin(); itr != attackers.end();)
|
||||
{
|
||||
if ((*itr)->getFactionTemplateEntry()->faction==faction_id)
|
||||
{
|
||||
(*itr)->AttackStop();
|
||||
itr = attackers.begin();
|
||||
}
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
|
||||
getHostileRefManager().deleteReferencesForFaction(faction_id);
|
||||
|
||||
if(Pet* pet = GetPet())
|
||||
pet->StopAttackFaction(faction_id);
|
||||
if(Unit* charm = GetCharm())
|
||||
charm->StopAttackFaction(faction_id);
|
||||
|
||||
for(GuardianPetList::const_iterator itr = m_guardianPets.begin(); itr != m_guardianPets.end(); ++itr)
|
||||
if(Unit* guardian = Unit::GetUnit(*this,*itr))
|
||||
guardian->StopAttackFaction(faction_id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue