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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
use std::collections::HashMap;
use serde::{Serialize, Deserialize};
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Player {
#[serde(rename = "steamid")]
pub steam_id: String,
pub name: String,
pub observer_slot: Option<u64>,
pub activity: Activity,
pub match_stats: Option<MatchStats>,
pub state: Option<State>,
pub team: Option<super::Team>,
#[serde(default)]
pub weapons: HashMap<String, Weapon>,
pub clan: Option<String>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum Activity {
Menu,
Playing,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct MatchStats {
pub kills: i64,
pub assists: u64,
pub deaths: u64,
pub mvps: u64,
pub score: u64,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct State {
pub health: u64,
pub armor: u64,
pub helmet: bool,
pub flashed: u64,
pub smoked: u64,
pub burning: u64,
pub money: u64,
pub round_kills: i64,
pub round_killhs: u64,
pub equip_value: u64,
pub round_totaldmg: Option<u64>,
#[serde(rename = "defusekit")]
pub defuse_kit: Option<bool>
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
pub struct Weapon {
pub name: String,
pub paintkit: String,
pub r#type: Option<WeaponType>,
pub state: WeaponState,
pub ammo_clip: Option<u64>,
pub ammo_clip_max: Option<u64>,
pub ammo_reserve: Option<u64>,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub enum WeaponType {
Knife,
Pistol,
#[serde(rename = "Submachine Gun")]
SMG,
#[serde(rename = "Machine Gun")]
MachineGun,
Rifle,
SniperRifle,
Shotgun,
StackableItem,
Grenade,
C4,
}
#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(rename_all = "lowercase")]
pub enum WeaponState {
Holstered,
Active,
Reloading,
}