Make trade message disappear for all non-steam appids

This commit is contained in:
Łukasz Domeradzki
2025-07-19 14:36:03 +02:00
parent d81e8d2de0
commit 0467dc1da3
2 changed files with 2 additions and 6 deletions

View File

@@ -22,7 +22,6 @@
// limitations under the License.
using System;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@@ -45,9 +44,6 @@ public sealed class Trading : IDisposable {
internal const byte MaxItemsPerTrade = byte.MaxValue; // This is decided upon various factors, mainly stability of Steam servers when dealing with huge trade offers
internal const byte MaxTradesPerAccount = 5; // This is limit introduced by Valve
[PublicAPI]
public static readonly FrozenSet<uint> TradeRestrictionsAppIDs = [730];
private readonly Bot Bot;
private readonly ConcurrentHashSet<ulong> HandledTradeOfferIDs = [];
private readonly SemaphoreSlim TradesSemaphore = new(1, 1);
@@ -298,7 +294,7 @@ public sealed class Trading : IDisposable {
IList<ParseTradeResult> tradeResults = await Utilities.InParallel(tasks).ConfigureAwait(false);
if (!Bot.BotDatabase.TradeRestrictionsAcknowledged && tradeResults.Any(static result => ((result.Result == ParseTradeResult.EResult.Accepted) && (result.ItemsToGive?.Any(static item => TradeRestrictionsAppIDs.Contains(item.AppID)) == true)) || (result.ItemsToReceive?.Any(static item => TradeRestrictionsAppIDs.Contains(item.AppID)) == true))) {
if (!Bot.BotDatabase.TradeRestrictionsAcknowledged && tradeResults.Any(static result => ((result.Result == ParseTradeResult.EResult.Accepted) && (result.ItemsToGive?.Any(static item => item.AppID != Asset.SteamAppID) == true)) || (result.ItemsToReceive?.Any(static item => item.AppID != Asset.SteamAppID) == true))) {
// We should normally fail the process in case of a failure here, but since the popup could be marked already in the past, we'll allow it in hope it wasn't needed after all
await AcknowledgeTradeRestrictions().ConfigureAwait(false);
}

View File

@@ -460,7 +460,7 @@ public sealed class Actions : IAsyncDisposable, IDisposable {
}
// In similar way we might need to accept popup on Steam side, we limit it only to cases that we're aware of, as sending this request otherwise is additional overhead for no reason
if (!Bot.BotDatabase.TradeRestrictionsAcknowledged && items.Any(static item => Trading.TradeRestrictionsAppIDs.Contains(item.AppID))) {
if (!Bot.BotDatabase.TradeRestrictionsAcknowledged && items.Any(static item => item.AppID != Asset.SteamAppID)) {
// We should normally fail the process in case of a failure here, but since the popup could be marked already in the past, we'll allow it in hope it wasn't needed after all
await Bot.Trading.AcknowledgeTradeRestrictions().ConfigureAwait(false);
}