diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs index ba1208ace..4163b3cb1 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Backend.cs @@ -65,6 +65,10 @@ internal static class Backend { ArgumentNullException.ThrowIfNull(inventoryRemoved); ArgumentException.ThrowIfNullOrEmpty(previousInventoryChecksum); + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(ArchiNet.URL, "/Api/Listing/AnnounceDiff"); AnnouncementDiffRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, inventory, inventoryChecksum, acceptedMatchableTypes, totalInventoryCount, matchEverything, ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration, tradeToken, inventoryRemoved, previousInventoryChecksum, nickname, avatarHash); @@ -96,6 +100,10 @@ internal static class Backend { throw new ArgumentOutOfRangeException(nameof(tradeToken)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(ArchiNet.URL, "/Api/Listing/Announce/v4"); AnnouncementRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, inventory, inventoryChecksum, acceptedMatchableTypes, totalInventoryCount, matchEverything, ASF.GlobalConfig?.MaxTradeHoldDuration ?? GlobalConfig.DefaultMaxTradeHoldDuration, tradeToken, nickname, avatarHash); @@ -127,6 +135,10 @@ internal static class Backend { throw new ArgumentNullException(nameof(acceptedMatchableTypes)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(ArchiNet.URL, "/Api/Listing/Inventories/v2"); Dictionary headers = new(1, StringComparer.Ordinal) { @@ -159,6 +171,10 @@ internal static class Backend { throw new ArgumentNullException(nameof(realAppIDs)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(ArchiNet.URL, "/Api/SetParts/Request"); SetPartsRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), steamID, matchableTypes, realAppIDs); @@ -170,6 +186,10 @@ internal static class Backend { ArgumentNullException.ThrowIfNull(bot); ArgumentNullException.ThrowIfNull(webBrowser); + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(ArchiNet.URL, "/Api/Listing/HeartBeat"); HeartBeatRequest data = new(ASF.GlobalDatabase?.Identifier ?? Guid.NewGuid(), bot.SteamID); diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs index a19b3700a..afe944202 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/ItemsMatcherPlugin.cs @@ -66,6 +66,10 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I throw new ArgumentOutOfRangeException(nameof(steamID)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + return await Commands.OnBotCommand(bot, access, args, steamID).ConfigureAwait(false); } @@ -90,6 +94,10 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I await remoteCommunication.DisposeAsync().ConfigureAwait(false); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return; + } + remoteCommunication = new RemoteCommunication(bot); if (!RemoteCommunications.TryAdd(bot, remoteCommunication)) { @@ -132,6 +140,12 @@ internal sealed class ItemsMatcherPlugin : OfficialPlugin, IBot, IBotCommand2, I } public override Task OnLoaded() { + if (SharedInfo.BuildInfo.IsCustomBuild) { + ASF.ArchiLogger.LogGenericWarning(Strings.PluginDisabledCustomBuild); + + return Task.CompletedTask; + } + Utilities.WarnAboutIncompleteTranslation(Strings.ResourceManager); return Task.CompletedTask; diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.Designer.cs b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.Designer.cs index d22ca609d..cd05e10c3 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.Designer.cs +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.Designer.cs @@ -74,5 +74,11 @@ namespace ArchiSteamFarm.OfficialPlugins.ItemsMatcher.Localization { return ResourceManager.GetString("ActivelyMatchingSomeConfirmationsFailed", resourceCulture); } } + + internal static string PluginDisabledCustomBuild { + get { + return ResourceManager.GetString("PluginDisabledCustomBuild", resourceCulture); + } + } } } diff --git a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.resx b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.resx index 50f62b98e..ab8d0a680 100644 --- a/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.resx +++ b/ArchiSteamFarm.OfficialPlugins.ItemsMatcher/Localization/Strings.resx @@ -82,4 +82,7 @@ Some confirmations have failed, approximately {0} out of {1} trades were sent successfully. {0} will be replaced by amount of the trade offers that succeeded (number), {1} will be replaced by amount of the trade offers that were supposed to be sent in total (number) + + ItemsMatcherPlugin is not supported in custom ASF builds, the functionality is disabled. + diff --git a/ArchiSteamFarm/Core/ArchiNet.cs b/ArchiSteamFarm/Core/ArchiNet.cs index e410174c5..0466c1865 100644 --- a/ArchiSteamFarm/Core/ArchiNet.cs +++ b/ArchiSteamFarm/Core/ArchiNet.cs @@ -51,6 +51,10 @@ internal static class ArchiNet { throw new InvalidOperationException(nameof(ASF.WebBrowser)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + Uri request = new(URL, $"/Api/Checksum/{version}/{variant}"); ObjectResponse>? response = await ASF.WebBrowser.UrlGetToJsonObject>(request, cancellationToken: cancellationToken).ConfigureAwait(false); @@ -67,6 +71,10 @@ internal static class ArchiNet { throw new ArgumentOutOfRangeException(nameof(steamID)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return null; + } + (_, IReadOnlyCollection? badBots) = await CachedBadBots.GetValue(ECacheFallback.FailedNow, cancellationToken).ConfigureAwait(false); return badBots?.Contains(steamID); @@ -76,7 +84,7 @@ internal static class ArchiNet { ArgumentNullException.ThrowIfNull(bot); ArgumentNullException.ThrowIfNull(webBrowser); - if (!bot.IsConnectedAndLoggedOn) { + if (!bot.IsConnectedAndLoggedOn || SharedInfo.BuildInfo.IsCustomBuild) { return null; } @@ -180,6 +188,10 @@ internal static class ArchiNet { throw new InvalidOperationException(nameof(ASF.WebBrowser)); } + if (SharedInfo.BuildInfo.IsCustomBuild) { + return (false, null); + } + Uri request = new(URL, "/Api/BadBots"); ObjectResponse>>? response = await ASF.WebBrowser.UrlGetToJsonObject>>(request, cancellationToken: cancellationToken).ConfigureAwait(false);