From f0a002594a8163063e498a280b6291de0f4e546a Mon Sep 17 00:00:00 2001 From: David Markowitz Date: Mon, 6 Nov 2023 13:39:12 -0800 Subject: [PATCH] Ugc: Add subkey for rockets and cars Tested that, if a user has followed the guide and turned UGCUSE3DSERVICES from 1 to 0, the do not get booted to login for having a rocket with a subkey in their inventory. Add bouncer logic Ugc: Use random Id --- dGame/dGameMessages/GameMessages.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 922ace25..57e0ffde 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -5625,10 +5625,18 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity* std::vector config; config.push_back(moduleAssembly); + LWOOBJID newIdBig; + // Make sure a subkey isnt already in use. Persistent Ids do not make sense here since this only needs to be unique for + // this character. Because of that, we just generate a random id and check for a collision. + do { + newIdBig = ObjectIDManager::Instance()->GenerateRandomObjectID(); + GeneralUtils::SetBit(newIdBig, eObjectBits::CHARACTER); + } while (inv->FindItemBySubKey(newIdBig)); + if (count == 3) { - inv->AddItem(6416, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config); + inv->AddItem(6416, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config, LWOOBJID_EMPTY, true, false, newIdBig); } else if (count == 7) { - inv->AddItem(8092, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config); + inv->AddItem(8092, 1, eLootSourceType::QUICKBUILD, eInventoryType::MODELS, config, LWOOBJID_EMPTY, true, false, newIdBig); } auto* missionComponent = character->GetComponent();