@akiver/cs-demo-analyzer 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/darwin-arm64/csda +0 -0
- package/dist/bin/darwin-x64/csda +0 -0
- package/dist/bin/linux-arm64/csda +0 -0
- package/dist/bin/linux-x64/csda +0 -0
- package/dist/bin/windows-x64/csda.exe +0 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +14 -0
- package/dist/constants.d.ts +304 -0
- package/dist/constants.js +287 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +72 -0
- package/dist/platform.d.ts +1 -0
- package/dist/platform.js +25 -0
- package/package.json +41 -0
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const platform_1 = require("./platform");
|
|
5
|
+
try {
|
|
6
|
+
const binPath = (0, platform_1.getBinaryPath)();
|
|
7
|
+
require('child_process').execFileSync(binPath, process.argv.slice(2), { stdio: 'inherit' });
|
|
8
|
+
}
|
|
9
|
+
catch (error) {
|
|
10
|
+
if (error && typeof error === 'object' && 'status' in error && typeof error.status === 'number') {
|
|
11
|
+
process.exit(error.status);
|
|
12
|
+
}
|
|
13
|
+
throw error;
|
|
14
|
+
}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
export declare const Game: {
|
|
2
|
+
readonly CSGO: "CSGO";
|
|
3
|
+
readonly CS2: "CS2";
|
|
4
|
+
readonly CS2LT: "CS2 LT";
|
|
5
|
+
};
|
|
6
|
+
export type Game = (typeof Game)[keyof typeof Game];
|
|
7
|
+
export declare const DemoSource: {
|
|
8
|
+
readonly Unknown: "unknown";
|
|
9
|
+
readonly Valve: "valve";
|
|
10
|
+
readonly Ebot: "ebot";
|
|
11
|
+
readonly Popflash: "popflash";
|
|
12
|
+
readonly FaceIt: "faceit";
|
|
13
|
+
readonly Cevo: "cevo";
|
|
14
|
+
readonly Esl: "esl";
|
|
15
|
+
readonly Esea: "esea";
|
|
16
|
+
readonly Esportal: "esportal";
|
|
17
|
+
readonly Fastcup: "fastcup";
|
|
18
|
+
readonly Gamersclub: "gamersclub";
|
|
19
|
+
};
|
|
20
|
+
export type DemoSource = (typeof DemoSource)[keyof typeof DemoSource];
|
|
21
|
+
export declare const SupportedDemoSources: DemoSource[];
|
|
22
|
+
export declare const DemoType: {
|
|
23
|
+
readonly POV: "POV";
|
|
24
|
+
readonly GOTV: "GOTV";
|
|
25
|
+
};
|
|
26
|
+
export type DemoType = (typeof DemoType)[keyof typeof DemoType];
|
|
27
|
+
export declare const ExportFormat: {
|
|
28
|
+
readonly CSV: "csv";
|
|
29
|
+
readonly JSON: "json";
|
|
30
|
+
readonly CSDM: "csdm";
|
|
31
|
+
};
|
|
32
|
+
export type ExportFormat = (typeof ExportFormat)[keyof typeof ExportFormat];
|
|
33
|
+
export declare const TeamNumber: {
|
|
34
|
+
readonly UNASSIGNED: 0;
|
|
35
|
+
readonly SPECTATOR: 1;
|
|
36
|
+
readonly T: 2;
|
|
37
|
+
readonly CT: 3;
|
|
38
|
+
};
|
|
39
|
+
export type TeamNumber = (typeof TeamNumber)[keyof typeof TeamNumber];
|
|
40
|
+
export declare const TeamLetter: {
|
|
41
|
+
readonly A: "A";
|
|
42
|
+
readonly B: "B";
|
|
43
|
+
};
|
|
44
|
+
export type TeamLetter = (typeof TeamLetter)[keyof typeof TeamLetter];
|
|
45
|
+
export declare const WeaponType: {
|
|
46
|
+
readonly Unknown: "unknown";
|
|
47
|
+
readonly Pistol: "pistol";
|
|
48
|
+
readonly SMG: "smg";
|
|
49
|
+
readonly Shotgun: "shotgun";
|
|
50
|
+
readonly Rifle: "rifle";
|
|
51
|
+
readonly Sniper: "sniper";
|
|
52
|
+
readonly MachineGun: "machine_gun";
|
|
53
|
+
readonly Grenade: "grenade";
|
|
54
|
+
readonly Equipment: "equipment";
|
|
55
|
+
readonly Melee: "melee";
|
|
56
|
+
readonly World: "world";
|
|
57
|
+
};
|
|
58
|
+
export type WeaponType = (typeof WeaponType)[keyof typeof WeaponType];
|
|
59
|
+
export declare const WeaponName: {
|
|
60
|
+
readonly AK47: "AK-47";
|
|
61
|
+
readonly AUG: "AUG";
|
|
62
|
+
readonly AWP: "AWP";
|
|
63
|
+
readonly Bomb: "C4";
|
|
64
|
+
readonly CZ75: "CZ75 Auto";
|
|
65
|
+
readonly Decoy: "Decoy Grenade";
|
|
66
|
+
readonly Deagle: "Desert Eagle";
|
|
67
|
+
readonly DefuseKit: "Defuse Kit";
|
|
68
|
+
readonly DualBerettas: "Dual Berettas";
|
|
69
|
+
readonly Famas: "FAMAS";
|
|
70
|
+
readonly FiveSeven: "Five-SeveN";
|
|
71
|
+
readonly Flashbang: "Flashbang";
|
|
72
|
+
readonly G3SG1: "G3SG1";
|
|
73
|
+
readonly GalilAR: "Galil AR";
|
|
74
|
+
readonly Glock: "Glock-18";
|
|
75
|
+
readonly HEGrenade: "HE Grenade";
|
|
76
|
+
readonly Helmet: "Kevlar + Helmet";
|
|
77
|
+
readonly Kevlar: "Kevlar Vest";
|
|
78
|
+
readonly Incendiary: "Incendiary Grenade";
|
|
79
|
+
readonly Knife: "Knife";
|
|
80
|
+
readonly M249: "M249";
|
|
81
|
+
readonly M4A1: "M4A1";
|
|
82
|
+
readonly M4A4: "M4A4";
|
|
83
|
+
readonly Mac10: "MAC-10";
|
|
84
|
+
readonly MAG7: "MAG-7";
|
|
85
|
+
readonly Molotov: "Molotov";
|
|
86
|
+
readonly MP5: "MP5-SD";
|
|
87
|
+
readonly MP7: "MP7";
|
|
88
|
+
readonly MP9: "MP9";
|
|
89
|
+
readonly Negev: "Negev";
|
|
90
|
+
readonly Nova: "Nova";
|
|
91
|
+
readonly P2000: "P2000";
|
|
92
|
+
readonly P250: "P250";
|
|
93
|
+
readonly P90: "P90";
|
|
94
|
+
readonly PPBizon: "PP-Bizon";
|
|
95
|
+
readonly Revolver: "R8 Revolver";
|
|
96
|
+
readonly SawedOff: "Sawed-Off";
|
|
97
|
+
readonly Scar20: "SCAR-20";
|
|
98
|
+
readonly Scout: "SSG 08";
|
|
99
|
+
readonly SG553: "SG 553";
|
|
100
|
+
readonly Smoke: "Smoke Grenade";
|
|
101
|
+
readonly Tec9: "Tec-9";
|
|
102
|
+
readonly UMP45: "UMP-45";
|
|
103
|
+
readonly Unknown: "Unknown";
|
|
104
|
+
readonly USP: "USP-S";
|
|
105
|
+
readonly World: "World";
|
|
106
|
+
readonly XM1014: "XM1014";
|
|
107
|
+
readonly Zeus: "Zeus x27";
|
|
108
|
+
};
|
|
109
|
+
export type WeaponName = (typeof WeaponName)[keyof typeof WeaponName];
|
|
110
|
+
/**
|
|
111
|
+
* Values come from https://github.com/alliedmodders/sourcemod/blob/master/plugins/include/cstrike.inc#L53
|
|
112
|
+
*/
|
|
113
|
+
export declare const RoundEndReason: {
|
|
114
|
+
readonly StillInProgress: 0;
|
|
115
|
+
readonly TargetBombed: 1;
|
|
116
|
+
readonly VipEscaped: 2;
|
|
117
|
+
readonly VipKilled: 3;
|
|
118
|
+
readonly TerroristsEscaped: 4;
|
|
119
|
+
readonly CounterTerroristsStoppedEscape: 5;
|
|
120
|
+
readonly TerroristsStopped: 6;
|
|
121
|
+
readonly BombDefused: 7;
|
|
122
|
+
readonly CtWin: 8;
|
|
123
|
+
readonly TerroristWin: 9;
|
|
124
|
+
readonly Draw: 10;
|
|
125
|
+
readonly HostagesRescued: 11;
|
|
126
|
+
readonly TargetSaved: 12;
|
|
127
|
+
readonly HostagesNotRescued: 13;
|
|
128
|
+
readonly TerroristsNotEscaped: 14;
|
|
129
|
+
readonly VipNotEscaped: 15;
|
|
130
|
+
readonly GameStart: 16;
|
|
131
|
+
readonly TerroristsSurrender: 17;
|
|
132
|
+
readonly CounterTerroristsSurrender: 18;
|
|
133
|
+
readonly TerroristsPlanted: 19;
|
|
134
|
+
readonly CounterTerroristsReachedHostage: 20;
|
|
135
|
+
};
|
|
136
|
+
export type RoundEndReason = (typeof RoundEndReason)[keyof typeof RoundEndReason];
|
|
137
|
+
export declare const PlayerColor: {
|
|
138
|
+
readonly Grey: -1;
|
|
139
|
+
readonly Yellow: 0;
|
|
140
|
+
readonly Purple: 1;
|
|
141
|
+
readonly Green: 2;
|
|
142
|
+
readonly Blue: 3;
|
|
143
|
+
readonly Orange: 4;
|
|
144
|
+
};
|
|
145
|
+
export type PlayerColor = (typeof PlayerColor)[keyof typeof PlayerColor];
|
|
146
|
+
export declare const HitGroup: {
|
|
147
|
+
readonly Generic: 0;
|
|
148
|
+
readonly Head: 1;
|
|
149
|
+
readonly Chest: 2;
|
|
150
|
+
readonly Stomach: 3;
|
|
151
|
+
readonly LeftArm: 4;
|
|
152
|
+
readonly RightArm: 5;
|
|
153
|
+
readonly LeftLeg: 6;
|
|
154
|
+
readonly RightLeg: 7;
|
|
155
|
+
readonly Gear: 10;
|
|
156
|
+
};
|
|
157
|
+
export type HitGroup = (typeof HitGroup)[keyof typeof HitGroup];
|
|
158
|
+
export declare const GrenadeName: {
|
|
159
|
+
readonly Smoke: "Smoke Grenade";
|
|
160
|
+
readonly Flashbang: "Flashbang";
|
|
161
|
+
readonly HE: "HE Grenade";
|
|
162
|
+
readonly Decoy: "Decoy Grenade";
|
|
163
|
+
readonly Molotov: "Molotov";
|
|
164
|
+
readonly Incendiary: "Incendiary Grenade";
|
|
165
|
+
};
|
|
166
|
+
export type GrenadeName = (typeof GrenadeName)[keyof typeof GrenadeName];
|
|
167
|
+
export declare const EconomyType: {
|
|
168
|
+
readonly Pistol: "pistol";
|
|
169
|
+
readonly Eco: "eco";
|
|
170
|
+
readonly Semi: "semi";
|
|
171
|
+
readonly ForceBuy: "force-buy";
|
|
172
|
+
readonly Full: "full";
|
|
173
|
+
};
|
|
174
|
+
export type EconomyType = (typeof EconomyType)[keyof typeof EconomyType];
|
|
175
|
+
/**
|
|
176
|
+
* The game type and game mode are related.
|
|
177
|
+
* Depending of the game type, the game mode will have different values.
|
|
178
|
+
* Values come from the file "gamemodes.txt" located inside pak01_dir.vpk of CS2.
|
|
179
|
+
*/
|
|
180
|
+
export declare const GameType: {
|
|
181
|
+
readonly Classic: 0;
|
|
182
|
+
readonly GunGame: 1;
|
|
183
|
+
readonly Training: 2;
|
|
184
|
+
readonly Custom: 3;
|
|
185
|
+
readonly CoOperative: 4;
|
|
186
|
+
readonly Skirmish: 5;
|
|
187
|
+
readonly FFA: 6;
|
|
188
|
+
};
|
|
189
|
+
export type GameType = (typeof GameType)[keyof typeof GameType];
|
|
190
|
+
/**
|
|
191
|
+
* When game type is Classic.
|
|
192
|
+
*/
|
|
193
|
+
export declare const GameModeClassic: {
|
|
194
|
+
readonly Casual: 0;
|
|
195
|
+
readonly Competitive: 1;
|
|
196
|
+
readonly Scrimmage2V2: 2;
|
|
197
|
+
readonly Scrimmage5V5: 3;
|
|
198
|
+
};
|
|
199
|
+
export type GameModeClassic = (typeof GameModeClassic)[keyof typeof GameModeClassic];
|
|
200
|
+
/**
|
|
201
|
+
* When game type is GunGame.
|
|
202
|
+
*/
|
|
203
|
+
export declare const GameModeGunGame: {
|
|
204
|
+
readonly Progressive: 0;
|
|
205
|
+
readonly Bomb: 1;
|
|
206
|
+
readonly Deathmatch: 2;
|
|
207
|
+
};
|
|
208
|
+
export type GameModeGunGame = (typeof GameModeGunGame)[keyof typeof GameModeGunGame];
|
|
209
|
+
/**
|
|
210
|
+
* When game type is Training.
|
|
211
|
+
*/
|
|
212
|
+
export declare const GameModeTraining: {
|
|
213
|
+
readonly Training: 0;
|
|
214
|
+
};
|
|
215
|
+
export type GameModeTraining = (typeof GameModeTraining)[keyof typeof GameModeTraining];
|
|
216
|
+
/**
|
|
217
|
+
* When game type is Custom.
|
|
218
|
+
*/
|
|
219
|
+
export declare const GameModeCustom: {
|
|
220
|
+
readonly Custom: 0;
|
|
221
|
+
};
|
|
222
|
+
export type GameModeCustom = (typeof GameModeCustom)[keyof typeof GameModeCustom];
|
|
223
|
+
/**
|
|
224
|
+
* When game type is CoOperative.
|
|
225
|
+
*/
|
|
226
|
+
export declare const GameModeCoOperative: {
|
|
227
|
+
readonly CoOperative: 0;
|
|
228
|
+
readonly CoOperativeMission: 1;
|
|
229
|
+
};
|
|
230
|
+
export type GameModeCoOperative = (typeof GameModeCoOperative)[keyof typeof GameModeCoOperative];
|
|
231
|
+
/**
|
|
232
|
+
* When game type is Skirmish.
|
|
233
|
+
*/
|
|
234
|
+
export declare const GameModeSkirmish: {
|
|
235
|
+
readonly Skirmish: 0;
|
|
236
|
+
};
|
|
237
|
+
export type GameModeSkirmish = (typeof GameModeSkirmish)[keyof typeof GameModeSkirmish];
|
|
238
|
+
/**
|
|
239
|
+
* When game type is FFA.
|
|
240
|
+
*/
|
|
241
|
+
export declare const GameModeSurvival: {
|
|
242
|
+
readonly Survival: 0;
|
|
243
|
+
};
|
|
244
|
+
export type GameModeSurvival = (typeof GameModeSurvival)[keyof typeof GameModeSurvival];
|
|
245
|
+
export declare const HostageState: {
|
|
246
|
+
readonly Idle: 0;
|
|
247
|
+
readonly BeingUntied: 1;
|
|
248
|
+
readonly GettingPickedUp: 2;
|
|
249
|
+
readonly BeingCarried: 3;
|
|
250
|
+
readonly FollowingPlayer: 4;
|
|
251
|
+
readonly GettingDropped: 5;
|
|
252
|
+
readonly Rescued: 6;
|
|
253
|
+
readonly Dead: 7;
|
|
254
|
+
};
|
|
255
|
+
export type HostageState = (typeof HostageState)[keyof typeof HostageState];
|
|
256
|
+
export declare const CsgoRankType: {
|
|
257
|
+
readonly Unknown: -1;
|
|
258
|
+
readonly None: 0;
|
|
259
|
+
readonly ClassicCompetitive: 6;
|
|
260
|
+
readonly Wingman2v2: 7;
|
|
261
|
+
readonly DangerZone: 10;
|
|
262
|
+
};
|
|
263
|
+
export type CsgoRankType = (typeof CsgoRankType)[keyof typeof CsgoRankType];
|
|
264
|
+
export declare const Cs2RankType: {
|
|
265
|
+
readonly Unknown: -1;
|
|
266
|
+
readonly None: 0;
|
|
267
|
+
readonly Wingman2v2: 7;
|
|
268
|
+
readonly PremierMode: 11;
|
|
269
|
+
readonly ClassicCompetitive: 12;
|
|
270
|
+
};
|
|
271
|
+
export type Cs2RankType = (typeof Cs2RankType)[keyof typeof Cs2RankType];
|
|
272
|
+
export type RankType = CsgoRankType | Cs2RankType;
|
|
273
|
+
export declare const CompetitiveRank: {
|
|
274
|
+
readonly Unknown: 0;
|
|
275
|
+
readonly SilverI: 1;
|
|
276
|
+
readonly SilverII: 2;
|
|
277
|
+
readonly SilverIII: 3;
|
|
278
|
+
readonly SilverIV: 4;
|
|
279
|
+
readonly SilverElite: 5;
|
|
280
|
+
readonly SilverEliteMaster: 6;
|
|
281
|
+
readonly GoldNovaI: 7;
|
|
282
|
+
readonly GoldNovaII: 8;
|
|
283
|
+
readonly GoldNovaIII: 9;
|
|
284
|
+
readonly GoldNovaMaster: 10;
|
|
285
|
+
readonly MasterGuardianI: 11;
|
|
286
|
+
readonly MasterGuardianII: 12;
|
|
287
|
+
readonly MasterGuardianElite: 13;
|
|
288
|
+
readonly DistinguishedMasterGuardian: 14;
|
|
289
|
+
readonly LegendaryEagle: 15;
|
|
290
|
+
readonly LegendaryEagleMaster: 16;
|
|
291
|
+
readonly SupremeMasterFirstClass: 17;
|
|
292
|
+
readonly GlobalElite: 18;
|
|
293
|
+
};
|
|
294
|
+
export type CompetitiveRank = (typeof CompetitiveRank)[keyof typeof CompetitiveRank];
|
|
295
|
+
export type PremierRank = number;
|
|
296
|
+
export type Rank = CompetitiveRank | PremierRank;
|
|
297
|
+
export declare const GameMode: {
|
|
298
|
+
readonly Casual: "casual";
|
|
299
|
+
readonly Premier: "premier";
|
|
300
|
+
readonly Competitive: "competitive";
|
|
301
|
+
readonly Scrimmage2V2: "scrimcomp2v2";
|
|
302
|
+
readonly Scrimmage5V5: "scrimcomp5v5";
|
|
303
|
+
};
|
|
304
|
+
export type GameMode = (typeof GameMode)[keyof typeof GameMode];
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GameMode = exports.CompetitiveRank = exports.Cs2RankType = exports.CsgoRankType = exports.HostageState = exports.GameModeSurvival = exports.GameModeSkirmish = exports.GameModeCoOperative = exports.GameModeCustom = exports.GameModeTraining = exports.GameModeGunGame = exports.GameModeClassic = exports.GameType = exports.EconomyType = exports.GrenadeName = exports.HitGroup = exports.PlayerColor = exports.RoundEndReason = exports.WeaponName = exports.WeaponType = exports.TeamLetter = exports.TeamNumber = exports.ExportFormat = exports.DemoType = exports.SupportedDemoSources = exports.DemoSource = exports.Game = void 0;
|
|
4
|
+
exports.Game = {
|
|
5
|
+
CSGO: 'CSGO',
|
|
6
|
+
CS2: 'CS2',
|
|
7
|
+
CS2LT: 'CS2 LT',
|
|
8
|
+
};
|
|
9
|
+
exports.DemoSource = {
|
|
10
|
+
Unknown: 'unknown',
|
|
11
|
+
Valve: 'valve',
|
|
12
|
+
Ebot: 'ebot',
|
|
13
|
+
Popflash: 'popflash',
|
|
14
|
+
FaceIt: 'faceit',
|
|
15
|
+
Cevo: 'cevo',
|
|
16
|
+
Esl: 'esl',
|
|
17
|
+
Esea: 'esea',
|
|
18
|
+
Esportal: 'esportal',
|
|
19
|
+
Fastcup: 'fastcup',
|
|
20
|
+
Gamersclub: 'gamersclub',
|
|
21
|
+
};
|
|
22
|
+
exports.SupportedDemoSources = [
|
|
23
|
+
exports.DemoSource.Valve,
|
|
24
|
+
exports.DemoSource.Esea,
|
|
25
|
+
exports.DemoSource.FaceIt,
|
|
26
|
+
exports.DemoSource.Ebot,
|
|
27
|
+
exports.DemoSource.Esl,
|
|
28
|
+
exports.DemoSource.Popflash,
|
|
29
|
+
];
|
|
30
|
+
exports.DemoType = {
|
|
31
|
+
POV: 'POV',
|
|
32
|
+
GOTV: 'GOTV',
|
|
33
|
+
};
|
|
34
|
+
exports.ExportFormat = {
|
|
35
|
+
CSV: 'csv',
|
|
36
|
+
JSON: 'json',
|
|
37
|
+
CSDM: 'csdm', // Special CSV export dedicated to the application CS Demo Manager
|
|
38
|
+
};
|
|
39
|
+
exports.TeamNumber = {
|
|
40
|
+
UNASSIGNED: 0,
|
|
41
|
+
SPECTATOR: 1,
|
|
42
|
+
T: 2,
|
|
43
|
+
CT: 3,
|
|
44
|
+
};
|
|
45
|
+
exports.TeamLetter = {
|
|
46
|
+
A: 'A',
|
|
47
|
+
B: 'B',
|
|
48
|
+
};
|
|
49
|
+
exports.WeaponType = {
|
|
50
|
+
Unknown: 'unknown',
|
|
51
|
+
Pistol: 'pistol',
|
|
52
|
+
SMG: 'smg',
|
|
53
|
+
Shotgun: 'shotgun',
|
|
54
|
+
Rifle: 'rifle',
|
|
55
|
+
Sniper: 'sniper',
|
|
56
|
+
MachineGun: 'machine_gun',
|
|
57
|
+
Grenade: 'grenade',
|
|
58
|
+
Equipment: 'equipment',
|
|
59
|
+
Melee: 'melee',
|
|
60
|
+
World: 'world',
|
|
61
|
+
};
|
|
62
|
+
exports.WeaponName = {
|
|
63
|
+
AK47: 'AK-47',
|
|
64
|
+
AUG: 'AUG',
|
|
65
|
+
AWP: 'AWP',
|
|
66
|
+
Bomb: 'C4',
|
|
67
|
+
CZ75: 'CZ75 Auto',
|
|
68
|
+
Decoy: 'Decoy Grenade',
|
|
69
|
+
Deagle: 'Desert Eagle',
|
|
70
|
+
DefuseKit: 'Defuse Kit',
|
|
71
|
+
DualBerettas: 'Dual Berettas',
|
|
72
|
+
Famas: 'FAMAS',
|
|
73
|
+
FiveSeven: 'Five-SeveN',
|
|
74
|
+
Flashbang: 'Flashbang',
|
|
75
|
+
G3SG1: 'G3SG1',
|
|
76
|
+
GalilAR: 'Galil AR',
|
|
77
|
+
Glock: 'Glock-18',
|
|
78
|
+
HEGrenade: 'HE Grenade',
|
|
79
|
+
Helmet: 'Kevlar + Helmet',
|
|
80
|
+
Kevlar: 'Kevlar Vest',
|
|
81
|
+
Incendiary: 'Incendiary Grenade',
|
|
82
|
+
Knife: 'Knife',
|
|
83
|
+
M249: 'M249',
|
|
84
|
+
M4A1: 'M4A1',
|
|
85
|
+
M4A4: 'M4A4',
|
|
86
|
+
Mac10: 'MAC-10',
|
|
87
|
+
MAG7: 'MAG-7',
|
|
88
|
+
Molotov: 'Molotov',
|
|
89
|
+
MP5: 'MP5-SD',
|
|
90
|
+
MP7: 'MP7',
|
|
91
|
+
MP9: 'MP9',
|
|
92
|
+
Negev: 'Negev',
|
|
93
|
+
Nova: 'Nova',
|
|
94
|
+
P2000: 'P2000',
|
|
95
|
+
P250: 'P250',
|
|
96
|
+
P90: 'P90',
|
|
97
|
+
PPBizon: 'PP-Bizon',
|
|
98
|
+
Revolver: 'R8 Revolver',
|
|
99
|
+
SawedOff: 'Sawed-Off',
|
|
100
|
+
Scar20: 'SCAR-20',
|
|
101
|
+
Scout: 'SSG 08',
|
|
102
|
+
SG553: 'SG 553',
|
|
103
|
+
Smoke: 'Smoke Grenade',
|
|
104
|
+
Tec9: 'Tec-9',
|
|
105
|
+
UMP45: 'UMP-45',
|
|
106
|
+
Unknown: 'Unknown',
|
|
107
|
+
USP: 'USP-S',
|
|
108
|
+
World: 'World',
|
|
109
|
+
XM1014: 'XM1014',
|
|
110
|
+
Zeus: 'Zeus x27',
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* Values come from https://github.com/alliedmodders/sourcemod/blob/master/plugins/include/cstrike.inc#L53
|
|
114
|
+
*/
|
|
115
|
+
exports.RoundEndReason = {
|
|
116
|
+
StillInProgress: 0 /* Round not over */,
|
|
117
|
+
TargetBombed: 1 /* Target Successfully Bombed! */,
|
|
118
|
+
VipEscaped: 2 /* The VIP has escaped! - Doesn't exist on CS:GO */,
|
|
119
|
+
VipKilled: 3 /* VIP has been assassinated! - Doesn't exist on CS:GO */,
|
|
120
|
+
TerroristsEscaped: 4 /* The terrorists have escaped! */,
|
|
121
|
+
CounterTerroristsStoppedEscape: 5 /* The CTs have prevented most of the terrorists from escaping! */,
|
|
122
|
+
TerroristsStopped: 6 /* Escaping terrorists have all been neutralized! */,
|
|
123
|
+
BombDefused: 7 /* The bomb has been defused! */,
|
|
124
|
+
CtWin: 8 /* Counter-Terrorists Win! */,
|
|
125
|
+
TerroristWin: 9 /* Terrorists Win! */,
|
|
126
|
+
Draw: 10 /* Round Draw! */,
|
|
127
|
+
HostagesRescued: 11 /* All Hostages have been rescued! */,
|
|
128
|
+
TargetSaved: 12 /* Target has been saved! */,
|
|
129
|
+
HostagesNotRescued: 13 /* Hostages have not been rescued! */,
|
|
130
|
+
TerroristsNotEscaped: 14 /* Terrorists have not escaped! */,
|
|
131
|
+
VipNotEscaped: 15 /* VIP has not escaped! - Doesn't exist on CS:GO */,
|
|
132
|
+
GameStart: 16 /* Game Commencing! */,
|
|
133
|
+
// The below only exist on CS:GO
|
|
134
|
+
TerroristsSurrender: 17 /* Terrorists Surrender */,
|
|
135
|
+
CounterTerroristsSurrender: 18 /* CTs Surrender */,
|
|
136
|
+
TerroristsPlanted: 19 /* Terrorists Planted the bomb */,
|
|
137
|
+
CounterTerroristsReachedHostage: 20 /* CTs Reached the hostage */,
|
|
138
|
+
};
|
|
139
|
+
exports.PlayerColor = {
|
|
140
|
+
Grey: -1,
|
|
141
|
+
Yellow: 0,
|
|
142
|
+
Purple: 1,
|
|
143
|
+
Green: 2,
|
|
144
|
+
Blue: 3,
|
|
145
|
+
Orange: 4,
|
|
146
|
+
};
|
|
147
|
+
exports.HitGroup = {
|
|
148
|
+
Generic: 0,
|
|
149
|
+
Head: 1,
|
|
150
|
+
Chest: 2,
|
|
151
|
+
Stomach: 3,
|
|
152
|
+
LeftArm: 4,
|
|
153
|
+
RightArm: 5,
|
|
154
|
+
LeftLeg: 6,
|
|
155
|
+
RightLeg: 7,
|
|
156
|
+
Gear: 10,
|
|
157
|
+
};
|
|
158
|
+
exports.GrenadeName = {
|
|
159
|
+
Smoke: exports.WeaponName.Smoke,
|
|
160
|
+
Flashbang: exports.WeaponName.Flashbang,
|
|
161
|
+
HE: exports.WeaponName.HEGrenade,
|
|
162
|
+
Decoy: exports.WeaponName.Decoy,
|
|
163
|
+
Molotov: exports.WeaponName.Molotov,
|
|
164
|
+
Incendiary: exports.WeaponName.Incendiary,
|
|
165
|
+
};
|
|
166
|
+
exports.EconomyType = {
|
|
167
|
+
Pistol: 'pistol',
|
|
168
|
+
Eco: 'eco',
|
|
169
|
+
Semi: 'semi',
|
|
170
|
+
ForceBuy: 'force-buy',
|
|
171
|
+
Full: 'full',
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* The game type and game mode are related.
|
|
175
|
+
* Depending of the game type, the game mode will have different values.
|
|
176
|
+
* Values come from the file "gamemodes.txt" located inside pak01_dir.vpk of CS2.
|
|
177
|
+
*/
|
|
178
|
+
exports.GameType = {
|
|
179
|
+
Classic: 0,
|
|
180
|
+
GunGame: 1,
|
|
181
|
+
Training: 2,
|
|
182
|
+
Custom: 3,
|
|
183
|
+
CoOperative: 4,
|
|
184
|
+
Skirmish: 5,
|
|
185
|
+
FFA: 6,
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* When game type is Classic.
|
|
189
|
+
*/
|
|
190
|
+
exports.GameModeClassic = {
|
|
191
|
+
Casual: 0,
|
|
192
|
+
Competitive: 1,
|
|
193
|
+
Scrimmage2V2: 2,
|
|
194
|
+
Scrimmage5V5: 3,
|
|
195
|
+
};
|
|
196
|
+
/**
|
|
197
|
+
* When game type is GunGame.
|
|
198
|
+
*/
|
|
199
|
+
exports.GameModeGunGame = {
|
|
200
|
+
Progressive: 0,
|
|
201
|
+
Bomb: 1,
|
|
202
|
+
Deathmatch: 2,
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* When game type is Training.
|
|
206
|
+
*/
|
|
207
|
+
exports.GameModeTraining = {
|
|
208
|
+
Training: 0,
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* When game type is Custom.
|
|
212
|
+
*/
|
|
213
|
+
exports.GameModeCustom = {
|
|
214
|
+
Custom: 0,
|
|
215
|
+
};
|
|
216
|
+
/**
|
|
217
|
+
* When game type is CoOperative.
|
|
218
|
+
*/
|
|
219
|
+
exports.GameModeCoOperative = {
|
|
220
|
+
CoOperative: 0,
|
|
221
|
+
CoOperativeMission: 1,
|
|
222
|
+
};
|
|
223
|
+
/**
|
|
224
|
+
* When game type is Skirmish.
|
|
225
|
+
*/
|
|
226
|
+
exports.GameModeSkirmish = {
|
|
227
|
+
Skirmish: 0,
|
|
228
|
+
};
|
|
229
|
+
/**
|
|
230
|
+
* When game type is FFA.
|
|
231
|
+
*/
|
|
232
|
+
exports.GameModeSurvival = {
|
|
233
|
+
Survival: 0,
|
|
234
|
+
};
|
|
235
|
+
exports.HostageState = {
|
|
236
|
+
Idle: 0,
|
|
237
|
+
BeingUntied: 1,
|
|
238
|
+
GettingPickedUp: 2,
|
|
239
|
+
BeingCarried: 3,
|
|
240
|
+
FollowingPlayer: 4,
|
|
241
|
+
GettingDropped: 5,
|
|
242
|
+
Rescued: 6,
|
|
243
|
+
Dead: 7,
|
|
244
|
+
};
|
|
245
|
+
exports.CsgoRankType = {
|
|
246
|
+
Unknown: -1,
|
|
247
|
+
None: 0,
|
|
248
|
+
ClassicCompetitive: 6,
|
|
249
|
+
Wingman2v2: 7,
|
|
250
|
+
DangerZone: 10,
|
|
251
|
+
};
|
|
252
|
+
exports.Cs2RankType = {
|
|
253
|
+
Unknown: -1,
|
|
254
|
+
None: 0,
|
|
255
|
+
Wingman2v2: 7,
|
|
256
|
+
PremierMode: 11,
|
|
257
|
+
ClassicCompetitive: 12,
|
|
258
|
+
};
|
|
259
|
+
exports.CompetitiveRank = {
|
|
260
|
+
Unknown: 0,
|
|
261
|
+
SilverI: 1,
|
|
262
|
+
SilverII: 2,
|
|
263
|
+
SilverIII: 3,
|
|
264
|
+
SilverIV: 4,
|
|
265
|
+
SilverElite: 5,
|
|
266
|
+
SilverEliteMaster: 6,
|
|
267
|
+
GoldNovaI: 7,
|
|
268
|
+
GoldNovaII: 8,
|
|
269
|
+
GoldNovaIII: 9,
|
|
270
|
+
GoldNovaMaster: 10,
|
|
271
|
+
MasterGuardianI: 11,
|
|
272
|
+
MasterGuardianII: 12,
|
|
273
|
+
MasterGuardianElite: 13,
|
|
274
|
+
DistinguishedMasterGuardian: 14,
|
|
275
|
+
LegendaryEagle: 15,
|
|
276
|
+
LegendaryEagleMaster: 16,
|
|
277
|
+
SupremeMasterFirstClass: 17,
|
|
278
|
+
GlobalElite: 18,
|
|
279
|
+
};
|
|
280
|
+
// Game mode as a string reported in CSVCMsg_ServerInfo messages.
|
|
281
|
+
exports.GameMode = {
|
|
282
|
+
Casual: 'casual',
|
|
283
|
+
Premier: 'premier',
|
|
284
|
+
Competitive: 'competitive',
|
|
285
|
+
Scrimmage2V2: 'scrimcomp2v2',
|
|
286
|
+
Scrimmage5V5: 'scrimcomp5v5',
|
|
287
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DemoSource, ExportFormat } from './constants';
|
|
2
|
+
export type Options = {
|
|
3
|
+
demoPath: string;
|
|
4
|
+
outputFolderPath: string;
|
|
5
|
+
format: ExportFormat;
|
|
6
|
+
source?: DemoSource;
|
|
7
|
+
analyzePositions?: boolean;
|
|
8
|
+
minify?: boolean;
|
|
9
|
+
onStart?: (command: string) => void;
|
|
10
|
+
onStdout?: (data: string) => void;
|
|
11
|
+
onStderr?: (data: string) => void;
|
|
12
|
+
onEnd?: (exitCode: number) => void;
|
|
13
|
+
executablePath?: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function analyzeDemo({ demoPath, outputFolderPath, format, source, analyzePositions, minify, onStart, onStdout, onStderr, onEnd, executablePath, }: Options): Promise<void>;
|
|
16
|
+
export * from './constants';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.analyzeDemo = void 0;
|
|
21
|
+
const node_child_process_1 = require("node:child_process");
|
|
22
|
+
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
23
|
+
const platform_1 = require("./platform");
|
|
24
|
+
async function analyzeDemo({ demoPath, outputFolderPath, format, source, analyzePositions, minify, onStart, onStdout, onStderr, onEnd, executablePath, }) {
|
|
25
|
+
await promises_1.default.mkdir(outputFolderPath, { recursive: true });
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
const binPath = executablePath ?? (0, platform_1.getBinaryPath)();
|
|
28
|
+
const args = [
|
|
29
|
+
`"${binPath}"`,
|
|
30
|
+
`-demo-path="${demoPath}"`,
|
|
31
|
+
`-output="${outputFolderPath}"`,
|
|
32
|
+
`-format="${format}"`,
|
|
33
|
+
];
|
|
34
|
+
if (source) {
|
|
35
|
+
args.push(`-source="${source}"`);
|
|
36
|
+
}
|
|
37
|
+
if (analyzePositions) {
|
|
38
|
+
args.push(`-positions="${analyzePositions}"`);
|
|
39
|
+
}
|
|
40
|
+
if (minify) {
|
|
41
|
+
args.push('-minify');
|
|
42
|
+
}
|
|
43
|
+
const command = args.join(' ');
|
|
44
|
+
if (onStart) {
|
|
45
|
+
onStart(command);
|
|
46
|
+
}
|
|
47
|
+
const child = (0, node_child_process_1.exec)(command, { windowsHide: true, maxBuffer: undefined });
|
|
48
|
+
if (onStdout) {
|
|
49
|
+
child.stdout?.on('data', (data) => {
|
|
50
|
+
onStdout(data);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (onStderr) {
|
|
54
|
+
child.stderr?.on('data', (data) => {
|
|
55
|
+
onStderr(data);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
child.on('exit', (code) => {
|
|
59
|
+
if (onEnd) {
|
|
60
|
+
onEnd(code);
|
|
61
|
+
}
|
|
62
|
+
if (code === 0) {
|
|
63
|
+
resolve();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
reject();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
exports.analyzeDemo = analyzeDemo;
|
|
72
|
+
__exportStar(require("./constants"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getBinaryPath(): string;
|
package/dist/platform.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getBinaryPath = void 0;
|
|
7
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
8
|
+
function getBinarySubpath() {
|
|
9
|
+
const supportedPlatforms = {
|
|
10
|
+
'darwin-x64': 'bin/darwin-x64/csda',
|
|
11
|
+
'darwin-arm64': 'bin/darwin-arm64/csda',
|
|
12
|
+
'linux-x64': 'bin/linux-x64/csda',
|
|
13
|
+
'linux-arm64': 'bin/linux-arm64/csda',
|
|
14
|
+
'win32-x64': 'bin/windows-x64/csda.exe',
|
|
15
|
+
};
|
|
16
|
+
const platformKey = `${process.platform}-${process.arch}`;
|
|
17
|
+
if (!supportedPlatforms[platformKey]) {
|
|
18
|
+
throw new Error(`Unsupported platform: ${platformKey}`);
|
|
19
|
+
}
|
|
20
|
+
return supportedPlatforms[platformKey];
|
|
21
|
+
}
|
|
22
|
+
function getBinaryPath() {
|
|
23
|
+
return node_path_1.default.join(__dirname, getBinarySubpath());
|
|
24
|
+
}
|
|
25
|
+
exports.getBinaryPath = getBinaryPath;
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@akiver/cs-demo-analyzer",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Analyze and extract data from Counter-Strike demos.",
|
|
5
|
+
"repository": "https://github.com/akiver/cs-demo-analyzer",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"csda": "./dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc && tsc --emitDeclarationOnly --declaration --removeComments false",
|
|
12
|
+
"format": "prettier --write src/*.ts"
|
|
13
|
+
},
|
|
14
|
+
"author": "AkiVer",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"os": [
|
|
20
|
+
"darwin",
|
|
21
|
+
"linux",
|
|
22
|
+
"win32"
|
|
23
|
+
],
|
|
24
|
+
"cpu": [
|
|
25
|
+
"x64",
|
|
26
|
+
"arm64"
|
|
27
|
+
],
|
|
28
|
+
"keywords": [
|
|
29
|
+
"Counter-Strike",
|
|
30
|
+
"CS",
|
|
31
|
+
"CSGO",
|
|
32
|
+
"CS2",
|
|
33
|
+
"demos",
|
|
34
|
+
"replays"
|
|
35
|
+
],
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "20.10.2",
|
|
38
|
+
"prettier": "3.1.0",
|
|
39
|
+
"typescript": "5.3.2"
|
|
40
|
+
}
|
|
41
|
+
}
|