diff --git a/Facepunch.Steamworks.Test/Client/Client.cs b/Facepunch.Steamworks.Test/Client/Client.cs
index ddd8042..359fb48 100644
--- a/Facepunch.Steamworks.Test/Client/Client.cs
+++ b/Facepunch.Steamworks.Test/Client/Client.cs
@@ -213,13 +213,15 @@ public void InventoryDefinitions()
Assert.IsNotNull( client.Inventory.Definitions );
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
- foreach ( var i in client.Inventory.Definitions )
+ foreach ( var i in client.Inventory.Definitions.Where( x => x.PriceRaw != "" ) )
{
Console.WriteLine( "{0}: {1} ({2})", i.Id, i.Name, i.Type );
Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) );
Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) );
Console.WriteLine( " IconUrl: {0}", i.IconUrl );
Console.WriteLine( " IconLargeUrl: {0}", i.IconLargeUrl );
+ Console.WriteLine( " PriceRaw: {0}", i.PriceRaw );
+ Console.WriteLine( " PriceDollars: {0}", i.PriceDollars );
}
}
}
diff --git a/Facepunch.Steamworks.Test/Web/IWorkshopService.cs b/Facepunch.Steamworks.Test/Web/IWorkshopService.cs
index 1c5882f..9308cb0 100644
--- a/Facepunch.Steamworks.Test/Web/IWorkshopService.cs
+++ b/Facepunch.Steamworks.Test/Web/IWorkshopService.cs
@@ -30,7 +30,7 @@ public void Init()
[TestMethod]
public void GetItemDailyRevenue()
{
- var response = Facepunch.SteamApi.IWorkshopService.GetItemDailyRevenue( 252490, 20006, DateTime.UtcNow.Subtract( TimeSpan.FromDays( 30 ) ), DateTime.UtcNow.AddDays( 30 ) );
+ var response = SteamApi.IWorkshopService.GetItemDailyRevenue( 252490, 20006, DateTime.Now.Subtract( TimeSpan.FromDays( 30 ) ), DateTime.Now.AddDays( 1 ) );
Console.WriteLine( "Item Sold " + response.TotalUnitsSold + " worldwide" );
Console.WriteLine( "Item Generated $" + response.TotalRevenue + " worldwide" );
diff --git a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs
index 5293512..fb3f436 100644
--- a/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs
+++ b/Facepunch.Steamworks/Interfaces/Inventory.Definition.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Net;
using System.Runtime.InteropServices;
using System.Text;
@@ -55,6 +56,21 @@ public class Definition
public DateTime Created { get; set; }
public DateTime Modified { get; set; }
+ ///
+ /// The raw contets of price_category from the schema
+ ///
+ public string PriceRaw { get; set; }
+
+ ///
+ /// The dollar price from PriceRaw
+ ///
+ public double PriceDollars { get; set; }
+
+ ///
+ /// Returns true if this item can be sold on the marketplace
+ ///
+ public bool Marketable { get; set; }
+
public bool IsGenerator
{
get { return Type == "generator"; }
@@ -86,6 +102,9 @@ public void SetProperty( string name, string value )
customProperties[name] = value;
}
+ ///
+ /// Read a raw property from the definition schema
+ ///
public T GetProperty( string name )
{
string val = GetStringProperty( name );
@@ -103,6 +122,9 @@ public T GetProperty( string name )
}
}
+ ///
+ /// Read a raw property from the definition schema
+ ///
public string GetStringProperty( string name )
{
string val = string.Empty;
@@ -116,6 +138,19 @@ public string GetStringProperty( string name )
return val;
}
+ ///
+ /// Read a raw property from the definition schema
+ ///
+ public bool GetBoolProperty( string name )
+ {
+ string val = GetStringProperty( name );
+
+ if ( val.Length == 0 ) return false;
+ if ( val[0] == '0' || val[0] == 'F'|| val[0] == 'f' ) return false;
+
+ return true;
+ }
+
internal void SetupCommonProperties()
{
Name = GetStringProperty( "name" );
@@ -126,6 +161,13 @@ internal void SetupCommonProperties()
IconUrl = GetStringProperty( "icon_url" );
IconLargeUrl = GetStringProperty( "icon_url_large" );
Type = GetStringProperty( "type" );
+ PriceRaw = GetStringProperty( "price_category" );
+ Marketable = GetBoolProperty( "marketable" );
+
+ if ( !string.IsNullOrEmpty( PriceRaw ) )
+ {
+ PriceDollars = PriceCategoryToFloat( PriceRaw );
+ }
}
///