aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp54
1 files changed, 35 insertions, 19 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 18de56321de..6acd2e077c7 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -593,25 +593,6 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
((Creature*)pVictim)->SetLootRecipient(this);
if (health <= damage)
{
- // battleground things
- if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround()))
- {
- Player *killed = ((Player*)pVictim);
- Player *killer = NULL;
- if(GetTypeId() == TYPEID_PLAYER)
- killer = ((Player*)this);
- else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
- {
- Unit *owner = GetOwner();
- if(owner && owner->GetTypeId() == TYPEID_PLAYER)
- killer = ((Player*)owner);
- }
-
- if(killer)
- if(BattleGround *bg = killed->GetBattleGround())
- bg->HandleKillPlayer(killed, killer); // drop flags and etc
- }
-
DEBUG_LOG("DealDamage: victim just died");
// find player: owner of controlled `this` or `this` itself maybe
@@ -750,6 +731,25 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
he->DuelComplete(DUEL_INTERUPTED);
}
+
+ // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
+ if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround()))
+ {
+ Player *killed = ((Player*)pVictim);
+ Player *killer = NULL;
+ if(GetTypeId() == TYPEID_PLAYER)
+ killer = ((Player*)this);
+ else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
+ {
+ Unit *owner = GetOwner();
+ if(owner && owner->GetTypeId() == TYPEID_PLAYER)
+ killer = ((Player*)owner);
+ }
+
+ if(killer)
+ if(BattleGround *bg = killed->GetBattleGround())
+ bg->HandleKillPlayer(killed, killer); // drop flags and etc
+ }
}
else // if (health <= damage)
{
@@ -4143,6 +4143,22 @@ void Unit::RemoveAllAuras()
}
}
+void Unit::RemoveArenaAuras(bool onleave)
+{
+ // in join, remove positive buffs, on end, remove negative
+ // used to remove positive visible auras in arenas
+ for(AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
+ {
+ if ( !(iter->second->GetSpellProto()->AttributesEx4 & (1<<21)) // don't remove stances, shadowform, pally/hunter auras
+ && !iter->second->IsPassive() // don't remove passive auras
+ && (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) || !(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNK8)) // not unaffected by invulnerability auras or not having that unknown flag (that seemed the most probable)
+ && (iter->second->IsPositive() ^ onleave)) // remove positive buffs on enter, negative buffs on leave
+ RemoveAura(iter);
+ else
+ ++iter;
+ }
+}
+
void Unit::RemoveAllAurasOnDeath()
{
// used just after dieing to remove all visible auras