-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcsgoIntegration.cs
52 lines (43 loc) · 1.59 KB
/
csgoIntegration.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using CSGSI;
using System;
namespace GLSI
{
public class CsgoIntegration
{
public static bool ToCountKills = false;
public static bool ToCountDeaths = false;
public static bool ToCountAssists = false;
// Set game state listener to http://localhost:6996/
public GameStateListener gsl;
public CsgoIntegration()
{
// Set game event handler to function
GameStateListener gsl = new GameStateListener(6996);
gsl.NewGameState += OnNewGameState;
gsl.Start();
}
void OnNewGameState(GameState gs)
{
//TODO save to program folder
if (ToCountKills &&
(gs.Previously.Player.MatchStats.Kills != gs.Added.Player.MatchStats.Kills) &&
gs.Player.MatchStats.Kills != -1)
{
//File.WriteAllText("C:\\Users\\gshef\\Desktop\\kills.txt", gs.Player.MatchStats.Kills.ToString());
Console.WriteLine(gs.Player.MatchStats.Kills);
}
if (ToCountDeaths &&
(gs.Previously.Player.MatchStats.Deaths != gs.Added.Player.MatchStats.Deaths) &&
gs.Player.MatchStats.Deaths != -1)
{
Console.WriteLine(gs.Player.MatchStats.Deaths);
}
if (ToCountAssists &&
(gs.Previously.Player.MatchStats.Assists != gs.Added.Player.MatchStats.Assists) &&
gs.Player.MatchStats.Assists != -1)
{
Console.WriteLine(gs.Player.MatchStats.Assists);
}
}
}
}