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 b489ee59f8
commit 527f54488b
14 changed files with 1509 additions and 533 deletions

View File

@@ -1,4 +1,5 @@
#include "HydrantBroken.h"
#include "PetMessages.h"
#include "EntityManager.h"
#include "GameMessages.h"
@@ -12,7 +13,10 @@ void HydrantBroken::OnStartup(Entity* self) {
for (auto* bouncer : bouncers) {
self->SetVar<LWOOBJID>(u"bouncer", bouncer->GetObjectID());
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::BouncerActiveStatus msg;
msg.target = bouncer->GetObjectID();
msg.bActive = true;
msg.Send(UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"enableCollision", UNASSIGNED_SYSTEM_ADDRESS);
}
@@ -25,7 +29,10 @@ void HydrantBroken::OnTimerDone(Entity* self, std::string timerName) {
auto* bouncer = Game::entityManager->GetEntity(self->GetVar<LWOOBJID>(u"bouncer"));
if (bouncer != nullptr) {
GameMessages::SendBouncerActiveStatus(bouncer->GetObjectID(), false, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::BouncerActiveStatus msg;
msg.target = bouncer->GetObjectID();
msg.bActive = false;
msg.Send(UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::SendNotifyObject(bouncer->GetObjectID(), self->GetObjectID(), u"disableCollision", UNASSIGNED_SYSTEM_ADDRESS);
}

View File

@@ -1,4 +1,5 @@
#include "CatapultBaseServer.h"
#include "PetMessages.h"
#include "GameMessages.h"
#include "EntityManager.h"
#include "Entity.h"
@@ -12,7 +13,10 @@ void CatapultBaseServer::OnNotifyObject(Entity* self, Entity* sender, const std:
// set the bouncer so we can use it later
self->SetVar(u"Bouncer", sender->GetObjectID());
GameMessages::SendBouncerActiveStatus(sender->GetObjectID(), true, UNASSIGNED_SYSTEM_ADDRESS);
GameMessages::BouncerActiveStatus msg;
msg.target = sender->GetObjectID();
msg.bActive = true;
msg.Send(UNASSIGNED_SYSTEM_ADDRESS);
}
}