public virtual async Task PlaytestFifteenMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestFifteenMinuteTask", false, color: LOG_COLOR); } _dataService.SetIncludePlayerCount(true); //Ensure server is awake and RCON connection is established. Run other things while waking server _ = rconService.WakeRconServer(ServerLocation); //Get rid of the old log file if one exists. Just scrap it. srcdsLogService.RemoveFeedbackFile(server); //Make a feedback file var logResult = srcdsLogService.CreateFeedbackFile(server, GetFeedbackFileName()); if (logResult) { await _log.LogMessage($"Log file created: {GetFeedbackFileName()}"); var fbf = srcdsLogService.GetFeedbackFile(server); await fbf.LogFeedback($"Pre-test feedback started at: {DateTime.Now} CT"); } }
public virtual async Task PlaytestStartingTask(RconService rconService, SrcdsLogService srcdsLogService, AnnouncementMessage announcementMessage) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestStartingTask", false, color: LOG_COLOR); } _ = rconService.WakeRconServer(ServerLocation); var mentionRole = TesterRole; //Handle comp or casual if (IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {_dataService.RSettings.General.CasualPassword}"); } else { mentionRole = _dataService.CompetitiveTesterRole; } //Skip the alert. if (!_dataService.GetStartAlertStatus()) { _dataService.SetStartAlert(true); return; } var unsubInfo = Game.ToString(); if (!IsCasual) { unsubInfo = "comp"; } await TesterRole.ModifyAsync(x => { x.Mentionable = true; }); await TestingChannel.SendMessageAsync($"Heads up {mentionRole.Mention}! " + "There is a playtest starting __now__!" + $"\nType `>playtester {unsubInfo}` to stop getting {unsubInfo} playtest notifications.", embed : announcementMessage.CreatePlaytestEmbed(this, true, AnnouncementMessage.Id)); await TesterRole.ModifyAsync(x => { x.Mentionable = false; }); }
public virtual async Task PlaytestTwentyMinuteTask(RconService rconService, SrcdsLogService srcdsLogService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestTwentyMinuteTask", false, color: LOG_COLOR); } _dataService.SetIncludePlayerCount(true); //Ensure server is awake and RCON connection is established. await rconService.WakeRconServer(ServerLocation); try { await Moderator.SendMessageAsync($"You're running the {CleanedTitle} playtest in 20 minutes!"); } catch { //Ignored } await _log.LogMessage("Running playtesting starting in 20 minutes task...", true, color : LOG_COLOR); }
public virtual async Task PlaytestStartingInTask(RconService rconService, SrcdsLogService srcdsLogService, AnnouncementMessage announcementMessage) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestStartingInTask", false, color: LOG_COLOR); } //Ensure server is awake and RCON connection is established. Run other things while waking server _ = rconService.WakeRconServer(ServerLocation); //Start asking the server for player counts. _dataService.SetIncludePlayerCount(true); //Start asking for player counts JobManager.AddJob( async() => await rconService.GetPlayCountFromServer(ServerLocation), s => s.WithName("[QueryPlayerCount]").ToRunEvery(60).Seconds()); //Figure out how far away from start we are string countdownString = null; var countdown = StartDateTime.GetValueOrDefault().Subtract(DateTime.Now); if (StartDateTime.GetValueOrDefault().CompareTo(DateTime.Now) < 0) { countdownString = $"Started: {countdown:h\'H \'m\'M\'} ago!"; } else { countdownString = countdown.ToString("d'D 'h'H 'm'M'").TrimStart(' ', 'D', 'H', '0'); } await rconService.RconCommand(ServerLocation, "sv_cheats 0"); var mentionRole = TesterRole; //Handle comp or casual if (IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {_dataService.RSettings.General.CasualPassword}"); } else { mentionRole = _dataService.CompetitiveTesterRole; } //Skip the alert. if (!_dataService.GetStartAlertStatus()) { _dataService.SetStartAlert(true); return; } var unsubInfo = Game.ToString(); if (!IsCasual) { unsubInfo = "comp"; } await TesterRole.ModifyAsync(x => { x.Mentionable = true; }); await TestingChannel.SendMessageAsync($"Heads up {mentionRole.Mention}! " + $"There is a playtest starting in {countdownString}." + $"\nType `>playtester {unsubInfo}` to manage {unsubInfo} playtest notifications.", embed : announcementMessage.CreatePlaytestEmbed(this, true, AnnouncementMessage.Id)); await TesterRole.ModifyAsync(x => { x.Mentionable = false; }); //DM users about their test foreach (var creator in Creators) { try { await creator.SendMessageAsync( $"Don't forget that you have a playtest for __**{CleanedTitle}**__ in __**{countdownString}**__"); } catch { //Could not DM creator about their test. } } }