mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-01-12 14:48:02 +03:00
Show removed and consumed items seperately in Inventory Result
This commit is contained in:
parent
f011ff8d8b
commit
0f26139d38
@ -15,6 +15,10 @@ namespace Facepunch.Steamworks
|
||||
private SteamNative.SteamInventoryResult_t Handle { get; set; }
|
||||
public Item[] Items { get; internal set; }
|
||||
|
||||
public Item[] Removed { get; internal set; }
|
||||
|
||||
public Item[] Consumed { get; internal set; }
|
||||
|
||||
public bool IsPending
|
||||
{
|
||||
get
|
||||
@ -80,7 +84,34 @@ namespace Facepunch.Steamworks
|
||||
throw new System.Exception( "steamItems was null" );
|
||||
}
|
||||
|
||||
Items = steamItems.Select( x =>
|
||||
Items = steamItems.Where( x => ((int)x.Flags & (int)SteamNative.SteamItemFlags.Removed) == 0 && ((int)x.Flags & (int)SteamNative.SteamItemFlags.Consumed ) == 0 )
|
||||
.Select( x =>
|
||||
{
|
||||
return new Inventory.Item()
|
||||
{
|
||||
Quantity = x.Quantity,
|
||||
Id = x.ItemId,
|
||||
DefinitionId = x.Definition,
|
||||
TradeLocked = ( (int)x.Flags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
||||
Definition = inventory.FindDefinition( x.Definition )
|
||||
};
|
||||
} ).ToArray();
|
||||
|
||||
Removed = steamItems.Where( x => ( (int)x.Flags & (int)SteamNative.SteamItemFlags.Removed ) != 0 )
|
||||
.Select( x =>
|
||||
{
|
||||
return new Inventory.Item()
|
||||
{
|
||||
Quantity = x.Quantity,
|
||||
Id = x.ItemId,
|
||||
DefinitionId = x.Definition,
|
||||
TradeLocked = ( (int)x.Flags & (int)SteamNative.SteamItemFlags.NoTrade ) != 0,
|
||||
Definition = inventory.FindDefinition( x.Definition )
|
||||
};
|
||||
} ).ToArray();
|
||||
|
||||
Consumed = steamItems.Where( x => ( (int)x.Flags & (int)SteamNative.SteamItemFlags.Consumed ) != 0 )
|
||||
.Select( x =>
|
||||
{
|
||||
return new Inventory.Item()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user