ExtendedItemTransaction, MirrorItemColllection how return overflow?

Checking the collection where the element is added is still working for me. I think I missed something, or misconfigured.

C#:
var mainItemCollection = characterInventory.MainItemCollection as ExtendedItemTransactionCollectionCustom;

canAddItemResult = mainItemCollection.CanAddItem(itemInfo);
if (mainItemCollection.AddingToCollection != null && canAddItemResult.HasValue)
{
 
Last edited:
We now have this scenario:
1 - We equip the backpack, an object on the stage will spawn - inventory of the backpack. Main collection: ExtendedItemTransactionCollectionCustom, custom, just added properties to view the collection where the item will be can added.
2 - a link is created, the player's main inventory, links to the backpack collection via MirrorItemCollection.
 
The MirrorItemCollection is a custom ItemCollection your created that mirrors another collection? I'm not sure I understand the purpose of that collection. One of the issues I see with that is that Unique and Mutable Items can only be part of a single ItemCollection at a time. So lets say you have IronSword with ID 101, if you add that IronSword to another Collection, without first removing it, that item will be duplicated and given a new ID. So you'll end up with IronSwrod ID 101 in the original collection and IronSword 102 is the new collection.

Apart from that, the way Items are rejected is by checking if the item can be added within the add function.
I'm actually changing some stuff in the latests update to allow that sort of functionality built-in the base ItemCollection. So if you update once it is released do make sure to go through the code again to make sure everything still works the way you intended
 
@Sangemdoko MirrorItemCollection if this is not yours, then my previous colleague tried to do something custom. I think its purpose is the same as TransactionItemCollcetion, only these collections are not on the main object.

at the moment I go through stage by stage to understand how it works and fix previous bugs
 
It turns out that the ExtendedItemCollection checks if it can be added to the MirrorItemCollection, which we add to it at runtime. For MirrorCollection, the inventory on the stage and the collection are passed through the constructor, the functionality of adding items to this collection, adds to the collection it refers to.

Code example:
C#:
public MirrorItemCollection(Opsive.UltimateInventorySystem.Core.InventoryCollections.Inventory mirroredInventory, string mirroredItemCollectionName)
        {
            this.mirroredInventory = mirroredInventory;
            this.mirroredItemCollectionName = mirroredItemCollectionName;
            this.mirroredItemCollection = mirroredInventory.GetItemCollection(mirroredItemCollectionName);
        }

        /// <summary>
        /// Check if the item can be added to this item collection.
        /// </summary>
        /// <param name="itemInfo">The item info to add.</param>
        /// <returns>The item info to add.</returns>
        public override ItemInfo? CanAddItem(ItemInfo itemInfo)
        {
            return mirroredItemCollection.CanAddItem(itemInfo);
        }

I'll take a look at this custom collection, maybe they forgot to redefine something.
 
Top