InventoryItem.Flags uses SteamItemFlags

This commit is contained in:
Garry Newman 2019-05-16 15:02:16 +01:00
parent a5bd78a597
commit f06b4b431b
2 changed files with 6 additions and 6 deletions

View File

@ -64,7 +64,7 @@ namespace Steamworks
foreach ( var item in items ) foreach ( var item in items )
{ {
Console.WriteLine( $"{item.Id} / {item.DefId} / {item.Quantity} / {item.Def?.Name} " ); Console.WriteLine( $"{item.Id} / {item.DefId} / {item.Quantity} / {item.Def?.Name} /[{item.IsNoTrade}|{item.IsRemoved}|{item.IsConsumed}] " );
foreach ( var prop in item.Properties ) foreach ( var prop in item.Properties )
{ {

View File

@ -9,7 +9,7 @@ namespace Steamworks
{ {
internal InventoryItemId _id; internal InventoryItemId _id;
internal InventoryDefId _def; internal InventoryDefId _def;
internal int _flags; internal SteamItemFlags _flags;
internal ushort _quantity; internal ushort _quantity;
internal Dictionary<string, string> _properties; internal Dictionary<string, string> _properties;
@ -31,19 +31,19 @@ namespace Steamworks
/// This item is account-locked and cannot be traded or given away. /// This item is account-locked and cannot be traded or given away.
/// This is an item status flag which is permanently attached to specific item instances /// This is an item status flag which is permanently attached to specific item instances
/// </summary> /// </summary>
public bool IsNoTrade => (_flags & 1 << 0) != 0; public bool IsNoTrade => _flags.HasFlag( SteamItemFlags.NoTrade );
/// <summary> /// <summary>
/// The item has been destroyed, traded away, expired, or otherwise invalidated. /// The item has been destroyed, traded away, expired, or otherwise invalidated.
/// This is an action confirmation flag which is only set one time, as part of a result set. /// This is an action confirmation flag which is only set one time, as part of a result set.
/// </summary> /// </summary>
public bool IsRemoved => (_flags & 1 << 8) != 0; public bool IsRemoved => _flags.HasFlag( SteamItemFlags.Removed );
/// <summary> /// <summary>
/// The item quantity has been decreased by 1 via ConsumeItem API. /// The item quantity has been decreased by 1 via ConsumeItem API.
/// This is an action confirmation flag which is only set one time, as part of a result set. /// This is an action confirmation flag which is only set one time, as part of a result set.
/// </summary> /// </summary>
public bool IsConsumed => (_flags & 1 << 9) != 0; public bool IsConsumed => _flags.HasFlag( SteamItemFlags.Consumed );
/// <summary> /// <summary>
/// Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed. /// Consumes items from a user's inventory. If the quantity of the given item goes to zero, it is permanently removed.
@ -91,7 +91,7 @@ namespace Steamworks
{ {
_id = details.ItemId, _id = details.ItemId,
_def = details.Definition, _def = details.Definition,
_flags = details.Flags, _flags = (SteamItemFlags) details.Flags,
_quantity = details.Quantity _quantity = details.Quantity
}; };