public override async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("TF2 class PlaytestCommandPost", false, color: LOG_COLOR); } await base.PlaytestCommandPost(replyInContext, srcdsLogService, rconService); await rconService.RconCommand(ServerLocation, $"changelevel workshop/{PlaytestCommandInfo.WorkshopId}"); await Task.Delay(15000); //Wait for map to change await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"sv_cheats 1; exec {_dataService.RSettings.General.PostgameConfig};sv_voiceenable 0"); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "mp_tournament 1"); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "mp_tournament_restart"); await DownloadHandler.DownloadPlaytestDemo(PlaytestCommandInfo); //TF2 Embed var embed = new EmbedBuilder() .WithAuthor($"Download playtest demo for {CleanedTitle}", _dataService.Guild.IconUrl, demoUrl) .WithThumbnailUrl(PlaytestCommandInfo.ThumbNailImage) .WithColor(new Color(243, 128, 72)) .WithDescription( $"[Download Demo Here]({demoUrl}) | [Map Images]({PlaytestCommandInfo.ImageAlbum}) | [Playtesting Information](https://www.tophattwaffle.com/playtesting/)"); await AnnouncmentChannel.SendMessageAsync(PlaytestCommandInfo.CreatorMentions, embed : embed.Build()); PlaytestCommandRunning = false; }
public virtual async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("Base class PlaytestCommandPost", false, color: LOG_COLOR); } PlaytestCommandRunning = true; //Force the next alert to true _dataService.SetStartAlert(true); await _log.LogMessage("Running Playtest Post Tasks!", color : LOG_COLOR); //No context to send these messages to - default them if (!replyInContext) { await _dataService.CSGOTestingChannel.SendMessageAsync(embed : new EmbedBuilder() .WithAuthor($"Post playtest of {PlaytestCommandInfo.Title}") .WithColor(new Color(55, 55, 165)) .WithDescription($"\nOn **{PlaytestCommandInfo.ServerAddress}**" + $"\nWorkshop ID **{PlaytestCommandInfo.WorkshopId}**" + $"\nDemo Name **{PlaytestCommandInfo.DemoName}**").Build()); } var fbf = srcdsLogService.GetFeedbackFile(server); if (fbf != null && File.Exists(fbf.FileName)) { Directory.CreateDirectory( $"{_dataService.RSettings.ProgramSettings.PlaytestDemoPath}\\{PlaytestCommandInfo.StartDateTime:yyyy}" + $"\\{PlaytestCommandInfo.StartDateTime:MM} - {PlaytestCommandInfo.StartDateTime:MMMM}" + $"\\{PlaytestCommandInfo.DemoName}"); File.Copy(fbf.FileName, $"{_dataService.RSettings.ProgramSettings.PlaytestDemoPath}\\{PlaytestCommandInfo.StartDateTime:yyyy}" + $"\\{PlaytestCommandInfo.StartDateTime:MM} - {PlaytestCommandInfo.StartDateTime:MMMM}" + $"\\{PlaytestCommandInfo.DemoName}\\{PlaytestCommandInfo.DemoName}.txt" , true); await AnnouncmentChannel.SendFileAsync(fbf.FileName, ""); } _ = Task.Run(async() => { await Task.Delay(35000); var patreonUsers = _dataService.PatreonsRole.Members.ToArray(); GeneralUtil.Shuffle(patreonUsers); var thanks = ""; foreach (var patreonsRoleMember in patreonUsers) { thanks += $"{patreonsRoleMember.Username}, "; } await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"say Thanks to these supporters: {thanks.TrimEnd(',', ' ')}"); await Task.Delay(2000); await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, @"Say Become a supporter at www.patreon.com/tophattwaffle"); }); //Stop getting more feedback srcdsLogService.RemoveFeedbackFile(server); }
public override async Task PlaytestCommandPost(bool replyInContext, SrcdsLogService srcdsLogService, RconService rconService) { await base.PlaytestCommandPost(replyInContext, srcdsLogService, rconService); if (_dataService.RSettings.ProgramSettings.Debug) { _ = _log.LogMessage("CSGO class PlaytestCommandPost", false, color: LOG_COLOR); } //Fire and forget all of this. _ = Task.Run(async() => { await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"host_workshop_map {PlaytestCommandInfo.WorkshopId}"); await Task.Delay(15000); //Wait for map to change await rconService.RconCommand(PlaytestCommandInfo.ServerAddress, $"sv_cheats 1; bot_stop 1;exec {_dataService.RSettings.General.PostgameConfig};sv_voiceenable 0"); if (!IsCasual) { await rconService.RconCommand(ServerLocation, $"sv_password {CompPassword}"); } //Display ingame notification for in game voice and make it stick for a while. _ = Task.Run(async() => { for (var i = 0; i < 4; i++) { _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "script ScriptPrintMessageCenterAll(\"Please join the level testing voice channel for feedback!\");", false); await Task.Delay(3000); } }); //Enable the no damage script, cause Thomas is a real one. _ = Task.Run(async() => { //Short delay to ensure that mp_restart game already happened. await Task.Delay(5000); _ = rconService.RconCommand(PlaytestCommandInfo.ServerAddress, "say No damage activated!; script_execute nodamage"); }); var demoPath = await DownloadHandler.DownloadPlaytestDemo(PlaytestCommandInfo); FileInfo jasonFile = null; try { jasonFile = DemoParser.ParseDemo(Path.GetDirectoryName(demoPath)); } catch (Exception e) { Console.WriteLine("JIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\nJIMCODE\n" + e.Message); } _ = Task.Run(async() => { foreach (var creator in Creators) { try { var user = _dataService.GetSocketGuildUser(creator.Id); await user.RemoveRoleAsync(_dataService.ComptesterPlaytestCreator); } catch { } } }); var embed = new EmbedBuilder() .WithAuthor($"Download playtest demo for {CleanedTitle}", _dataService.Guild.IconUrl, demoUrl) .WithThumbnailUrl(PlaytestCommandInfo.ThumbNailImage) .WithColor(new Color(243, 128, 72)) .WithDescription( $"[Download Demo Here]({demoUrl}) | [Map Images]({PlaytestCommandInfo.ImageAlbum}) | [Playtesting Information](https://www.tophattwaffle.com/playtesting/)"); if (jasonFile != null) { embed.AddField("Analyzed Demo", $"[View Processed Demo Here!]({demoSiteUrlBase}{jasonFile.Name.Replace(jasonFile.Extension, "")})"); } await AnnouncmentChannel.SendMessageAsync(PlaytestCommandInfo.CreatorMentions, embed: embed.Build()); PlaytestCommandRunning = false; }); }