Breakout message identifiers (#1065)

and make them scope enums
This commit is contained in:
Aaron Kimbrell
2023-05-03 16:38:32 -05:00
committed by GitHub
parent c17b5fa586
commit e297aacc68
43 changed files with 1131 additions and 1066 deletions

View File

@@ -1,22 +1,23 @@
#include "MasterPackets.h"
#include "BitStream.h"
#include "PacketUtils.h"
#include "dMessageIdentifiers.h"
#include "dCommonVars.h"
#include "dServer.h"
#include "eConnectionType.h"
#include "eMasterMessageType.h"
#include <string>
void MasterPackets::SendPersistentIDRequest(dServer* server, uint64_t requestID) {
CBITSTREAM;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_PERSISTENT_ID);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::REQUEST_PERSISTENT_ID);
bitStream.Write(requestID);
server->SendToMaster(&bitStream);
}
void MasterPackets::SendPersistentIDResponse(dServer* server, const SystemAddress& sysAddr, uint64_t requestID, uint32_t objID) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_PERSISTENT_ID_RESPONSE);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::REQUEST_PERSISTENT_ID_RESPONSE);
bitStream.Write(requestID);
bitStream.Write(objID);
@@ -26,7 +27,7 @@ void MasterPackets::SendPersistentIDResponse(dServer* server, const SystemAddres
void MasterPackets::SendZoneTransferRequest(dServer* server, uint64_t requestID, bool mythranShift, uint32_t zoneID, uint32_t cloneID) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_ZONE_TRANSFER);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::REQUEST_ZONE_TRANSFER);
bitStream.Write(requestID);
bitStream.Write(static_cast<uint8_t>(mythranShift));
@@ -38,7 +39,7 @@ void MasterPackets::SendZoneTransferRequest(dServer* server, uint64_t requestID,
void MasterPackets::SendZoneCreatePrivate(dServer* server, uint32_t zoneID, uint32_t cloneID, const std::string& password) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_CREATE_PRIVATE_ZONE);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::CREATE_PRIVATE_ZONE);
bitStream.Write(zoneID);
bitStream.Write(cloneID);
@@ -53,7 +54,7 @@ void MasterPackets::SendZoneCreatePrivate(dServer* server, uint32_t zoneID, uint
void MasterPackets::SendZoneRequestPrivate(dServer* server, uint64_t requestID, bool mythranShift, const std::string& password) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_PRIVATE_ZONE);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::REQUEST_PRIVATE_ZONE);
bitStream.Write(requestID);
bitStream.Write(static_cast<uint8_t>(mythranShift));
@@ -68,7 +69,7 @@ void MasterPackets::SendZoneRequestPrivate(dServer* server, uint64_t requestID,
void MasterPackets::SendWorldReady(dServer* server, LWOMAPID zoneId, LWOINSTANCEID instanceId) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_WORLD_READY);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::WORLD_READY);
bitStream.Write(zoneId);
bitStream.Write(instanceId);
@@ -78,7 +79,7 @@ void MasterPackets::SendWorldReady(dServer* server, LWOMAPID zoneId, LWOINSTANCE
void MasterPackets::SendZoneTransferResponse(dServer* server, const SystemAddress& sysAddr, uint64_t requestID, bool mythranShift, uint32_t zoneID, uint32_t zoneInstance, uint32_t zoneClone, const std::string& serverIP, uint32_t serverPort) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_REQUEST_ZONE_TRANSFER_RESPONSE);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::REQUEST_ZONE_TRANSFER_RESPONSE);
bitStream.Write(requestID);
bitStream.Write(static_cast<uint8_t>(mythranShift));
@@ -110,7 +111,7 @@ void MasterPackets::HandleServerInfo(Packet* packet) {
void MasterPackets::SendServerInfo(dServer* server, Packet* packet) {
RakNet::BitStream bitStream;
PacketUtils::WriteHeader(bitStream, MASTER, MSG_MASTER_SERVER_INFO);
PacketUtils::WriteHeader(bitStream, eConnectionType::MASTER, eMasterMessageType::SERVER_INFO);
bitStream.Write(server->GetPort());
bitStream.Write(server->GetZoneID());