@cs2dak/contract 0.2.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/LICENSE +21 -0
- package/README.md +7 -0
- package/package.json +20 -0
- package/src/index.ts +599 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Starfie1d
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cs2dak/contract",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@rivalhub/rival-rating": "github:Starfie1d1272/rival-rating#5d862eb",
|
|
11
|
+
"cs2-demo-format": "^2.2.0",
|
|
12
|
+
"zod": "^3.25.0"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src"
|
|
16
|
+
],
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AccountSignalsV2,
|
|
3
|
+
RRIndicators,
|
|
4
|
+
RRResult,
|
|
5
|
+
RRResultV2,
|
|
6
|
+
PrismResult,
|
|
7
|
+
ValueAccountsWeights
|
|
8
|
+
} from "@rivalhub/rival-rating";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import {
|
|
11
|
+
blindRowSchema,
|
|
12
|
+
blindsSchema,
|
|
13
|
+
bombRowSchema,
|
|
14
|
+
bombsSchema,
|
|
15
|
+
clutchRowSchema,
|
|
16
|
+
clutchesSchema,
|
|
17
|
+
damageRowSchema,
|
|
18
|
+
damagesSchema,
|
|
19
|
+
economyTypeSchema,
|
|
20
|
+
grenadeRowSchema,
|
|
21
|
+
grenadesSchema,
|
|
22
|
+
killRowSchema,
|
|
23
|
+
killsSchema,
|
|
24
|
+
manifestSchema,
|
|
25
|
+
matchSchema,
|
|
26
|
+
playerEconomiesSchema,
|
|
27
|
+
playerEconomyRowSchema,
|
|
28
|
+
playerRowSchema,
|
|
29
|
+
playersSchema,
|
|
30
|
+
playerStatsRowSchema,
|
|
31
|
+
playerStatsSchema,
|
|
32
|
+
positionRowSchema,
|
|
33
|
+
positionsSchema,
|
|
34
|
+
replaySchema,
|
|
35
|
+
replayPlayerTrackSchema,
|
|
36
|
+
replayRoundSchema,
|
|
37
|
+
roundRowSchema,
|
|
38
|
+
roundsSchema,
|
|
39
|
+
shotRowSchema,
|
|
40
|
+
grenadeTypeSchema,
|
|
41
|
+
shotsSchema,
|
|
42
|
+
sideSchema,
|
|
43
|
+
teamEconomySchema,
|
|
44
|
+
teamKeySchema,
|
|
45
|
+
vec3Schema
|
|
46
|
+
} from "cs2-demo-format";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
SCHEMAS_BY_KEY,
|
|
50
|
+
blindRowSchema,
|
|
51
|
+
blindsSchema,
|
|
52
|
+
bombEventTypeSchema,
|
|
53
|
+
bombRowSchema,
|
|
54
|
+
bombsSchema,
|
|
55
|
+
clutchRowSchema,
|
|
56
|
+
clutchesSchema,
|
|
57
|
+
damageRowSchema,
|
|
58
|
+
damagesSchema,
|
|
59
|
+
economyTypeSchema,
|
|
60
|
+
endReasonSchema,
|
|
61
|
+
grenadeRowSchema,
|
|
62
|
+
grenadeTypeSchema,
|
|
63
|
+
grenadesSchema,
|
|
64
|
+
hitgroupSchema,
|
|
65
|
+
killRowSchema,
|
|
66
|
+
killsSchema,
|
|
67
|
+
manifestSchema,
|
|
68
|
+
matchSchema,
|
|
69
|
+
playerEconomiesSchema,
|
|
70
|
+
playerEconomyRowSchema,
|
|
71
|
+
playerRowSchema,
|
|
72
|
+
playersSchema,
|
|
73
|
+
playerStatsRowSchema,
|
|
74
|
+
playerStatsSchema,
|
|
75
|
+
positionRowSchema,
|
|
76
|
+
positionsSchema,
|
|
77
|
+
replaySchema,
|
|
78
|
+
replayPlayerTrackSchema,
|
|
79
|
+
replayRoundSchema,
|
|
80
|
+
roundRowSchema,
|
|
81
|
+
roundsSchema,
|
|
82
|
+
shotRowSchema,
|
|
83
|
+
shotsSchema,
|
|
84
|
+
sideSchema,
|
|
85
|
+
steamId64Schema,
|
|
86
|
+
teamEconomySchema,
|
|
87
|
+
teamEconomyTypeSchema,
|
|
88
|
+
teamKeySchema,
|
|
89
|
+
teamSummarySchema,
|
|
90
|
+
vec3Schema
|
|
91
|
+
} from "cs2-demo-format";
|
|
92
|
+
|
|
93
|
+
export const demoPackageSchema = z.object({
|
|
94
|
+
manifest: manifestSchema,
|
|
95
|
+
match: matchSchema,
|
|
96
|
+
players: playersSchema,
|
|
97
|
+
rounds: roundsSchema,
|
|
98
|
+
playerEconomies: playerEconomiesSchema.default([]),
|
|
99
|
+
playerStats: playerStatsSchema.default([]),
|
|
100
|
+
kills: killsSchema.default([]),
|
|
101
|
+
damages: damagesSchema.default([]),
|
|
102
|
+
blinds: blindsSchema.default([]),
|
|
103
|
+
bombs: bombsSchema.default([]),
|
|
104
|
+
grenades: grenadesSchema.default([]),
|
|
105
|
+
clutches: clutchesSchema.default([]),
|
|
106
|
+
shots: shotsSchema.optional(),
|
|
107
|
+
positions1s: positionsSchema.optional(),
|
|
108
|
+
replay: replaySchema.optional(),
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
export const qaIssueSchema = z.object({
|
|
112
|
+
severity: z.enum(["info", "warning", "error"]),
|
|
113
|
+
code: z.string().min(1),
|
|
114
|
+
message: z.string().min(1),
|
|
115
|
+
path: z.string().optional()
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export const qaReportSchema = z.object({
|
|
119
|
+
ok: z.boolean(),
|
|
120
|
+
summary: z.object({
|
|
121
|
+
issueCount: z.number().int().nonnegative(),
|
|
122
|
+
errorCount: z.number().int().nonnegative(),
|
|
123
|
+
warningCount: z.number().int().nonnegative()
|
|
124
|
+
}),
|
|
125
|
+
issues: z.array(qaIssueSchema)
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const clutchSplitSchema = z.object({
|
|
129
|
+
count: z.number().int().nonnegative(),
|
|
130
|
+
won: z.number().int().nonnegative()
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
export const rrIndicatorsSchema: z.ZodType<RRIndicators> = z.object({
|
|
134
|
+
steamId64: z.string(),
|
|
135
|
+
totalRounds: z.number().int().nonnegative(),
|
|
136
|
+
kills: z.number().int().nonnegative(),
|
|
137
|
+
deaths: z.number().int().nonnegative(),
|
|
138
|
+
assists: z.number().int().nonnegative(),
|
|
139
|
+
kpr: z.number().nonnegative(),
|
|
140
|
+
dpr: z.number().nonnegative(),
|
|
141
|
+
apr: z.number().nonnegative(),
|
|
142
|
+
adr: z.number().nonnegative(),
|
|
143
|
+
hsPercent: z.number().min(0).max(100),
|
|
144
|
+
kast: z.number().min(0).max(100),
|
|
145
|
+
survivalRate: z.number().min(0).max(1),
|
|
146
|
+
twoKillRounds: z.number().int().nonnegative(),
|
|
147
|
+
threeKillRounds: z.number().int().nonnegative(),
|
|
148
|
+
fourKillRounds: z.number().int().nonnegative(),
|
|
149
|
+
fiveKillRounds: z.number().int().nonnegative(),
|
|
150
|
+
multiKillRate: z.number().min(0).max(1),
|
|
151
|
+
firstKillCount: z.number().int().nonnegative(),
|
|
152
|
+
firstDeathCount: z.number().int().nonnegative(),
|
|
153
|
+
firstKillRate: z.number().nonnegative(),
|
|
154
|
+
firstDeathRate: z.number().nonnegative(),
|
|
155
|
+
openingDuelRate: z.number().nonnegative(),
|
|
156
|
+
openingDuelWinRate: z.number().min(0).max(1),
|
|
157
|
+
tradeKillCount: z.number().int().nonnegative(),
|
|
158
|
+
tradeDeathCount: z.number().int().nonnegative(),
|
|
159
|
+
tradeKillRate: z.number().nonnegative(),
|
|
160
|
+
tradeDeathRate: z.number().nonnegative(),
|
|
161
|
+
clutchAttempts: z.number().int().nonnegative(),
|
|
162
|
+
clutchWins: z.number().int().nonnegative(),
|
|
163
|
+
clutchWinRate: z.number().min(0).max(1),
|
|
164
|
+
clutchFrequency: z.number().nonnegative(),
|
|
165
|
+
clutchScore: z.number().nonnegative(),
|
|
166
|
+
clutchScoreRate: z.number().nonnegative(),
|
|
167
|
+
vsOne: clutchSplitSchema,
|
|
168
|
+
vsTwo: clutchSplitSchema,
|
|
169
|
+
vsThree: clutchSplitSchema,
|
|
170
|
+
vsFour: clutchSplitSchema,
|
|
171
|
+
vsFive: clutchSplitSchema,
|
|
172
|
+
awpKills: z.number().int().nonnegative(),
|
|
173
|
+
awpKillsPerRound: z.number().nonnegative(),
|
|
174
|
+
awpKillRate: z.number().min(0).max(1),
|
|
175
|
+
sniperKills: z.number().int().nonnegative(),
|
|
176
|
+
sniperKillRate: z.number().min(0).max(1),
|
|
177
|
+
awpMultiKillRate: z.number().min(0).max(1).nullable(),
|
|
178
|
+
awpDuelWinRate: z.number().min(0).max(1).nullable(),
|
|
179
|
+
utilityDamage: z.number().int().nonnegative(),
|
|
180
|
+
utilityDamagePerRound: z.number().nonnegative(),
|
|
181
|
+
flashAssistCount: z.number().int().nonnegative(),
|
|
182
|
+
flashAssistPerRound: z.number().nonnegative(),
|
|
183
|
+
blindDurationTotal: z.number().nonnegative(),
|
|
184
|
+
blindDurationPerRound: z.number().nonnegative(),
|
|
185
|
+
enemyFlashDurationSeconds: z.number().nonnegative().nullable(),
|
|
186
|
+
enemyFlashDurationPerRound: z.number().nonnegative().nullable(),
|
|
187
|
+
teamFlashDurationSeconds: z.number().nonnegative().nullable(),
|
|
188
|
+
teamFlashDurationPerRound: z.number().nonnegative().nullable(),
|
|
189
|
+
grenadeCount: z.number().int().nonnegative(),
|
|
190
|
+
grenadeCountPerRound: z.number().nonnegative(),
|
|
191
|
+
ecoRoundCount: z.number().int().nonnegative(),
|
|
192
|
+
forceRoundCount: z.number().int().nonnegative(),
|
|
193
|
+
fullBuyRoundCount: z.number().int().nonnegative(),
|
|
194
|
+
pistolRoundCount: z.number().int().nonnegative(),
|
|
195
|
+
avgEquipmentValue: z.number().nonnegative(),
|
|
196
|
+
combatDeathCount: z.number().int().nonnegative().nullable(),
|
|
197
|
+
bombDeathCount: z.number().int().nonnegative().nullable(),
|
|
198
|
+
wallbangKillCount: z.number().int().nonnegative().nullable(),
|
|
199
|
+
roundSwingTotal: z.number().nullable(),
|
|
200
|
+
roundSwingPerKill: z.number().nullable()
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
export const playerRoundFactSchema = z.object({
|
|
204
|
+
roundNumber: z.number().int().positive(),
|
|
205
|
+
steamId64: z.string(),
|
|
206
|
+
name: z.string(),
|
|
207
|
+
teamKey: teamKeySchema,
|
|
208
|
+
side: sideSchema,
|
|
209
|
+
survived: z.boolean(),
|
|
210
|
+
kills: z.number().int().nonnegative(),
|
|
211
|
+
deaths: z.number().int().nonnegative(),
|
|
212
|
+
assists: z.number().int().nonnegative(),
|
|
213
|
+
damage: z.number().int().nonnegative(),
|
|
214
|
+
utilityDamage: z.number().int().nonnegative(),
|
|
215
|
+
flashAssists: z.number().int().nonnegative(),
|
|
216
|
+
tradeKills: z.number().int().nonnegative(),
|
|
217
|
+
tradedDeaths: z.number().int().nonnegative(),
|
|
218
|
+
openingDuel: z.enum(["none", "won", "lost"]),
|
|
219
|
+
kastTags: z.array(z.enum(["kill", "assist", "survive", "trade"])),
|
|
220
|
+
equipmentValue: z.number().int().nonnegative().nullable(),
|
|
221
|
+
economyType: economyTypeSchema.nullable()
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
export const playerIndicatorRowSchema = z.object({
|
|
225
|
+
steamId64: z.string(),
|
|
226
|
+
name: z.string(),
|
|
227
|
+
teamKey: teamKeySchema,
|
|
228
|
+
indicators: rrIndicatorsSchema,
|
|
229
|
+
rr: z.custom<RRResult>(),
|
|
230
|
+
rrPercentile: z.number().min(0).max(100),
|
|
231
|
+
prism: z.custom<PrismResult>().nullable()
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
export const playerScoreboardRowSchema = z.object({
|
|
235
|
+
steamId64: z.string(),
|
|
236
|
+
name: z.string(),
|
|
237
|
+
teamKey: teamKeySchema,
|
|
238
|
+
kills: z.number().int().nonnegative(),
|
|
239
|
+
deaths: z.number().int().nonnegative(),
|
|
240
|
+
assists: z.number().int().nonnegative(),
|
|
241
|
+
adr: z.number().nonnegative(),
|
|
242
|
+
kast: z.number().min(0).max(100),
|
|
243
|
+
headshotPercent: z.number().min(0).max(100),
|
|
244
|
+
entryKills: z.number().int().nonnegative(),
|
|
245
|
+
tradeKills: z.number().int().nonnegative(),
|
|
246
|
+
awpKills: z.number().int().nonnegative(),
|
|
247
|
+
utilityDamage: z.number().int().nonnegative(),
|
|
248
|
+
combatDeathCount: z.number().int().nonnegative().nullable(),
|
|
249
|
+
bombDeathCount: z.number().int().nonnegative().nullable(),
|
|
250
|
+
wallbangKillCount: z.number().int().nonnegative().nullable(),
|
|
251
|
+
noScopeKillCount: z.number().int().nonnegative().nullable(),
|
|
252
|
+
throughSmokeKillCount: z.number().int().nonnegative().nullable(),
|
|
253
|
+
collateralKillCount: z.number().int().nonnegative().nullable(),
|
|
254
|
+
bombPlantCount: z.number().int().nonnegative().nullable(),
|
|
255
|
+
bombDefuseCount: z.number().int().nonnegative().nullable(),
|
|
256
|
+
confidence: z.number().min(0).max(1),
|
|
257
|
+
fieldAvailability: z.object({
|
|
258
|
+
playerStats: z.enum(["available", "missing"]),
|
|
259
|
+
economy: z.enum(["available", "missing"]),
|
|
260
|
+
rounds: z.enum(["available", "missing"]),
|
|
261
|
+
richKills: z.enum(["available", "partial", "missing"]),
|
|
262
|
+
damages: z.enum(["available", "missing"]),
|
|
263
|
+
bombs: z.enum(["available", "missing"])
|
|
264
|
+
}),
|
|
265
|
+
ratingSeed: z.number().nonnegative(),
|
|
266
|
+
rr: z.number().nonnegative(),
|
|
267
|
+
rrPercentile: z.number().min(0).max(100),
|
|
268
|
+
/** RR v2 账户分。锚定后:1.00 = 本场联赛均值(per-match league mean)。 */
|
|
269
|
+
accountRR: z.number().nonnegative(),
|
|
270
|
+
/** 锚定/clamp 前的原始账户分(调试用)。 */
|
|
271
|
+
accountRRRaw: z.number(),
|
|
272
|
+
/** Combat 击杀项的 context 乘子(1.0 = context 未生效 / 已降级)。 */
|
|
273
|
+
accountCombatContextFactor: z.number(),
|
|
274
|
+
/** 五账户对 RR 的加权贡献(解释面板用;和为 accountRRRaw − intercept)。 */
|
|
275
|
+
accountBreakdown: z.object({
|
|
276
|
+
combat: z.number(),
|
|
277
|
+
trade: z.number(),
|
|
278
|
+
clutch: z.number(),
|
|
279
|
+
objective: z.number(),
|
|
280
|
+
utility: z.number()
|
|
281
|
+
}),
|
|
282
|
+
/**
|
|
283
|
+
* Combat context 分桶的可用性。
|
|
284
|
+
* "available" = 采集到数据源(即使无相关样本,分桶为 0 也算 available);
|
|
285
|
+
* "missing" = 数据源缺失(parser 未产出),乘子已降级为 1.0,前端应显示"未启用"。
|
|
286
|
+
*/
|
|
287
|
+
accountContextStatus: z.object({
|
|
288
|
+
buyDelta: z.enum(["available", "missing"]),
|
|
289
|
+
manState: z.enum(["available", "missing"])
|
|
290
|
+
})
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
export const accountContextAvailabilitySchema = z.enum(["available", "partial", "missing"]);
|
|
294
|
+
|
|
295
|
+
export const seasonPlayerRowSchema = z.object({
|
|
296
|
+
playerKey: z.string(),
|
|
297
|
+
steamIds: z.array(z.string()),
|
|
298
|
+
primarySteamId64: z.string(),
|
|
299
|
+
externalUserId: z.string().nullable(),
|
|
300
|
+
name: z.string(),
|
|
301
|
+
teamKeys: z.array(teamKeySchema),
|
|
302
|
+
mapCount: z.number().int().positive(),
|
|
303
|
+
rrV1: z.number().nonnegative(),
|
|
304
|
+
rrV1Percentile: z.number().min(0).max(100),
|
|
305
|
+
indicators: rrIndicatorsSchema,
|
|
306
|
+
accountRR: z.number().nonnegative(),
|
|
307
|
+
accountRRRaw: z.number(),
|
|
308
|
+
accountBreakdown: z.object({
|
|
309
|
+
combat: z.number(),
|
|
310
|
+
trade: z.number(),
|
|
311
|
+
clutch: z.number(),
|
|
312
|
+
objective: z.number(),
|
|
313
|
+
utility: z.number()
|
|
314
|
+
}),
|
|
315
|
+
accountContextStatus: z.object({
|
|
316
|
+
buyDelta: accountContextAvailabilitySchema,
|
|
317
|
+
manState: accountContextAvailabilitySchema
|
|
318
|
+
}),
|
|
319
|
+
prism: z.custom<PrismResult>().nullable(),
|
|
320
|
+
confidence: z.number().min(0).max(1),
|
|
321
|
+
perMatch: z.array(z.object({
|
|
322
|
+
matchId: z.string(),
|
|
323
|
+
steamId64: z.string(),
|
|
324
|
+
accountRR: z.number().nonnegative(),
|
|
325
|
+
rrV1: z.number().nonnegative()
|
|
326
|
+
}))
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
export const seasonCohortBundleSchema = z.object({
|
|
330
|
+
version: z.literal("cs2-demo-analysis-kit/season-0.1"),
|
|
331
|
+
matchCount: z.number().int().nonnegative(),
|
|
332
|
+
players: z.array(seasonPlayerRowSchema),
|
|
333
|
+
weightsVersion: z.string()
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
export const timelineEventSchema = z.object({
|
|
337
|
+
id: z.string(),
|
|
338
|
+
roundNumber: z.number().int().positive(),
|
|
339
|
+
tick: z.number().int().positive(),
|
|
340
|
+
timeSeconds: z.number().nonnegative(),
|
|
341
|
+
clockPhase: z.enum(["freeze", "round", "bomb", "round-end"]),
|
|
342
|
+
clockSeconds: z.number().nonnegative(),
|
|
343
|
+
clockLabel: z.string(),
|
|
344
|
+
type: z.enum(["kill", "bomb", "grenade", "round-end"]),
|
|
345
|
+
label: z.string(),
|
|
346
|
+
teamKey: teamKeySchema.nullable()
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
export const economyPointSchema = z.object({
|
|
350
|
+
roundNumber: z.number().int().positive(),
|
|
351
|
+
teamA: z.number().int().nonnegative(),
|
|
352
|
+
teamB: z.number().int().nonnegative(),
|
|
353
|
+
advantage: z.number().int(),
|
|
354
|
+
teamAEconomy: teamEconomySchema,
|
|
355
|
+
teamBEconomy: teamEconomySchema,
|
|
356
|
+
winnerTeamKey: teamKeySchema
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
export const heatmapPointSchema = z.object({
|
|
360
|
+
x: z.number(),
|
|
361
|
+
y: z.number(),
|
|
362
|
+
z: z.number(),
|
|
363
|
+
roundNumber: z.number().int().positive(),
|
|
364
|
+
teamKey: teamKeySchema.nullable(),
|
|
365
|
+
steamId64: z.string().nullable(),
|
|
366
|
+
side: sideSchema.nullable(),
|
|
367
|
+
kind: z.enum(["kill", "death", "grenade"]),
|
|
368
|
+
grenadeType: grenadeTypeSchema.nullable()
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
export const mapViewSchema = z.object({
|
|
372
|
+
name: z.string(),
|
|
373
|
+
radarImageUrl: z.string().nullable(),
|
|
374
|
+
calibrated: z.boolean()
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
export const analysisBundleSchema = z.object({
|
|
378
|
+
version: z.literal("cs2-demo-analysis-kit/0.2"),
|
|
379
|
+
sourceSchemaVersion: z.literal("cs2-demo-format/2.0"),
|
|
380
|
+
mapName: z.string(),
|
|
381
|
+
tickrate: z.number().int().positive(),
|
|
382
|
+
teams: z.object({
|
|
383
|
+
teamA: z.object({ name: z.string(), score: z.number().int().nonnegative() }),
|
|
384
|
+
teamB: z.object({ name: z.string(), score: z.number().int().nonnegative() })
|
|
385
|
+
}),
|
|
386
|
+
scoreboard: z.array(playerScoreboardRowSchema),
|
|
387
|
+
playerIndicators: z.array(playerIndicatorRowSchema),
|
|
388
|
+
playerRoundFacts: z.array(playerRoundFactSchema),
|
|
389
|
+
timeline: z.array(timelineEventSchema),
|
|
390
|
+
economy: z.array(economyPointSchema),
|
|
391
|
+
heatmap: z.array(heatmapPointSchema),
|
|
392
|
+
qa: qaReportSchema
|
|
393
|
+
});
|
|
394
|
+
|
|
395
|
+
export const demoViewModelSchema = z.object({
|
|
396
|
+
title: z.string(),
|
|
397
|
+
subtitle: z.string(),
|
|
398
|
+
map: mapViewSchema,
|
|
399
|
+
scoreline: z.string(),
|
|
400
|
+
teams: analysisBundleSchema.shape.teams,
|
|
401
|
+
scoreboard: z.array(playerScoreboardRowSchema),
|
|
402
|
+
playerIndicators: z.array(playerIndicatorRowSchema),
|
|
403
|
+
playerRoundFacts: z.array(playerRoundFactSchema),
|
|
404
|
+
timeline: z.array(timelineEventSchema),
|
|
405
|
+
economy: z.array(economyPointSchema),
|
|
406
|
+
heatmap: z.array(heatmapPointSchema),
|
|
407
|
+
qa: qaReportSchema
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
export const workspaceTabSchema = z.object({
|
|
411
|
+
key: z.enum(["overview", "rounds", "players", "economy", "map", "replay"]),
|
|
412
|
+
label: z.string()
|
|
413
|
+
});
|
|
414
|
+
|
|
415
|
+
export const workspaceKpiSchema = z.object({
|
|
416
|
+
key: z.string(),
|
|
417
|
+
label: z.string(),
|
|
418
|
+
value: z.string(),
|
|
419
|
+
detail: z.string()
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
export const workspaceOverviewSchema = z.object({
|
|
423
|
+
kpis: z.array(workspaceKpiSchema),
|
|
424
|
+
story: z.array(z.string())
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
export const workspaceRoundSchema = z.object({
|
|
428
|
+
roundNumber: z.number().int().positive(),
|
|
429
|
+
scoreBefore: z.string(),
|
|
430
|
+
winnerTeamKey: teamKeySchema,
|
|
431
|
+
winnerSide: sideSchema,
|
|
432
|
+
endReason: z.string(),
|
|
433
|
+
teamAEconomy: teamEconomySchema,
|
|
434
|
+
teamBEconomy: teamEconomySchema,
|
|
435
|
+
events: z.array(timelineEventSchema),
|
|
436
|
+
playerFacts: z.array(playerRoundFactSchema)
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
export const workspacePlayerSchema = z.object({
|
|
440
|
+
row: playerScoreboardRowSchema,
|
|
441
|
+
teamName: z.string(),
|
|
442
|
+
summary: z.array(z.string()),
|
|
443
|
+
rrBreakdown: z.array(z.object({
|
|
444
|
+
key: z.enum(["combat", "trade", "clutch", "objective", "utility"]),
|
|
445
|
+
label: z.string(),
|
|
446
|
+
value: z.number()
|
|
447
|
+
})),
|
|
448
|
+
roundFacts: z.array(playerRoundFactSchema)
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
export const workspaceMapModeSchema = z.object({
|
|
452
|
+
key: z.enum(["death", "kill", "grenade", "bomb", "position"]),
|
|
453
|
+
label: z.string(),
|
|
454
|
+
count: z.number().int().nonnegative()
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
export const workspaceSpatialPointSchema = z.object({
|
|
458
|
+
x: z.number(),
|
|
459
|
+
y: z.number(),
|
|
460
|
+
z: z.number(),
|
|
461
|
+
roundNumber: z.number().int().positive(),
|
|
462
|
+
teamKey: teamKeySchema.nullable(),
|
|
463
|
+
steamId64: z.string().nullable(),
|
|
464
|
+
side: sideSchema.nullable(),
|
|
465
|
+
kind: z.enum(["kill", "death", "grenade", "bomb", "position"]),
|
|
466
|
+
grenadeType: grenadeTypeSchema.nullable()
|
|
467
|
+
});
|
|
468
|
+
|
|
469
|
+
export const workspaceMapSchema = z.object({
|
|
470
|
+
view: mapViewSchema,
|
|
471
|
+
modes: z.array(workspaceMapModeSchema),
|
|
472
|
+
points: z.array(workspaceSpatialPointSchema),
|
|
473
|
+
status: z.object({
|
|
474
|
+
hasRadar: z.boolean(),
|
|
475
|
+
hasPositionData: z.boolean(),
|
|
476
|
+
message: z.string().nullable()
|
|
477
|
+
})
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
export const workspaceReplayFrameSchema = z.object({
|
|
481
|
+
tick: z.number().int().positive(),
|
|
482
|
+
x: z.number(),
|
|
483
|
+
y: z.number(),
|
|
484
|
+
z: z.number(),
|
|
485
|
+
yaw: z.number(),
|
|
486
|
+
hp: z.number().int().nonnegative().max(100),
|
|
487
|
+
weapon: z.string().nullable(),
|
|
488
|
+
alive: z.boolean(),
|
|
489
|
+
flashed: z.boolean(),
|
|
490
|
+
hasDefuseKit: z.boolean()
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
export const workspaceReplayPlayerSchema = z.object({
|
|
494
|
+
steamId64: z.string(),
|
|
495
|
+
name: z.string(),
|
|
496
|
+
teamKey: teamKeySchema,
|
|
497
|
+
side: sideSchema,
|
|
498
|
+
frames: z.array(workspaceReplayFrameSchema)
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
export const workspaceKillEventSchema = z.object({
|
|
502
|
+
id: z.string(),
|
|
503
|
+
tick: z.number().int().positive(),
|
|
504
|
+
killerName: z.string().nullable(),
|
|
505
|
+
killerTeamKey: teamKeySchema.nullable(),
|
|
506
|
+
victimName: z.string(),
|
|
507
|
+
weapon: z.string(),
|
|
508
|
+
headshot: z.boolean(),
|
|
509
|
+
throughSmoke: z.boolean(),
|
|
510
|
+
noScope: z.boolean(),
|
|
511
|
+
flashAssist: z.boolean(),
|
|
512
|
+
tradeKill: z.boolean()
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
export const workspaceReplayRoundSchema = z.object({
|
|
516
|
+
roundNumber: z.number().int().positive(),
|
|
517
|
+
startTick: z.number().int().positive(),
|
|
518
|
+
tickStep: z.number().int().positive(),
|
|
519
|
+
frameCount: z.number().int().nonnegative(),
|
|
520
|
+
players: z.array(workspaceReplayPlayerSchema),
|
|
521
|
+
kills: z.array(workspaceKillEventSchema)
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
export const workspaceReplaySchema = z.object({
|
|
525
|
+
available: z.boolean(),
|
|
526
|
+
sampleRate: z.number().int().positive().nullable(),
|
|
527
|
+
tickrate: z.number().int().positive().nullable(),
|
|
528
|
+
rounds: z.array(workspaceReplayRoundSchema),
|
|
529
|
+
capabilities: z.object({
|
|
530
|
+
hasDefuseKit: z.boolean(),
|
|
531
|
+
hasBombPosition: z.boolean()
|
|
532
|
+
})
|
|
533
|
+
});
|
|
534
|
+
|
|
535
|
+
export const matchWorkspaceModelSchema = z.object({
|
|
536
|
+
version: z.literal("cs2-demo-analysis-kit/workspace-0.1"),
|
|
537
|
+
sourceSchemaVersion: z.literal("cs2-demo-format/2.0"),
|
|
538
|
+
title: z.string(),
|
|
539
|
+
subtitle: z.string(),
|
|
540
|
+
scoreline: z.string(),
|
|
541
|
+
mapName: z.string(),
|
|
542
|
+
teams: analysisBundleSchema.shape.teams,
|
|
543
|
+
tabs: z.array(workspaceTabSchema),
|
|
544
|
+
overview: workspaceOverviewSchema,
|
|
545
|
+
scoreboard: z.array(playerScoreboardRowSchema),
|
|
546
|
+
rounds: z.array(workspaceRoundSchema),
|
|
547
|
+
players: z.array(workspacePlayerSchema),
|
|
548
|
+
economy: z.array(economyPointSchema),
|
|
549
|
+
map: workspaceMapSchema,
|
|
550
|
+
replay: workspaceReplaySchema,
|
|
551
|
+
adminQa: qaReportSchema
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
export type Side = z.infer<typeof sideSchema>;
|
|
555
|
+
export type TeamKey = z.infer<typeof teamKeySchema>;
|
|
556
|
+
export type EconomyType = z.infer<typeof economyTypeSchema>;
|
|
557
|
+
export type TeamEconomyType = z.infer<typeof teamEconomySchema>;
|
|
558
|
+
export type Vec3 = z.infer<typeof vec3Schema>;
|
|
559
|
+
export type DemoPackage = z.infer<typeof demoPackageSchema>;
|
|
560
|
+
export type PackagePlayer = z.infer<typeof playerRowSchema>;
|
|
561
|
+
export type PackageRound = z.infer<typeof roundRowSchema>;
|
|
562
|
+
export type PackageKill = z.infer<typeof killRowSchema>;
|
|
563
|
+
export type PackageDamage = z.infer<typeof damageRowSchema>;
|
|
564
|
+
export type PackagePlayerEconomy = z.infer<typeof playerEconomyRowSchema>;
|
|
565
|
+
export type PackagePlayerStats = z.infer<typeof playerStatsRowSchema>;
|
|
566
|
+
export type PackageBlind = z.infer<typeof blindRowSchema>;
|
|
567
|
+
export type PackageBomb = z.infer<typeof bombRowSchema>;
|
|
568
|
+
export type PackageGrenade = z.infer<typeof grenadeRowSchema>;
|
|
569
|
+
export type PackageClutch = z.infer<typeof clutchRowSchema>;
|
|
570
|
+
export type PackageShot = z.infer<typeof shotRowSchema>;
|
|
571
|
+
export type PackagePosition = z.infer<typeof positionRowSchema>;
|
|
572
|
+
export type QaIssue = z.infer<typeof qaIssueSchema>;
|
|
573
|
+
export type QaReport = z.infer<typeof qaReportSchema>;
|
|
574
|
+
export type PlayerRoundFact = z.infer<typeof playerRoundFactSchema>;
|
|
575
|
+
export type PlayerIndicatorRow = z.infer<typeof playerIndicatorRowSchema>;
|
|
576
|
+
export type PlayerScoreboardRow = z.infer<typeof playerScoreboardRowSchema>;
|
|
577
|
+
export type AccountContextAvailability = z.infer<typeof accountContextAvailabilitySchema>;
|
|
578
|
+
export type SeasonPlayerRow = z.infer<typeof seasonPlayerRowSchema>;
|
|
579
|
+
export type SeasonCohortBundle = z.infer<typeof seasonCohortBundleSchema>;
|
|
580
|
+
export type TimelineEvent = z.infer<typeof timelineEventSchema>;
|
|
581
|
+
export type EconomyPoint = z.infer<typeof economyPointSchema>;
|
|
582
|
+
export type GrenadeType = z.infer<typeof grenadeTypeSchema>;
|
|
583
|
+
export type HeatmapPoint = z.infer<typeof heatmapPointSchema>;
|
|
584
|
+
export type AnalysisBundle = z.infer<typeof analysisBundleSchema>;
|
|
585
|
+
export type DemoViewModel = z.infer<typeof demoViewModelSchema>;
|
|
586
|
+
export type WorkspaceTab = z.infer<typeof workspaceTabSchema>;
|
|
587
|
+
export type WorkspaceKpi = z.infer<typeof workspaceKpiSchema>;
|
|
588
|
+
export type WorkspaceRound = z.infer<typeof workspaceRoundSchema>;
|
|
589
|
+
export type WorkspacePlayer = z.infer<typeof workspacePlayerSchema>;
|
|
590
|
+
export type WorkspaceSpatialPoint = z.infer<typeof workspaceSpatialPointSchema>;
|
|
591
|
+
export type WorkspaceReplayFrame = z.infer<typeof workspaceReplayFrameSchema>;
|
|
592
|
+
export type WorkspaceReplayPlayer = z.infer<typeof workspaceReplayPlayerSchema>;
|
|
593
|
+
export type WorkspaceKillEvent = z.infer<typeof workspaceKillEventSchema>;
|
|
594
|
+
export type WorkspaceReplayRound = z.infer<typeof workspaceReplayRoundSchema>;
|
|
595
|
+
export type MatchWorkspaceModel = z.infer<typeof matchWorkspaceModelSchema>;
|
|
596
|
+
export type Replay = z.infer<typeof replaySchema>;
|
|
597
|
+
export type ReplayRound = z.infer<typeof replayRoundSchema>;
|
|
598
|
+
export type ReplayPlayerTrack = z.infer<typeof replayPlayerTrackSchema>;
|
|
599
|
+
export type { AccountSignalsV2, RRIndicators, RRResult, RRResultV2, PrismResult, ValueAccountsWeights };
|