mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-31 12:41:55 +00:00 
			
		
		
		
	it compiles again
This commit is contained in:
		| @@ -366,7 +366,7 @@ void ChatPacketHandler::HandleGMLevelUpdate(Packet* packet) { | |||||||
|  |  | ||||||
| void ChatPacketHandler::HandleWho(Packet* packet) { | void ChatPacketHandler::HandleWho(Packet* packet) { | ||||||
| 	CINSTREAM_SKIP_HEADER; | 	CINSTREAM_SKIP_HEADER; | ||||||
| 	FindPlayerRequest request; | 	ChatPackets::FindPlayerRequest request; | ||||||
| 	request.Deserialize(inStream); | 	request.Deserialize(inStream); | ||||||
|  |  | ||||||
| 	const auto& sender = Game::playerContainer.GetPlayerData(request.requestor); | 	const auto& sender = Game::playerContainer.GetPlayerData(request.requestor); | ||||||
| @@ -392,7 +392,7 @@ void ChatPacketHandler::HandleWho(Packet* packet) { | |||||||
|  |  | ||||||
| void ChatPacketHandler::HandleShowAll(Packet* packet) { | void ChatPacketHandler::HandleShowAll(Packet* packet) { | ||||||
| 	CINSTREAM_SKIP_HEADER; | 	CINSTREAM_SKIP_HEADER; | ||||||
| 	ShowAllRequest request; | 	ChatPackets::ShowAllRequest request; | ||||||
| 	request.Deserialize(inStream); | 	request.Deserialize(inStream); | ||||||
|  |  | ||||||
| 	const auto& sender = Game::playerContainer.GetPlayerData(request.requestor); | 	const auto& sender = Game::playerContainer.GetPlayerData(request.requestor); | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| #include "dNetCommon.h" | #include "dNetCommon.h" | ||||||
| #include "BitStream.h" | #include "BitStream.h" | ||||||
| #include "PlayerContainer.h" | #include "PlayerContainer.h" | ||||||
|  | #include "eChatMessageResponseCode.h" | ||||||
|  |  | ||||||
| enum class eAddFriendResponseType : uint8_t; | enum class eAddFriendResponseType : uint8_t; | ||||||
|  |  | ||||||
| @@ -33,15 +34,6 @@ enum class eChatChannel : uint8_t { | |||||||
| }; | }; | ||||||
|  |  | ||||||
|  |  | ||||||
| enum class eChatMessageResponseCode : uint8_t { |  | ||||||
|     SENT = 0, |  | ||||||
|     NOTONLINE, |  | ||||||
|     GENERALERROR, |  | ||||||
|     RECEIVEDNEWWHISPER, |  | ||||||
|     NOTFRIENDS, |  | ||||||
|     SENDERFREETRIAL, |  | ||||||
|     RECEIVERFREETRIAL, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| struct ChatMessage { | struct ChatMessage { | ||||||
| 	LUWString message; | 	LUWString message; | ||||||
|   | |||||||
| @@ -51,7 +51,7 @@ void HandleHTTPAnnounceRequest(HTTPReply& reply, std::string body) { | |||||||
| 		ChatPackets::Announcement announcement; | 		ChatPackets::Announcement announcement; | ||||||
| 		announcement.title = good_data["title"]; | 		announcement.title = good_data["title"]; | ||||||
| 		announcement.message = good_data["message"]; | 		announcement.message = good_data["message"]; | ||||||
| 		announcement.Send(); | 		announcement.Send(UNASSIGNED_SYSTEM_ADDRESS); | ||||||
|  |  | ||||||
| 		reply.status = eHTTPStatusCode::OK; | 		reply.status = eHTTPStatusCode::OK; | ||||||
| 		reply.message = "{\"status\":\"Announcement Sent\"}"; | 		reply.message = "{\"status\":\"Announcement Sent\"}"; | ||||||
|   | |||||||
							
								
								
									
										15
									
								
								dCommon/dEnums/eChatMessageResponseCode.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								dCommon/dEnums/eChatMessageResponseCode.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,15 @@ | |||||||
|  | #ifndef __ECHATMESSAGERESPONSECODES__H__ | ||||||
|  | #define __ECHATMESSAGERESPONSECODES__H__ | ||||||
|  |  | ||||||
|  | #include <cstdint> | ||||||
|  | enum class eChatMessageResponseCode : uint8_t { | ||||||
|  | 	SENT = 0, | ||||||
|  | 	NOTONLINE, | ||||||
|  | 	GENERALERROR, | ||||||
|  | 	RECEIVEDNEWWHISPER, | ||||||
|  | 	NOTFRIENDS, | ||||||
|  | 	SENDERFREETRIAL, | ||||||
|  | 	RECEIVERFREETRIAL, | ||||||
|  | }; | ||||||
|  |  | ||||||
|  | #endif  //!__ECHATMESSAGERESPONSECODES__H__ | ||||||
| @@ -296,15 +296,12 @@ namespace GMGreaterThanZeroCommands { | |||||||
| 		if (!splitArgs.empty() && !splitArgs.at(0).empty()) displayZoneData = splitArgs.at(0) == "1"; | 		if (!splitArgs.empty() && !splitArgs.at(0).empty()) displayZoneData = splitArgs.at(0) == "1"; | ||||||
| 		if (splitArgs.size() > 1) displayIndividualPlayers = splitArgs.at(1) == "1"; | 		if (splitArgs.size() > 1) displayIndividualPlayers = splitArgs.at(1) == "1"; | ||||||
|  |  | ||||||
| 		ShowAllRequest request { | 		ChatPackets::ShowAllRequest request; | ||||||
| 			.requestor = entity->GetObjectID(), | 		request.requestor = entity->GetObjectID(); | ||||||
| 			.displayZoneData = displayZoneData, | 		request.displayZoneData = displayZoneData; | ||||||
| 			.displayIndividualPlayers = displayIndividualPlayers | 		request.displayIndividualPlayers = displayIndividualPlayers; | ||||||
| 		}; |  | ||||||
|  |  | ||||||
| 		CBITSTREAM; | 		request.Send(Game::chatSysAddr); | ||||||
| 		request.Serialize(bitStream); |  | ||||||
| 		Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args) { | 	void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args) { | ||||||
| @@ -313,14 +310,11 @@ namespace GMGreaterThanZeroCommands { | |||||||
| 			return; | 			return; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		FindPlayerRequest request { | 		ChatPackets::FindPlayerRequest request; | ||||||
| 			.requestor = entity->GetObjectID(), | 		request.requestor = entity->GetObjectID(); | ||||||
| 			.playerName = LUWString(args) | 		request.playerName = LUWString(args); | ||||||
| 		}; |  | ||||||
|  |  | ||||||
| 		CBITSTREAM; | 		request.Send(Game::chatSysAddr); | ||||||
| 		request.Serialize(bitStream); |  | ||||||
| 		Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args) { | 	void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args) { | ||||||
|   | |||||||
| @@ -46,10 +46,15 @@ namespace ChatPackets { | |||||||
| 		bitStream.Write(playerObjectID); // senderID | 		bitStream.Write(playerObjectID); // senderID | ||||||
| 		bitStream.Write<uint16_t>(0); // sourceID | 		bitStream.Write<uint16_t>(0); // sourceID | ||||||
| 		bitStream.Write(responseCode); | 		bitStream.Write(responseCode); | ||||||
| 		bitStream.Write(message) | 		bitStream.Write(message); | ||||||
| 		 | 		 | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	bool ChatMessage::Deserialize(RakNet::BitStream& inStream) { | ||||||
|  | 		//TODO: Implement this | ||||||
|  | 		return false; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	void SendSystemMessage(const SystemAddress& sysAddr, const std::u16string& message, const bool broadcast) { | 	void SendSystemMessage(const SystemAddress& sysAddr, const std::u16string& message, const bool broadcast) { | ||||||
| 		CBITSTREAM; | 		CBITSTREAM; | ||||||
| 		BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, MessageType::Chat::GENERAL_CHAT_MESSAGE); | 		BitStreamUtils::WriteHeader(bitStream, eConnectionType::CHAT, MessageType::Chat::GENERAL_CHAT_MESSAGE); | ||||||
|   | |||||||
| @@ -11,6 +11,8 @@ struct SystemAddress; | |||||||
| #include <string> | #include <string> | ||||||
| #include "dCommonVars.h" | #include "dCommonVars.h" | ||||||
| #include "BitStreamUtils.h" | #include "BitStreamUtils.h" | ||||||
|  | #include "MessageType/Chat.h" | ||||||
|  | #include "eChatMessageResponseCode.h" | ||||||
|  |  | ||||||
| enum class eCannedText : uint8_t { | enum class eCannedText : uint8_t { | ||||||
| 	CHAT_DISABLED = 0, | 	CHAT_DISABLED = 0, | ||||||
| @@ -18,6 +20,8 @@ enum class eCannedText : uint8_t { | |||||||
| }; | }; | ||||||
|  |  | ||||||
| namespace ChatPackets { | namespace ChatPackets { | ||||||
|  | 	void SendSystemMessage(const SystemAddress& sysAddr, const std::u16string& message, const bool broadcast = false); | ||||||
|  |  | ||||||
| 	struct ShowAllRequest : public LUBitStream { | 	struct ShowAllRequest : public LUBitStream { | ||||||
| 		LWOOBJID requestor = LWOOBJID_EMPTY; | 		LWOOBJID requestor = LWOOBJID_EMPTY; | ||||||
| 		bool displayZoneData = true; | 		bool displayZoneData = true; | ||||||
| @@ -53,6 +57,8 @@ namespace ChatPackets { | |||||||
| 		bool senderMythran; | 		bool senderMythran; | ||||||
| 		eChatMessageResponseCode responseCode = eChatMessageResponseCode::SENT; | 		eChatMessageResponseCode responseCode = eChatMessageResponseCode::SENT; | ||||||
| 		LUWString message; | 		LUWString message; | ||||||
|  |  | ||||||
|  | 		ChatMessage() : LUBitStream(eConnectionType::CHAT, MessageType::Chat::GENERAL_CHAT_MESSAGE) {}; | ||||||
| 		virtual void Serialize(RakNet::BitStream& bitStream) const override; | 		virtual void Serialize(RakNet::BitStream& bitStream) const override; | ||||||
| 		virtual bool Deserialize(RakNet::BitStream& inStream) override; | 		virtual bool Deserialize(RakNet::BitStream& inStream) override; | ||||||
| 	}; | 	}; | ||||||
|   | |||||||
| @@ -1319,7 +1319,7 @@ void HandlePacket(Packet* packet) { | |||||||
|  |  | ||||||
| 	case MessageType::World::GENERAL_CHAT_MESSAGE: { | 	case MessageType::World::GENERAL_CHAT_MESSAGE: { | ||||||
| 		if (chatDisabled) { | 		if (chatDisabled) { | ||||||
| 			ChatPackets::SendMessageFail(packet->systemAddress); | 			ChatPackets::MessageFailure().Send(packet->systemAddress); | ||||||
| 		} else { | 		} else { | ||||||
| 			auto chatMessage = ClientPackets::HandleChatMessage(packet); | 			auto chatMessage = ClientPackets::HandleChatMessage(packet); | ||||||
| 			// TODO: Find a good home for the logic in this case. | 			// TODO: Find a good home for the logic in this case. | ||||||
| @@ -1342,7 +1342,16 @@ void HandlePacket(Packet* packet) { | |||||||
|  |  | ||||||
| 			std::string sMessage = GeneralUtils::UTF16ToWTF8(chatMessage.message); | 			std::string sMessage = GeneralUtils::UTF16ToWTF8(chatMessage.message); | ||||||
| 			LOG("%s: %s", playerName.c_str(), sMessage.c_str()); | 			LOG("%s: %s", playerName.c_str(), sMessage.c_str()); | ||||||
| 			ChatPackets::SendChatMessage(packet->systemAddress, chatMessage.chatChannel, playerName, user->GetLoggedInChar(), isMythran, chatMessage.message); | 			//(packet->systemAddress, chatMessage.chatChannel, playerName, user->GetLoggedInChar(), isMythran, chatMessage.message); | ||||||
|  |  | ||||||
|  | 			ChatPackets::ChatMessage outChatMessage;  | ||||||
|  | 			outChatMessage.chatChannel = chatMessage.chatChannel; | ||||||
|  | 			outChatMessage.message = chatMessage.message; | ||||||
|  | 			outChatMessage.senderMythran = isMythran; | ||||||
|  | 			outChatMessage.senderName = playerName; | ||||||
|  | 			outChatMessage.playerObjectID = user->GetLoggedInChar(); | ||||||
|  | 			outChatMessage.Send(packet->systemAddress); | ||||||
|  |  | ||||||
| 			{ | 			{ | ||||||
| 				// TODO: make it so we don't write this manually, but instead use a proper read and writes | 				// TODO: make it so we don't write this manually, but instead use a proper read and writes | ||||||
| 				// aka: this is awful and should be fixed, but I can't be bothered to do it right now | 				// aka: this is awful and should be fixed, but I can't be bothered to do it right now | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Aaron Kimbre
					Aaron Kimbre