mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-26 06:35:49 +03:00
Added ItemDef.PriceDollars
This commit is contained in:
parent
ef2fb26911
commit
f011ff8d8b
@ -213,13 +213,15 @@ public void InventoryDefinitions()
|
|||||||
Assert.IsNotNull( client.Inventory.Definitions );
|
Assert.IsNotNull( client.Inventory.Definitions );
|
||||||
Assert.AreNotEqual( 0, client.Inventory.Definitions.Length );
|
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( "{0}: {1} ({2})", i.Id, i.Name, i.Type );
|
||||||
Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) );
|
Console.WriteLine( " itemshortname: {0}", i.GetStringProperty( "itemshortname" ) );
|
||||||
Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) );
|
Console.WriteLine( " workshopdownload: {0}", i.GetStringProperty( "workshopdownload" ) );
|
||||||
Console.WriteLine( " IconUrl: {0}", i.IconUrl );
|
Console.WriteLine( " IconUrl: {0}", i.IconUrl );
|
||||||
Console.WriteLine( " IconLargeUrl: {0}", i.IconLargeUrl );
|
Console.WriteLine( " IconLargeUrl: {0}", i.IconLargeUrl );
|
||||||
|
Console.WriteLine( " PriceRaw: {0}", i.PriceRaw );
|
||||||
|
Console.WriteLine( " PriceDollars: {0}", i.PriceDollars );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ public void Init()
|
|||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void GetItemDailyRevenue()
|
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 Sold " + response.TotalUnitsSold + " worldwide" );
|
||||||
Console.WriteLine( "Item Generated $" + response.TotalRevenue + " worldwide" );
|
Console.WriteLine( "Item Generated $" + response.TotalRevenue + " worldwide" );
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
@ -55,6 +56,21 @@ public class Definition
|
|||||||
public DateTime Created { get; set; }
|
public DateTime Created { get; set; }
|
||||||
public DateTime Modified { get; set; }
|
public DateTime Modified { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The raw contets of price_category from the schema
|
||||||
|
/// </summary>
|
||||||
|
public string PriceRaw { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The dollar price from PriceRaw
|
||||||
|
/// </summary>
|
||||||
|
public double PriceDollars { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if this item can be sold on the marketplace
|
||||||
|
/// </summary>
|
||||||
|
public bool Marketable { get; set; }
|
||||||
|
|
||||||
public bool IsGenerator
|
public bool IsGenerator
|
||||||
{
|
{
|
||||||
get { return Type == "generator"; }
|
get { return Type == "generator"; }
|
||||||
@ -86,6 +102,9 @@ public void SetProperty( string name, string value )
|
|||||||
customProperties[name] = value;
|
customProperties[name] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a raw property from the definition schema
|
||||||
|
/// </summary>
|
||||||
public T GetProperty<T>( string name )
|
public T GetProperty<T>( string name )
|
||||||
{
|
{
|
||||||
string val = GetStringProperty( name );
|
string val = GetStringProperty( name );
|
||||||
@ -103,6 +122,9 @@ public T GetProperty<T>( string name )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a raw property from the definition schema
|
||||||
|
/// </summary>
|
||||||
public string GetStringProperty( string name )
|
public string GetStringProperty( string name )
|
||||||
{
|
{
|
||||||
string val = string.Empty;
|
string val = string.Empty;
|
||||||
@ -116,6 +138,19 @@ public string GetStringProperty( string name )
|
|||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Read a raw property from the definition schema
|
||||||
|
/// </summary>
|
||||||
|
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()
|
internal void SetupCommonProperties()
|
||||||
{
|
{
|
||||||
Name = GetStringProperty( "name" );
|
Name = GetStringProperty( "name" );
|
||||||
@ -126,6 +161,13 @@ 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" );
|
||||||
|
Marketable = GetBoolProperty( "marketable" );
|
||||||
|
|
||||||
|
if ( !string.IsNullOrEmpty( PriceRaw ) )
|
||||||
|
{
|
||||||
|
PriceDollars = PriceCategoryToFloat( PriceRaw );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user