From a3d1b6a8b861ec8a14721ec37a768c8b31ebe7ae Mon Sep 17 00:00:00 2001 From: Aaron Kimbrell Date: Fri, 2 Oct 2026 10:30:40 -0500 Subject: [PATCH] fix(inventory): the model vault uses the models' inventory groups, as the client LWOInventoryComponent_Common::msgUpdateInventoryGroup (0x00c955b0) and msgUpdateInventoryGroupContents (0x00ce1f50) look the inventory type up in m_VaultToPlayerInventory first, which Initialize (0x00d55a60) fills with VAULT_MODELS -> MODELS. The server refused group updates for the model vault. Co-Authored-By: Claude Opus 5.5 --- dGame/dComponents/InventoryComponent.cpp | 6 ++++-- .../dGameTests/dComponentsTests/InventoryGroupTests.cpp | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dGame/dComponents/InventoryComponent.cpp b/dGame/dComponents/InventoryComponent.cpp index 36c20530f..1c9ba7258 100644 --- a/dGame/dComponents/InventoryComponent.cpp +++ b/dGame/dComponents/InventoryComponent.cpp @@ -1988,12 +1988,14 @@ bool InventoryComponent::SetSkill(BehaviorSlot slot, uint32_t skillId) { void InventoryComponent::UpdateGroup(const GroupUpdate& groupUpdate) { if (groupUpdate.groupId.empty()) return; - if (groupUpdate.inventory != eInventoryType::BRICKS && groupUpdate.inventory != eInventoryType::MODELS) { + // The model vault shares the models' groups (the client's m_VaultToPlayerInventory: VAULT_MODELS -> MODELS) + const auto inventory = groupUpdate.inventory == eInventoryType::VAULT_MODELS ? eInventoryType::MODELS : groupUpdate.inventory; + if (inventory != eInventoryType::BRICKS && inventory != eInventoryType::MODELS) { LOG("Invalid inventory type for grouping %s", StringifiedEnum::ToString(groupUpdate.inventory).data()); return; } - auto& groups = m_Groups[groupUpdate.inventory]; + auto& groups = m_Groups[inventory]; auto groupItr = std::ranges::find_if(groups, [&groupUpdate](const Group& group) { return group.groupId == groupUpdate.groupId; }); diff --git a/tests/dGameTests/dComponentsTests/InventoryGroupTests.cpp b/tests/dGameTests/dComponentsTests/InventoryGroupTests.cpp index e2b9a22af..ac6a3352d 100644 --- a/tests/dGameTests/dComponentsTests/InventoryGroupTests.cpp +++ b/tests/dGameTests/dComponentsTests/InventoryGroupTests.cpp @@ -69,3 +69,12 @@ TEST_F(InventoryGroupTests, NamesAreCutTo64Characters) { Group("MODIFY", "user_group1", std::u16string(65, u'b')); EXPECT_EQ(Groups()[0].groupName, std::string(64, 'b')); } + +TEST_F(InventoryGroupTests, TheModelVaultUsesTheModelsGroups) { + Group("ADD", "user_group1", u"models", eInventoryType::VAULT_MODELS); + Contents("ADD", "user_group1", 3001, eInventoryType::VAULT_MODELS); + + ASSERT_EQ(Groups(eInventoryType::MODELS).size(), 1u); + EXPECT_EQ(Groups(eInventoryType::MODELS)[0].lots.size(), 1u); + EXPECT_FALSE(inventory->GetGroups().contains(eInventoryType::VAULT_MODELS)); +}