From 589444235581ff54638ed2cd621a4484b858eca4 Mon Sep 17 00:00:00 2001 From: Micdu70 Date: Thu, 12 Dec 2024 02:06:02 +0100 Subject: [PATCH] Bug fix --- Entities/LogFileWatcher.cs | 42 +++++++++++--------------------------- Views/Stats.cs | 11 +++++----- 2 files changed, 18 insertions(+), 35 deletions(-) diff --git a/Entities/LogFileWatcher.cs b/Entities/LogFileWatcher.cs index 72ee8324..0d237da6 100644 --- a/Entities/LogFileWatcher.cs +++ b/Entities/LogFileWatcher.cs @@ -192,7 +192,7 @@ private void ReadLogFile() { sb.AppendLine(line); } } - } else if (line.IndexOf("[FNMMSClientRemoteService] Message received: {") != -1) { + } else if (line.IndexOf("[FNMMSClientRemoteService] Status message received: {") != -1) { while ((line = sr.ReadLine()) != null) { if (line.IndexOf("\"queuedPlayers\": ") != -1) { string content = Regex.Replace(line.Substring(21), "[\",]", ""); @@ -507,7 +507,7 @@ private void SetDefaultCreativeLevelVariables() { private void SetCreativeLevelVariables(string shareCode) { RoundInfo ri = this.StatsForm.GetRoundInfoFromShareCode(shareCode); if (ri != null) { - this.threadLocalVariable.Value.creativeOnlinePlatformId = ri.CreativePlatformId; + this.threadLocalVariable.Value.creativeOnlinePlatformId = ri.CreativeOnlinePlatformId; this.threadLocalVariable.Value.creativeAuthor = ri.CreativeAuthor; // this.threadLocalVariable.Value.creativeShareCode = ri.CreativeShareCode; this.threadLocalVariable.Value.creativeVersion = ri.CreativeVersion; @@ -800,9 +800,7 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { this.UpdateServerConnectionLog(this.threadLocalVariable.Value.currentSessionId, this.threadLocalVariable.Value.selectedShowId); } } else if ((index = line.Line.IndexOf("[RoundLoader] Load UGC via share code: ", StringComparison.OrdinalIgnoreCase)) != -1) { - if (string.Equals(this.threadLocalVariable.Value.selectedShowId, "casual_show") || string.Equals(this.threadLocalVariable.Value.selectedShowId, "spotlight_mode")) { - this.threadLocalVariable.Value.creativeShareCode = line.Line.Substring(index + 39, 14); - } + this.threadLocalVariable.Value.creativeShareCode = line.Line.Substring(index + 39, 14); } else if ((index = line.Line.IndexOf("[RoundLoader] LoadGameLevelSceneASync COMPLETE for scene ", StringComparison.OrdinalIgnoreCase)) != -1) { if (line.Date > Stats.LastRoundLoad) { Stats.LastRoundLoad = line.Date; @@ -842,18 +840,6 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { OnlineServiceType = (int)Stats.OnlineServiceType, OnlineServiceId = Stats.OnlineServiceId, OnlineServiceNickname = Stats.OnlineServiceNickname }; - if (logRound.Info.UseShareCode) { - if (line.Date > Stats.LastCreativeRoundLoad) { - Stats.LastCreativeRoundLoad = line.Date; - this.threadLocalVariable.Value.creativeShareCode = logRound.Info.IsCasualShow ? this.threadLocalVariable.Value.creativeShareCode : logRound.Info.ShowNameId; - this.SetCreativeLevelVariables(this.threadLocalVariable.Value.creativeShareCode); - } - logRound.Info.SceneName = this.threadLocalVariable.Value.creativeGameModeId; - } else { - logRound.Info.SceneName = this._sceneNameReplacer.TryGetValue(this.threadLocalVariable.Value.sceneName, out string sceneName) - ? sceneName - : this.threadLocalVariable.Value.sceneName; - } logRound.FindingPosition = false; round.Add(logRound.Info); @@ -870,18 +856,6 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { OnlineServiceType = (int)Stats.OnlineServiceType, OnlineServiceId = Stats.OnlineServiceId, OnlineServiceNickname = Stats.OnlineServiceNickname }; - if (logRound.Info.UseShareCode) { - if (line.Date > Stats.LastCreativeRoundLoad) { - Stats.LastCreativeRoundLoad = line.Date; - this.threadLocalVariable.Value.creativeShareCode = logRound.Info.IsCasualShow ? this.threadLocalVariable.Value.creativeShareCode : logRound.Info.ShowNameId; - this.SetCreativeLevelVariables(this.threadLocalVariable.Value.creativeShareCode); - } - logRound.Info.SceneName = this.threadLocalVariable.Value.creativeGameModeId; - } else { - logRound.Info.SceneName = this._sceneNameReplacer.TryGetValue(this.threadLocalVariable.Value.sceneName, out string sceneName) - ? sceneName - : this.threadLocalVariable.Value.sceneName; - } logRound.FindingPosition = false; round.Add(logRound.Info); @@ -898,10 +872,18 @@ private bool ParseLine(LogLine line, List round, LogRound logRound) { } if (logRound.Info.UseShareCode) { - logRound.Info.Name = logRound.Info.IsCasualShow ? this.threadLocalVariable.Value.creativeShareCode : logRound.Info.ShowNameId; + if (line.Date > Stats.LastCreativeRoundLoad) { + Stats.LastCreativeRoundLoad = line.Date; + this.SetCreativeLevelVariables(this.threadLocalVariable.Value.creativeShareCode); + } + logRound.Info.SceneName = this.threadLocalVariable.Value.creativeGameModeId; + logRound.Info.Name = this.threadLocalVariable.Value.creativeShareCode; logRound.Info.ShowNameId = this.StatsForm.GetUserCreativeLevelTypeId(this.threadLocalVariable.Value.creativeGameModeId); this.SetCreativeLevelInfo(logRound.Info); } else { + logRound.Info.SceneName = this._sceneNameReplacer.TryGetValue(this.threadLocalVariable.Value.sceneName, out string sceneName) + ? sceneName + : this.threadLocalVariable.Value.sceneName; int index2 = line.Line.IndexOf(". ", index + 62); if (index2 < 0) { index2 = line.Line.Length; } logRound.Info.Name = this.StatsForm.ReplaceLevelIdInShuffleShow(logRound.Info.ShowNameId ?? this.threadLocalVariable.Value.selectedShowId, line.Line.Substring(index + 62, index2 - index - 62)); diff --git a/Views/Stats.cs b/Views/Stats.cs index 3d02ee43..442e7a82 100644 --- a/Views/Stats.cs +++ b/Views/Stats.cs @@ -4460,11 +4460,12 @@ private void LogFile_OnParsedLogLines(List round) { stat.Profile = profile; if (((this.StatLookup.TryGetValue(stat.Name, out LevelStats l1) && l1.IsCreative && !string.IsNullOrEmpty(l1.ShareCode) && string.IsNullOrEmpty(stat.CreativeTitle)) - || (stat.UseShareCode && (string.Equals(stat.ShowNameId, "unknown") || string.IsNullOrEmpty(stat.CreativeTitle)))) && Utils.IsInternetConnected()) { - string shareCode = stat.UseShareCode ? stat.Name : l1.ShareCode; + || (stat.UseShareCode && !string.IsNullOrEmpty(stat.CreativeShareCode) && (string.Equals(stat.ShowNameId, "unknown") || string.IsNullOrEmpty(stat.CreativeTitle)))) && Utils.IsInternetConnected()) { + string shareCode = stat.UseShareCode ? stat.CreativeShareCode : l1.ShareCode; RoundInfo ri = this.GetRoundInfoFromShareCode(shareCode); if (ri != null) { - stat.CreativeOnlinePlatformId = ri.CreativePlatformId; + if (stat.UseShareCode) { stat.ShowNameId = ri.ShowNameId; } + stat.CreativeOnlinePlatformId = ri.CreativeOnlinePlatformId; stat.CreativeAuthor = ri.CreativeAuthor; stat.CreativeShareCode = shareCode; stat.CreativeVersion = ri.CreativeVersion; @@ -4587,7 +4588,7 @@ private void LogFile_OnParsedLogLines(List round) { this.RoundDetails.Insert(stat); this.AllStats.Add(stat); - // Below is where reporting to fallaytics happen + // Below is where reporting to fallalytics happen // Must have enabled the setting to enable tracking // Must not be a private lobby // Must be a game that is played after FallGuysStats started @@ -5287,7 +5288,7 @@ private void SetCurrentProfileIcon(bool linked) { } public RoundInfo GetRoundInfoFromShareCode(string shareCode) { - return this.AllStats.FindLast(r => r.UseShareCode && string.Equals(r.Name, shareCode) && !string.IsNullOrEmpty(r.CreativeTitle)); + return this.AllStats.FindLast(r => r.UseShareCode && string.Equals(r.CreativeShareCode, shareCode) && !string.IsNullOrEmpty(r.CreativeTitle)); } public void UpdateCreativeLevels(string levelId, string shareCode, JsonElement levelData) {