mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2025-02-03 09:10:41 +03:00
Inventory cleanup/fixes
This commit is contained in:
parent
512c74640c
commit
ec71461dbf
@ -92,6 +92,7 @@
|
||||
<Compile Include="Client\Networking.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Client\Friends.cs" />
|
||||
<Compile Include="Server\Inventory.cs" />
|
||||
<Compile Include="Server\Server.cs" />
|
||||
<Compile Include="Server\Stats.cs" />
|
||||
</ItemGroup>
|
||||
|
53
Facepunch.Steamworks.Test/Server/Inventory.cs
Normal file
53
Facepunch.Steamworks.Test/Server/Inventory.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System.Linq;
|
||||
|
||||
namespace Facepunch.Steamworks.Test
|
||||
{
|
||||
public partial class Server
|
||||
{
|
||||
[TestMethod]
|
||||
public void Invetory()
|
||||
{
|
||||
using ( var client = new Facepunch.Steamworks.Client( 252490 ) )
|
||||
{
|
||||
Assert.IsTrue( client.Valid );
|
||||
|
||||
Assert.IsNull( client.Inventory.SerializedItems );
|
||||
|
||||
client.Inventory.Refresh();
|
||||
|
||||
//
|
||||
// Block until we have the items
|
||||
//
|
||||
while ( client.Inventory.SerializedItems == null )
|
||||
{
|
||||
client.Update();
|
||||
}
|
||||
|
||||
Assert.IsNotNull( client.Inventory.SerializedItems );
|
||||
Assert.IsTrue( client.Inventory.SerializedItems.Length > 4 );
|
||||
|
||||
using ( var server = new Facepunch.Steamworks.Server( 252490, 0, 30002, true, "VersionString" ) )
|
||||
{
|
||||
server.LogOnAnonymous();
|
||||
Assert.IsTrue( server.Valid );
|
||||
|
||||
var result = server.Inventory.Deserialize( client.Inventory.SerializedItems );
|
||||
|
||||
Assert.IsTrue( result.Block() );
|
||||
Assert.IsNotNull( result.Items );
|
||||
|
||||
foreach ( var item in result.Items )
|
||||
{
|
||||
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
|
||||
Console.WriteLine( "Item: {0} ({1})", item.Id, item.DefinitionId );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -9,8 +9,8 @@ namespace Facepunch.Steamworks
|
||||
{
|
||||
internal class Internal : IDisposable
|
||||
{
|
||||
private uint _hpipe;
|
||||
private uint _huser;
|
||||
private int _hpipe;
|
||||
private int _huser;
|
||||
|
||||
internal Valve.Steamworks.ISteamClient client;
|
||||
internal Valve.Steamworks.ISteamUser user;
|
||||
@ -25,7 +25,18 @@ namespace Facepunch.Steamworks
|
||||
|
||||
internal bool Init()
|
||||
{
|
||||
client = Valve.Steamworks.SteamAPI.SteamClient();
|
||||
_huser = Valve.Interop.NativeEntrypoints.Extended.SteamAPI_GetHSteamUser();
|
||||
_hpipe = Valve.Interop.NativeEntrypoints.Extended.SteamAPI_GetHSteamPipe();
|
||||
if ( _hpipe == 0 )
|
||||
throw new System.Exception( "Couldn't get Steam Pipe" );
|
||||
|
||||
var clientPtr = Valve.Interop.NativeEntrypoints.Extended.SteamInternal_CreateInterface( "SteamClient017" );
|
||||
if ( clientPtr == IntPtr.Zero )
|
||||
{
|
||||
throw new System.Exception( "Steam Client: Couldn't load SteamClient017" );
|
||||
}
|
||||
|
||||
client = new Valve.Steamworks.CSteamClient( clientPtr );
|
||||
|
||||
if ( client.GetIntPtr() == IntPtr.Zero )
|
||||
{
|
||||
@ -33,10 +44,9 @@ namespace Facepunch.Steamworks
|
||||
return false;
|
||||
}
|
||||
|
||||
_hpipe = client.CreateSteamPipe();
|
||||
_huser = client.ConnectToGlobalUser( _hpipe );
|
||||
|
||||
friends = client.GetISteamFriends( _huser, _hpipe, "SteamFriends015" );
|
||||
if ( friends.GetIntPtr() == IntPtr.Zero ) throw new System.Exception( "Couldn't load SteamFriends015" );
|
||||
|
||||
user = client.GetISteamUser( _huser, _hpipe, "SteamUser019" );
|
||||
servers = client.GetISteamMatchmakingServers( _huser, _hpipe, "SteamMatchMakingServers002" );
|
||||
inventory = client.GetISteamInventory( _huser, _hpipe, "STEAMINVENTORY_INTERFACE_V001" );
|
||||
@ -54,10 +64,10 @@ namespace Facepunch.Steamworks
|
||||
{
|
||||
if ( _hpipe > 0 && client != null )
|
||||
{
|
||||
if ( _huser > 0 )
|
||||
client.ReleaseUser( _hpipe, _huser );
|
||||
// if ( _huser > 0 )
|
||||
// client.ReleaseUser( _hpipe, _huser );
|
||||
|
||||
client.BReleaseSteamPipe( _hpipe );
|
||||
// client.BReleaseSteamPipe( _hpipe );
|
||||
|
||||
_huser = 0;
|
||||
_hpipe = 0;
|
||||
@ -68,6 +78,8 @@ namespace Facepunch.Steamworks
|
||||
client.BShutdownIfAllPipesClosed();
|
||||
client = null;
|
||||
}
|
||||
|
||||
Valve.Interop.NativeEntrypoints.Extended.SteamAPI_Shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,7 +118,7 @@ namespace Facepunch.Steamworks
|
||||
|
||||
public Client( uint appId )
|
||||
{
|
||||
Valve.Steamworks.SteamAPI.Init( appId );
|
||||
Valve.Steamworks.SteamAPIInterop.SteamAPI_Init();
|
||||
|
||||
native = new Internal();
|
||||
|
||||
|
71
Facepunch.Steamworks/Client/Inventory.Definition.cs
Normal file
71
Facepunch.Steamworks/Client/Inventory.Definition.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// An item definition. This describes an item in your Steam inventory, but is
|
||||
/// not unique to that item. For example, this might be a tshirt, but you might be able to own
|
||||
/// multiple tshirts.
|
||||
/// </summary>
|
||||
public class Definition
|
||||
{
|
||||
internal Valve.Steamworks.ISteamInventory inventory;
|
||||
|
||||
public int Id;
|
||||
public string Name;
|
||||
public string Description;
|
||||
|
||||
public DateTime Created;
|
||||
public DateTime Modified;
|
||||
|
||||
internal Definition( int id )
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public T GetProperty<T>( string name )
|
||||
{
|
||||
string val = string.Empty;
|
||||
|
||||
if ( !inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
||||
return default( T );
|
||||
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType( val, typeof( T ) );
|
||||
}
|
||||
catch ( System.Exception )
|
||||
{
|
||||
return default( T );
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetupCommonProperties()
|
||||
{
|
||||
Name = GetProperty<string>( "name" );
|
||||
Description = GetProperty<string>( "description" );
|
||||
Created = GetProperty<DateTime>( "timestamp" );
|
||||
Modified = GetProperty<DateTime>( "modified" );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger an item drop. Call this when it's a good time to award
|
||||
/// an item drop to a player. This won't automatically result in giving
|
||||
/// an item to a player. Just call it every minute or so, or on launch.
|
||||
/// ItemDefinition is usually a generator
|
||||
/// </summary>
|
||||
public void TriggerItemDrop()
|
||||
{
|
||||
int result = 0;
|
||||
inventory.TriggerItemDrop( ref result, Id );
|
||||
inventory.DestroyResult( result );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
29
Facepunch.Steamworks/Client/Inventory.Item.cs
Normal file
29
Facepunch.Steamworks/Client/Inventory.Item.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// An item in your inventory.
|
||||
/// </summary>
|
||||
public class Item
|
||||
{
|
||||
public ulong Id;
|
||||
public int Quantity;
|
||||
|
||||
public int DefinitionId;
|
||||
|
||||
/// <summary>
|
||||
/// Careful, this might not be available. Especially on a game server.
|
||||
/// </summary>
|
||||
public Definition Definition;
|
||||
|
||||
public bool TradeLocked;
|
||||
}
|
||||
}
|
||||
}
|
108
Facepunch.Steamworks/Client/Inventory.Result.cs
Normal file
108
Facepunch.Steamworks/Client/Inventory.Result.cs
Normal file
@ -0,0 +1,108 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Inventory
|
||||
{
|
||||
public class Result : IDisposable
|
||||
{
|
||||
internal Inventory inventory;
|
||||
|
||||
public int Handle { get; private set; }
|
||||
public Item[] Items { get; internal set; }
|
||||
|
||||
public bool IsPending
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Items != null ) return false;
|
||||
if ( Handle == -1 ) return false;
|
||||
if ( inventory.inventory.GetResultStatus( Handle ) == 22 ) return true;
|
||||
|
||||
Fill();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
internal bool IsSuccess
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Items != null ) return true;
|
||||
if ( Handle == -1 ) return false;
|
||||
return inventory.inventory.GetResultStatus( Handle ) == 1;
|
||||
}
|
||||
}
|
||||
|
||||
internal Result( Inventory inventory, int Handle )
|
||||
{
|
||||
this.Handle = Handle;
|
||||
this.inventory = inventory;
|
||||
}
|
||||
|
||||
public bool Block( float maxWait = 5.0f )
|
||||
{
|
||||
while ( IsPending )
|
||||
{
|
||||
System.Threading.Thread.Sleep( 5 );
|
||||
}
|
||||
|
||||
return IsSuccess;
|
||||
}
|
||||
|
||||
internal void Fill()
|
||||
{
|
||||
if ( Items != null ) return;
|
||||
|
||||
Valve.Steamworks.SteamItemDetails_t[] steamItems = null;
|
||||
inventory.inventory.GetResultItems( Handle, out steamItems );
|
||||
|
||||
if ( steamItems == null )
|
||||
{
|
||||
throw new System.Exception( "steamItems was null" );
|
||||
}
|
||||
|
||||
Items = steamItems.Select( x =>
|
||||
{
|
||||
return new Inventory.Item()
|
||||
{
|
||||
Quantity = x.m_unQuantity,
|
||||
Id = x.m_itemId,
|
||||
DefinitionId = x.m_iDefinition,
|
||||
TradeLocked = ( (int)x.m_unFlags & (int)Valve.Steamworks.ESteamItemFlags.k_ESteamItemNoTrade ) != 0,
|
||||
Definition = inventory.FindDefinition( x.m_iDefinition )
|
||||
};
|
||||
} ).ToArray();
|
||||
}
|
||||
|
||||
internal byte[] Serialize()
|
||||
{
|
||||
uint size = 0;
|
||||
inventory.inventory.SerializeResult( Handle, IntPtr.Zero, out size );
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal((int) size);
|
||||
|
||||
if ( !inventory.inventory.SerializeResult( Handle, ptr, out size ) )
|
||||
return null;
|
||||
|
||||
var data = new byte[size];
|
||||
|
||||
Marshal.Copy( ptr, data, 0, (int)size );
|
||||
Marshal.FreeHGlobal( ptr );
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
inventory.inventory.DestroyResult( Handle );
|
||||
Handle = -1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
@ -14,129 +15,21 @@ namespace Facepunch.Steamworks
|
||||
get
|
||||
{
|
||||
if ( _inv == null )
|
||||
_inv = new Inventory( this );
|
||||
_inv = new Inventory( native.inventory, false );
|
||||
|
||||
return _inv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Inventory
|
||||
public partial class Inventory
|
||||
{
|
||||
/// <summary>
|
||||
/// Called when the items are first retrieved, and when they change
|
||||
/// Called when the local client's items are first retrieved, and when they change.
|
||||
/// Obviously not called on the server.
|
||||
/// </summary>
|
||||
public Action OnUpdate;
|
||||
|
||||
internal Client client;
|
||||
private int updateRequest = -1;
|
||||
|
||||
internal Inventory( Client c )
|
||||
{
|
||||
client = c;
|
||||
|
||||
LoadItemDefinitions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this at least every two minutes, every frame doesn't hurt.
|
||||
/// You should call it when you consider it active play time.
|
||||
/// IE - your player is alive, and playing.
|
||||
/// Don't stress on it too much tho cuz it's super hijackable anyway.
|
||||
/// </summary>
|
||||
public void PlaytimeHeartbeat()
|
||||
{
|
||||
client.native.inventory.SendItemDropHeartbeat();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this to retrieve the items.
|
||||
/// Note that if this has already been called it won't
|
||||
/// trigger a call to OnUpdate unless the items have changed
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
// Pending
|
||||
if ( updateRequest != -1 )
|
||||
return;
|
||||
|
||||
if ( !client.native.inventory.GetAllItems( ref updateRequest ) )
|
||||
{
|
||||
Console.WriteLine( "GetAllItems failed!?" );
|
||||
}
|
||||
}
|
||||
|
||||
public Definition CreateDefinition( int id )
|
||||
{
|
||||
return new Definition( id )
|
||||
{
|
||||
client = client
|
||||
};
|
||||
}
|
||||
|
||||
internal void LoadItemDefinitions()
|
||||
{
|
||||
//
|
||||
// Make sure item definitions are loaded, because we're going to be using them.
|
||||
//
|
||||
client.native.inventory.LoadItemDefinitions();
|
||||
|
||||
int[] ids;
|
||||
if ( !client.native.inventory.GetItemDefinitionIDs( out ids ) )
|
||||
return;
|
||||
|
||||
Definitions = ids.Select( x =>
|
||||
{
|
||||
var d = CreateDefinition( x );
|
||||
d.SetupCommonProperties();
|
||||
return d;
|
||||
|
||||
} ).ToArray();
|
||||
}
|
||||
|
||||
internal T DefinitionProperty<T>( int i, string name )
|
||||
{
|
||||
string val = string.Empty;
|
||||
client.native.inventory.GetItemDefinitionProperty( i, name, out val );
|
||||
return (T) Convert.ChangeType( val, typeof( T) );
|
||||
}
|
||||
|
||||
internal void DestroyResult()
|
||||
{
|
||||
if ( updateRequest == -1 ) return;
|
||||
|
||||
client.native.inventory.DestroyResult( updateRequest );
|
||||
updateRequest = -1;
|
||||
}
|
||||
|
||||
|
||||
internal void Update()
|
||||
{
|
||||
UpdateRequest();
|
||||
}
|
||||
|
||||
private void UpdateRequest()
|
||||
{
|
||||
if ( updateRequest == -1 )
|
||||
return;
|
||||
|
||||
var status = (Valve.Steamworks.EResult) client.native.inventory.GetResultStatus( updateRequest );
|
||||
|
||||
if ( status == Valve.Steamworks.EResult.k_EResultPending )
|
||||
return;
|
||||
|
||||
if ( status == Valve.Steamworks.EResult.k_EResultOK )
|
||||
{
|
||||
RetrieveInventory();
|
||||
return;
|
||||
}
|
||||
|
||||
// Some other error
|
||||
// Lets just retry.
|
||||
DestroyResult();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of items owned by this user. You should call Refresh() before trying to access this,
|
||||
/// and then wait until it's non null or listen to OnUpdate to find out immediately when it's populated.
|
||||
@ -154,42 +47,131 @@ namespace Facepunch.Steamworks
|
||||
/// </summary>
|
||||
public DateTime SerializedExpireTime;
|
||||
|
||||
private unsafe void RetrieveInventory()
|
||||
{
|
||||
Valve.Steamworks.SteamItemDetails_t[] items = null;
|
||||
client.native.inventory.GetResultItems( updateRequest, out items );
|
||||
internal Valve.Steamworks.ISteamInventory inventory;
|
||||
private Result LocalPlayerRequest;
|
||||
private bool IsServer { get; set; }
|
||||
|
||||
Items = items.Select( x =>
|
||||
internal Inventory( Valve.Steamworks.ISteamInventory c, bool server )
|
||||
{
|
||||
return new Item()
|
||||
{
|
||||
client = client,
|
||||
Quantity = x.m_unQuantity,
|
||||
Id = x.m_itemId,
|
||||
DefinitionId = x.m_iDefinition,
|
||||
TradeLocked = ( (int)x.m_unFlags & (int)Valve.Steamworks.ESteamItemFlags.k_ESteamItemNoTrade ) != 0,
|
||||
Definition = Definitions.FirstOrDefault( y => y.Id == x.m_iDefinition )
|
||||
};
|
||||
} ).ToArray();
|
||||
IsServer = server;
|
||||
inventory = c;
|
||||
|
||||
//
|
||||
// Get a serialized version
|
||||
//
|
||||
uint size = 0;
|
||||
client.native.inventory.SerializeResult( updateRequest, IntPtr.Zero, ref size );
|
||||
SerializedItems = new byte[size];
|
||||
|
||||
fixed( byte* b = SerializedItems )
|
||||
{
|
||||
client.native.inventory.SerializeResult( updateRequest, (IntPtr) b, ref size );
|
||||
inventory.LoadItemDefinitions();
|
||||
FetchItemDefinitions();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this at least every two minutes, every frame doesn't hurt.
|
||||
/// You should call it when you consider it active play time.
|
||||
/// IE - your player is alive, and playing.
|
||||
/// Don't stress on it too much tho cuz it's super hijackable anyway.
|
||||
/// </summary>
|
||||
public void PlaytimeHeartbeat()
|
||||
{
|
||||
inventory.SendItemDropHeartbeat();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Call this to retrieve the items.
|
||||
/// Note that if this has already been called it won't
|
||||
/// trigger a call to OnUpdate unless the items have changed
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
if ( IsServer ) return;
|
||||
|
||||
// Pending
|
||||
if ( LocalPlayerRequest != null )
|
||||
return;
|
||||
|
||||
int request = 0;
|
||||
if ( !inventory.GetAllItems( ref request ) || request == -1 )
|
||||
{
|
||||
Console.WriteLine( "GetAllItems failed!?" );
|
||||
return;
|
||||
}
|
||||
|
||||
LocalPlayerRequest = new Result( this, request );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Some definitions aren't sent to the client, and all aren't available on the server.
|
||||
/// Manually getting a Definition here lets you call functions on those definitions.
|
||||
/// </summary>
|
||||
public Definition CreateDefinition( int id )
|
||||
{
|
||||
return new Definition( id )
|
||||
{
|
||||
inventory = inventory
|
||||
};
|
||||
}
|
||||
|
||||
internal void FetchItemDefinitions()
|
||||
{
|
||||
//
|
||||
// Make sure item definitions are loaded, because we're going to be using them.
|
||||
//
|
||||
|
||||
int[] ids;
|
||||
if ( !inventory.GetItemDefinitionIDs( out ids ) )
|
||||
{
|
||||
Console.WriteLine( "Couldn't load definitions" );
|
||||
return;
|
||||
}
|
||||
|
||||
Definitions = ids.Select( x =>
|
||||
{
|
||||
var d = CreateDefinition( x );
|
||||
d.SetupCommonProperties();
|
||||
return d;
|
||||
|
||||
} ).ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called every frame
|
||||
/// </summary>
|
||||
internal void Update()
|
||||
{
|
||||
if ( Definitions == null )
|
||||
FetchItemDefinitions();
|
||||
|
||||
UpdateLocalRequest();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If we have a local player request process it.
|
||||
/// </summary>
|
||||
private void UpdateLocalRequest()
|
||||
{
|
||||
if ( LocalPlayerRequest == null )
|
||||
return;
|
||||
|
||||
if ( LocalPlayerRequest.IsPending )
|
||||
return;
|
||||
|
||||
if ( LocalPlayerRequest.IsSuccess )
|
||||
{
|
||||
RetrieveInventory();
|
||||
return;
|
||||
}
|
||||
|
||||
// Some other error
|
||||
// Lets just retry.
|
||||
LocalPlayerRequest.Dispose();
|
||||
LocalPlayerRequest = null;
|
||||
Refresh();
|
||||
}
|
||||
|
||||
private unsafe void RetrieveInventory()
|
||||
{
|
||||
SerializedItems = LocalPlayerRequest.Serialize();
|
||||
SerializedExpireTime = DateTime.Now.Add( TimeSpan.FromMinutes( 60 ) );
|
||||
|
||||
//
|
||||
// Finished with this result, don't call it again
|
||||
//
|
||||
DestroyResult();
|
||||
Items = LocalPlayerRequest.Items;
|
||||
|
||||
LocalPlayerRequest.Dispose();
|
||||
LocalPlayerRequest = null;
|
||||
|
||||
//
|
||||
// Tell everyone we've got new items!
|
||||
@ -197,90 +179,12 @@ namespace Facepunch.Steamworks
|
||||
OnUpdate?.Invoke();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An item in your inventory.
|
||||
/// </summary>
|
||||
public class Item
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public ulong Id;
|
||||
public int Quantity;
|
||||
|
||||
public int DefinitionId;
|
||||
public Definition Definition;
|
||||
|
||||
public bool TradeLocked;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A list of items defined for this app.
|
||||
/// This should be immediately populated and available.
|
||||
/// </summary>
|
||||
public Definition[] Definitions;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An item definition. This describes an item in your Steam inventory, but is
|
||||
/// not unique to that item. For example, this might be a tshirt, but you might be able to own
|
||||
/// multiple tshirts.
|
||||
/// </summary>
|
||||
public class Definition
|
||||
{
|
||||
internal Client client;
|
||||
|
||||
public int Id;
|
||||
public string Name;
|
||||
public string Description;
|
||||
|
||||
public DateTime Created;
|
||||
public DateTime Modified;
|
||||
|
||||
internal Definition( int id )
|
||||
{
|
||||
Id = id;
|
||||
}
|
||||
|
||||
public T GetProperty<T>( string name )
|
||||
{
|
||||
string val = string.Empty;
|
||||
|
||||
if ( !client.native.inventory.GetItemDefinitionProperty( Id, name, out val ) )
|
||||
return default( T );
|
||||
|
||||
try
|
||||
{
|
||||
return (T)Convert.ChangeType( val, typeof( T ) );
|
||||
}
|
||||
catch( System.Exception )
|
||||
{
|
||||
return default( T );
|
||||
}
|
||||
}
|
||||
|
||||
internal void SetupCommonProperties()
|
||||
{
|
||||
Name = GetProperty<string>( "name" );
|
||||
Description = GetProperty<string>( "description" );
|
||||
Created = GetProperty<DateTime>( "timestamp" );
|
||||
Modified = GetProperty<DateTime>( "modified" );
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Trigger an item drop. Call this when it's a good time to award
|
||||
/// an item drop to a player. This won't automatically result in giving
|
||||
/// an item to a player. Just call it every minute or so, or on launch.
|
||||
/// ItemDefinition is usually a generator
|
||||
/// </summary>
|
||||
public void TriggerItemDrop()
|
||||
{
|
||||
int result = 0;
|
||||
client.native.inventory.TriggerItemDrop( ref result, Id );
|
||||
client.native.inventory.DestroyResult( result );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Utility, given a "1;VLV250" string, convert it to a 2.5
|
||||
/// </summary>
|
||||
@ -295,5 +199,30 @@ namespace Facepunch.Steamworks
|
||||
return int.Parse( price ) / 100.0f;
|
||||
}
|
||||
|
||||
private Definition FindDefinition( int def )
|
||||
{
|
||||
if ( Definitions == null ) return null;
|
||||
|
||||
return Definitions.FirstOrDefault( x => x.Id == def );
|
||||
}
|
||||
|
||||
public Result Deserialize( byte[] data, int dataLength = -1 )
|
||||
{
|
||||
if ( dataLength == -1 )
|
||||
dataLength = data.Length;
|
||||
|
||||
int resultHandle = -1;
|
||||
|
||||
IntPtr ptr = Marshal.AllocHGlobal( dataLength);
|
||||
Marshal.Copy( data, 0, ptr, dataLength );
|
||||
var result = inventory.DeserializeResult( out resultHandle, ptr, (uint)dataLength, false );
|
||||
Marshal.FreeHGlobal( ptr );
|
||||
|
||||
if ( !result || resultHandle == -1 )
|
||||
return null;
|
||||
|
||||
return new Result( this, resultHandle );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -114,6 +114,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Callbacks\User.cs" />
|
||||
<Compile Include="Client\Inventory.Item.cs" />
|
||||
<Compile Include="Client\Inventory.Result.cs" />
|
||||
<Compile Include="Client\Networking.cs" />
|
||||
<Compile Include="Client\Overlay.cs" />
|
||||
<Compile Include="Client\ServerList.cs" />
|
||||
@ -127,6 +129,7 @@
|
||||
<Compile Include="Client\Inventory.cs" />
|
||||
<Compile Include="Client\Screenshots.cs" />
|
||||
<Compile Include="Client\Stats.cs" />
|
||||
<Compile Include="Client\Inventory.Definition.cs" />
|
||||
<Compile Include="Client\Voice.cs" />
|
||||
<Compile Include="Config.cs" />
|
||||
<Compile Include="Interop\Callback.cs" />
|
||||
@ -135,6 +138,7 @@
|
||||
<Compile Include="Interop\steam_api_interop.cs" />
|
||||
<Compile Include="Server.cs" />
|
||||
<Compile Include="Server\Auth.cs" />
|
||||
<Compile Include="Server\Inventory.cs" />
|
||||
<Compile Include="Server\Query.cs" />
|
||||
<Compile Include="Server\Stats.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -15,6 +15,8 @@ namespace Valve.Interop
|
||||
{
|
||||
internal class NativeEntrypoints
|
||||
{
|
||||
|
||||
|
||||
internal class Extended
|
||||
{
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
@ -24,10 +26,10 @@ namespace Valve.Interop
|
||||
internal static extern IntPtr SteamInternal_CreateInterface( string ver );
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern uint SteamGameServer_GetHSteamUser();
|
||||
internal static extern int SteamGameServer_GetHSteamUser();
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern uint SteamGameServer_GetHSteamPipe();
|
||||
internal static extern int SteamGameServer_GetHSteamPipe();
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern void SteamGameServer_Shutdown();
|
||||
@ -35,46 +37,54 @@ namespace Valve.Interop
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern void SteamGameServer_RunCallbacks();
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern int SteamAPI_GetHSteamUser();
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern int SteamAPI_GetHSteamPipe();
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl )]
|
||||
internal static extern int SteamAPI_Shutdown();
|
||||
}
|
||||
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_CreateSteamPipe" )]
|
||||
internal static extern uint SteamAPI_ISteamClient_CreateSteamPipe( IntPtr instancePtr );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_BReleaseSteamPipe" )]
|
||||
internal static extern bool SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr instancePtr, uint hSteamPipe );
|
||||
internal static extern bool SteamAPI_ISteamClient_BReleaseSteamPipe( IntPtr instancePtr, int hSteamPipe );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_ConnectToGlobalUser" )]
|
||||
internal static extern uint SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr instancePtr, uint hSteamPipe );
|
||||
internal static extern uint SteamAPI_ISteamClient_ConnectToGlobalUser( IntPtr instancePtr, int hSteamPipe );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_CreateLocalUser" )]
|
||||
internal static extern uint SteamAPI_ISteamClient_CreateLocalUser( IntPtr instancePtr, ref uint phSteamPipe, uint eAccountType );
|
||||
internal static extern uint SteamAPI_ISteamClient_CreateLocalUser( IntPtr instancePtr, ref int phSteamPipe, uint eAccountType );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_ReleaseUser" )]
|
||||
internal static extern void SteamAPI_ISteamClient_ReleaseUser( IntPtr instancePtr, uint hSteamPipe, uint hUser );
|
||||
internal static extern void SteamAPI_ISteamClient_ReleaseUser( IntPtr instancePtr, int hSteamPipe, int hUser );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUser" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUser( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUser( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServer" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServer( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServer( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_SetLocalIPBinding" )]
|
||||
internal static extern void SteamAPI_ISteamClient_SetLocalIPBinding( IntPtr instancePtr, uint unIP, char usPort );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamFriends" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamFriends( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamFriends( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUtils" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUtils( IntPtr instancePtr, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUtils( IntPtr instancePtr, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmaking" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmaking( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMatchmakingServers" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMatchmakingServers( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGenericInterface" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGenericInterface( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUserStats" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUserStats( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUserStats( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamGameServerStats" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamGameServerStats( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamApps" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamApps( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamApps( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamNetworking" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamNetworking( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamNetworking( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamRemoteStorage" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamRemoteStorage( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamScreenshots" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamScreenshots( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetIPCCallCount" )]
|
||||
internal static extern uint SteamAPI_ISteamClient_GetIPCCallCount( IntPtr instancePtr );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_SetWarningMessageHook" )]
|
||||
@ -82,25 +92,25 @@ namespace Valve.Interop
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_BShutdownIfAllPipesClosed" )]
|
||||
internal static extern bool SteamAPI_ISteamClient_BShutdownIfAllPipesClosed( IntPtr instancePtr );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamHTTP" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTTP( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTTP( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUnifiedMessages" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUnifiedMessages( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUnifiedMessages( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamController" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamController( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamController( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamUGC" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUGC( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamUGC( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamAppList" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamAppList( IntPtr instancePtr, uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamAppList( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMusic" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusic( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusic( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamMusicRemote" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamMusicRemote( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamHTMLSurface" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamHTMLSurface( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamInventory" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamInventory( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamInventory( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamClient_GetISteamVideo" )]
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamVideo( IntPtr instancePtr, uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal static extern IntPtr SteamAPI_ISteamClient_GetISteamVideo( IntPtr instancePtr, int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamUser_GetHSteamUser" )]
|
||||
internal static extern uint SteamAPI_ISteamUser_GetHSteamUser( IntPtr instancePtr );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamUser_BLoggedOn" )]
|
||||
@ -1168,7 +1178,7 @@ namespace Valve.Interop
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamHTMLSurface_JSDialogResponse" )]
|
||||
internal static extern void SteamAPI_ISteamHTMLSurface_JSDialogResponse( IntPtr instancePtr, uint unBrowserHandle, bool bResult );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GetResultStatus" )]
|
||||
internal static extern uint SteamAPI_ISteamInventory_GetResultStatus( IntPtr instancePtr, int resultHandle );
|
||||
internal static extern int SteamAPI_ISteamInventory_GetResultStatus( IntPtr instancePtr, int resultHandle );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GetResultItems" )]
|
||||
internal static extern bool SteamAPI_ISteamInventory_GetResultItems( IntPtr instancePtr, int resultHandle, [In, Out] SteamItemDetails_t[] pOutItemsArray, ref uint punOutItemsArraySize );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GetResultTimestamp" )]
|
||||
@ -1182,9 +1192,9 @@ namespace Valve.Interop
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GetItemsByID" )]
|
||||
internal static extern bool SteamAPI_ISteamInventory_GetItemsByID( IntPtr instancePtr, ref int pResultHandle, [In, Out] ulong[] pInstanceIDs, uint unCountInstanceIDs );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_SerializeResult" )]
|
||||
internal static extern bool SteamAPI_ISteamInventory_SerializeResult( IntPtr instancePtr, int resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize );
|
||||
internal static extern bool SteamAPI_ISteamInventory_SerializeResult( IntPtr instancePtr, int resultHandle, IntPtr pOutBuffer, out uint punOutBufferSize );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_DeserializeResult" )]
|
||||
internal static extern bool SteamAPI_ISteamInventory_DeserializeResult( IntPtr instancePtr, ref int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE );
|
||||
internal static unsafe extern bool SteamAPI_ISteamInventory_DeserializeResult( IntPtr instancePtr, out int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GenerateItems" )]
|
||||
internal static extern bool SteamAPI_ISteamInventory_GenerateItems( IntPtr instancePtr, ref int pResultHandle, [In, Out] int[] pArrayItemDefs, [In, Out] uint[] punArrayQuantity, uint unArrayLength );
|
||||
[DllImportAttribute( Config.LibraryName, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SteamAPI_ISteamInventory_GrantPromoItems" )]
|
||||
@ -1580,37 +1590,37 @@ namespace Valve.Steamworks
|
||||
{
|
||||
internal abstract IntPtr GetIntPtr();
|
||||
internal abstract uint CreateSteamPipe();
|
||||
internal abstract bool BReleaseSteamPipe( uint hSteamPipe );
|
||||
internal abstract uint ConnectToGlobalUser( uint hSteamPipe );
|
||||
internal abstract uint CreateLocalUser( ref uint phSteamPipe, uint eAccountType );
|
||||
internal abstract void ReleaseUser( uint hSteamPipe, uint hUser );
|
||||
internal abstract ISteamUser GetISteamUser( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamGameServer GetISteamGameServer( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract bool BReleaseSteamPipe( int hSteamPipe );
|
||||
internal abstract uint ConnectToGlobalUser( int hSteamPipe );
|
||||
internal abstract uint CreateLocalUser( ref int phSteamPipe, uint eAccountType );
|
||||
internal abstract void ReleaseUser( int hSteamPipe, int hUser );
|
||||
internal abstract ISteamUser GetISteamUser( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamGameServer GetISteamGameServer( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract void SetLocalIPBinding( uint unIP, char usPort );
|
||||
internal abstract ISteamFriends GetISteamFriends( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUtils GetISteamUtils( uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMatchmaking GetISteamMatchmaking( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMatchmakingServers GetISteamMatchmakingServers( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract IntPtr GetISteamGenericInterface( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUserStats GetISteamUserStats( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamGameServerStats GetISteamGameServerStats( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamApps GetISteamApps( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamNetworking GetISteamNetworking( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamRemoteStorage GetISteamRemoteStorage( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamScreenshots GetISteamScreenshots( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamFriends GetISteamFriends( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUtils GetISteamUtils( int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMatchmaking GetISteamMatchmaking( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMatchmakingServers GetISteamMatchmakingServers( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract IntPtr GetISteamGenericInterface( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUserStats GetISteamUserStats( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamGameServerStats GetISteamGameServerStats( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamApps GetISteamApps( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamNetworking GetISteamNetworking( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamRemoteStorage GetISteamRemoteStorage( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamScreenshots GetISteamScreenshots( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract uint GetIPCCallCount();
|
||||
internal abstract void SetWarningMessageHook( IntPtr pFunction );
|
||||
internal abstract bool BShutdownIfAllPipesClosed();
|
||||
internal abstract ISteamHTTP GetISteamHTTP( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUnifiedMessages GetISteamUnifiedMessages( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamController GetISteamController( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUGC GetISteamUGC( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamAppList GetISteamAppList( uint hSteamUser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMusic GetISteamMusic( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMusicRemote GetISteamMusicRemote( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamHTMLSurface GetISteamHTMLSurface( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamInventory GetISteamInventory( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamVideo GetISteamVideo( uint hSteamuser, uint hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamHTTP GetISteamHTTP( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUnifiedMessages GetISteamUnifiedMessages( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamController GetISteamController( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamUGC GetISteamUGC( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamAppList GetISteamAppList( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMusic GetISteamMusic( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamMusicRemote GetISteamMusicRemote( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamHTMLSurface GetISteamHTMLSurface( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamInventory GetISteamInventory( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
internal abstract ISteamVideo GetISteamVideo( int hSteamUser, int hSteamPipe, string pchVersion );
|
||||
}
|
||||
|
||||
|
||||
@ -2282,15 +2292,15 @@ namespace Valve.Steamworks
|
||||
internal abstract class ISteamInventory
|
||||
{
|
||||
internal abstract IntPtr GetIntPtr();
|
||||
internal abstract uint GetResultStatus( int resultHandle );
|
||||
internal abstract int GetResultStatus( int resultHandle );
|
||||
internal abstract bool GetResultItems( int resultHandle, out SteamItemDetails_t[] pOutItemsArray );
|
||||
internal abstract uint GetResultTimestamp( int resultHandle );
|
||||
internal abstract bool CheckResultSteamID( int resultHandle, ulong steamIDExpected );
|
||||
internal abstract void DestroyResult( int resultHandle );
|
||||
internal abstract bool GetAllItems( ref int pResultHandle );
|
||||
internal abstract bool GetItemsByID( ref int pResultHandle, ulong[] pInstanceIDs );
|
||||
internal abstract bool SerializeResult( int resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize );
|
||||
internal abstract bool DeserializeResult( ref int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE );
|
||||
internal abstract bool SerializeResult( int resultHandle, IntPtr pOutBuffer, out uint punOutBufferSize );
|
||||
internal abstract bool DeserializeResult( out int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE );
|
||||
internal abstract bool GenerateItems( ref int pResultHandle, int[] pArrayItemDefs, uint[] punArrayQuantity );
|
||||
internal abstract bool GrantPromoItems( ref int pResultHandle );
|
||||
internal abstract bool AddPromoItem( ref int pResultHandle, int itemDef );
|
||||
@ -2404,37 +2414,37 @@ namespace Valve.Steamworks
|
||||
uint result = NativeEntrypoints.SteamAPI_ISteamClient_CreateSteamPipe(m_pSteamClient);
|
||||
return result;
|
||||
}
|
||||
internal override bool BReleaseSteamPipe( uint hSteamPipe )
|
||||
internal override bool BReleaseSteamPipe( int hSteamPipe )
|
||||
{
|
||||
CheckIfUsable();
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamClient_BReleaseSteamPipe(m_pSteamClient,hSteamPipe);
|
||||
return result;
|
||||
}
|
||||
internal override uint ConnectToGlobalUser( uint hSteamPipe )
|
||||
internal override uint ConnectToGlobalUser( int hSteamPipe )
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_ISteamClient_ConnectToGlobalUser(m_pSteamClient,hSteamPipe);
|
||||
return result;
|
||||
}
|
||||
internal override uint CreateLocalUser( ref uint phSteamPipe, uint eAccountType )
|
||||
internal override uint CreateLocalUser( ref int phSteamPipe, uint eAccountType )
|
||||
{
|
||||
CheckIfUsable();
|
||||
phSteamPipe = 0;
|
||||
uint result = NativeEntrypoints.SteamAPI_ISteamClient_CreateLocalUser(m_pSteamClient,ref phSteamPipe,eAccountType);
|
||||
return result;
|
||||
}
|
||||
internal override void ReleaseUser( uint hSteamPipe, uint hUser )
|
||||
internal override void ReleaseUser( int hSteamPipe, int hUser )
|
||||
{
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_ISteamClient_ReleaseUser( m_pSteamClient, hSteamPipe, hUser );
|
||||
}
|
||||
internal override ISteamUser GetISteamUser( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamUser GetISteamUser( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUser(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamUser( result );
|
||||
}
|
||||
internal override ISteamGameServer GetISteamGameServer( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamGameServer GetISteamGameServer( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGameServer(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
@ -2445,70 +2455,70 @@ namespace Valve.Steamworks
|
||||
CheckIfUsable();
|
||||
NativeEntrypoints.SteamAPI_ISteamClient_SetLocalIPBinding( m_pSteamClient, unIP, usPort );
|
||||
}
|
||||
internal override ISteamFriends GetISteamFriends( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamFriends GetISteamFriends( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamFriends(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamFriends( result );
|
||||
}
|
||||
internal override ISteamUtils GetISteamUtils( uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamUtils GetISteamUtils( int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUtils(m_pSteamClient,hSteamPipe,pchVersion);
|
||||
return new CSteamUtils( result );
|
||||
}
|
||||
internal override ISteamMatchmaking GetISteamMatchmaking( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamMatchmaking GetISteamMatchmaking( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMatchmaking(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamMatchmaking)Marshal.PtrToStructure( result, typeof( ISteamMatchmaking ) );
|
||||
}
|
||||
internal override ISteamMatchmakingServers GetISteamMatchmakingServers( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamMatchmakingServers GetISteamMatchmakingServers( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMatchmakingServers(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamMatchmakingServers( result );
|
||||
}
|
||||
internal override IntPtr GetISteamGenericInterface( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override IntPtr GetISteamGenericInterface( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGenericInterface(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (IntPtr)Marshal.PtrToStructure( result, typeof( IntPtr ) );
|
||||
}
|
||||
internal override ISteamUserStats GetISteamUserStats( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamUserStats GetISteamUserStats( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUserStats(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamUserStats( result );
|
||||
}
|
||||
internal override ISteamGameServerStats GetISteamGameServerStats( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamGameServerStats GetISteamGameServerStats( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGameServerStats(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamGameServerStats(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamGameServerStats( result );
|
||||
}
|
||||
internal override ISteamApps GetISteamApps( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamApps GetISteamApps( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamApps(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamApps( result );
|
||||
}
|
||||
internal override ISteamNetworking GetISteamNetworking( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamNetworking GetISteamNetworking( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamNetworking(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamNetworking( result );
|
||||
}
|
||||
internal override ISteamRemoteStorage GetISteamRemoteStorage( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamRemoteStorage GetISteamRemoteStorage( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamRemoteStorage(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamRemoteStorage(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamRemoteStorage)Marshal.PtrToStructure( result, typeof( ISteamRemoteStorage ) );
|
||||
}
|
||||
internal override ISteamScreenshots GetISteamScreenshots( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamScreenshots GetISteamScreenshots( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamScreenshots(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamScreenshots(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamScreenshots( result );
|
||||
}
|
||||
internal override uint GetIPCCallCount()
|
||||
@ -2528,64 +2538,64 @@ namespace Valve.Steamworks
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamClient_BShutdownIfAllPipesClosed(m_pSteamClient);
|
||||
return result;
|
||||
}
|
||||
internal override ISteamHTTP GetISteamHTTP( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamHTTP GetISteamHTTP( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTTP(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTTP(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamHTTP( result );
|
||||
}
|
||||
internal override ISteamUnifiedMessages GetISteamUnifiedMessages( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamUnifiedMessages GetISteamUnifiedMessages( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUnifiedMessages(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUnifiedMessages(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamUnifiedMessages)Marshal.PtrToStructure( result, typeof( ISteamUnifiedMessages ) );
|
||||
}
|
||||
internal override ISteamController GetISteamController( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamController GetISteamController( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamController(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamController)Marshal.PtrToStructure( result, typeof( ISteamController ) );
|
||||
}
|
||||
internal override ISteamUGC GetISteamUGC( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamUGC GetISteamUGC( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamUGC(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamUGC( result );
|
||||
}
|
||||
internal override ISteamAppList GetISteamAppList( uint hSteamUser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamAppList GetISteamAppList( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamAppList(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamAppList)Marshal.PtrToStructure( result, typeof( ISteamAppList ) );
|
||||
}
|
||||
internal override ISteamMusic GetISteamMusic( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamMusic GetISteamMusic( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusic(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusic(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamMusic)Marshal.PtrToStructure( result, typeof( ISteamMusic ) );
|
||||
}
|
||||
internal override ISteamMusicRemote GetISteamMusicRemote( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamMusicRemote GetISteamMusicRemote( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusicRemote(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamMusicRemote(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamMusicRemote)Marshal.PtrToStructure( result, typeof( ISteamMusicRemote ) );
|
||||
}
|
||||
internal override ISteamHTMLSurface GetISteamHTMLSurface( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamHTMLSurface GetISteamHTMLSurface( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTMLSurface(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamHTMLSurface(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamHTMLSurface)Marshal.PtrToStructure( result, typeof( ISteamHTMLSurface ) );
|
||||
}
|
||||
internal override ISteamInventory GetISteamInventory( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamInventory GetISteamInventory( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamInventory(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamInventory(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return new CSteamInventory( result );
|
||||
}
|
||||
internal override ISteamVideo GetISteamVideo( uint hSteamuser, uint hSteamPipe, string pchVersion )
|
||||
internal override ISteamVideo GetISteamVideo( int hSteamUser, int hSteamPipe, string pchVersion )
|
||||
{
|
||||
CheckIfUsable();
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamVideo(m_pSteamClient,hSteamuser,hSteamPipe,pchVersion);
|
||||
IntPtr result = NativeEntrypoints.SteamAPI_ISteamClient_GetISteamVideo(m_pSteamClient,hSteamUser,hSteamPipe,pchVersion);
|
||||
return (ISteamVideo)Marshal.PtrToStructure( result, typeof( ISteamVideo ) );
|
||||
}
|
||||
}
|
||||
@ -6280,17 +6290,24 @@ namespace Valve.Steamworks
|
||||
throw new Exception( "Steam Pointer not configured" );
|
||||
}
|
||||
}
|
||||
internal override uint GetResultStatus( int resultHandle )
|
||||
internal override int GetResultStatus( int resultHandle )
|
||||
{
|
||||
CheckIfUsable();
|
||||
uint result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultStatus(m_pSteamInventory,resultHandle);
|
||||
int result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultStatus(m_pSteamInventory,resultHandle);
|
||||
return result;
|
||||
}
|
||||
internal override bool GetResultItems( int resultHandle, out SteamItemDetails_t[] pOutItemsArray )
|
||||
{
|
||||
CheckIfUsable();
|
||||
pOutItemsArray = null;
|
||||
uint punOutItemsArraySize = 0;
|
||||
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems(m_pSteamInventory,resultHandle,null,ref punOutItemsArraySize);
|
||||
if ( result == false )
|
||||
return false;
|
||||
|
||||
Console.WriteLine( "punOutItemsArraySize: " + punOutItemsArraySize );
|
||||
|
||||
pOutItemsArray = new SteamItemDetails_t[punOutItemsArraySize];
|
||||
result = NativeEntrypoints.SteamAPI_ISteamInventory_GetResultItems( m_pSteamInventory, resultHandle, pOutItemsArray, ref punOutItemsArraySize );
|
||||
return result;
|
||||
@ -6326,18 +6343,18 @@ namespace Valve.Steamworks
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemsByID(m_pSteamInventory,ref pResultHandle,pInstanceIDs,(uint) pInstanceIDs.Length);
|
||||
return result;
|
||||
}
|
||||
internal override bool SerializeResult( int resultHandle, IntPtr pOutBuffer, ref uint punOutBufferSize )
|
||||
internal override bool SerializeResult( int resultHandle, IntPtr pOutBuffer, out uint punOutBufferSize )
|
||||
{
|
||||
CheckIfUsable();
|
||||
punOutBufferSize = 0;
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_SerializeResult(m_pSteamInventory,resultHandle,pOutBuffer,ref punOutBufferSize);
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_SerializeResult(m_pSteamInventory,resultHandle,pOutBuffer,out punOutBufferSize);
|
||||
return result;
|
||||
}
|
||||
internal override bool DeserializeResult( ref int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE )
|
||||
internal unsafe override bool DeserializeResult( out int pOutResultHandle, IntPtr pBuffer, uint unBufferSize, bool bRESERVED_MUST_BE_FALSE )
|
||||
{
|
||||
CheckIfUsable();
|
||||
pOutResultHandle = 0;
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_DeserializeResult(m_pSteamInventory,ref pOutResultHandle,pBuffer,unBufferSize,bRESERVED_MUST_BE_FALSE);
|
||||
pOutResultHandle = -1;
|
||||
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_DeserializeResult(m_pSteamInventory, out pOutResultHandle, pBuffer,unBufferSize,bRESERVED_MUST_BE_FALSE);
|
||||
return result;
|
||||
}
|
||||
internal override bool GenerateItems( ref int pResultHandle, int[] pArrayItemDefs, uint[] punArrayQuantity )
|
||||
@ -6417,8 +6434,10 @@ namespace Valve.Steamworks
|
||||
internal override bool GetItemDefinitionIDs( out int[] pItemDefIDs )
|
||||
{
|
||||
CheckIfUsable();
|
||||
pItemDefIDs = null;
|
||||
uint punItemDefIDsArraySize = 0;
|
||||
bool result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionIDs(m_pSteamInventory,null,ref punItemDefIDsArraySize);
|
||||
if ( result == false ) return false;
|
||||
pItemDefIDs = new int[punItemDefIDsArraySize];
|
||||
result = NativeEntrypoints.SteamAPI_ISteamInventory_GetItemDefinitionIDs( m_pSteamInventory, pItemDefIDs, ref punItemDefIDsArraySize );
|
||||
return result;
|
||||
@ -7870,7 +7889,7 @@ namespace Valve.Steamworks
|
||||
k_EUniverseDev = 4,
|
||||
k_EUniverseMax = 5,
|
||||
}
|
||||
public enum EResult
|
||||
public enum EResult : int
|
||||
{
|
||||
k_EResultOK = 1,
|
||||
k_EResultFail = 2,
|
||||
|
@ -50,15 +50,17 @@ namespace Facepunch.Steamworks
|
||||
http = client.GetISteamHTTP( user, pipe, "STEAMHTTP_INTERFACE_VERSION002" );
|
||||
inventory = client.GetISteamInventory( user, pipe, "STEAMINVENTORY_INTERFACE_V001" );
|
||||
ugc = client.GetISteamUGC( user, pipe, "STEAMUGC_INTERFACE_VERSION008" );
|
||||
apps = client.GetISteamApps( user, pipe, "STEAMAPPS_INTERFACE_VERSION008" );
|
||||
|
||||
if ( ugc.GetIntPtr() == IntPtr.Zero )
|
||||
throw new System.Exception( "Steam Server: Couldn't load STEAMUGC_INTERFACE_VERSION008" );
|
||||
|
||||
apps = client.GetISteamApps( user, pipe, "STEAMAPPS_INTERFACE_VERSION008" );
|
||||
|
||||
if ( apps.GetIntPtr() == IntPtr.Zero )
|
||||
throw new System.Exception( "Steam Server: Couldn't load STEAMAPPS_INTERFACE_VERSION008" );
|
||||
|
||||
if ( inventory.GetIntPtr() == IntPtr.Zero )
|
||||
throw new System.Exception( "Steam Server: Couldn't load STEAMINVENTORY_INTERFACE_V001" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
25
Facepunch.Steamworks/Server/Inventory.cs
Normal file
25
Facepunch.Steamworks/Server/Inventory.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace Facepunch.Steamworks
|
||||
{
|
||||
public partial class Server
|
||||
{
|
||||
Inventory _inv;
|
||||
|
||||
public Inventory Inventory
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( _inv == null )
|
||||
_inv = new Inventory( native.inventory, true );
|
||||
|
||||
return _inv;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user