Skip to content

Commit

Permalink
Ugc: Add subkey for rockets and cars (#1266)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
EmosewaMC authored Nov 8, 2023
1 parent 4c10faa commit 52b5994
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions dGame/dGameMessages/GameMessages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5610,10 +5610,18 @@ void GameMessages::HandleModularBuildFinish(RakNet::BitStream* inStream, Entity*
std::vector<LDFBaseData*> 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<MissionComponent>();
Expand Down

0 comments on commit 52b5994

Please sign in to comment.