Class InventoryExtensions
Inheritance
System.Object
InventoryExtensions
Namespace: OpenMod.Extensions.Games.Abstractions.Items
Assembly: OpenMod.Extensions.Games.Abstractions.dll
Syntax
public static class InventoryExtensions : object
Methods
| Improve this Doc View SourceClearAsync(IInventory)
Removes all items from the given inventory.
Declaration
public static Task ClearAsync(this IInventory inventory)
Parameters
| Type | Name | Description |
|---|---|---|
| IInventory | inventory | The inventory to clear. |
Returns
| Type | Description |
|---|---|
| Task |
FindByAssetId(IInventory, String, Nullable<IComparer<IInventoryItem>>)
Searches for items by the item asset id.
Declaration
public static IEnumerable<IInventoryItem> FindByAssetId(this IInventory inventory, string itemAssetId, IComparer<IInventoryItem>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IInventory | inventory | The inventory to search in. |
| System.String | itemAssetId | The ID of the item to search for. |
| System.Nullable<IComparer<IInventoryItem>> | comparer | The optional item comparer. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IInventoryItem> |
FindByAssetId(IInventoryPage, String, Nullable<IComparer<IInventoryItem>>)
Searches for items by the item asset id.
Declaration
public static IEnumerable<IInventoryItem> FindByAssetId(this IInventoryPage page, string itemAssetId, IComparer<IInventoryItem>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IInventoryPage | page | The inventory page to search in. |
| System.String | itemAssetId | The ID of the item to search for. |
| System.Nullable<IComparer<IInventoryItem>> | comparer | The optional item comparer. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IInventoryItem> |
FindByType(IInventory, String, Nullable<IComparer<IInventoryItem>>)
Searches for items by the item type.
Declaration
public static IEnumerable<IInventoryItem> FindByType(this IInventory inventory, string itemType, IComparer<IInventoryItem>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IInventory | inventory | The inventory to search in. |
| System.String | itemType | The type of the item to search for. |
| System.Nullable<IComparer<IInventoryItem>> | comparer | The optional item comparer. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IInventoryItem> |
FindByType(IInventoryPage, String, Nullable<IComparer<IInventoryItem>>)
Searches for items by the item type.
Declaration
public static IEnumerable<IInventoryItem> FindByType(this IInventoryPage page, string itemType, IComparer<IInventoryItem>? comparer = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IInventoryPage | page | The inventory page to search in. |
| System.String | itemType | The type of the item to search for. |
| System.Nullable<IComparer<IInventoryItem>> | comparer | The optional item comparer. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IInventoryItem> |