From 93d0186a253885ad775e500d1dce30633c298433 Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Thu, 21 Mar 2024 19:08:06 -0500 Subject: [PATCH] it compiles --- dChatServer/ChatPacketHandler.h | 1 + dChatServer/ChatServer.cpp | 18 +++++------------- dChatServer/PlayerContainer.cpp | 1 + dCommon/dEnums/eChatMessageType.h | 1 + dGame/dComponents/ActivityComponent.cpp | 1 + dWorldServer/WorldServer.cpp | 6 +++--- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/dChatServer/ChatPacketHandler.h b/dChatServer/ChatPacketHandler.h index 2cf5ea2f..dd9dd59b 100644 --- a/dChatServer/ChatPacketHandler.h +++ b/dChatServer/ChatPacketHandler.h @@ -4,6 +4,7 @@ #include "BitStream.h" struct PlayerData; +struct TeamData; enum class eAddFriendResponseType : uint8_t; diff --git a/dChatServer/ChatServer.cpp b/dChatServer/ChatServer.cpp index ad2b17c7..2f75721f 100644 --- a/dChatServer/ChatServer.cpp +++ b/dChatServer/ChatServer.cpp @@ -187,6 +187,7 @@ void HandlePacket(Packet* packet) { LOG("A server is connecting, awaiting user list."); } if (packet->length < 4) return; // Nothing left to process. Need 4 bytes to continue. + CINSTREAM; inStream.SetReadOffset(BYTES_TO_BITS(1)); @@ -199,12 +200,10 @@ void HandlePacket(Packet* packet) { switch (chatMessageID) { case eChatMessageType::GM_MUTE: - // verif internal Game::playerContainer.MuteUpdate(packet); break; case eChatMessageType::CREATE_TEAM: - // verif internal Game::playerContainer.CreateTeamServer(packet); break; case eChatMessageType::GET_FRIENDS_LIST: @@ -277,30 +276,24 @@ void HandlePacket(Packet* packet) { ChatPacketHandler::HandleTeamLootOption(packet); break; case eChatMessageType::GMLEVEL_UPDATE: - // verify internal ChatPacketHandler::HandleGMLevelUpdate(packet); break; case eChatMessageType::WHO: - // verify internal ChatPacketHandler::HandleWho(packet); break; case eChatMessageType::SHOW_ALL: - // verify internal ChatPacketHandler::HandleShowAll(packet); break; case eChatMessageType::LOGIN_SESSION_NOTIFY: - // verify internal Game::playerContainer.InsertPlayer(packet); break; case eChatMessageType::GM_ANNOUNCE:{ - // verify internal //we just forward this packet to every connected server CINSTREAM; - Game::server->Send(&inStream, packet->systemAddress, true); //send to everyone except origin + Game::server->Send(inStream, packet->systemAddress, true); //send to everyone except origin } break; case eChatMessageType::UNEXPECTED_DISCONNECT: - // verify internal Game::playerContainer.RemovePlayer(packet); break; case eChatMessageType::USER_CHANNEL_CHAT_MESSAGE: @@ -346,14 +339,13 @@ void HandlePacket(Packet* packet) { case eChatMessageType::PRG_CSR_COMMAND: case eChatMessageType::HEARTBEAT_REQUEST_FROM_WORLD: case eChatMessageType::UPDATE_FREE_TRIAL_STATUS: - LOG("Unhandled CHAT Message id: %s (%i)", StringifiedEnum::ToString(chat_message_type).data(), chat_message_type); + LOG("Unhandled CHAT Message id: %s (%i)", StringifiedEnum::ToString(chatMessageID).data(), chatMessageID); break; default: - LOG("Unknown CHAT Message id: %i", chat_message_type); - } + LOG("Unknown CHAT Message id: %i", chatMessageID); } - if (static_cast(packet->data[1]) == eConnectionType::WORLD) { + if (connection == eConnectionType::WORLD) { switch (static_cast(packet->data[3])) { case eWorldMessageType::ROUTE_PACKET: { LOG("Routing packet from world"); diff --git a/dChatServer/PlayerContainer.cpp b/dChatServer/PlayerContainer.cpp index e449fcde..9773a41c 100644 --- a/dChatServer/PlayerContainer.cpp +++ b/dChatServer/PlayerContainer.cpp @@ -12,6 +12,7 @@ #include "eGameMasterLevel.h" #include "ChatPackets.h" #include "dConfig.h" +#include "eChatMessageType.h" void PlayerContainer::Initialize() { m_MaxNumberOfBestFriends = diff --git a/dCommon/dEnums/eChatMessageType.h b/dCommon/dEnums/eChatMessageType.h index 30250272..38cd86de 100644 --- a/dCommon/dEnums/eChatMessageType.h +++ b/dCommon/dEnums/eChatMessageType.h @@ -74,6 +74,7 @@ enum class eChatMessageType :uint32_t { HEARTBEAT_REQUEST_FROM_WORLD, UPDATE_FREE_TRIAL_STATUS, // CUSTOM DLU MESSAGE ID FOR INTERNAL USE + CREATE_TEAM, }; #endif //!__ECHATMESSAGETYPE__H__ diff --git a/dGame/dComponents/ActivityComponent.cpp b/dGame/dComponents/ActivityComponent.cpp index 818d36b5..8bc87a01 100644 --- a/dGame/dComponents/ActivityComponent.cpp +++ b/dGame/dComponents/ActivityComponent.cpp @@ -21,6 +21,7 @@ #include "eMissionTaskType.h" #include "eMatchUpdate.h" #include "eConnectionType.h" +#include "eChatMessageType.h" #include "CDCurrencyTableTable.h" #include "CDActivityRewardsTable.h" diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index c434f8de..db5368d8 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -820,7 +820,7 @@ void HandlePacket(Packet* packet) { { CBITSTREAM; - BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::PLAYER_REMOVED_NOTIFICATION); + BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::UNEXPECTED_DISCONNECT); bitStream.Write(user->GetLoggedInChar()); Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false); } @@ -989,7 +989,7 @@ void HandlePacket(Packet* packet) { // This means we swapped characters and we need to remove the previous player from the container. if (static_cast(lastCharacter) != playerID) { CBITSTREAM; - BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::PLAYER_REMOVED_NOTIFICATION); + BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::UNEXPECTED_DISCONNECT); bitStream.Write(lastCharacter); Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false); } @@ -1135,7 +1135,7 @@ void HandlePacket(Packet* packet) { const auto& playerName = character->GetName(); CBITSTREAM; - BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::PLAYER_ADDED_NOTIFICATION); + BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT_INTERNAL, eChatMessageType::LOGIN_SESSION_NOTIFY); bitStream.Write(player->GetObjectID()); bitStream.Write(playerName.size()); for (size_t i = 0; i < playerName.size(); i++) {