protected new void HandleRoundOfficiallyEnd(object sender, RoundOfficiallyEndedEventArgs e) { // Prevent adding rounds that are between half side during overtime if (IsOvertime && Parser.TScore == _previousScoreT && Parser.CTScore == _previousScoreCT && !IsHalfMatch) { IsMatchStarted = false; return; } // Keep track of the score to avoid "warmup" round that are between half side if (IsOvertime) { _previousScoreCT = Parser.CTScore; _previousScoreT = Parser.TScore; } base.HandleRoundOfficiallyEnd(sender, e); if (!IsMatchStarted) return; int score = Demo.ScoreTeam1 + Demo.ScoreTeam2; if (score < 15) return; if (score == 15) { IsMatchStarted = false; IsHalfMatch = true; } if (score < 30) return; if (score == 30) { IsMatchStarted = false; IsOvertime = true; // Create a new round when the score is 15-15 because round_start isn't raised if (Parser.TScore == 15 && Parser.CTScore == 15) CreateNewRound(); // Init the first OT CurrentOvertime = new Overtime() { Number = ++OvertimeCount }; } }
protected new void HandleRoundOfficiallyEnd(object sender, RoundOfficiallyEndedEventArgs e) { base.HandleRoundOfficiallyEnd(sender, e); int score = Demo.ScoreTeam1 + Demo.ScoreTeam2; if (score < 30) return; if (score == 30) { IsHalfMatch = false; IsOvertime = true; CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } }
protected override void HandleMatchStarted(object sender, MatchStartedEventArgs e) { _matchStartedCount++; // ESEA demos raise begin_new_match between half time, it's only when the LO3 occurs that the match resume if (_matchStartedCount == 1) IsMatchStarted = false; if (IsOvertime && _matchStartedCount == 3) { // Ignore the first OT if (CurrentRound.Number > 32) { if (!_overtimeHasSwapped) { SwapTeams(); _overtimeHasSwapped = true; } else { _overtimeHasSwapped = false; } } if (IsHalfMatch && CurrentOvertime.ScoreTeam1 != 0 && CurrentOvertime.ScoreTeam2 != 0) { Application.Current.Dispatcher.Invoke(delegate { Demo.Overtimes.Add(CurrentOvertime); }); CurrentOvertime = new Overtime() { Number = ++OvertimeCount }; } if (Demo.Overtimes.Count > 0 && IsHalfMatch) { IsHalfMatch = false; } else { IsHalfMatch = !IsHalfMatch; } IsMatchStarted = true; } if (IsMatchStarted && CurrentRound.Number == 1) { InitPlayers(); } }
protected override void HandleRoundEnd(object sender, RoundEndedEventArgs e) { if (!IsMatchStarted) return; UpdateTeamScore(e); Application.Current.Dispatcher.Invoke(delegate { CurrentRound.Winner = e.Winner; if (CurrentRound.OpenKillEvent != null) { if (CurrentRound.OpenKillEvent.KillerTeam == Team.Terrorist && e.Winner == Team.Terrorist || CurrentRound.OpenKillEvent.KillerTeam == Team.CounterTerrorist && e.Winner == Team.CounterTerrorist) { if (CurrentRound.OpenKillEvent.KillerTeam == Team.Terrorist && e.Winner == Team.Terrorist || CurrentRound.OpenKillEvent.KillerTeam == Team.CounterTerrorist && e.Winner == Team.CounterTerrorist) { if (CurrentRound.OpenKillEvent != null) CurrentRound.OpenKillEvent.HasWin = true; if (CurrentRound.EntryKillEvent != null) CurrentRound.EntryKillEvent.HasWin = true; } } } }); // On faceit round_officialy_ended is raised between half side, not on eBot public demos if (IsLastRoundHalf) { Application.Current.Dispatcher.Invoke(delegate { Demo.Rounds.Add(CurrentRound); }); if (!IsOvertime) return; } Application.Current.Dispatcher.Invoke(delegate { var playerWithEntryKill = Demo.Players.FirstOrDefault(p => p.HasEntryKill); playerWithEntryKill?.EntryKills.Add(CurrentRound.EntryKillEvent); var playerWithOpeningKill = Demo.Players.FirstOrDefault(p => p.HasOpeningKill); playerWithOpeningKill?.OpeningKills.Add(CurrentRound.OpenKillEvent); // Last round of the match or of an overtime, the final overtime is added on cs_win_panel_match if (IsOvertime && _isLastRoundFinal) { Demo.Overtimes.Add(CurrentOvertime); _isLastRoundFinal = false; CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } }); }
protected new void HandleRoundOfficiallyEnd(object sender, RoundOfficiallyEndedEventArgs e) { base.HandleRoundOfficiallyEnd(sender, e); if (!IsMatchStarted) return; if (Parser.CTScore == 15 && Parser.TScore == 15) { IsOvertime = true; CurrentOvertime = new Overtime() { Number = ++OvertimeCount }; } }
protected void HandleSayText(object sender, SayTextEventArgs e) { // cleanup text e.Text = Regex.Replace(e.Text, @"[\u0001\u0005\u0004]", string.Empty); // Beginning of the match Match faceItLive = _faceItLiveRegex.Match(e.Text); if (e.Text == EBOT_LIVE || faceItLive.Success) { Demo.ResetStats(false); AddTeams(); RoundCount = 0; CreateNewRound(); IsMatchStarted = true; } Match scoreUpdateEbot = _scoreRegex.Match(e.Text); Match scoreUpdateFaceit = _faceitScoreRegex.Match(e.Text); // Score update if (scoreUpdateEbot.Success || scoreUpdateFaceit.Success) { // sometimes the parser doesn't have the right team's name when they have been swapped // use the first score update to know the right name of the teams if (!_isTeamsNameDetected) { _isTeamsNameDetected = true; if (Parser.CTClanName != Demo.ClanTagNameTeam1) { Demo.ClanTagNameTeam1 = Parser.CTClanName; Demo.ClanTagNameTeam2 = Parser.TClanName; Demo.Teams[0].Name = Parser.CTClanName; Demo.Teams[1].Name = Parser.TClanName; } } int score1; int score2; if (scoreUpdateEbot.Success) { score1 = Convert.ToInt32(scoreUpdateEbot.Groups["score1"].Value); score2 = Convert.ToInt32(scoreUpdateEbot.Groups["score2"].Value); } else { score1 = Convert.ToInt32(scoreUpdateFaceit.Groups["score1"].Value); score2 = Convert.ToInt32(scoreUpdateFaceit.Groups["score2"].Value); _isFaceit = true; } int scoreTotal = score1 + score2; if (scoreTotal == 15) IsSwapTeamRequired = true; // End of the match may have an overtime, init the 1st one if (scoreTotal == 30) { // Don't stop the match for Faceit demos because there isn't warmup between end of the match and OT if(!scoreUpdateFaceit.Success) IsMatchStarted = false; // Start the OT IsOvertime = true; IsHalfMatch = false; CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } return; } // End of the match (OT or not) Match matchEnd = _endMatchRegex.Match(e.Text); if (matchEnd.Success) { IsMatchStarted = false; return; } if (IsOvertime) { // if eBot is waiting for !ready, the match isn't started if (e.Text == PLEASE_WRITE_READY) IsMatchStarted = false; // announce the beginning of the 1st OT side if (e.Text == BEGIN_FIRST_SIDE_OVERTIME) { IsMatchStarted = true; // Add the last OT played and create a new one if (Demo.ScoreTeam1 + Demo.ScoreTeam2 > 30) { Application.Current.Dispatcher.Invoke(delegate { Demo.Overtimes.Add(CurrentOvertime); }); CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } IsHalfMatch = Demo.Overtimes.Any(); } // announce the beginning of the 2nd OT side if (e.Text == BEGIN_SECOND_SIDE_OVERTIME) { IsMatchStarted = true; IsHalfMatch = !Demo.Overtimes.Any(); IsSwapTeamRequired = true; } } }
protected new void HandleRoundOfficiallyEnd(object sender, RoundOfficiallyEndedEventArgs e) { if (!IsMatchStarted) return; CheckForSpecialClutchEnd(); UpdateKillsCount(); UpdatePlayerScore(); Application.Current.Dispatcher.Invoke(delegate { Demo.Rounds.Add(CurrentRound); }); // End of a half if (IsLastRoundHalf) { IsHalfMatch = !IsHalfMatch; IsMatchStarted = false; } // Last round of the match ended, may have OT if (_isLastRoundFinal) { IsMatchStarted = false; IsOvertime = true; // Add the current overtime only if it's not the first if (CurrentOvertime.Number != 0) { Application.Current.Dispatcher.Invoke(delegate { Demo.Overtimes.Add(CurrentOvertime); }); IsHalfMatch = true; } else { // If it's the first OT, teams haven't been swapped IsHalfMatch = false; } // Create new OT CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } if (IsLastRoundHalf) { CheckForSpecialClutchEnd(); IsSwapTeamRequired = true; IsLastRoundHalf = false; } }
protected override void HandleRoundStart(object sender, RoundStartedEventArgs e) { if (_playerTeamCount > 8) IsMatchStarted = true; if (!IsMatchStarted) return; _isRoundOffiallyEndedOccured = false; // Detect new OT for FaceIt demos if (_isFaceit && IsOvertime && _isFinalRound) { Application.Current.Dispatcher.Invoke(delegate { Demo.Overtimes.Add(CurrentOvertime); }); CurrentOvertime = new Overtime { Number = ++OvertimeCount }; IsHalfMatch = false; } _isFinalRound = false; // First OT detection for FaceIt demos if (Parser.CTScore + Parser.TScore == 30) { IsOvertime = true; CurrentOvertime = new Overtime { Number = ++OvertimeCount }; } // Reset until both scores > 0 if (Parser.CTScore == 0 && Parser.TScore == 0) { Demo.ResetStats(false); RoundCount = 0; AddTeams(); } CreateNewRound(); if (Demo.ScoreTeam1 + Demo.ScoreTeam2 == 15) IsHalfMatch = true; if(!IsOvertime) return; _playerTeamCount = 0; }