aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Server
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-05-01 15:44:43 +0200
committerShauren <shauren.trinity@gmail.com>2015-05-01 15:44:43 +0200
commit68bd33b6549563ac3b719c27aa16cc4ebd33890a (patch)
treef3b12dbac650877fcc2f5cfa3ab714d1de44ddea /src/server/game/Server
parent522ae49c6a17e51826ad7f62d2588e0866eb2639 (diff)
Core/Player: Implemented seamless teleporting
Diffstat (limited to 'src/server/game/Server')
-rw-r--r--src/server/game/Server/Packets/InstancePackets.cpp32
-rw-r--r--src/server/game/Server/Packets/InstancePackets.h52
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp9
-rw-r--r--src/server/game/Server/WorldSession.cpp6
-rw-r--r--src/server/game/Server/WorldSession.h11
5 files changed, 99 insertions, 11 deletions
diff --git a/src/server/game/Server/Packets/InstancePackets.cpp b/src/server/game/Server/Packets/InstancePackets.cpp
new file mode 100644
index 00000000000..50b2a66a8b8
--- /dev/null
+++ b/src/server/game/Server/Packets/InstancePackets.cpp
@@ -0,0 +1,32 @@
+/*
+ * 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 "InstancePackets.h"
+
+WorldPacket const* WorldPackets::Instance::UpdateLastInstance::Write()
+{
+ _worldPacket << uint32(MapID);
+
+ return &_worldPacket;
+}
+
+WorldPacket const* WorldPackets::Instance::UpdateInstanceOwnership::Write()
+{
+ _worldPacket << int32(IOwnInstance);
+
+ return &_worldPacket;
+}
diff --git a/src/server/game/Server/Packets/InstancePackets.h b/src/server/game/Server/Packets/InstancePackets.h
new file mode 100644
index 00000000000..09f6c1efdcb
--- /dev/null
+++ b/src/server/game/Server/Packets/InstancePackets.h
@@ -0,0 +1,52 @@
+/*
+ * 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 InstancePackets_h__
+#define InstancePackets_h__
+
+#include "Packet.h"
+#include "ObjectGuid.h"
+
+namespace WorldPackets
+{
+ namespace Instance
+ {
+ class UpdateLastInstance final : public ServerPacket
+ {
+ public:
+ UpdateLastInstance() : ServerPacket(SMSG_UPDATE_LAST_INSTANCE, 4) { }
+
+ WorldPacket const* Write() override;
+
+ uint32 MapID = 0;
+ };
+
+ // This packet is no longer sent - it is only here for documentation purposes
+ class UpdateInstanceOwnership final : public ServerPacket
+ {
+ public:
+ UpdateInstanceOwnership() : ServerPacket(SMSG_UPDATE_INSTANCE_OWNERSHIP, 4) { }
+
+ WorldPacket const* Write() override;
+
+ int32 IOwnInstance = 0; // Used to control whether "Reset all instances" button appears on the UI - Script_CanShowResetInstances()
+ // but it has been deperecated in favor of simply checking group leader, being inside an instance or using dungeon finder
+ };
+ }
+}
+
+#endif // InstancePackets_h__
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 7805ea84147..82af7f986f6 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -23,8 +23,8 @@
#include "Packets/BankPackets.h"
#include "Packets/BattlegroundPackets.h"
#include "Packets/BlackMarketPackets.h"
-#include "Packets/CharacterPackets.h"
#include "Packets/ChannelPackets.h"
+#include "Packets/CharacterPackets.h"
#include "Packets/ChatPackets.h"
#include "Packets/ClientConfigPackets.h"
#include "Packets/CombatPackets.h"
@@ -33,6 +33,7 @@
#include "Packets/GameObjectPackets.h"
#include "Packets/GuildPackets.h"
#include "Packets/InspectPackets.h"
+#include "Packets/InstancePackets.h"
#include "Packets/ItemPackets.h"
#include "Packets/LootPackets.h"
#include "Packets/MailPackets.h"
@@ -47,9 +48,9 @@
#include "Packets/ScenePackets.h"
#include "Packets/SocialPackets.h"
#include "Packets/TalentPackets.h"
+#include "Packets/TicketPackets.h"
#include "Packets/TokenPackets.h"
#include "Packets/TradePackets.h"
-#include "Packets/TicketPackets.h"
#include "Packets/VehiclePackets.h"
#include "Packets/VoidStoragePackets.h"
#include "Packets/WhoPackets.h"
@@ -1709,8 +1710,8 @@ void OpcodeTable::Initialize()
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_CHARACTER_FLAGS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_DUNGEON_ENCOUNTER_FOR_LOOT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_EXPANSION_LEVEL, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_INSTANCE_OWNERSHIP, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
- DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_LAST_INSTANCE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_INSTANCE_OWNERSHIP, STATUS_NEVER, CONNECTION_TYPE_REALM);
+ DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_LAST_INSTANCE, STATUS_NEVER, CONNECTION_TYPE_REALM);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_OBJECT, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_TALENT_DATA, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
DEFINE_SERVER_OPCODE_HANDLER(SMSG_UPDATE_TASK_PROGRESS, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index db4ec66ea00..fa557616450 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -322,6 +322,10 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
if (IsConnectionIdle())
m_Socket[CONNECTION_TYPE_REALM]->CloseSocket();
+ if (updater.ProcessUnsafe())
+ while (_player && _player->IsBeingTeleportedSeamlessly())
+ HandleMoveWorldportAckOpcode();
+
///- Retrieve packets from the receive queue and call the appropriate handlers
/// not process packets if socket already closed
WorldPacket* packet = NULL;
@@ -453,7 +457,7 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
//check if we are safe to proceed with logout
//logout procedure should happen only in World::UpdateSessions() method!!!
- if (updater.ProcessLogout())
+ if (updater.ProcessUnsafe())
{
time_t currTime = time(NULL);
///- If necessary, log the player out
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index a506c050181..a4b268dc6b9 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -638,8 +638,8 @@ public:
explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) { }
virtual ~PacketFilter() { }
- virtual bool Process(WorldPacket* /*packet*/) { return true; }
- virtual bool ProcessLogout() const { return true; }
+ virtual bool Process(WorldPacket* /*packet*/) = 0;
+ virtual bool ProcessUnsafe() const { return false; }
protected:
WorldSession* const m_pSession;
@@ -656,9 +656,7 @@ public:
explicit MapSessionFilter(WorldSession* pSession) : PacketFilter(pSession) { }
~MapSessionFilter() { }
- virtual bool Process(WorldPacket* packet) override;
- //in Map::Update() we do not process player logout!
- virtual bool ProcessLogout() const override { return false; }
+ bool Process(WorldPacket* packet) override;
};
//class used to filer only thread-unsafe packets from queue
@@ -669,7 +667,8 @@ public:
explicit WorldSessionFilter(WorldSession* pSession) : PacketFilter(pSession) { }
~WorldSessionFilter() { }
- virtual bool Process(WorldPacket* packet) override;
+ bool Process(WorldPacket* packet) override;
+ bool ProcessUnsafe() const override { return true; }
};
struct PacketCounter