From 9fecd91bedab0bd9b8b8b042a5d5f67bd78252ac Mon Sep 17 00:00:00 2001 From: Garry Newman Date: Fri, 4 Sep 2020 10:42:25 +0100 Subject: [PATCH] StartPurchaseAsync: Should now be able to pass in multiple of the same item to purchase multiples --- Facepunch.Steamworks/SteamInventory.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Facepunch.Steamworks/SteamInventory.cs b/Facepunch.Steamworks/SteamInventory.cs index f0a63c0..79fa3ac 100644 --- a/Facepunch.Steamworks/SteamInventory.cs +++ b/Facepunch.Steamworks/SteamInventory.cs @@ -347,8 +347,9 @@ namespace Steamworks /// 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 d = items.GroupBy( x => x._id ).ToDictionary( x => x.Key, x => (uint) x.Count() ); + var item_i = d.Keys.ToArray(); + var item_q = d.Values.ToArray(); var r = await Internal.StartPurchase( item_i, item_q, (uint)item_i.Length ); if ( !r.HasValue ) return null;