mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Add CustomGamePlayedWhileIdle
This commit is contained in:
@@ -180,6 +180,27 @@ namespace ArchiSteamFarm {
|
||||
Client.Send(request);
|
||||
}
|
||||
|
||||
internal void PlayGame(string gameName) {
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
var request = new ClientMsgProtobuf<CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);
|
||||
|
||||
var gamePlayed = new CMsgClientGamesPlayed.GamePlayed();
|
||||
if (!string.IsNullOrEmpty(gameName)) {
|
||||
gamePlayed.game_id = new GameID() {
|
||||
AppType = GameID.GameType.Shortcut,
|
||||
ModID = uint.MaxValue
|
||||
};
|
||||
gamePlayed.game_extra_info = gameName;
|
||||
}
|
||||
|
||||
request.Body.games_played.Add(gamePlayed);
|
||||
|
||||
Client.Send(request);
|
||||
}
|
||||
|
||||
internal void PlayGames(params uint[] gameIDs) {
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
@@ -200,7 +221,7 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal void PlayGames(ICollection<uint> gameIDs) {
|
||||
if (gameIDs == null || gameIDs.Count == 0 || !Client.IsConnected) {
|
||||
if (gameIDs == null || !Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -278,8 +278,8 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
|
||||
internal void ResetGamesPlayed() {
|
||||
if (BotConfig.GamesPlayedWhileIdle.Contains(0)) {
|
||||
ArchiHandler.PlayGames(0);
|
||||
if (!string.IsNullOrEmpty(BotConfig.CustomGamePlayedWhileIdle)) {
|
||||
ArchiHandler.PlayGame(BotConfig.CustomGamePlayedWhileIdle);
|
||||
} else {
|
||||
ArchiHandler.PlayGames(BotConfig.GamesPlayedWhileIdle);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,9 @@ namespace ArchiSteamFarm {
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal byte SendTradePeriod { get; private set; } = 0;
|
||||
|
||||
[JsonProperty]
|
||||
internal string CustomGamePlayedWhileIdle { get; private set; } = null;
|
||||
|
||||
[JsonProperty(Required = Required.DisallowNull)]
|
||||
internal HashSet<uint> GamesPlayedWhileIdle { get; private set; } = new HashSet<uint>() { 0 };
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
"SendOnFarmingFinished": false,
|
||||
"SteamTradeToken": null,
|
||||
"SendTradePeriod": 0,
|
||||
"CustomGamePlayedWhileIdle": null,
|
||||
"GamesPlayedWhileIdle": [
|
||||
0
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user