From 52b5994b9872860feac1cc7f188183633446b48b Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 8 Nov 2023 10:18:02 -0800 Subject: [PATCH] Ugc: Add subkey for rockets and cars (#1266) 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 06a536518..a814c0001 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -5610,10 +5610,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();