diff --git a/Facepunch.Steamworks/SteamInventory.cs b/Facepunch.Steamworks/SteamInventory.cs index 45aa3ca..92cf266 100644 --- a/Facepunch.Steamworks/SteamInventory.cs +++ b/Facepunch.Steamworks/SteamInventory.cs @@ -347,5 +347,26 @@ public static bool GetAllItems() return await InventoryResult.GetAsync( sresult ); } + + /// + /// Start buying a cart load of items. This will return a positive result is the purchase has + /// begun. You should listen out for SteamUser.OnMicroTxnAuthorizationResponse for a success. + /// + public static async Task StartPurchaseAsync( InventoryDef[] items ) + { + var item_i = items.Select( x => x._id ).ToArray(); + var item_q = items.Select( x => (uint)1 ).ToArray(); + + var r = await Internal.StartPurchase( item_i, item_q, (uint)item_i.Length ); + if ( !r.HasValue ) return null; + + return new InventoryPurchaseResult + { + Result = r.Value.Result, + OrderID = r.Value.OrderID, + TransID = r.Value.TransID + }; + } + } } \ No newline at end of file diff --git a/Facepunch.Steamworks/Structs/InventoryPurchaseResult.cs b/Facepunch.Steamworks/Structs/InventoryPurchaseResult.cs new file mode 100644 index 0000000..ef5b682 --- /dev/null +++ b/Facepunch.Steamworks/Structs/InventoryPurchaseResult.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Steamworks.Data +{ + public struct InventoryPurchaseResult + { + public Result Result; + public ulong OrderID; + public ulong TransID; + } +} \ No newline at end of file