Show / Hide Table of Contents

Class InventoryChangeSet

A collection of modifications we wish to perform on an inventory

Inheritance
System.Object
InventoryChangeSet
Implements
IInventoryChangeSet
IAtomicAction
System.IDisposable
IGameActionPackChangeSet
Namespace: Eco.Gameplay.Items
Assembly: Eco.Gameplay.dll
Syntax
public sealed class InventoryChangeSet : Object, IInventoryChangeSet, IAtomicAction, IDisposable, IGameActionPackChangeSet

Fields

AccessNeeded

Declaration
public AccessType AccessNeeded
Field Value
Type Description
AccessType

ChangedStacks

Declaration
public Dictionary<ItemStack, ChangedStack> ChangedStacks
Field Value
Type Description
System.Collections.Generic.Dictionary<ItemStack, ChangedStack>

IgnoreRestrictions

Declaration
public bool IgnoreRestrictions
Field Value
Type Description
System.Boolean

InventoryAccessType

Declaration
public InventoryAccessType InventoryAccessType
Field Value
Type Description
InventoryAccessType

OnItemsMoved

Declaration
public Action<IEnumerable<Item>> OnItemsMoved
Field Value
Type Description
System.Action<System.Collections.Generic.IEnumerable<Item>>

StacktraceCreation

Declaration
public static ConcurrentDictionary<int, string> StacktraceCreation
Field Value
Type Description
System.Collections.Concurrent.ConcurrentDictionary<System.Int32, System.String>

Methods

AddItem(Item, Int32, Inventory)

Declaration
public void AddItem(Item item, int count = 1, Inventory inventory = null)
Parameters
Type Name Description
Item item
System.Int32 count
Inventory inventory

AddItemNonUnique(Type, Inventory)

Declaration
public void AddItemNonUnique(Type itemType, Inventory inventory = null)
Parameters
Type Name Description
System.Type itemType
Inventory inventory

AddItemNonUnique<T>(Inventory)

Declaration
public void AddItemNonUnique<T>(Inventory inventory = null)
Parameters
Type Name Description
Inventory inventory
Type Parameters
Name Description
T

AddItems(IEnumerable<ItemStack>)

Declaration
public void AddItems(IEnumerable<ItemStack> stacks)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ItemStack> stacks

AddItemsNonUnique(Type, Int32, Inventory)

Declaration
public void AddItemsNonUnique(Type itemType, int quantity, Inventory inventory = null)
Parameters
Type Name Description
System.Type itemType
System.Int32 quantity
Inventory inventory

AddItemsNonUnique<T>(Int32, Inventory)

Declaration
public void AddItemsNonUnique<T>(int quantity, Inventory inventory = null)
Parameters
Type Name Description
System.Int32 quantity
Inventory inventory
Type Parameters
Name Description
T

Apply()

Declaration
public Result Apply()
Returns
Type Description
Result

ApplyInternal(Boolean, Boolean)

Declaration
public Result ApplyInternal(bool throwOnInvalid, bool consolidating = false)
Parameters
Type Name Description
System.Boolean throwOnInvalid
System.Boolean consolidating
Returns
Type Description
Result

CanApplyNonDisposing()

Declaration
public Result CanApplyNonDisposing()
Returns
Type Description
Result

Clear(Inventory)

Declaration
public void Clear(Inventory inventory = null)
Parameters
Type Name Description
Inventory inventory

ClearStack(ItemStack)

Declaration
public void ClearStack(ItemStack stack)
Parameters
Type Name Description
ItemStack stack

DescribeWhatItAdds()

Return a comma-separated string of the recent items added to the inventory.

Declaration
public LocString DescribeWhatItAdds()
Returns
Type Description
LocString

Dispose()

Declaration
public void Dispose()

Finalize()

Declaration
protected override void Finalize()

GameActionPackDispose()

Declaration
public void GameActionPackDispose()

GameActionPackPostEffect()

Declaration
public LocString GameActionPackPostEffect()
Returns
Type Description
LocString

GameActionPackPretest()

Declaration
public Result GameActionPackPretest()
Returns
Type Description
Result

GetTargetInventory(Inventory)

Declaration
public Inventory GetTargetInventory(Inventory inventory = null)
Parameters
Type Name Description
Inventory inventory
Returns
Type Description
Inventory

GetUser()

Declaration
public User GetUser()
Returns
Type Description
User

HasInventory(Inventory)

Declaration
public bool HasInventory(Inventory inventory)
Parameters
Type Name Description
Inventory inventory
Returns
Type Description
System.Boolean

MergeStack(ItemStack, Int32, Item, Boolean)

Merges stack with newItem changing its quantity by delta.

Declaration
public void MergeStack(ItemStack stack, int delta, Item newItem, bool splittingStack)
Parameters
Type Name Description
ItemStack stack
System.Int32 delta
Item newItem
System.Boolean splittingStack

ModifyStack(ItemStack, Int32)

Declaration
public void ModifyStack(ItemStack stack, int delta)
Parameters
Type Name Description
ItemStack stack
System.Int32 delta

MoveAllItems(Inventory, Inventory, Boolean, Func<ItemStack, Boolean>)

Try to move all items from src to dst inventory with move result.

Declaration
public InventoryMoveResult MoveAllItems(Inventory source, Inventory destination, bool allowPartial, Func<ItemStack, bool> selector = null)
Parameters
Type Name Description
Inventory source
Inventory destination
System.Boolean allowPartial
System.Func<ItemStack, System.Boolean> selector
Returns
Type Description
InventoryMoveResult
Remarks

Only returns failure when not a single item is moved otherwise success

MoveAllItems(Item, Int32, Inventory, Inventory, Boolean, Func<ItemStack, Boolean>)

Try to move all items from source to dst inventory with result.

Declaration
public ValResult<int> MoveAllItems(Item sourceItem, int quantity, Inventory source, Inventory destination, bool allowPartial, Func<ItemStack, bool> sourceStackPredicate = null)
Parameters
Type Name Description
Item sourceItem
System.Int32 quantity
Inventory source
Inventory destination
System.Boolean allowPartial
System.Func<ItemStack, System.Boolean> sourceStackPredicate
Returns
Type Description
ValResult<System.Int32>

MoveAsManyItemsAsPossible(Type, Int32, Inventory, Inventory, ItemStack, Func<ItemStack, Boolean>)

Declaration
public ValResult<int> MoveAsManyItemsAsPossible(Type itemType, int quantity, Inventory source, Inventory destination, ItemStack destinationStack, Func<ItemStack, bool> sourceStackPredicate = null)
Parameters
Type Name Description
System.Type itemType
System.Int32 quantity
Inventory source
Inventory destination
ItemStack destinationStack
System.Func<ItemStack, System.Boolean> sourceStackPredicate
Returns
Type Description
ValResult<System.Int32>

MoveItems(Item, Int32, Inventory, Inventory, Func<ItemStack, Boolean>)

Declaration
public void MoveItems(Item item, int quantity, Inventory source, Inventory destination, Func<ItemStack, bool> sourceStackPredicate = null)
Parameters
Type Name Description
Item item
System.Int32 quantity
Inventory source
Inventory destination
System.Func<ItemStack, System.Boolean> sourceStackPredicate

MoveItems<TKey>(Item, Int32, Inventory, Inventory, Func<ItemStack, Boolean>, Func<ItemStack, TKey>)

Moves items with an optional source stack order, ordered by a given key

Declaration
public void MoveItems<TKey>(Item item, int quantity, Inventory source, Inventory destination, Func<ItemStack, bool> sourceStackPredicate = null, Func<ItemStack, TKey> sourceStackOrder = null)
Parameters
Type Name Description
Item item
System.Int32 quantity
Inventory source
Inventory destination
System.Func<ItemStack, System.Boolean> sourceStackPredicate
System.Func<ItemStack, TKey> sourceStackOrder
Type Parameters
Name Description
TKey

MoveItemsNonUnique(Type, Int32, Inventory, Inventory)

Declaration
public void MoveItemsNonUnique(Type itemType, int quantity, Inventory source, Inventory destination)
Parameters
Type Name Description
System.Type itemType
System.Int32 quantity
Inventory source
Inventory destination

MoveItemsNonUnique<TKey>(Type, Int32, Inventory, Inventory, Func<ItemStack, Boolean>, Func<ItemStack, TKey>)

Declaration
public void MoveItemsNonUnique<TKey>(Type itemType, int quantity, Inventory source, Inventory destination, Func<ItemStack, bool> sourceStackPredicate = null, Func<ItemStack, TKey> sourceStackOrder = null)
Parameters
Type Name Description
System.Type itemType
System.Int32 quantity
Inventory source
Inventory destination
System.Func<ItemStack, System.Boolean> sourceStackPredicate
System.Func<ItemStack, TKey> sourceStackOrder
Type Parameters
Name Description
TKey

MoveStacks(ItemStack, ItemStack, Int32)

Declaration
public void MoveStacks(ItemStack source, ItemStack destination, int requestedQuantity)
Parameters
Type Name Description
ItemStack source
ItemStack destination
System.Int32 requestedQuantity

New(Inventory, User)

Declaration
public static InventoryChangeSet New(Inventory inventory, User user = null)
Parameters
Type Name Description
Inventory inventory
User user
Returns
Type Description
InventoryChangeSet

New(IEnumerable<Inventory>, User)

Declaration
public static InventoryChangeSet New(IEnumerable<Inventory> inventories, User user = null)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Inventory> inventories
User user
Returns
Type Description
InventoryChangeSet

PerformWithActionManager()

Declaration
public Result PerformWithActionManager()
Returns
Type Description
Result

RemoveAsMuchAsPossible(ItemRepresentation, Int32)

Tries to remove as much as possible representation up to requested. Returns in order of least durability first, if there is durability.

Declaration
public List<(Item, int)> RemoveAsMuchAsPossible(ItemRepresentation representation, int requested)
Parameters
Type Name Description
ItemRepresentation representation
System.Int32 requested
Returns
Type Description
System.Collections.Generic.List<System.ValueTuple<Item, System.Int32>>

Returns all removed items with count.

RemoveItemByType(Type, Inventory)

Declaration
public void RemoveItemByType(Type itemType, Inventory inventory = null)
Parameters
Type Name Description
System.Type itemType
Inventory inventory

RemoveItemByType<T>(Inventory)

Declaration
public void RemoveItemByType<T>(Inventory inventory = null)
Parameters
Type Name Description
Inventory inventory
Type Parameters
Name Description
T

RemoveItemsByType(Type, Int32, Inventory)

Declaration
public void RemoveItemsByType(Type itemType, int quantity, Inventory inventory = null)
Parameters
Type Name Description
System.Type itemType
System.Int32 quantity
Inventory inventory

RemoveItemsByType<T>(Int32, Inventory)

Declaration
public void RemoveItemsByType<T>(int quantity, Inventory inventory = null)
Parameters
Type Name Description
System.Int32 quantity
Inventory inventory
Type Parameters
Name Description
T

RemoveItemsUnique(Item, Int32, Inventory)

Declaration
public int RemoveItemsUnique(Item matchesItem, int quantity, Inventory inventory)
Parameters
Type Name Description
Item matchesItem
System.Int32 quantity
Inventory inventory
Returns
Type Description
System.Int32

TryApply()

Declaration
public Result TryApply()
Returns
Type Description
Result

Implements

IInventoryChangeSet
IAtomicAction
System.IDisposable
IGameActionPackChangeSet

Extension Methods

OrganismItemManager.AddResourcesToChangeSet(InventoryChangeSet, Species, Int32)
TagUtils.TagNames(Object, Boolean)
TagUtils.TagDisplayNames(Object, Boolean)
ClientSetViewExtensions.SetClassOfProperty(Object, Player, String, String, Int32)
TypeTooltipExtensions.UILinkGeneric(Object)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾