Skip to content

Commit

Permalink
Merge pull request #400 from Micdu70/patch-1
Browse files Browse the repository at this point in the history
Bug fix
  • Loading branch information
qubqub authored Dec 12, 2024
2 parents ec3302d + 5894442 commit f3a128d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 35 deletions.
42 changes: 12 additions & 30 deletions Entities/LogFileWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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), "[\",]", "");
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -800,9 +800,7 @@ private bool ParseLine(LogLine line, List<RoundInfo> 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;
Expand Down Expand Up @@ -842,18 +840,6 @@ private bool ParseLine(LogLine line, List<RoundInfo> 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);
Expand All @@ -870,18 +856,6 @@ private bool ParseLine(LogLine line, List<RoundInfo> 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);
Expand All @@ -898,10 +872,18 @@ private bool ParseLine(LogLine line, List<RoundInfo> 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));
Expand Down
11 changes: 6 additions & 5 deletions Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4460,11 +4460,12 @@ private void LogFile_OnParsedLogLines(List<RoundInfo> 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;
Expand Down Expand Up @@ -4587,7 +4588,7 @@ private void LogFile_OnParsedLogLines(List<RoundInfo> 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
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit f3a128d

Please sign in to comment.