Files
DarkflameServer/dGame/dGameMessages/GameMessageDecoder.h
Aaron Kimbrell e213a7aeff feat: web dashboard and playground work
The NexusDashboard-parity dashboard (dDashboardServer) and everything built on it on the experimental branch:
accounts, characters, properties and moderation tools, permissions shared with in-game slash commands, economy
reports, World 3D and property 3D views with client scenery, scheduled events (features, vanity changes, live
events, announcements, restarts), vanity files and events, the CDClient browser, the message inspector with saved
captures, chat filter tools, community challenges, live ops, the AI moderator helper, and the server-side changes
they need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 22:30:43 -05:00

25 lines
983 B
C++

#ifndef __GAMEMESSAGEDECODER__H__
#define __GAMEMESSAGEDECODER__H__
#include <optional>
#include "BitStream.h"
#include "json.hpp"
#include "MessageType/Game.h"
/**
* Reads a game message's fields for the dashboard's message inspector, using the server's own typed message struct
* and its Deserialize, so what is shown is exactly what the server reads. Messages the server has no typed struct
* for (the ones handled by reading the stream inline) aren't decoded; the inspector shows their bytes instead.
*/
namespace GameMessageDecoder {
// Whether a message sent in this direction has a typed struct
bool CanDecode(MessageType::Game messageId, bool toServer);
// The message's fields, read from `payload` (the bits after the object ID and message ID), or nullopt when it has
// no typed struct or doesn't read cleanly
std::optional<nlohmann::json> Decode(MessageType::Game messageId, bool toServer, RakNet::BitStream& payload);
}
#endif //!__GAMEMESSAGEDECODER__H__