diff --git a/ArchiSteamFarm b/ArchiSteamFarm index 0d65f51..84ff83b 160000 --- a/ArchiSteamFarm +++ b/ArchiSteamFarm @@ -1 +1 @@ -Subproject commit 0d65f5174b0ed77892f481be53794e7929d055d5 +Subproject commit 84ff83bbe25fc3d713fbddb61b4d5a53c8eaee15 diff --git a/BoosterManager/Handlers/InventoryHandler.cs b/BoosterManager/Handlers/InventoryHandler.cs index 0048c7e..6963c56 100644 --- a/BoosterManager/Handlers/InventoryHandler.cs +++ b/BoosterManager/Handlers/InventoryHandler.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Reflection; using System.Threading.Tasks; using ArchiSteamFarm.Localization; using ArchiSteamFarm.Steam; @@ -54,13 +53,7 @@ internal static async Task SendItemToMultipleBots(Bot sender, List<(Bot return (true, "Successfully sent nothing!"); } - HashSet? itemsToGive; - try { - itemsToGive = GetItemsFromStacks(sender, itemStacks, amountToSend, amountToSkip); - } catch (Exception e) { - return (false, e.Message); - } - + HashSet? itemsToGive = GetItemsFromStacks(sender, itemStacks, amountToSend, amountToSkip); if (itemsToGive == null) { return (false, "Not enough to send!"); } @@ -139,13 +132,7 @@ internal static async Task SendMultipleItemsToMultipleBots(Bot sender, H // Allow for partial trades, but not partial amounts of individual items. // If user is trying to send: 3 of ItemA and 2 of ItemB. Yet they have: 3 of ItemA and 1 of ItemB. This will send only: 3 of ItemA and 0 of ItemB foreach ((HashSet itemStacks, ItemIdentifier itemIdentifier, uint amount) in itemStacksWithAmounts) { - HashSet? itemsToGive; - try { - itemsToGive = GetItemsFromStacks(sender, itemStacks, amount, amount * numRecieversProcessed); - } catch (Exception e) { - return (false, e.Message); - } - + HashSet? itemsToGive = GetItemsFromStacks(sender, itemStacks, amount, amount * numRecieversProcessed); if (itemsToGive == null) { sender.ArchiLogger.LogGenericInfo(String.Format("Not enough of {0} to send!", itemIdentifier.ToString())); responses.Add(String.Format("Not enough of {0} to send :steamthumbsdown:", itemIdentifier.ToString())); @@ -200,20 +187,7 @@ internal static async Task SendMultipleItemsToMultipleBots(Bot sender, H break; } - if (itemStack.Amount != amountToTakeFromStack) { - // This asset has an amount greater than 1 (such as in the case of gems) - // We only want to send some, but not all of this amount - PropertyInfo? propertyInfo = itemStack.GetType().GetProperty("Amount"); - if (propertyInfo == null) { - bot.ArchiLogger.LogGenericError("Couldn't find Asset.Amount"); - - throw new Exception("Plugin error, please report this"); - } - - propertyInfo.SetValue(itemStack, amountToTakeFromStack); - } - - items.Add(itemStack); + items.Add(new Asset(appID: itemStack.AppID, contextID: itemStack.ContextID, classID: itemStack.ClassID, assetID: itemStack.AssetID, amount: amountToTakeFromStack)); amountTaken += amountToTakeFromStack; }