public void FinishBotting(TitanAccount acc = null) { if (acc != null) { if (acc.IsRunning) { acc.Stop(); } if (_taskDic.ContainsKey(acc)) { _taskDic.Remove(acc); } } else { foreach (var pair in _taskDic) { if (pair.Key.IsRunning || !pair.Value.IsCompleted) { pair.Key.Stop(); _log.Warning("Forcefully finished botting of account {account}.", pair.Key.JsonAccount.Username); } _taskDic.Remove(pair.Key); } } }
public void FinishBotting(TitanAccount acc) { if (acc.IsRunning) { acc.Stop(); } if (_taskDic.ContainsKey(acc)) { _taskDic.Remove(acc); } }
public void StartMatchResolving(TitanAccount account, LiveGameInfo info) { if (_taskDic.ContainsKey(account)) { _log.Warning("Account is already reporting / commending. Aborting forcefully!"); FinishBotting(account); } account.FeedLiveGameInfo(info); _successCount = 0; _failCount = 0; _count = 0; Titan.Instance.IsBotting = true; _log.Debug("Starting Match ID resolving thread for {Target} using account {Account}.", info.SteamID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartEpoch = DateTime.Now.ToEpochTime(); // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec. var origin = Task.Run(() => account.Start()); var result = origin.RunUntil(account.JsonAccount.Sentry ? TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60)); switch (result.Result) { case Result.Success: _successCount++; break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not resolve Match ID with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; case Result.Code2FAWrong: _log.Error("The provided SteamGuard code was wrong. Please retry."); break; } } catch (TimeoutException) { var timeSpent = DateTime.Now.Subtract(account.StartEpoch.ToDateTime()); _log.Error("Connection to account {Account} timed out. It was not possible to resolve the Match " + "ID for the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); _successCount = 0; }
private int _count; // Amount of accounts that started reporting / commending public void StartReport(TitanAccount account, ReportInfo info) { if (_taskDic.ContainsKey(account)) { _log.Warning("Account is already reporting / commending. Aborting forcefully!"); FinishBotting(account); } account.FeedReportInfo(info); _successCount = 0; _failCount = 0; _count = 0; Titan.Instance.IsBotting = true; _log.Debug("Starting reporting thread for {Target} in {Match} using account {Account}.", info.SteamID, info.MatchID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartEpoch = DateTime.Now.ToEpochTime(); // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec. var origin = Task.Run(() => account.Start()); var result = origin.RunUntil(account.JsonAccount.Sentry ? TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60)); _count++; switch (result.Result) { case Result.Success: _successCount++; break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not report with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); _failCount++; break; case Result.AccountBanned: _log.Error("Account {Account} has a cooldown on record. The report has been aborted.", account.JsonAccount.Username); _failCount++; break; case Result.NoMatches: _log.Error("Could not receive match information for {Account}: User is not in live match.", account._liveGameInfo.SteamID.ConvertToUInt64()); _failCount++; break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); _failCount++; break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); _failCount++; break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); _failCount++; break; case Result.Code2FAWrong: _log.Error("The provided SteamGuard code was wrong. Please retry."); _failCount++; break; default: _failCount++; break; } if (_count - _successCount - _failCount == 0) { if (_successCount == 0) { _log.Error("FAIL! Titan was not able to report target {Target}.", info.SteamID.ConvertToUInt64()); Titan.Instance.UIManager.SendNotification( "Titan", "Titan was not able to report your target." ); if (Titan.Instance.ParsedObject != null) { Titan.Instance.IsBotting = false; } } else { _log.Information( "SUCCESS! Titan has successfully sent {Amount} out of {Fail} reports to target {Target}.", _successCount, _count, info.SteamID.ConvertToUInt64()); Titan.Instance.UIManager.SendNotification( "Titan", _successCount + " reports have been successfully sent!" ); if (Titan.Instance.ParsedObject != null) { Titan.Instance.IsBotting = false; } } } } catch (TimeoutException) { var timeSpent = DateTime.Now.Subtract(account.StartEpoch.ToDateTime()); _log.Error("Connection to account {Account} timed out. It was not possible to " + "report the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); }
public void StartIdling(TitanAccount account, IdleInfo info) { if (_taskDic.ContainsKey(account)) { _log.Warning("Account is already reporting / commending / idling. Aborting forcefully!"); FinishBotting(account); } account.FeedIdleInfo(info); _count = 0; _log.Debug("Starting idling thread in games {@Games} using account {Account}.", info.GameID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartTick = DateTime.Now.Ticks; var result = WaitFor <Result> .Run(TimeSpan.FromMinutes(info.Minutes + 2), account.Start); switch (result) { case Result.Success: _count++; if (account.IsLast) { _log.Information("SUCCESS! Titan has successfully idled {Amount} times in {Games}.", _count, account._idleInfo.GameID.ToString()); Titan.Instance.UIManager.SendNotification( "Titan", _count + "x was idled in " + account._idleInfo.GameID + " games!" ); account.IsLast = false; } break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not idle with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; case Result.NoMatches: _log.Error("Could not find a live match for target."); break; } } catch (TimeoutException) { var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick)); _log.Error("Connection to account {Account} timed out. It was not possible to " + "stop idle in the games after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); }
private int _count; // Amount of accounts that successfully reported or commended public void StartReport(TitanAccount account, ReportInfo info) { if (_taskDic.ContainsKey(account)) { _log.Warning("Account is already reporting / commending / idling. Aborting forcefully!"); FinishBotting(account); } account.FeedReportInfo(info); _count = 0; _log.Debug("Starting reporting thread for {Target} in {Match} using account {Account}.", info.SteamID, info.MatchID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartTick = DateTime.Now.Ticks; // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec. var result = WaitFor <Result> .Run(account.JsonAccount.Sentry ? TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), account.Start); switch (result) { case Result.Success: _count++; if (account.IsLast) { _log.Information("SUCCESS! Titan has successfully sent {Amount} reports to {Target}.", _count, account._reportInfo.SteamID.ConvertToUInt64()); Titan.Instance.UIManager.SendNotification( "Titan", _count + " reports have been successfully sent!" ); account.IsLast = false; } break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not report with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); break; case Result.AccountBanned: _log.Warning("Account {Account} has VAC or game bans on record. The report may " + "have not been submitted."); _count++; break; case Result.NoMatches: _log.Error("Could not receive match information for {Account}: User is not in live match.", account._liveGameInfo.SteamID.ConvertToUInt64()); break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; } } catch (TimeoutException) { var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick)); _log.Error("Connection to account {Account} timed out. It was not possible to " + "report the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); }
public void StartCommend(TitanAccount account, CommendInfo info) { account.FeedCommendInfo(info); _count = 0; _log.Debug("Starting commending thread for {Target} using account {Account}.", info.SteamID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartTick = DateTime.Now.Ticks; // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec. var result = WaitFor <Result> .Run(account.JsonAccount.Sentry ? TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), account.Start); switch (result) { case Result.Success: _count++; break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not commend with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); break; case Result.AccountBanned: _log.Warning("Account {Account} has VAC or game bans on record. The report may " + "have not been submitted."); _count++; break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; } } catch (TimeoutException) { var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick)); _log.Error("Connection to account {Account} timed out. It was not possible to " + "commend the target after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); }
public void StartIdling(TitanAccount account, IdleInfo info) { account.FeedIdleInfo(info); _count = 0; _log.Debug("Starting idling thread in games {@Games} using account {Account}.", info.GameID, account.JsonAccount.Username); _taskDic.Add(account, Task.Run(() => { var timedOut = false; try { account.StartTick = DateTime.Now.Ticks; var result = WaitFor <Result> .Run(TimeSpan.FromMinutes(info.Minutes + 2), account.Start); switch (result) { case Result.Success: _count++; break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not idle with account {Account}. The account is " + "already logged in somewhere else.", account.JsonAccount.Username); break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; } } catch (TimeoutException) { var timeSpent = new DateTime(DateTime.Now.Ticks).Subtract(new DateTime(account.StartTick)); _log.Error("Connection to account {Account} timed out. It was not possible to " + "stop idle in the games after {Timespan} seconds.", account.JsonAccount.Username, timeSpent.Seconds); timedOut = true; } finally { if (timedOut) { account.Stop(); } _taskDic.Remove(account); } })); }
private int _count; // Amount of accounts that successfully reported or commended public void Start(BotMode mode, TitanAccount acc, uint target, ulong matchId) { acc.Feed(new Info { Mode = mode, Target = target, MatchID = matchId }); _count = 0; _log.Debug("Starting {Mode} thread for {Target} in match {MatchId} " + "using account {Account}.", mode.ToString().ToLower() + "ing", target, matchId, acc.JsonAccount.Username); _taskDic.Add(acc, Task.Run(() => { var timedOut = false; try { acc.StartTick = DateTime.Now.Ticks; // Timeout on Sentry Account: 3min (so the user has enough time to input the 2FA code), else 60sec. var result = WaitFor <Result> .Run(acc.JsonAccount.Sentry ? TimeSpan.FromMinutes(3) : TimeSpan.FromSeconds(60), acc.Start); switch (result) { case Result.Success: _count++; break; case Result.AlreadyLoggedInSomewhereElse: _log.Error("Could not report with account {Account}. The account is " + "already logged in somewhere else.", acc.JsonAccount.Username); break; case Result.AccountBanned: _log.Warning("Account {Account} has VAC or game bans on record. The report may " + "have not been submitted."); _count++; break; case Result.TimedOut: _log.Error("Processing thread for {Account} has timed out."); break; case Result.SentryRequired: _log.Error("The account has 2FA enabled. Please set {sentry} to {true} " + "in the accounts.json file.", "sentry", true); break; case Result.RateLimit: _log.Error("The Steam Rate Limit has been reached. Please try again in a " + "few minutes."); break; } } catch (TimeoutException) { var timeSpent = new DateTime(DateTime.Now.Ticks - acc.StartTick); _log.Error("Connection to account {Account} timed out. It was not possible to " + "report the target after {Timespan} seconds.", acc.JsonAccount.Username, timeSpent.Second); timedOut = true; } finally { if (timedOut) { acc.Stop(); } _taskDic.Remove(acc); } })); }