File tree Expand file tree Collapse file tree 4 files changed +17
-7
lines changed
Expand file tree Collapse file tree 4 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ internal enum EUpdateChannel : byte {
8989 [ JsonProperty ( Required = Required . DisallowNull ) ]
9090 internal byte GiftsLimiterDelay { get ; private set ; } = 1 ;
9191
92+ [ JsonProperty ( Required = Required . DisallowNull ) ]
93+ internal byte MaxTradeHoldDuration { get ; private set ; } = 15 ;
94+
9295 [ JsonProperty ( Required = Required . DisallowNull ) ]
9396 internal bool ForceHttp { get ; private set ; } = false ;
9497
Original file line number Diff line number Diff line change @@ -185,14 +185,17 @@ private async Task<ParseTradeResult> ShouldAcceptTrade(Steam.TradeOffer tradeOff
185185
186186 // At this point we're sure that STM trade is valid
187187
188- // If we're dealing with special cards with short lifespan, accept the trade only if user doesn't have trade holds
189- if ( tradeOffer . ItemsToGive . Any ( item => GlobalConfig . GlobalBlacklist . Contains ( item . RealAppID ) ) ) {
190- byte ? holdDuration = await Bot . ArchiWebHandler . GetTradeHoldDuration ( tradeOffer . TradeOfferID ) . ConfigureAwait ( false ) ;
191- if ( ! holdDuration . HasValue ) {
192- return ParseTradeResult . RejectedTemporarily ;
193- }
188+ // Fetch trade hold duration
189+ byte ? holdDuration = await Bot . ArchiWebHandler . GetTradeHoldDuration ( tradeOffer . TradeOfferID ) . ConfigureAwait ( false ) ;
190+ if ( ! holdDuration . HasValue ) {
191+ // If we can't get trade hold duration, reject trade temporarily
192+ return ParseTradeResult . RejectedTemporarily ;
193+ }
194194
195- if ( holdDuration . Value > 0 ) {
195+ // If user has a trade hold, we add extra logic
196+ if ( holdDuration . Value > 0 ) {
197+ // If trade hold duration exceeds our max, or user asks for cards with short lifespan, reject the trade
198+ if ( ( holdDuration . Value > Program . GlobalConfig . MaxTradeHoldDuration ) || tradeOffer . ItemsToGive . Any ( item => GlobalConfig . GlobalBlacklist . Contains ( item . RealAppID ) ) ) {
196199 return ParseTradeResult . RejectedPermanently ;
197200 }
198201 }
Original file line number Diff line number Diff line change 1212 "LoginLimiterDelay" : 10 ,
1313 "InventoryLimiterDelay" : 3 ,
1414 "GiftsLimiterDelay" : 1 ,
15+ "MaxTradeHoldDuration" : 15 ,
1516 "ForceHttp" : false ,
1617 "HttpTimeout" : 60 ,
1718 "WCFHostname" : " localhost" ,
Original file line number Diff line number Diff line change @@ -89,6 +89,9 @@ internal enum EUpdateChannel : byte {
8989 [ JsonProperty ( Required = Required . DisallowNull ) ]
9090 public byte GiftsLimiterDelay { get ; set ; } = 1 ;
9191
92+ [ JsonProperty ( Required = Required . DisallowNull ) ]
93+ public byte MaxTradeHoldDuration { get ; set ; } = 15 ;
94+
9295 [ JsonProperty ( Required = Required . DisallowNull ) ]
9396 public bool ForceHttp { get ; set ; } = false ;
9497
You can’t perform that action at this time.
0 commit comments