aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
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/Server
parent7db5f65f03c87978440f49dc4c0a744883977d82 (diff)
Core/PacketIO: updated totem packets
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/TotemPackets.cpp43
-rw-r--r--src/server/game/Server/Packets/TotemPackets.h66
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp7
-rw-r--r--src/server/game/Server/WorldSession.h9
4 files changed, 119 insertions, 6 deletions
diff --git a/src/server/game/Server/Packets/TotemPackets.cpp b/src/server/game/Server/Packets/TotemPackets.cpp
new file mode 100644
index 00000000000..150e88812ed
--- /dev/null
+++ b/src/server/game/Server/Packets/TotemPackets.cpp
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#include "TotemPackets.h"
+
+void WorldPackets::Totem::TotemDestroyed::Read()
+{
+ _worldPacket >> Slot;
+ _worldPacket >> TotemGUID;
+}
+
+WorldPacket const* WorldPackets::Totem::TotemCreated::Write()
+{
+ _worldPacket << Slot;
+ _worldPacket << Totem;
+ _worldPacket << int32(Duration);
+ _worldPacket << int32(SpellID);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Totem::TotemMoved::Write()
+{
+ _worldPacket << uint8(Slot);
+ _worldPacket << uint8(NewSlot);
+ _worldPacket << Totem;
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/TotemPackets.h b/src/server/game/Server/Packets/TotemPackets.h
new file mode 100644
index 00000000000..519025d4cba
--- /dev/null
+++ b/src/server/game/Server/Packets/TotemPackets.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TotemPackets_h__
+#define TotemPackets_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+namespace WorldPackets
+{
+ namespace Totem
+ {
+ class TotemDestroyed final : public ClientPacket
+ {
+ public:
+ TotemDestroyed(WorldPacket&& packet) : ClientPacket(CMSG_TOTEM_DESTROYED, std::move(packet)) { }
+
+ void Read() override;
+
+ ObjectGuid TotemGUID;
+ uint8 Slot = 0;
+ };
+
+ class TotemCreated final : public ServerPacket
+ {
+ public:
+ TotemCreated() : ServerPacket(SMSG_TOTEM_CREATED, 25) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid Totem;
+ int32 SpellID = 0;
+ int32 Duration = 0;
+ int8 Slot = 0;
+ };
+
+ class TotemMoved final : public ServerPacket
+ {
+ public:
+ TotemMoved() : ServerPacket(SMSG_TOTEM_MOVED, 18) { }
+
+ WorldPacket const* Write() override;
+
+ ObjectGuid Totem;
+ uint8 Slot = 0;
+ uint8 NewSlot = 0;
+ };
+ }
+}
+
+#endif // TotemPackets_h__
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 84df89eddf6..bc2df0d7956 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -52,6 +52,7 @@
#include "Packets/TalentPackets.h"
#include "Packets/TicketPackets.h"
#include "Packets/TokenPackets.h"
+#include "Packets/TotemPackets.h"
#include "Packets/TradePackets.h"
#include "Packets/VehiclePackets.h"
#include "Packets/VoidStoragePackets.h"
@@ -783,7 +784,7 @@ void OpcodeTable::Initialize()
DEFINE_HANDLER(CMSG_TIME_SYNC_RESPONSE_FAILED, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_TOGGLE_DIFFICULTY, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_OPCODE_HANDLER_OLD(CMSG_TOGGLE_PVP, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleTogglePvP );
- DEFINE_OPCODE_HANDLER_OLD(CMSG_TOTEM_DESTROYED, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleTotemDestroyed );
+ DEFINE_HANDLER(CMSG_TOTEM_DESTROYED, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Totem::TotemDestroyed, &WorldSession::HandleTotemDestroyed);
DEFINE_HANDLER(CMSG_TOY_SET_FAVORITE, STATUS_UNHANDLED, PROCESS_INPLACE, WorldPackets::Null, &WorldSession::Handle_NULL);
DEFINE_HANDLER(CMSG_TRAINER_BUY_SPELL, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::NPC::TrainerBuySpell, &WorldSession::HandleTrainerBuySpellOpcode);
DEFINE_HANDLER(CMSG_TRAINER_LIST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::NPC::Hello, &WorldSession::HandleTrainerListOpcode);
@@ -1682,8 +1683,8 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TIME_SYNC_REQUEST, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TITLE_EARNED, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TITLE_LOST, STATUS_NEVER, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_TOTEM_CREATED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_TOTEM_MOVED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_TOTEM_CREATED, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_TOTEM_MOVED, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TRADE_STATUS, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TRADE_UPDATED, STATUS_UNHANDLED, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_TRAINER_BUY_FAILED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index 888bbc522b6..9c092ec98a1 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -28,10 +28,8 @@
#include "AddonMgr.h"
#include "DatabaseEnv.h"
#include "World.h"
-#include "Opcodes.h"
#include "Packet.h"
#include "Cryptography/BigNumber.h"
-#include "Opcodes.h"
#include "AccountMgr.h"
#include <unordered_set>
@@ -525,6 +523,11 @@ namespace WorldPackets
class RequestWowTokenMarketPrice;
}
+ namespace Totem
+ {
+ class TotemDestroyed;
+ }
+
namespace Trade
{
class AcceptTrade;
@@ -1350,7 +1353,7 @@ class WorldSession
void HandleSetActionBarToggles(WorldPackets::Character::SetActionBarToggles& packet);
- void HandleTotemDestroyed(WorldPacket& recvData);
+ void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed& totemDestroyed);
void HandleDismissCritter(WorldPacket& recvData);
//Battleground