From 5d4666d5381dd44bed65f2053a3ca703dfa26315 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Thu, 29 May 2025 23:29:40 +0200 Subject: [PATCH] Adapt to yet another Steam's breaking change --- ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs index 6c77d2841..c813be953 100644 --- a/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs +++ b/ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs @@ -52,7 +52,7 @@ namespace ArchiSteamFarm.Steam.Integration; public sealed class ArchiWebHandler : IDisposable { // Steam network (ArchiHandler) works unstable with more items than this (throwing upon description details), while Steam web (ArchiWebHandler) silently limits to this value maximum - internal const ushort MaxItemsInSingleInventoryRequest = 5000; + internal const ushort MaxItemsInSingleInventoryRequest = 2500; private const string EconService = "IEconService"; private const byte MaxTradeOfferMessageLength = 128; @@ -234,9 +234,10 @@ public sealed class ArchiWebHandler : IDisposable { /// This method should be used exclusively for foreign inventories (other users), but in special circumstances it can be used for fetching bot's own inventory as well. /// [PublicAPI] - public async IAsyncEnumerable GetInventoryAsync(ulong steamID = 0, uint appID = Asset.SteamAppID, ulong contextID = Asset.SteamCommunityContextID, string? language = null) { + public async IAsyncEnumerable GetInventoryAsync(ulong steamID = 0, uint appID = Asset.SteamAppID, ulong contextID = Asset.SteamCommunityContextID, ushort itemsCountPerRequest = MaxItemsInSingleInventoryRequest, string? language = null) { ArgumentOutOfRangeException.ThrowIfZero(appID); ArgumentOutOfRangeException.ThrowIfZero(contextID); + ArgumentOutOfRangeException.ThrowIfZero(itemsCountPerRequest); if (steamID == 0) { if (!Initialized) { @@ -274,7 +275,7 @@ public sealed class ArchiWebHandler : IDisposable { int rateLimitingDelay = (ASF.GlobalConfig?.InventoryLimiterDelay ?? GlobalConfig.DefaultInventoryLimiterDelay) * 1000; while (true) { - Uri request = new(SteamCommunityURL, $"/inventory/{steamID}/{appID}/{contextID}?l={language}&count={MaxItemsInSingleInventoryRequest}{(startAssetID > 0 ? $"&start_assetid={startAssetID}" : "")}"); + Uri request = new(SteamCommunityURL, $"/inventory/{steamID}/{appID}/{contextID}?l={language}&count={itemsCountPerRequest}{(startAssetID > 0 ? $"&start_assetid={startAssetID}" : "")}"); await ASF.InventorySemaphore.WaitAsync().ConfigureAwait(false);