From 958d4675af604321aad7b1a64529e67e979df72f Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Wed, 31 Jan 2018 12:51:22 +0000 Subject: [PATCH] Added ItemDefinition.LocalPrice + LocalPriceFormatted --- .../Interfaces/Inventory.Definition.cs | 30 +++++++++++++------ 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs index b8d9852..5ebcaa3 100644 --- a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs +++ b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs @@ -16,7 +16,7 @@ public partial class Inventory /// public class Definition { - internal SteamNative.SteamInventory inventory; + internal Inventory inventory; public int Id { get; private set; } public string Name { get; set; } @@ -64,7 +64,19 @@ public class Definition /// /// The dollar price from PriceRaw /// - public double PriceDollars { get; set; } + public double PriceDollars { get; internal set; } + + + /// + /// The price in the local player's currency. The local player's currency + /// is available in Invetory.Currency + /// + public double LocalPrice { get; internal set; } + + /// + /// Local Price but probably how you want to display it (ie, $3.99, �1.99 etc ) + /// + public string LocalPriceFormatted { get; internal set; } /// /// Returns true if this item can be sold on the marketplace @@ -78,7 +90,7 @@ public bool IsGenerator private Dictionary customProperties; - internal Definition( SteamNative.SteamInventory i, int id ) + internal Definition( Inventory i, int id ) { inventory = i; Id = id; @@ -132,7 +144,7 @@ public string GetStringProperty( string name ) if ( customProperties != null && customProperties.ContainsKey( name ) ) return customProperties[name]; - if ( !inventory.GetItemDefinitionProperty( Id, name, out val ) ) + if ( !inventory.inventory.GetItemDefinitionProperty( Id, name, out val ) ) return string.Empty; return val; @@ -161,12 +173,12 @@ internal void SetupCommonProperties() IconUrl = GetStringProperty( "icon_url" ); IconLargeUrl = GetStringProperty( "icon_url_large" ); Type = GetStringProperty( "type" ); - PriceRaw = GetStringProperty( "price_category" ); + PriceCategory = GetStringProperty( "price_category" ); Marketable = GetBoolProperty( "marketable" ); - if ( !string.IsNullOrEmpty( PriceRaw ) ) + if ( !string.IsNullOrEmpty( PriceCategory ) ) { - PriceDollars = PriceCategoryToFloat( PriceRaw ); + PriceDollars = PriceCategoryToFloat( PriceCategory ); } } @@ -179,8 +191,8 @@ internal void SetupCommonProperties() public void TriggerItemDrop() { SteamNative.SteamInventoryResult_t result = 0; - inventory.TriggerItemDrop( ref result, Id ); - inventory.DestroyResult( result ); + inventory.inventory.TriggerItemDrop( ref result, Id ); + inventory.inventory.DestroyResult( result ); } internal void Link( Definition[] definitions )