Remove TradeMatcher remote communication

Instead, make MatchActively work without specifying SteamTradeMatcher
This commit is contained in:
Archi
2022-02-03 18:01:39 +01:00
parent c3c5f33289
commit e18046084e
2 changed files with 11 additions and 15 deletions

View File

@@ -74,7 +74,7 @@ internal sealed class RemoteCommunication : IAsyncDisposable {
internal RemoteCommunication(Bot bot) {
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
if (Bot.BotConfig.RemoteCommunication.HasFlag(BotConfig.ERemoteCommunication.TradeMatcher)) {
if (Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchActively)) {
MatchActivelyTimer = new Timer(
MatchActively,
null,
@@ -245,12 +245,20 @@ internal sealed class RemoteCommunication : IAsyncDisposable {
}
private async Task<bool?> IsEligibleForListing() {
// But must be eligible for matching first
bool? isEligibleForMatching = await IsEligibleForMatching().ConfigureAwait(false);
if (isEligibleForMatching != true) {
return isEligibleForMatching;
}
// Bot must have STM enabled in TradingPreferences
if (!Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher)) {
Bot.ArchiLogger.LogGenericTrace(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{nameof(Bot.BotConfig.TradingPreferences)}: {Bot.BotConfig.TradingPreferences}"));
return false;
}
// Bot must have public inventory
bool? hasPublicInventory = await Bot.HasPublicInventory().ConfigureAwait(false);
@@ -271,13 +279,6 @@ internal sealed class RemoteCommunication : IAsyncDisposable {
return false;
}
// Bot must have STM enable in TradingPreferences
if (!Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher)) {
Bot.ArchiLogger.LogGenericTrace(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{nameof(Bot.BotConfig.TradingPreferences)}: {Bot.BotConfig.TradingPreferences}"));
return false;
}
// Bot must have at least one accepted matchable type set
if ((Bot.BotConfig.MatchableTypes.Count == 0) || Bot.BotConfig.MatchableTypes.All(static type => !AcceptedMatchableTypes.Contains(type))) {
Bot.ArchiLogger.LogGenericTrace(string.Format(CultureInfo.CurrentCulture, Strings.WarningFailedWithError, $"{nameof(Bot.BotConfig.MatchableTypes)}: {string.Join(", ", Bot.BotConfig.MatchableTypes)}"));
@@ -298,10 +299,6 @@ internal sealed class RemoteCommunication : IAsyncDisposable {
}
private async void MatchActively(object? state = null) {
if (!Bot.BotConfig.RemoteCommunication.HasFlag(BotConfig.ERemoteCommunication.TradeMatcher)) {
return;
}
if (!Bot.IsConnectedAndLoggedOn || Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything) || !Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchActively) || (await IsEligibleForMatching().ConfigureAwait(false) != true)) {
Bot.ArchiLogger.LogGenericTrace(Strings.ErrorAborted);

View File

@@ -687,9 +687,8 @@ public sealed class BotConfig {
public enum ERemoteCommunication : byte {
None = 0,
SteamGroup = 1,
TradeMatcher = 2,
PublicListing = 4,
All = SteamGroup | TradeMatcher | PublicListing
PublicListing = 2,
All = SteamGroup | PublicListing
}
[Flags]