From cdaf2b01aa84d5c5d0a5e0e205e04f8e5054fd75 Mon Sep 17 00:00:00 2001 From: Kittenji <41535779+ChrisFeline@users.noreply.github.com> Date: Fri, 4 Oct 2024 08:18:36 -0400 Subject: [PATCH] Fix (BETA) Overseer notes. This is for people that love changing their time for some reason. --- Utils/LogParser/ToNLogContext.cs | 3 ++- Windows/MainWindow.cs | 45 +++++++++++++++++--------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/Utils/LogParser/ToNLogContext.cs b/Utils/LogParser/ToNLogContext.cs index a2e8abb..bf9b2f9 100644 --- a/Utils/LogParser/ToNLogContext.cs +++ b/Utils/LogParser/ToNLogContext.cs @@ -159,7 +159,8 @@ public override void Drop(string name) { public RoundSummary Summary { get; private set; } = new RoundSummary(ToNRoundResult.R, TerrorMatrix.Empty, ToNIndex.Map.Empty, null, true); // Triggered at end of round public void SaveSummary() { - Summary = new RoundSummary(Result, Terrors, Location, Settings.Get.SaveRoundNote ? Settings.Get.RoundNoteTemplate.GetString() : null); + Summary = new RoundSummary(Result, Terrors, Location, + Settings.Get.SaveRoundNote ? (IsRecent && MainWindow.Started ? Settings.Get.RoundNoteTemplate.GetString() : Terrors.GetTerrorNames()) : null); } // Triggered when consumed by the save code public void ClearSummary() { diff --git a/Windows/MainWindow.cs b/Windows/MainWindow.cs index 08bccda..c89f948 100644 --- a/Windows/MainWindow.cs +++ b/Windows/MainWindow.cs @@ -722,32 +722,35 @@ private bool HandleTerrorIndex(string line, DateTime timestamp, ToNLogContext co return true; } - bool isUnknown = line.StartsWith(KILLER_MATRIX_UNKNOWN); // Killers is unknown - - bool isRevealed = line.StartsWith(KILLER_MATRIX_REVEAL); // Killers have been revealed - - if (isUnknown || isRevealed || line.StartsWith(KILLER_MATRIX_KEYWORD)) { // Killers have been set - - int index = isRevealed ? KILLER_MATRIX_REVEAL.Length : KILLER_MATRIX_KEYWORD.Length; - int rndInd = line.IndexOf(KILLER_ROUND_TYPE_KEYWORD, index, StringComparison.InvariantCulture); - if (rndInd < 0) return true; - - string roundType = line.Substring(rndInd + KILLER_ROUND_TYPE_KEYWORD.Length).Trim(); - int[] killerMatrix = new int[3]; - - if (isUnknown) { - killerMatrix[0] = killerMatrix[1] = killerMatrix[2] = byte.MaxValue; - } else { - string[] kMatrixRaw = line.Substring(index, rndInd - index).Trim().Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); - for (int i = 0; i < kMatrixRaw.Length; i++) { - killerMatrix[i] = int.TryParse(kMatrixRaw[i], out index) ? index : -1; + if (!context.Location.IsEmpty) { + bool isUnknown = line.StartsWith(KILLER_MATRIX_UNKNOWN); // Killers is unknown - + bool isRevealed = line.StartsWith(KILLER_MATRIX_REVEAL); // Killers have been revealed - + bool isSet = line.StartsWith(KILLER_MATRIX_KEYWORD); + if (isUnknown || isRevealed || isSet) { // Killers have been set - + int index = isRevealed ? KILLER_MATRIX_REVEAL.Length : KILLER_MATRIX_KEYWORD.Length; + int rndInd = line.IndexOf(KILLER_ROUND_TYPE_KEYWORD, index, StringComparison.InvariantCulture); + if (rndInd < 0) return true; + + string roundType = line.Substring(rndInd + KILLER_ROUND_TYPE_KEYWORD.Length).Trim(); + int[] killerMatrix = new int[3]; + + if (isUnknown) { + killerMatrix[0] = killerMatrix[1] = killerMatrix[2] = byte.MaxValue; + } else { + string[] kMatrixRaw = line.Substring(index, rndInd - index).Trim().Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries); + for (int i = 0; i < kMatrixRaw.Length; i++) { + killerMatrix[i] = int.TryParse(kMatrixRaw[i], out index) ? index : -1; + } } - } - context.SetTerrorMatrix(new TerrorMatrix(roundType, killerMatrix) { IsUnknown = isUnknown, IsRevealed = isRevealed }); - return true; + context.SetTerrorMatrix(new TerrorMatrix(roundType, killerMatrix) { IsUnknown = isUnknown, IsRevealed = isRevealed }); + return true; + } } if (!context.Terrors.IsEmpty) { // Track round participation results / Supports live build maybe - if (line.StartsWith(ROUND_OVER_KEYWORD) || line.StartsWith(ROUND_WON_KEYWORD) || line.StartsWith(ROUND_LOST_KEYWORD)) { + if (line.StartsWith(ROUND_OVER_KEYWORD)) { if (context.IsOptedIn) { context.SetRoundResult(context.IsAlive ? ToNRoundResult.W : ToNRoundResult.L); context.SaveSummary(); @@ -956,7 +959,7 @@ private void AddLogEntry(string dateKey, string content, DateTime timestamp, ToN if (!context.HasLoadedSave) entry.Pre = true; } - if (!context.IsHomeWorld) entry.Note = "(BETA) " + entry.Note; + // if (!context.IsHomeWorld) entry.Note = "(BETA) " + entry.Note; if (listBoxKeys.SelectedItem == collection) InsertSafe(listBoxEntries, ind, entry);