mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-19 15:58:39 +00:00
Add MatchEveryting trading preference
This commit is contained in:
@@ -52,7 +52,8 @@ namespace ArchiSteamFarm {
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Global")]
|
||||
None = 0,
|
||||
AcceptDonations = 1,
|
||||
SteamTradeMatcher = 2
|
||||
SteamTradeMatcher = 2,
|
||||
MatchEverything = 4
|
||||
}
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
|
||||
@@ -186,10 +186,15 @@ namespace ArchiSteamFarm {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Accept trades when we're not losing anything
|
||||
if ((tradeOffer.ItemsToGive.Count == 0) && Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.AcceptDonations)) {
|
||||
// Unless it's steam fuckup and we're dealing with broken trade
|
||||
return tradeOffer.ItemsToReceive.Count > 0 ? new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.AcceptedWithoutItemLose) : new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.RejectedTemporarily);
|
||||
// Check if it's donation trade
|
||||
if (tradeOffer.ItemsToGive.Count == 0) {
|
||||
// Temporarily ignore steam fuckups
|
||||
if (tradeOffer.ItemsToReceive.Count == 0) {
|
||||
return new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.RejectedTemporarily);
|
||||
}
|
||||
|
||||
// Either accept or reject such trade, depending on our preference
|
||||
return Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.AcceptDonations) ? new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.AcceptedWithoutItemLose) : new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.RejectedPermanently);
|
||||
}
|
||||
|
||||
// Always accept trades from SteamMasterID
|
||||
@@ -229,6 +234,11 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
// If we're matching everything, this is enough for us
|
||||
if (Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything)) {
|
||||
return new ParseTradeResult(tradeOffer.TradeOfferID, ParseTradeResult.EResult.AcceptedWithItemLose);
|
||||
}
|
||||
|
||||
// Now check if it's worth for us to do the trade
|
||||
await LimitInventoryRequestsAsync().ConfigureAwait(false);
|
||||
|
||||
|
||||
@@ -57,7 +57,8 @@ namespace ConfigGenerator {
|
||||
internal enum ETradingPreferences : byte {
|
||||
None = 0,
|
||||
AcceptDonations = 1,
|
||||
SteamTradeMatcher = 2
|
||||
SteamTradeMatcher = 2,
|
||||
MatchEverything = 4
|
||||
}
|
||||
|
||||
[Category("\t\tCore")]
|
||||
|
||||
Reference in New Issue
Block a user