Added ItemDefinition.LocalPrice + LocalPriceFormatted

This commit is contained in:
Garry Newman 2018-01-31 12:51:22 +00:00
parent 916d9afdc9
commit 958d4675af

View File

@ -16,7 +16,7 @@ public partial class Inventory
/// </summary>
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
/// <summary>
/// The dollar price from PriceRaw
/// </summary>
public double PriceDollars { get; set; }
public double PriceDollars { get; internal set; }
/// <summary>
/// The price in the local player's currency. The local player's currency
/// is available in Invetory.Currency
/// </summary>
public double LocalPrice { get; internal set; }
/// <summary>
/// Local Price but probably how you want to display it (ie, $3.99, <20>1.99 etc )
/// </summary>
public string LocalPriceFormatted { get; internal set; }
/// <summary>
/// Returns true if this item can be sold on the marketplace
@ -78,7 +90,7 @@ public bool IsGenerator
private Dictionary<string, string> 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 )