Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Micdu70 committed Oct 26, 2024
1 parent 38ca833 commit f2d4c5f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
26 changes: 14 additions & 12 deletions Entities/LogFileWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ private bool IsShowIsCasualShow(string showId) {
|| string.Equals(showId, "xtreme_explore");
}

private bool IsRealFinalRound(string roundId, string showId) {
private bool IsRealFinalRound(int roundNum, string roundId, string showId) {
if ((showId.StartsWith("knockout_fp") && showId.EndsWith("_srs"))
|| (showId.StartsWith("show_wle_s10_") && showId.IndexOf("_srs", StringComparison.OrdinalIgnoreCase) != -1)
|| showId.IndexOf("wle_s10_player_round_", StringComparison.OrdinalIgnoreCase) != -1
Expand Down Expand Up @@ -394,7 +394,7 @@ private bool IsRealFinalRound(string roundId, string showId) {
&& string.Equals(roundId, "round_hoverboardsurvival_final"))

|| (string.Equals(showId, "event_only_button_bashers_template")
&& string.Equals(roundId, "round_1v1_button_basher_event_only_final"))
&& roundNum == 4)

|| (string.Equals(showId, "no_elimination_show")
&& (string.Equals(roundId, "round_snowballsurvival_final_noelim") || string.Equals(roundId, "round_robotrampage_arena_2_final_noelim")));
Expand Down Expand Up @@ -877,6 +877,16 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
int index2 = line.Line.IndexOf(". ", index + 62);
if (index2 < 0) { index2 = line.Line.Length; }

if (logRound.Info.IsCasualShow) {
if (this.threadLocalVariable.Value.currentSessionId != Stats.SavedSessionId) {
Stats.SavedSessionId = this.threadLocalVariable.Value.currentSessionId;
Stats.CasualRoundNum++;
}
logRound.Info.Round = 1;
} else {
logRound.Info.Round = !Stats.EndedShow ? round.Count : Stats.SavedRoundCount + round.Count;
}

if (logRound.Info.UseShareCode) {
logRound.Info.Name = logRound.Info.IsCasualShow ? this.threadLocalVariable.Value.creativeShareCode : logRound.Info.ShowNameId;
logRound.Info.ShowNameId = this.StatsForm.GetUserCreativeLevelTypeId(this.threadLocalVariable.Value.creativeGameModeId);
Expand All @@ -887,7 +897,7 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {

if (logRound.Info.IsCasualShow) {
logRound.Info.IsFinal = false;
} else if (logRound.Info.UseShareCode || this.IsRealFinalRound(logRound.Info.Name, logRound.Info.ShowNameId)) {
} else if (logRound.Info.UseShareCode || this.IsRealFinalRound(logRound.Info.Round, logRound.Info.Name, logRound.Info.ShowNameId)) {
logRound.Info.IsFinal = true;
} else if (this.IsModeException(logRound.Info.Name, logRound.Info.ShowNameId)) {
logRound.Info.IsFinal = this.IsModeFinalException(logRound.Info.Name);
Expand All @@ -896,17 +906,9 @@ private bool ParseLine(LogLine line, List<RoundInfo> round, LogRound logRound) {
} else {
logRound.Info.IsFinal = LevelStats.SceneToRound.TryGetValue(logRound.Info.SceneName, out string levelId) && this.StatsForm.StatLookup.TryGetValue(levelId, out LevelStats levelStats) && levelStats.IsFinal;
}

logRound.Info.IsTeam = this.IsTeamException(logRound.Info.Name);

if (logRound.Info.IsCasualShow) {
if (this.threadLocalVariable.Value.currentSessionId != Stats.SavedSessionId) {
Stats.SavedSessionId = this.threadLocalVariable.Value.currentSessionId;
Stats.CasualRoundNum++;
}
logRound.Info.Round = 1;
} else {
logRound.Info.Round = !Stats.EndedShow ? round.Count : Stats.SavedRoundCount + round.Count;
}
logRound.Info.Start = line.Date;
logRound.Info.InParty = logRound.CurrentlyInParty;
logRound.Info.PrivateLobby = logRound.PrivateLobby;
Expand Down
18 changes: 18 additions & 0 deletions Views/Stats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3550,6 +3550,24 @@ where string.Equals(ri.ShowNameId, "explore_points")
this.CurrentSettings.Version = 106;
this.SaveUserSettings();
}

if (this.CurrentSettings.Version == 106) {
DateTime dateCond = new DateTime(2024, 10, 25, 12, 0, 0, DateTimeKind.Utc);
List<RoundInfo> roundInfoList = (from ri in this.RoundDetails.FindAll()
where string.Equals(ri.ShowNameId, "event_only_button_bashers_template") && ri.Start >= dateCond
select ri).ToList();

foreach (RoundInfo ri in roundInfoList) {
if (ri.Round < 4) {
ri.IsFinal = false;
}
}
this.StatsDB.BeginTrans();
this.RoundDetails.Update(roundInfoList);
this.StatsDB.Commit();
this.CurrentSettings.Version = 107;
this.SaveUserSettings();
}
}

private UserSettings GetDefaultSettings() {
Expand Down

0 comments on commit f2d4c5f

Please sign in to comment.