diff --git a/ArchiSteamFarm/Steam/Bot.cs b/ArchiSteamFarm/Steam/Bot.cs index 5abbf2646..90a1033d2 100644 --- a/ArchiSteamFarm/Steam/Bot.cs +++ b/ArchiSteamFarm/Steam/Bot.cs @@ -2857,7 +2857,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), + GamingDeviceType = BotConfig.GamingDeviceType, LoginID = LoginID, ShouldRememberPassword = BotConfig.UseLoginKeys, UIMode = BotConfig.UserInterfaceMode, diff --git a/ArchiSteamFarm/Steam/Storage/BotConfig.cs b/ArchiSteamFarm/Steam/Storage/BotConfig.cs index 4f7b79789..7f68b308d 100644 --- a/ArchiSteamFarm/Steam/Storage/BotConfig.cs +++ b/ArchiSteamFarm/Steam/Storage/BotConfig.cs @@ -66,12 +66,17 @@ public sealed class BotConfig { [PublicAPI] public const EFarmingPreferences DefaultFarmingPreferences = EFarmingPreferences.None; + [PublicAPI] + public const EGamingDeviceType DefaultGamingDeviceType = EGamingDeviceType.StandardPC; + [PublicAPI] public const byte DefaultHoursUntilCardDrops = 3; [PublicAPI] public const EPersonaStateFlag DefaultOnlineFlags = 0; + // TODO: Remove me + [Obsolete("Will be removed in the next stable release")] [PublicAPI] public const EOnlinePreferences DefaultOnlinePreferences = EOnlinePreferences.None; @@ -229,6 +234,10 @@ public sealed class BotConfig { [UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "This is optional, supportive attribute, we don't care if it gets trimmed or not")] public ImmutableList GamesPlayedWhileIdle { get; init; } = DefaultGamesPlayedWhileIdle; + // TODO: Change set to init + [JsonInclude] + public EGamingDeviceType GamingDeviceType { get; internal set; } = DefaultGamingDeviceType; + [JsonInclude] [Range(byte.MinValue, byte.MaxValue)] public byte HoursUntilCardDrops { get; init; } = DefaultHoursUntilCardDrops; @@ -244,7 +253,9 @@ public sealed class BotConfig { [JsonInclude] public EPersonaStateFlag OnlineFlags { get; init; } = DefaultOnlineFlags; + // TODO: Remove me [JsonInclude] + [Obsolete("Will be removed in the next stable release")] public EOnlinePreferences OnlinePreferences { get; init; } = DefaultOnlinePreferences; [JsonInclude] @@ -403,6 +414,9 @@ public sealed class BotConfig { [UsedImplicitly] public bool ShouldSerializeGamesPlayedWhileIdle() => !Saving || ((GamesPlayedWhileIdle != DefaultGamesPlayedWhileIdle) && !GamesPlayedWhileIdle.SequenceEqual(DefaultGamesPlayedWhileIdle)); + [UsedImplicitly] + public bool ShouldSerializeGamingDeviceType() => !Saving || (GamingDeviceType != DefaultGamingDeviceType); + [UsedImplicitly] public bool ShouldSerializeHoursUntilCardDrops() => !Saving || (HoursUntilCardDrops != DefaultHoursUntilCardDrops); @@ -415,8 +429,10 @@ public sealed class BotConfig { [UsedImplicitly] public bool ShouldSerializeOnlineFlags() => !Saving || (OnlineFlags != DefaultOnlineFlags); +#pragma warning disable CA1822 // TODO: Remove me [UsedImplicitly] - public bool ShouldSerializeOnlinePreferences() => !Saving || (OnlinePreferences != DefaultOnlinePreferences); + public bool ShouldSerializeOnlinePreferences() => false; +#pragma warning restore CA1822 // TODO: Remove me [UsedImplicitly] public bool ShouldSerializeOnlineStatus() => !Saving || (OnlineStatus != DefaultOnlineStatus); @@ -514,6 +530,10 @@ public sealed class BotConfig { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(GamesPlayedWhileIdle), $"{nameof(GamesPlayedWhileIdle.Count)} {GamesPlayedWhileIdle.Count} > {ArchiHandler.MaxGamesPlayedConcurrently}")); } + if (GamingDeviceType == EGamingDeviceType.Unknown || !Enum.IsDefined(GamingDeviceType)) { + return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(GamingDeviceType), GamingDeviceType)); + } + foreach (EAssetType lootableType in LootableTypes.Where(static lootableType => !Enum.IsDefined(lootableType))) { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(LootableTypes), lootableType)); } @@ -548,10 +568,16 @@ public sealed class BotConfig { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlineFlags), OnlineFlags)); } +#pragma warning disable CS0618 // TODO: Remove me if (OnlinePreferences > EOnlinePreferences.All) { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlinePreferences), OnlinePreferences)); } + if (OnlinePreferences.HasFlag(EOnlinePreferences.IsSteamDeck)) { + GamingDeviceType = EGamingDeviceType.SteamDeck; + } +#pragma warning restore CS0618 // TODO: Remove me + if (!Enum.IsDefined(OnlineStatus)) { return (false, Strings.FormatErrorConfigPropertyInvalid(nameof(OnlineStatus), OnlineStatus)); } @@ -736,6 +762,7 @@ public sealed class BotConfig { } [Flags] + [Obsolete("Will be removed in the next stable release")] [PublicAPI] public enum EOnlinePreferences : byte { None = 0, diff --git a/Directory.Packages.props b/Directory.Packages.props index 966222036..4d1a49eea 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -17,7 +17,7 @@ - +