From 4ff1411c38e0bc66eeac86fd1b9f3ffbbfe08ae9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Domeradzki?= Date: Tue, 6 Aug 2024 03:07:41 +0200 Subject: [PATCH] Closes #3261 --- ArchiSteamFarm/Steam/Bot.cs | 1 + ArchiSteamFarm/Steam/Storage/BotConfig.cs | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 80375b992..a249aed19 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2774,6 +2774,7 @@ public sealed class Bot : IAsyncDisposable, IDisposable { CellID = ASF.GlobalDatabase?.CellID, ChatMode = SteamUser.ChatMode.NewSteamChat, ClientLanguage = CultureInfo.CurrentCulture.ToSteamClientLanguage(), + IsSteamDeck = BotConfig.OnlinePreferences.HasFlag(BotConfig.EOnlinePreferences.IsSteamDeck), LoginID = LoginID, ShouldRememberPassword = BotConfig.UseLoginKeys, UIMode = BotConfig.UserInterfaceMode, diff --git a/ArchiSteamFarm/Steam/Storage/BotConfig.cs b/ArchiSteamFarm/Steam/Storage/BotConfig.cs index b18343ae4..8284fed6e 100644 --- a/ArchiSteamFarm/Steam/Storage/BotConfig.cs +++ b/ArchiSteamFarm/Steam/Storage/BotConfig.cs @@ -71,6 +71,9 @@ public sealed class BotConfig { [PublicAPI] public const EPersonaStateFlag DefaultOnlineFlags = 0; + [PublicAPI] + public const EOnlinePreferences DefaultOnlinePreferences = EOnlinePreferences.None; + [PublicAPI] public const EPersonaState DefaultOnlineStatus = EPersonaState.Online; @@ -186,6 +189,9 @@ public sealed class BotConfig { [JsonInclude] public EPersonaStateFlag OnlineFlags { get; private init; } = DefaultOnlineFlags; + [JsonInclude] + public EOnlinePreferences OnlinePreferences { get; private init; } = DefaultOnlinePreferences; + [JsonInclude] public EPersonaState OnlineStatus { get; private init; } = DefaultOnlineStatus; @@ -338,6 +344,9 @@ public sealed class BotConfig { [UsedImplicitly] public bool ShouldSerializeOnlineFlags() => !Saving || (OnlineFlags != DefaultOnlineFlags); + [UsedImplicitly] + public bool ShouldSerializeOnlinePreferences() => !Saving || (OnlinePreferences != DefaultOnlinePreferences); + [UsedImplicitly] public bool ShouldSerializeOnlineStatus() => !Saving || (OnlineStatus != DefaultOnlineStatus); @@ -459,6 +468,10 @@ public sealed class BotConfig { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlineFlags), OnlineFlags)); } + if (OnlinePreferences > EOnlinePreferences.All) { + return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlinePreferences), OnlinePreferences)); + } + if (!Enum.IsDefined(OnlineStatus)) { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlineStatus), OnlineStatus)); } @@ -641,6 +654,14 @@ public sealed class BotConfig { All = FarmingPausedByDefault | ShutdownOnFarmingFinished | SendOnFarmingFinished | FarmPriorityQueueOnly | SkipRefundableGames | SkipUnplayedGames | EnableRiskyCardsDiscovery | AutoSteamSaleEvent } + [Flags] + [PublicAPI] + public enum EOnlinePreferences : byte { + None = 0, + IsSteamDeck = 1, + All = IsSteamDeck + } + [Flags] [PublicAPI] public enum ERedeemingPreferences : byte {