aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/SpellAuras.cpp32
-rw-r--r--src/game/SpellAuras.h1
-rw-r--r--src/game/Unit.cpp6
3 files changed, 38 insertions, 1 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index a81ab666cfd..1a3188aacb4 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -204,6 +204,38 @@ void AuraApplication::ClientUpdate(bool remove)
m_target->SendMessageToSet(&data, true);
}
+void AuraApplication::ConstructAuraInfo(ByteBuffer &data)
+{
+ m_needClientUpdate = false;
+
+ data << uint8(m_slot);
+
+ if(!m_target->GetVisibleAura(m_slot))
+ {
+ data << uint32(0);
+ sLog.outDebug("Aura %u removed slot %u",GetBase()->GetId(), m_slot);
+ return;
+ }
+
+ Aura const * aura = GetBase();
+ data << uint32(aura->GetId());
+ uint32 flags = m_flags;
+ if (aura->GetMaxDuration() > 0)
+ flags |= AFLAG_DURATION;
+ data << uint8(flags);
+ data << uint8(aura->GetCasterLevel());
+ data << uint8(aura->GetStackAmount() > 1 ? aura->GetStackAmount() : (aura->GetCharges()) ? aura->GetCharges() : 1);
+
+ if(!(flags & AFLAG_CASTER))
+ data.appendPackGUID(aura->GetCasterGUID());
+
+ if(flags & AFLAG_DURATION)
+ {
+ data << uint32(aura->GetMaxDuration());
+ data << uint32(aura->GetDuration());
+ }
+}
+
Aura * Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID)
{
assert(spellproto);
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index b83d19f2310..309e646edcc 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -72,6 +72,7 @@ class AuraApplication
void SetNeedClientUpdate() { m_needClientUpdate = true;}
bool IsNeedClientUpdate() const { return m_needClientUpdate;}
void ClientUpdate(bool remove = false);
+ void ConstructAuraInfo(ByteBuffer &);
};
class TRINITY_DLL_SPEC Aura
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 195bc6230ee..c454353955c 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3242,9 +3242,13 @@ void Unit::_UpdateSpells( uint32 time )
++i;
}
+ WorldPacket data(SMSG_AURA_UPDATE, 50);
+ data.append(GetPackGUID());
for (VisibleAuraMap::iterator itr = m_visibleAuras.begin(); itr != m_visibleAuras.end(); ++itr)
if (itr->second->IsNeedClientUpdate())
- itr->second->ClientUpdate();
+ itr->second->ConstructAuraInfo(data);
+
+ SendMessageToSet(&data, true);
_DeleteRemovedAuras();