From 597ae9ce519291cf4df788a2eb5d93c258ae9275 Mon Sep 17 00:00:00 2001 From: rakijah Date: Fri, 15 Feb 2019 13:03:57 +0100 Subject: [PATCH] Bomb related fixes * bumped version to 1.3.1 * re-added gs.Round.Bomb * added gs.Bomb.Countdown --- CSGSI/GameStateListener.cs | 9 ++------- CSGSI/Nodes/BombNode.cs | 8 +++++++- CSGSI/Nodes/RoundNode.cs | 6 ++++++ CSGSI/Properties/AssemblyInfo.cs | 4 ++-- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CSGSI/GameStateListener.cs b/CSGSI/GameStateListener.cs index 1565e63..efa47cd 100644 --- a/CSGSI/GameStateListener.cs +++ b/CSGSI/GameStateListener.cs @@ -180,7 +180,7 @@ private void ReceiveGameState(IAsyncResult result) #region Intricate Events /// - /// Determines whether intricate events such as PlayerDied are raised or ignored. + /// Determines whether intricate events are raised or ignored. Most of these events are only available when spectating a match! /// public bool EnableRaisingIntricateEvents { get; set; } = false; @@ -218,10 +218,6 @@ private void ProcessGameState(GameState gs) if (BombPlanted != null) { - //if previous state contains any player with the bomb - //and current state does not contain any players with the bomb - //and the previous bombstate was undefined - //and the current bombstate is planted var planter = gs.Previously.AllPlayers.PlayerList.SingleOrDefault(player => player.Weapons.WeaponList.Any(weapon => weapon.Type == WeaponType.C4)); if (planter != null && gs.Previously.Bomb.State == BombState.Planting && @@ -233,8 +229,7 @@ private void ProcessGameState(GameState gs) if (BombDefused != null) { - if (gs.Previously.Bomb.State == BombState.Planted && - gs.Bomb.State == BombState.Defused) + if (gs.Previously.Bomb.State == BombState.Planted && gs.Bomb.State == BombState.Defused) { var defuser = gs.AllPlayers.PlayerList.SingleOrDefault(player => gs.AllPlayers.GetBySteamID(player.SteamID).MatchStats.Score > player.MatchStats.Score); if (defuser == null) diff --git a/CSGSI/Nodes/BombNode.cs b/CSGSI/Nodes/BombNode.cs index c2ad1a0..eccad6a 100644 --- a/CSGSI/Nodes/BombNode.cs +++ b/CSGSI/Nodes/BombNode.cs @@ -1,7 +1,7 @@ namespace CSGSI.Nodes { /// - /// Contains information about the bomb. + /// Contains information about the bomb. This node is only available when spectating! /// public class BombNode : NodeBase { @@ -15,6 +15,11 @@ public class BombNode : NodeBase /// public Vector3 Position { get; set; } + /// + /// The time remaining for the current state (i.e. time remaining until explosion if bomb is planted, time remaining until defused if defusing, etc). + /// + public float Countdown { get; set; } + /// /// Initializes a new from the given JSON string. /// @@ -24,6 +29,7 @@ public BombNode(string json) { State = GetEnum("state"); Position = GetVector3("position"); + Countdown = GetFloat("countdown"); } } diff --git a/CSGSI/Nodes/RoundNode.cs b/CSGSI/Nodes/RoundNode.cs index 9df5909..c755a7f 100644 --- a/CSGSI/Nodes/RoundNode.cs +++ b/CSGSI/Nodes/RoundNode.cs @@ -10,6 +10,11 @@ public class RoundNode : NodeBase /// public RoundPhase Phase { get; set; } + /// + /// The current state of the bomb (does not include states like "Dropped" or "Planting"). + /// + public BombState Bomb { get; set; } + /// /// The team that won the current round (only available when Phase == Over) /// @@ -19,6 +24,7 @@ internal RoundNode(string json) : base(json) { Phase = GetEnum("phase"); + Bomb = GetEnum("bomb"); WinTeam = GetEnum("win_team"); } } diff --git a/CSGSI/Properties/AssemblyInfo.cs b/CSGSI/Properties/AssemblyInfo.cs index a49055a..0001588 100644 --- a/CSGSI/Properties/AssemblyInfo.cs +++ b/CSGSI/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file +[assembly: AssemblyVersion("1.3.1.0")] +[assembly: AssemblyFileVersion("1.3.1.0")] \ No newline at end of file