Skip to content

Commit

Permalink
Closes #3261
Browse files Browse the repository at this point in the history
  • Loading branch information
JustArchi committed Aug 6, 2024
1 parent f983a2e commit 4ff1411
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions ArchiSteamFarm/Steam/Bot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2774,6 +2774,7 @@ private async void OnConnected(SteamClient.ConnectedCallback callback) {
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,
Expand Down
21 changes: 21 additions & 0 deletions ArchiSteamFarm/Steam/Storage/BotConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -338,6 +344,9 @@ internal BotConfig() { }
[UsedImplicitly]
public bool ShouldSerializeOnlineFlags() => !Saving || (OnlineFlags != DefaultOnlineFlags);

[UsedImplicitly]
public bool ShouldSerializeOnlinePreferences() => !Saving || (OnlinePreferences != DefaultOnlinePreferences);

[UsedImplicitly]
public bool ShouldSerializeOnlineStatus() => !Saving || (OnlineStatus != DefaultOnlineStatus);

Expand Down Expand Up @@ -459,6 +468,10 @@ public static async Task<bool> Write(string filePath, BotConfig 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));
}
Expand Down Expand Up @@ -641,6 +654,14 @@ public enum EFarmingPreferences : byte {
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 {
Expand Down

0 comments on commit 4ff1411

Please sign in to comment.