From 1171d2033382671b82ca97bfd5972ccc025d6c6f Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Sat, 4 Oct 2025 21:38:07 -0500 Subject: [PATCH] update world sending bbb to be more efficient --- dWorldServer/WorldServer.cpp | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/dWorldServer/WorldServer.cpp b/dWorldServer/WorldServer.cpp index 110b7573..ad570534 100644 --- a/dWorldServer/WorldServer.cpp +++ b/dWorldServer/WorldServer.cpp @@ -1166,32 +1166,36 @@ void HandlePacket(Packet* packet) { LOG("Couldn't find property ID for zone %i, clone %i", zoneId, cloneId); goto noBBB; } - for (auto& bbbModel : Database::Get()->GetUgcModels(propertyId)) { + + // Workaround for not having a UGC server to get model LXFML onto the client so it + // can generate the physics and nif for the object. + + auto bbbModels = Database::Get()->GetUgcModels(propertyId); + if (bbbModels.empty()) { + LOG("No BBB models found for property %llu", propertyId); + goto noBBB; + } + + CBITSTREAM; + BitStreamUtils::WriteHeader(bitStream, ServiceType::CLIENT, MessageType::Client::BLUEPRINT_SAVE_RESPONSE); + bitStream.Write(LWOOBJID_EMPTY); //always zero so that a check on the client passes + bitStream.Write(eBlueprintSaveResponseType::EverythingWorked); + bitStream.Write(bbbModels.size()); + for (auto& bbbModel : bbbModels) { LOG("Getting lxfml ugcID: %llu", bbbModel.id); bbbModel.lxfmlData.seekg(0, std::ios::end); size_t lxfmlSize = bbbModel.lxfmlData.tellg(); bbbModel.lxfmlData.seekg(0); - //Send message: + // write data LWOOBJID blueprintID = bbbModel.id; - - // Workaround for not having a UGC server to get model LXFML onto the client so it - // can generate the physics and nif for the object. - CBITSTREAM; - BitStreamUtils::WriteHeader(bitStream, ServiceType::CLIENT, MessageType::Client::BLUEPRINT_SAVE_RESPONSE); - bitStream.Write(LWOOBJID_EMPTY); //always zero so that a check on the client passes - bitStream.Write(eBlueprintSaveResponseType::EverythingWorked); - bitStream.Write(1); bitStream.Write(blueprintID); - bitStream.Write(lxfmlSize); - bitStream.WriteAlignedBytes(reinterpret_cast(bbbModel.lxfmlData.str().c_str()), lxfmlSize); - - SystemAddress sysAddr = packet->systemAddress; - SEND_PACKET; } + SystemAddress sysAddr = packet->systemAddress; + SEND_PACKET; } noBBB: