mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
Every game message still written or read by hand is now a NetGameMsg with Serialize and Deserialize, in per-domain files: - MovementMessages: teleport, platforms (resync and its request), orient to angle, node rotation lock, gravity scale, jetpack mode, control scheme, respawn checkpoint, rails (set/start, ready, cancel, arrived), mount inventory ID, dismount complete, possession ack, ghost reference override and position, camera cycling (eCameraTargetCyclingMode moves here). - ZoneMessages: player loaded (the old PLAYER_LOADED case), ready for updates, player ready, restore to post load stats, server done loading, invalid zone transfer list, zone summary display/dismissed, level processing complete, object world state, and the localized announcement WorldMigration wrote by hand. - PlayerMessages: chat mode, GM level, LEGO score, currency, reputation, GM invis, pickup currency, zone and player statistics, chat commands, bug reports, verify ack. - ObjectMessages: fire event client/server side, notify client (zone) object, notify object, script network vars, failed preconditions, terminate interaction, set name, request use, request server object info. - QuickBuildMessages: notify state, enable, cancel. - ActivityMessages gains match response/update/request, leaderboard request and data, shooting gallery score/rotation/fire, activity state change. - MissionMessages gains MissionDialogueCancelled (a no-op, as before). The wire structs left in GameMessages.h move to their domains (tooltip and emote to Effects, loot and item use to Inventory, model build to Building, behavior sound to Property, skill sets to Skill) and gain the missing direction. The dismount logic moves to PossessorComponent::OnDismountComplete. Every inbound message is registered in the GameMessageHandler map; the switch is gone, and GameMessages.cpp only holds the GameMsg/NetGameMsg base code. Call sites build the structs (NotifyClientObject, TerminateInteraction, Teleport, PlatformResync, FireEventClientSide, NotifyObject and NotifyClientZoneObject get convenience constructors like PlayFXEffect). Dead senders are dropped: SendSetShootingGalleryParams (no callers, field order was a guess), SendTeamPickupItem (the struct already existed), SendRequestActivitySummaryLeaderboardData (the struct covers it). Verified with RemainingMessagesTests: every old Send* function is frozen verbatim in Legacy/RemainingMessagesLegacy.h and compared byte for byte (same bits, destination and broadcast flag) over grids of inputs; every old Handle* read sequence is frozen as a Read* oracle and compared with the struct's Deserialize; round trips, truncation and a golden packet. PlayerLoaded (0x00dc36f0), SetGMLevel (0x00dd6230), MissionDialogueCancelled (0x00d9cc10) and LocalizedAnnouncementServerToSingleClient (0x00f23c50) were checked against the client. Behaviour notes: an inbound message that fails to deserialize is dropped, so ParseChatMessage over MAX_MESSAGE_LENGTH is dropped instead of truncated, and PLAYER_LOADED / READY_FOR_UPDATES / MISSION_DIALOGUE_CANCELLED now read their (unused) client fields. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
113 lines
4.5 KiB
C++
113 lines
4.5 KiB
C++
#ifndef ZONEMESSAGES_H
|
|
#define ZONEMESSAGES_H
|
|
|
|
#include "GameMessages.h"
|
|
#include "eObjectWorldState.h"
|
|
|
|
#include <string>
|
|
|
|
// Game messages for a player's zone lifecycle: loading in, zone summaries, level ups, announcements.
|
|
// Fields are listed in wire order; names follow the client (legouniverse.exe 1.10.64) where known.
|
|
namespace GameMessages {
|
|
// Client -> server. The client finished loading the zone and its player.
|
|
struct PlayerLoaded : public NetGameMsg {
|
|
PlayerLoaded() : NetGameMsg(MessageType::Game::PLAYER_LOADED) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
|
|
|
LWOOBJID playerID{};
|
|
};
|
|
|
|
// Client -> server. The client finished loading an object. Nothing to do.
|
|
struct ReadyForUpdates : public NetGameMsg {
|
|
ReadyForUpdates() : NetGameMsg(MessageType::Game::READY_FOR_UPDATES) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
|
|
LWOOBJID objectID{};
|
|
};
|
|
|
|
// Server -> client, to one client. No payload.
|
|
struct PlayerReady : public NetGameMsg {
|
|
PlayerReady() : NetGameMsg(MessageType::Game::PLAYER_READY) {}
|
|
};
|
|
|
|
// Server -> client, to one client. No payload.
|
|
struct RestoreToPostLoadStats : public NetGameMsg {
|
|
RestoreToPostLoadStats() : NetGameMsg(MessageType::Game::RESTORE_TO_POST_LOAD_STATS) {}
|
|
};
|
|
|
|
// Server -> client, to one client. No payload.
|
|
struct ServerDoneLoadingAllObjects : public NetGameMsg {
|
|
ServerDoneLoadingAllObjects() : NetGameMsg(MessageType::Game::SERVER_DONE_LOADING_ALL_OBJECTS) {}
|
|
};
|
|
|
|
// Server -> client, to one client.
|
|
struct InvalidZoneTransferList : public NetGameMsg {
|
|
InvalidZoneTransferList() : NetGameMsg(MessageType::Game::INVALID_ZONE_TRANSFER_LIST) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
|
|
std::u16string customerFeedbackURL{};
|
|
std::u16string invalidMapTransferList{};
|
|
bool bCustomerFeedbackOnExit{};
|
|
bool bCustomerFeedbackOnInvalidMapTransfer{};
|
|
};
|
|
|
|
// Server -> client, to one client (UNASSIGNED broadcasts).
|
|
struct DisplayZoneSummary : public NetGameMsg {
|
|
DisplayZoneSummary() : NetGameMsg(MessageType::Game::DISPLAY_ZONE_SUMMARY) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
|
|
bool isPropertyMap{ false };
|
|
bool isZoneStart{ false };
|
|
LWOOBJID sender{ LWOOBJID_EMPTY }; // optional
|
|
};
|
|
|
|
// Client -> server.
|
|
struct ZoneSummaryDismissed : public NetGameMsg {
|
|
ZoneSummaryDismissed() : NetGameMsg(MessageType::Game::ZONE_SUMMARY_DISMISSED) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
|
|
|
LWOOBJID playerID{};
|
|
};
|
|
|
|
// Client -> server. No payload. The client finished showing a level up.
|
|
struct NotifyServerLevelProcessingComplete : public NetGameMsg {
|
|
NotifyServerLevelProcessingComplete() : NetGameMsg(MessageType::Game::NOTIFY_SERVER_LEVEL_PROCESSING_COMPLETE) {}
|
|
void Handle(Entity& entity, const SystemAddress& sysAddr) override;
|
|
};
|
|
|
|
// Server -> client, to one client (UNASSIGNED broadcasts).
|
|
struct ChangeObjectWorldState : public NetGameMsg {
|
|
ChangeObjectWorldState() : NetGameMsg(MessageType::Game::CHANGE_OBJECT_WORLD_STATE) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
|
|
eObjectWorldState newState{};
|
|
};
|
|
|
|
// Server -> client, to one client. The client looks both strings up in its locale (falling back to the text
|
|
// itself) and shows the announcement popup. Client Deserialize: 0x00f23c50.
|
|
struct LocalizedAnnouncementServerToSingleClient : public NetGameMsg {
|
|
LocalizedAnnouncementServerToSingleClient() : NetGameMsg(MessageType::Game::LOCALIZED_ANNOUNCEMENT_SERVER_TO_SINGLE_CLIENT) {}
|
|
void Serialize(RakNet::BitStream& bitStream) const override;
|
|
bool Deserialize(RakNet::BitStream& bitStream) override;
|
|
|
|
// Name-value (LDF) text: u32 character count, then that many characters plus a null terminator when not empty.
|
|
std::u16string bodyParams{};
|
|
bool bForceOpenChatBox{ false };
|
|
bool bShowAnnouncement{ true };
|
|
bool bShowInChat{ true };
|
|
std::u16string body{};
|
|
std::u16string title{};
|
|
std::u16string titleParams{}; // name-value (LDF) text, as bodyParams
|
|
};
|
|
}
|
|
|
|
#endif // ZONEMESSAGES_H
|