mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-02-06 04:53:39 +00:00
Add MaxTradeHoldDuration
This commit is contained in:
@@ -89,6 +89,9 @@ namespace ArchiSteamFarm {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal byte GiftsLimiterDelay { get; private set; } = 1;
|
internal byte GiftsLimiterDelay { get; private set; } = 1;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
internal byte MaxTradeHoldDuration { get; private set; } = 15;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
internal bool ForceHttp { get; private set; } = false;
|
internal bool ForceHttp { get; private set; } = false;
|
||||||
|
|
||||||
|
|||||||
@@ -185,14 +185,17 @@ namespace ArchiSteamFarm {
|
|||||||
|
|
||||||
// At this point we're sure that STM trade is valid
|
// At this point we're sure that STM trade is valid
|
||||||
|
|
||||||
// If we're dealing with special cards with short lifespan, accept the trade only if user doesn't have trade holds
|
// Fetch trade hold duration
|
||||||
if (tradeOffer.ItemsToGive.Any(item => GlobalConfig.GlobalBlacklist.Contains(item.RealAppID))) {
|
byte? holdDuration = await Bot.ArchiWebHandler.GetTradeHoldDuration(tradeOffer.TradeOfferID).ConfigureAwait(false);
|
||||||
byte? holdDuration = await Bot.ArchiWebHandler.GetTradeHoldDuration(tradeOffer.TradeOfferID).ConfigureAwait(false);
|
if (!holdDuration.HasValue) {
|
||||||
if (!holdDuration.HasValue) {
|
// If we can't get trade hold duration, reject trade temporarily
|
||||||
return ParseTradeResult.RejectedTemporarily;
|
return ParseTradeResult.RejectedTemporarily;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (holdDuration.Value > 0) {
|
// If user has a trade hold, we add extra logic
|
||||||
|
if (holdDuration.Value > 0) {
|
||||||
|
// If trade hold duration exceeds our max, or user asks for cards with short lifespan, reject the trade
|
||||||
|
if ((holdDuration.Value > Program.GlobalConfig.MaxTradeHoldDuration) || tradeOffer.ItemsToGive.Any(item => GlobalConfig.GlobalBlacklist.Contains(item.RealAppID))) {
|
||||||
return ParseTradeResult.RejectedPermanently;
|
return ParseTradeResult.RejectedPermanently;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
"LoginLimiterDelay": 10,
|
"LoginLimiterDelay": 10,
|
||||||
"InventoryLimiterDelay": 3,
|
"InventoryLimiterDelay": 3,
|
||||||
"GiftsLimiterDelay": 1,
|
"GiftsLimiterDelay": 1,
|
||||||
|
"MaxTradeHoldDuration": 15,
|
||||||
"ForceHttp": false,
|
"ForceHttp": false,
|
||||||
"HttpTimeout": 60,
|
"HttpTimeout": 60,
|
||||||
"WCFHostname": "localhost",
|
"WCFHostname": "localhost",
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ namespace ConfigGenerator {
|
|||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
public byte GiftsLimiterDelay { get; set; } = 1;
|
public byte GiftsLimiterDelay { get; set; } = 1;
|
||||||
|
|
||||||
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
|
public byte MaxTradeHoldDuration { get; set; } = 15;
|
||||||
|
|
||||||
[JsonProperty(Required = Required.DisallowNull)]
|
[JsonProperty(Required = Required.DisallowNull)]
|
||||||
public bool ForceHttp { get; set; } = false;
|
public bool ForceHttp { get; set; } = false;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user