refactor: pet game messages as structs

Converts the pet taming minigame, naming, command and bouncer messages to
NetGameMsgs in PetMessages.{h,cpp}: NotifyPetTamingMinigame,
NotifyTamingModelLoadedOnServer, NotifyPetTamingPuzzleSelected,
PetTamingTryBuildResult, PetResponse, AddPetToPlayer, RegisterPetID,
RegisterPetDBID, ShowPetActionButton, BouncerActiveStatus, SetPetName,
SetPetNameModerated and PetNameChanged (sent), and PetTamingTryBuild,
NotifyTamingBuildSuccess, RequestSetPetName, StartServerPetMinigameTimer,
ClientExitTamingMinigame, CommandPet and DespawnPet (received, registered
in GameMessageHandler's map; each Handle hands the message to the
player's taming or active PetComponent exactly as the old handler did).
PetComponent, BouncerComponent and the hydrant/catapult scripts build
the structs; the old Send*/Handle* functions and switch cases are gone.
The never-called SendClientExitTamingMinigame is folded into the
ClientExitTamingMinigame struct. MarkInventoryItemAsActive stays with
the inventory messages.

No wire change and no change in recipients. Verified byte for byte
against a frozen verbatim copy of the old functions over an input grid
(to one client and broadcast), received messages compared with the old
handlers' read sequences with every truncated payload rejected, hand
computed golden bytes, round trips, and a mutation check. Layouts
confirmed against the 1.10.64 client's Serialize/Deserialize in Ghidra.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-26 18:44:25 -05:00
parent f5ca541869
commit 795c937bbb
14 changed files with 1509 additions and 533 deletions

View File

@@ -34,6 +34,7 @@
#include "ActivityMessages.h"
#include "RacingMessages.h"
#include "MissionMessages.h"
#include "PetMessages.h"
#include "eMissionTaskType.h"
#include "eReplicaComponentType.h"
#include "ServiceType.h"
@@ -73,6 +74,15 @@ namespace {
{ REQUEST_LINKED_MISSION, []() { return std::make_unique<RequestLinkedMission>(); } },
{ SET_FLAG, []() { return std::make_unique<SetFlag>(); } },
{ HAS_BEEN_COLLECTED, []() { return std::make_unique<HasBeenCollected>(); } },
// Pets
{ PET_TAMING_TRY_BUILD, []() { return std::make_unique<PetTamingTryBuild>(); } },
{ NOTIFY_TAMING_BUILD_SUCCESS, []() { return std::make_unique<NotifyTamingBuildSuccess>(); } },
{ REQUEST_SET_PET_NAME, []() { return std::make_unique<RequestSetPetName>(); } },
{ START_SERVER_PET_MINIGAME_TIMER, []() { return std::make_unique<StartServerPetMinigameTimer>(); } },
{ CLIENT_EXIT_TAMING_MINIGAME, []() { return std::make_unique<ClientExitTamingMinigame>(); } },
{ COMMAND_PET, []() { return std::make_unique<CommandPet>(); } },
{ DESPAWN_PET, []() { return std::make_unique<DespawnPet>(); } },
};
};
@@ -506,35 +516,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream& inStream, const System
GameMessages::HandleClientTradeUpdate(inStream, entity, sysAddr);
break;
// Pets
case MessageType::Game::PET_TAMING_TRY_BUILD:
GameMessages::HandlePetTamingTryBuild(inStream, entity, sysAddr);
break;
case MessageType::Game::NOTIFY_TAMING_BUILD_SUCCESS:
GameMessages::HandleNotifyTamingBuildSuccess(inStream, entity, sysAddr);
break;
case MessageType::Game::REQUEST_SET_PET_NAME:
GameMessages::HandleRequestSetPetName(inStream, entity, sysAddr);
break;
case MessageType::Game::START_SERVER_PET_MINIGAME_TIMER:
GameMessages::HandleStartServerPetMinigameTimer(inStream, entity, sysAddr);
break;
case MessageType::Game::CLIENT_EXIT_TAMING_MINIGAME:
GameMessages::HandleClientExitTamingMinigame(inStream, entity, sysAddr);
break;
case MessageType::Game::COMMAND_PET:
GameMessages::HandleCommandPet(inStream, entity, sysAddr);
break;
case MessageType::Game::DESPAWN_PET:
GameMessages::HandleDespawnPet(inStream, entity, sysAddr);
break;
case MessageType::Game::MESSAGE_BOX_RESPOND:
GameMessages::HandleMessageBoxResponse(inStream, entity, sysAddr);
break;