Add Round Win/Loss Events

This commit is contained in:
glax 2024-01-16 00:25:47 +01:00
parent b4e9e595a7
commit 592fee31ca
2 changed files with 16 additions and 0 deletions

View File

@ -32,6 +32,12 @@ internal static class CS2EventGenerator
if(newGameState.Round?.Phase == Round.RoundPhase.Over && lastGameState.Round?.Phase == Round.RoundPhase.Live)
events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.OnRoundOver, new CS2EventArgs()));
if(newGameState.Round?.WinnerTeam is not null && newGameState.Round?.WinnerTeam == previousPlayerState.Player?.Team)
events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.OnRoundWin, new CS2EventArgs()));
if(newGameState.Round?.WinnerTeam is not null && newGameState.Round?.WinnerTeam != previousPlayerState.Player?.Team)
events.Add(new ValueTuple<CS2Event, CS2EventArgs>(CS2Event.OnRoundLoss, new CS2EventArgs()));
}
if(newGameState.Map?.Phase == Map.MapPhase.Live && lastGameState.Map?.Phase != Map.MapPhase.Live)

View File

@ -84,6 +84,12 @@ public class CS2GSI
case CS2Event.OnRoundOver:
OnRoundOver?.Invoke(cs2Event.Item2);
break;
case CS2Event.OnRoundWin:
OnRoundWin?.Invoke(cs2Event.Item2);
break;
case CS2Event.OnRoundLoss:
OnRoundLoss?.Invoke(cs2Event.Item2);
break;
case CS2Event.OnDamageTaken:
OnDamageTaken?.Invoke(cs2Event.Item2);
break;
@ -150,6 +156,8 @@ public class CS2GSI
OnSmoked,
OnRoundStart,
OnRoundOver,
OnRoundWin,
OnRoundLoss,
OnDamageTaken,
OnMatchStart,
OnMatchOver,
@ -179,6 +187,8 @@ public class CS2GSI
OnSmoked,
OnRoundStart,
OnRoundOver,
OnRoundWin,
OnRoundLoss,
OnDamageTaken,
OnMatchStart,
OnMatchOver,