Skip to content

GetFilteredInventoryItemsData list contains removed wardrobe items #10

Description

@MrSimbax

After using wardrobeSystem.ForgetItemID on a specific item, the item is still on the list returned by wardrobeSystem.GetFilteredInventoryItemsData. GetStoredItemIDs and GetFilteredStoredItemIDs work correctly and don't have the item.

The consequences are visible to the user. Since WardrobeSetEditorUIController uses GetFilteredInventoryItemsData instead of GetFilteredStoredItemIDs, the removed item is still visible in the wardrobe outfit editor. It can even be equipped, but it isn't saved in the outfit.

The issue can be workarounded by saving the game after using ForgetItemID, and loading the new save.

Example CET snippet reproducing the issue:

local inventoryManager = Game.GetScriptableSystemsContainer():Get(CName.new('EquipmentSystem')):GetPlayerData(Game.GetPlayer()):GetInventoryManager()
local wardrobeSystem = Game.GetWardrobeSystem()

local function printFilteredStoredItemIds ()
    local itemIds = wardrobeSystem:GetFilteredStoredItemIDs(gamedataEquipmentArea.OuterChest)
    for _,itemId in pairs(itemIds) do
        print("GetFilteredStoredItemIDs: "..ItemID.GetTDBID(itemId).value)
    end
end

local function printFilteredInventoryItemsData ()
    local itemDatas = wardrobeSystem:GetFilteredInventoryItemsData(gamedataEquipmentArea.OuterChest, inventoryManager)
    for _,itemData in pairs(itemDatas) do
        print("GetFilteredInventoryItemsData: "..ItemID.GetTDBID(itemData:GetID()).value)
    end
end

local itemId = ItemID.FromTDBID("Items.MQ049_martinez_jacket")

printFilteredStoredItemIds() -- the item is not present
printFilteredInventoryItemsData() -- the item is not present

wardrobeSystem:StoreUniqueItemID(itemId)

printFilteredStoredItemIds() -- the added item is present [OK]
printFilteredInventoryItemsData() -- the added item is present [OK]

wardrobeSystem:ForgetItemID(itemId)

printFilteredStoredItemIds() -- the removed item is not present [OK]
printFilteredInventoryItemsData() -- the removed item is present [NOT OK]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions