diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp
index e08c8ec972..a81c963115 100644
--- a/src/server/game/Handlers/SpellHandler.cpp
+++ b/src/server/game/Handlers/SpellHandler.cpp
@@ -39,6 +39,7 @@
#include "SpellMgr.h"
#include "SpellPackets.h"
#include "Totem.h"
+#include "TotemPackets.h"
#include "World.h"
#include "WorldPacket.h"
@@ -415,26 +416,20 @@ void WorldSession::HandleCancelChanneling(WorldPacket& recvData)
mover->InterruptSpell(CURRENT_CHANNELED_SPELL);
}
-void WorldSession::HandleTotemDestroyed(WorldPacket& recvPacket)
+void WorldSession::HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& packet)
{
// ignore for remote control state
if (_player->IsCharming())
return;
- uint8 slotId;
- uint64 guid;
- recvPacket >> slotId;
- recvPacket >> guid;
-
- ++slotId;
- if (slotId >= MAX_TOTEM_SLOT)
+ if (packet.Slot +1 >= MAX_TOTEM_SLOT)
return;
- if (!_player->m_SummonSlot[slotId])
+ if (!_player->m_SummonSlot[packet.Slot + 1])
return;
- Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[slotId]);
- if (totem && totem->IsTotem() && totem->GetGUID() == guid)
+ Creature* totem = ObjectAccessor::GetCreature(*GetPlayer(), _player->m_SummonSlot[packet.Slot + 1]);
+ if (totem && totem->IsTotem() && totem->GetGUID() == packet.TotemGUID)
totem->ToTotem()->UnSummon();
}
diff --git a/src/server/game/Server/Packets/AllPackets.h b/src/server/game/Server/Packets/AllPackets.h
index ab8b8530e1..0a3e17613a 100644
--- a/src/server/game/Server/Packets/AllPackets.h
+++ b/src/server/game/Server/Packets/AllPackets.h
@@ -42,6 +42,7 @@
#include "SpellPackets.h"
#include "SystemPackets.h"
#include "TicketPackets.h"
+#include "TotemPackets.h"
#include "TradePackets.h"
#include "VehiclePackets.h"
#include "WhoPackets.h"
diff --git a/src/server/game/Server/Packets/TotemPackets.cpp b/src/server/game/Server/Packets/TotemPackets.cpp
new file mode 100644
index 0000000000..c47b40a0a7
--- /dev/null
+++ b/src/server/game/Server/Packets/TotemPackets.cpp
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#include "TotemPackets.h"
+
+WorldPacket const* WorldPackets::Totem::TotemCreated::Write()
+{
+ _worldPacket << uint8(Slot);
+ _worldPacket << Totem;
+ _worldPacket << int32(Duration);
+ _worldPacket << int32(SpellID);
+
+ return &_worldPacket;
+}
+
+void WorldPackets::Totem::TotemDestroyed::Read()
+{
+ _worldPacket >> Slot;
+ _worldPacket >> TotemGUID;
+}
diff --git a/src/server/game/Server/Packets/TotemPackets.h b/src/server/game/Server/Packets/TotemPackets.h
new file mode 100644
index 0000000000..2ccc8faa00
--- /dev/null
+++ b/src/server/game/Server/Packets/TotemPackets.h
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see .
+ */
+
+#ifndef TotemPackets_h__
+#define TotemPackets_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+namespace WorldPackets
+{
+ namespace Totem
+ {
+ class TotemCreated final : public ServerPacket
+ {
+ public:
+ TotemCreated() : ServerPacket(SMSG_TOTEM_CREATED, 8 + 4 + 4 + 1) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid Totem;
+ int32 SpellID = 0;
+ int32 Duration = 0;
+ uint8 Slot = 0;
+ };
+
+ class TotemDestroyed final : public ClientPacket
+ {
+ public:
+ TotemDestroyed(WorldPacket&& packet) : ClientPacket(CMSG_TOTEM_DESTROYED, std::move(packet)) { }
+
+ void Read() override;
+
+ ObjectGuid TotemGUID;
+ uint8 Slot = 0;
+ };
+ }
+}
+
+#endif // TotemPackets_h__
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index e81c0d9f7a..4b765c354a 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -234,6 +234,11 @@ namespace WorldPackets
class Complaint;
}
+ namespace Totem
+ {
+ class TotemDestroyed;
+ }
+
namespace Trade
{
class AcceptTrade;
@@ -1061,7 +1066,7 @@ class TC_GAME_API WorldSession
void HandleSetActionBarToggles(WorldPacket& recvData);
- void HandleTotemDestroyed(WorldPacket& recvData);
+ void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& packet);
void HandleDismissCritter(WorldPacket& recvData);
//Battleground