From 20e89820756f8057c53741aa4e3c81c855a70dd8 Mon Sep 17 00:00:00 2001 From: balrok Date: Tue, 20 Oct 2009 18:53:16 +0200 Subject: [PATCH] [8690] added unit auraFlag variable this can be used for faster checking if an unit has a specific aura applied.. also implemented the alive-invisible auras now with this way --- src/game/SpellAuras.cpp | 10 ++++++++++ src/game/Unit.cpp | 5 ++--- src/game/Unit.h | 8 ++++++++ src/shared/revision_nr.h | 2 +- 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 1e2d83ec8..4faf8b9e0 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2467,6 +2467,16 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->PlayDirectSound(14972, (Player *)m_target); } return; + case 10848: + case 36978: + case 40131: + case 27978: + case 33900: + if (apply) + m_target->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE; + else + m_target->m_AuraFlags |= ~UNIT_AURAFLAG_ALIVE_INVISIBLE; + return; } break; } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 5ef95104a..35d60cb5c 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -104,6 +104,7 @@ Unit::Unit() //m_AurasCheck = 2000; //m_removeAuraTimer = 4; m_AurasUpdateIterator = m_Auras.end(); + m_AuraFlags = 0; m_Visibility = VISIBILITY_ON; @@ -10627,9 +10628,7 @@ bool Unit::isVisibleForInState( Player const* u, WorldObject const* viewPoint, b /// returns true if creature can't be seen by alive units bool Unit::isInvisibleForAlive() const { - // TODO: more generic check for those auras - // TODO: maybe we also don't need an isAlive() check for visibilty.. but only those auras - if (HasAura(10848) || HasAura(36978) || HasAura(40131) || HasAura(27978) || HasAura(33900)) + if (m_AuraFlags & UNIT_AURAFLAG_ALIVE_INVISIBLE) return true; // TODO: maybe spiritservices also have just an aura return isSpiritService(); diff --git a/src/game/Unit.h b/src/game/Unit.h index eb13fe3ff..95a062647 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -469,6 +469,12 @@ enum DamageEffectType SELF_DAMAGE = 5 }; +/// internal used flags for marking special auras - for example some dummy-auras +enum UnitAuraFlags +{ + UNIT_AURAFLAG_ALIVE_INVISIBLE = 0x1, // aura which makes unit invisible for alive +}; + enum UnitVisibility { VISIBILITY_OFF = 0, // absolute, not detectable, GM-like, can see all other @@ -1390,6 +1396,8 @@ class MANGOS_DLL_SPEC Unit : public WorldObject Aura* GetDummyAura(uint32 spell_id) const; + uint32 m_AuraFlags; + uint32 GetDisplayId() { return GetUInt32Value(UNIT_FIELD_DISPLAYID); } void SetDisplayId(uint32 modelId); uint32 GetNativeDisplayId() { return GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID); } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index e8e9dcb9d..7c2aa67bf 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8689" + #define REVISION_NR "8690" #endif // __REVISION_NR_H__