mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-05 20:33:44 +00:00
refactor: property game messages as structs
Converts the property messages to NetGameMsgs in PropertyMessages.{h,cpp}.
Sent: OpenPropertyVendor, OpenPropertyManagement, DownloadPropertyData
(replaces PropertyDataMessage, now with the client's PropertyData field
names), PropertyRentalResponse, PropertyEntranceBegin,
PropertySelectQuery (replaces PropertySelectQueryProperty with the
client's PropertyInfo), GetModelsOnProperty, PlaceModelResponse and
HandleUGCEquipPre/PostDeleteBasedOnEditMode. Received, registered in
GameMessageHandler's map: SetPropertyAccess,
UpdatePropertyOrModelForFilterCheck, QueryPropertyData,
PropertyEditorBegin/End, PropertyContentsFromClient,
ZonePropertyModelEquipped/Rotated, PlacePropertyModel,
UpdateModelFromClient, DeleteModelFromClient, ControlBehaviors,
PropertyEntranceSync, EnterProperty1, UpdatePropertyPerformanceCost,
ReportOffensiveModel/Property and GetHotPropertyData. The news screen's
NewsSendHotPropertiesInfoToClient moves here with the top properties
lookup; the dashboard's player reports now take the decoded text.
Handlers keep their logic and hand the work to PropertyManagementComponent,
PropertyVendorComponent, PropertyEntranceComponent and
MultiZoneEntranceComponent as before. Messages whose payload DLU ignored
(PropertyEditorBegin, PropertyContentsFromClient, ZonePropertyModel*)
now read it with the client's layout. The never-called
SendZonePropertyModelEquipped (which wrote no default flags) is gone.
No wire change and no change in recipients. Verified byte for byte
against a frozen verbatim copy of the old functions, PropertyDataMessage
and PropertySelectQueryProperty 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 in Ghidra. Known wire bug kept as is: PlaceModelResponse
writes response where the client reads a rotation quaternion
(PlaceModelResponse::Deserialize 0x00dc0170).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <ctime>
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "Database.h"
|
||||
#include "DashboardNotify.h"
|
||||
#include "Entity.h"
|
||||
@@ -59,21 +58,6 @@ namespace {
|
||||
LOG("Player report %llu (%s) from %llu about %llu", id, report.kind.c_str(), report.reporterId, report.targetCharacterId);
|
||||
DashboardNotify::Changed("player_reports");
|
||||
}
|
||||
|
||||
// Description (u32 length + UTF-16) followed by an object ID
|
||||
bool ReadDescriptionAndObject(RakNet::BitStream& inStream, std::string& description, LWOOBJID& objectId) {
|
||||
uint32_t length{};
|
||||
if (!inStream.Read(length) || length > MAX_BODY) return false;
|
||||
std::u16string text;
|
||||
text.reserve(length);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
char16_t character{};
|
||||
if (!inStream.Read(character)) return false;
|
||||
text.push_back(character);
|
||||
}
|
||||
description = GeneralUtils::UTF16ToWTF8(text);
|
||||
return inStream.Read(objectId);
|
||||
}
|
||||
}
|
||||
|
||||
namespace PlayerReports {
|
||||
@@ -87,10 +71,9 @@ namespace PlayerReports {
|
||||
Save(report);
|
||||
}
|
||||
|
||||
void HandleReportOffensiveModel(RakNet::BitStream& inStream, Entity* reporter) {
|
||||
std::string description;
|
||||
LWOOBJID objectId{};
|
||||
if (!ReadDescriptionAndObject(inStream, description, objectId)) return;
|
||||
void ReportOffensiveModel(Entity* reporter, const std::u16string& text, LWOOBJID objectId) {
|
||||
if (text.size() > MAX_BODY) return;
|
||||
const auto description = GeneralUtils::UTF16ToWTF8(text);
|
||||
auto report = NewReport(reporter, ePlayerReportKind::MODEL, description);
|
||||
report.objectId = objectId;
|
||||
auto* object = Game::entityManager->GetEntity(objectId);
|
||||
@@ -106,10 +89,9 @@ namespace PlayerReports {
|
||||
Save(report);
|
||||
}
|
||||
|
||||
void HandleReportOffensiveProperty(RakNet::BitStream& inStream, Entity* reporter) {
|
||||
std::string description;
|
||||
LWOOBJID plaqueId{};
|
||||
if (!ReadDescriptionAndObject(inStream, description, plaqueId)) return;
|
||||
void ReportOffensiveProperty(Entity* reporter, const std::u16string& text, LWOOBJID plaqueId) {
|
||||
if (text.size() > MAX_BODY) return;
|
||||
const auto description = GeneralUtils::UTF16ToWTF8(text);
|
||||
auto report = NewReport(reporter, ePlayerReportKind::PROPERTY, description);
|
||||
report.objectId = plaqueId;
|
||||
if (auto* plaque = Game::entityManager->GetEntity(plaqueId)) report.objectLot = plaque->GetLOT();
|
||||
|
||||
Reference in New Issue
Block a user