mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
refactor: building game messages and blueprint packets as structs
Converts build mode, arranging, modular build and brick by brick
messages to NetGameMsgs in BuildingMessages.{h,cpp}: StartArrangingWithItem,
FinishArrangingWithItem, ModularBuildEnd and SetBuildModeConfirmed
(sent), and StartBuildingWithItem, DoneArrangingWithItem,
ModularBuildFinish, ModularBuildMoveAndEquip, ModularBuildConvertModel,
SetBuildMode, BuildModeSet, UnUseBBBModel, BBBLoadItemRequest and
BBBSaveRequest (received, registered in GameMessageHandler's map with
their handlers' logic kept). The BLUEPRINT_SAVE_RESPONSE and
BLUEPRINT_LOAD_RESPONSE_ITEMID client packets become the LUBitStream
structs ClientPackets::BlueprintSaveResponse and BlueprintLoadItemResponse,
also used by WorldServer's level load. The never-called
SendBBBSaveResponse is gone.
SetBuildModeConfirmed keeps writing modeValue's and startPos's default
flags as always set, as DLU did. BuildModeSet and UnUseBBBModel now read
their whole client layout (DLU read only the first fields).
No wire change and no change in recipients. Verified byte for byte
against a frozen verbatim copy of the old functions and inline packet
writes over an input grid, 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.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1091,11 +1091,9 @@ void LoadPlayer(const SystemAddress& sysAddr) {
|
||||
goto noBBB;
|
||||
}
|
||||
|
||||
CBITSTREAM;
|
||||
BitStreamUtils::WriteHeader(bitStream, ServiceType::CLIENT, MessageType::Client::BLUEPRINT_SAVE_RESPONSE);
|
||||
bitStream.Write<LWOOBJID>(LWOOBJID_EMPTY); //always zero so that a check on the client passes
|
||||
bitStream.Write(eBlueprintSaveResponseType::EverythingWorked);
|
||||
bitStream.Write<uint32_t>(bbbModels.size());
|
||||
ClientPackets::BlueprintSaveResponse response;
|
||||
response.localId = LWOOBJID_EMPTY; //always zero so that a check on the client passes
|
||||
response.reasonCode = eBlueprintSaveResponseType::EverythingWorked;
|
||||
for (auto& bbbModel : bbbModels) {
|
||||
LOG("Getting lxfml ugcID: %llu", bbbModel.id);
|
||||
|
||||
@@ -1104,12 +1102,11 @@ void LoadPlayer(const SystemAddress& sysAddr) {
|
||||
bbbModel.lxfmlData.seekg(0);
|
||||
|
||||
// write data
|
||||
LWOOBJID blueprintID = bbbModel.id;
|
||||
bitStream.Write(blueprintID);
|
||||
bitStream.Write<uint32_t>(lxfmlSize);
|
||||
bitStream.WriteAlignedBytes(reinterpret_cast<const unsigned char*>(bbbModel.lxfmlData.str().c_str()), lxfmlSize);
|
||||
auto& model = response.models.emplace_back();
|
||||
model.blueprintId = bbbModel.id;
|
||||
model.data = bbbModel.lxfmlData.str().substr(0, lxfmlSize);
|
||||
}
|
||||
SEND_PACKET;
|
||||
response.Send(sysAddr);
|
||||
}
|
||||
|
||||
noBBB:
|
||||
|
||||
Reference in New Issue
Block a user