mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 22:25:49 +03:00
Added ItemDefinition.LocalPrice + LocalPriceFormatted
This commit is contained in:
parent
916d9afdc9
commit
958d4675af
@ -16,7 +16,7 @@ public partial class Inventory
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class Definition
|
public class Definition
|
||||||
{
|
{
|
||||||
internal SteamNative.SteamInventory inventory;
|
internal Inventory inventory;
|
||||||
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
@ -64,7 +64,19 @@ public class Definition
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The dollar price from PriceRaw
|
/// The dollar price from PriceRaw
|
||||||
/// </summary>
|
/// </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>
|
/// <summary>
|
||||||
/// Returns true if this item can be sold on the marketplace
|
/// Returns true if this item can be sold on the marketplace
|
||||||
@ -78,7 +90,7 @@ public bool IsGenerator
|
|||||||
|
|
||||||
private Dictionary<string, string> customProperties;
|
private Dictionary<string, string> customProperties;
|
||||||
|
|
||||||
internal Definition( SteamNative.SteamInventory i, int id )
|
internal Definition( Inventory i, int id )
|
||||||
{
|
{
|
||||||
inventory = i;
|
inventory = i;
|
||||||
Id = id;
|
Id = id;
|
||||||
@ -132,7 +144,7 @@ public string GetStringProperty( string name )
|
|||||||
if ( customProperties != null && customProperties.ContainsKey( name ) )
|
if ( customProperties != null && customProperties.ContainsKey( name ) )
|
||||||
return customProperties[name];
|
return customProperties[name];
|
||||||
|
|
||||||
if ( !inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
if ( !inventory.inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
@ -161,12 +173,12 @@ internal void SetupCommonProperties()
|
|||||||
IconUrl = GetStringProperty( "icon_url" );
|
IconUrl = GetStringProperty( "icon_url" );
|
||||||
IconLargeUrl = GetStringProperty( "icon_url_large" );
|
IconLargeUrl = GetStringProperty( "icon_url_large" );
|
||||||
Type = GetStringProperty( "type" );
|
Type = GetStringProperty( "type" );
|
||||||
PriceRaw = GetStringProperty( "price_category" );
|
PriceCategory = GetStringProperty( "price_category" );
|
||||||
Marketable = GetBoolProperty( "marketable" );
|
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()
|
public void TriggerItemDrop()
|
||||||
{
|
{
|
||||||
SteamNative.SteamInventoryResult_t result = 0;
|
SteamNative.SteamInventoryResult_t result = 0;
|
||||||
inventory.TriggerItemDrop( ref result, Id );
|
inventory.inventory.TriggerItemDrop( ref result, Id );
|
||||||
inventory.DestroyResult( result );
|
inventory.inventory.DestroyResult( result );
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void Link( Definition[] definitions )
|
internal void Link( Definition[] definitions )
|
||||||
|
Loading…
Reference in New Issue
Block a user