aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorjoschiwald <joschiwald.trinity@gmail.com>2015-07-26 15:09:00 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2015-07-26 15:09:00 +0200
commit5c813f6f028aa36c374d7039fd1186802bc8e8af (patch)
treea2bd214f21e305a0bccbe2b0369199326166911c /src/server/game/Entities
parent7db5f65f03c87978440f49dc4c0a744883977d82 (diff)
Core/PacketIO: updated totem packets
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index 81232bf23d8..3dea9368bf8 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -19,12 +19,11 @@
#include "Totem.h"
#include "Group.h"
#include "ObjectMgr.h"
-#include "Opcodes.h"
#include "Player.h"
#include "SpellHistory.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
-#include "WorldPacket.h"
+#include "TotemPackets.h"
Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner, false)
{
@@ -55,19 +54,20 @@ void Totem::Update(uint32 time)
void Totem::InitStats(uint32 duration)
{
// client requires SMSG_TOTEM_CREATED to be sent before adding to world and before removing old totem
- if (GetOwner()->GetTypeId() == TYPEID_PLAYER
- && m_Properties->Slot >= SUMMON_SLOT_TOTEM
- && m_Properties->Slot < MAX_TOTEM_SLOT)
+ if (Player* owner = GetOwner()->ToPlayer())
{
- WorldPacket data(SMSG_TOTEM_CREATED, 1 + 8 + 4 + 4);
- data << uint8(m_Properties->Slot - 1);
- data << GetGUID();
- data << uint32(duration);
- data << uint32(GetUInt32Value(UNIT_CREATED_BY_SPELL));
- GetOwner()->ToPlayer()->SendDirectMessage(&data);
+ if (m_Properties->Slot >= SUMMON_SLOT_TOTEM && m_Properties->Slot < MAX_TOTEM_SLOT)
+ {
+ WorldPackets::Totem::TotemCreated data;
+ data.Totem = GetGUID();
+ data.Slot = m_Properties->Slot - SUMMON_SLOT_TOTEM;
+ data.Duration = duration;
+ data.SpellID = GetUInt32Value(UNIT_CREATED_BY_SPELL);
+ owner->SendDirectMessage(data.Write());
+ }
// set display id depending on caster's race
- SetDisplayId(GetOwner()->GetModelForTotem(PlayerTotemType(m_Properties->ID)));
+ SetDisplayId(owner->GetModelForTotem(PlayerTotemType(m_Properties->ID)));
}
Minion::InitStats(duration);