mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 10:45:27 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -1988,12 +1988,14 @@ bool InventoryComponent::SetSkill(BehaviorSlot slot, uint32_t skillId) {
|
|||||||
void InventoryComponent::UpdateGroup(const GroupUpdate& groupUpdate) {
|
void InventoryComponent::UpdateGroup(const GroupUpdate& groupUpdate) {
|
||||||
if (groupUpdate.groupId.empty()) return;
|
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());
|
LOG("Invalid inventory type for grouping %s", StringifiedEnum::ToString(groupUpdate.inventory).data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& groups = m_Groups[groupUpdate.inventory];
|
auto& groups = m_Groups[inventory];
|
||||||
auto groupItr = std::ranges::find_if(groups, [&groupUpdate](const Group& group) {
|
auto groupItr = std::ranges::find_if(groups, [&groupUpdate](const Group& group) {
|
||||||
return group.groupId == groupUpdate.groupId;
|
return group.groupId == groupUpdate.groupId;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -69,3 +69,12 @@ TEST_F(InventoryGroupTests, NamesAreCutTo64Characters) {
|
|||||||
Group("MODIFY", "user_group1", std::u16string(65, u'b'));
|
Group("MODIFY", "user_group1", std::u16string(65, u'b'));
|
||||||
EXPECT_EQ(Groups()[0].groupName, std::string(64, '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));
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user