steamworks-ffi-node 0.2.3 → 0.3.1
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/README.md +74 -14
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/SteamAPICore.d.ts +198 -8
- package/dist/internal/SteamAPICore.d.ts.map +1 -1
- package/dist/internal/SteamAPICore.js +197 -8
- package/dist/internal/SteamAPICore.js.map +1 -1
- package/dist/internal/SteamAchievementManager.d.ts +602 -31
- package/dist/internal/SteamAchievementManager.d.ts.map +1 -1
- package/dist/internal/SteamAchievementManager.js +600 -31
- package/dist/internal/SteamAchievementManager.js.map +1 -1
- package/dist/internal/SteamLibraryLoader.d.ts +12 -0
- package/dist/internal/SteamLibraryLoader.d.ts.map +1 -1
- package/dist/internal/SteamLibraryLoader.js +34 -5
- package/dist/internal/SteamLibraryLoader.js.map +1 -1
- package/dist/internal/SteamStatsManager.d.ts +460 -0
- package/dist/internal/SteamStatsManager.d.ts.map +1 -0
- package/dist/internal/SteamStatsManager.js +838 -0
- package/dist/internal/SteamStatsManager.js.map +1 -0
- package/dist/steam.d.ts +65 -0
- package/dist/steam.d.ts.map +1 -1
- package/dist/steam.js +98 -0
- package/dist/steam.js.map +1 -1
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { SteamLibraryLoader } from './SteamLibraryLoader';
|
|
2
|
+
import { SteamAPICore } from './SteamAPICore';
|
|
3
|
+
/**
|
|
4
|
+
* SteamStatsManager
|
|
5
|
+
*
|
|
6
|
+
* Manages all Steam user statistics operations including:
|
|
7
|
+
* - User stats (get/set integer and float values)
|
|
8
|
+
* - Average rate stats (for tracking rates over time)
|
|
9
|
+
* - Friend/user stats (view stats of other players)
|
|
10
|
+
* - Global stats (aggregate statistics across all players)
|
|
11
|
+
* - Global stat history (historical data over time)
|
|
12
|
+
*
|
|
13
|
+
* Stats are different from achievements - they are numeric values that can increase/decrease
|
|
14
|
+
* and are used for leaderboards, progress tracking, and game analytics.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const statsManager = new SteamStatsManager(libraryLoader, apiCore);
|
|
19
|
+
*
|
|
20
|
+
* // Set and get player stats
|
|
21
|
+
* await statsManager.setStatInt('total_kills', 100);
|
|
22
|
+
* const kills = await statsManager.getStatInt('total_kills');
|
|
23
|
+
*
|
|
24
|
+
* // Get global stats
|
|
25
|
+
* await statsManager.requestGlobalStats(7);
|
|
26
|
+
* const globalKills = await statsManager.getGlobalStatInt('total_kills');
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare class SteamStatsManager {
|
|
30
|
+
/** Steam library loader for FFI function calls */
|
|
31
|
+
private libraryLoader;
|
|
32
|
+
/** Steam API core for initialization and callback management */
|
|
33
|
+
private apiCore;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new SteamStatsManager instance
|
|
36
|
+
*
|
|
37
|
+
* @param libraryLoader - The Steam library loader for FFI calls
|
|
38
|
+
* @param apiCore - The Steam API core for lifecycle management
|
|
39
|
+
*/
|
|
40
|
+
constructor(libraryLoader: SteamLibraryLoader, apiCore: SteamAPICore);
|
|
41
|
+
/**
|
|
42
|
+
* Get an integer stat value for the current user
|
|
43
|
+
*
|
|
44
|
+
* Retrieves a 32-bit integer stat value from Steam. Stats are numeric values
|
|
45
|
+
* that track player progress and can be used for leaderboards and analytics.
|
|
46
|
+
*
|
|
47
|
+
* @param statName - Name of the stat to retrieve (as defined in Steamworks Partner site)
|
|
48
|
+
* @returns The stat value, or null if not found or on error
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const totalKills = await statsManager.getStatInt('total_kills');
|
|
53
|
+
* if (totalKills !== null) {
|
|
54
|
+
* console.log(`Total kills: ${totalKills}`);
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* @remarks
|
|
59
|
+
* - Returns null if Steam API is not initialized
|
|
60
|
+
* - Stat names are case-sensitive and must match Steamworks configuration
|
|
61
|
+
* - Use getStatFloat() for decimal values
|
|
62
|
+
*
|
|
63
|
+
* Steamworks SDK Functions:
|
|
64
|
+
* - `SteamAPI_ISteamUserStats_GetStatInt32()` - Get int32 stat value
|
|
65
|
+
*/
|
|
66
|
+
getStatInt(statName: string): Promise<number | null>;
|
|
67
|
+
/**
|
|
68
|
+
* Get a float stat value for the current user
|
|
69
|
+
*
|
|
70
|
+
* Retrieves a floating-point stat value from Steam. Use this for stats that
|
|
71
|
+
* require decimal precision (e.g., average accuracy, distance traveled).
|
|
72
|
+
*
|
|
73
|
+
* @param statName - Name of the stat to retrieve (as defined in Steamworks Partner site)
|
|
74
|
+
* @returns The stat value, or null if not found or on error
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* const accuracy = await statsManager.getStatFloat('shooting_accuracy');
|
|
79
|
+
* if (accuracy !== null) {
|
|
80
|
+
* console.log(`Accuracy: ${(accuracy * 100).toFixed(2)}%`);
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*
|
|
84
|
+
* @remarks
|
|
85
|
+
* - Returns null if Steam API is not initialized
|
|
86
|
+
* - Use getStatInt() for whole number values
|
|
87
|
+
*
|
|
88
|
+
* Steamworks SDK Functions:
|
|
89
|
+
* - `SteamAPI_ISteamUserStats_GetStatFloat()` - Get float stat value
|
|
90
|
+
*/
|
|
91
|
+
getStatFloat(statName: string): Promise<number | null>;
|
|
92
|
+
/**
|
|
93
|
+
* Set an integer stat value for the current user
|
|
94
|
+
*
|
|
95
|
+
* Updates a 32-bit integer stat value and immediately stores it to Steam servers.
|
|
96
|
+
* The new value will be visible in your Steam profile and can trigger achievements.
|
|
97
|
+
*
|
|
98
|
+
* @param statName - Name of the stat to set (as defined in Steamworks Partner site)
|
|
99
|
+
* @param value - Integer value to set
|
|
100
|
+
* @returns true if successful, false otherwise
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```typescript
|
|
104
|
+
* // Increment kill count
|
|
105
|
+
* const currentKills = await statsManager.getStatInt('total_kills') || 0;
|
|
106
|
+
* const success = await statsManager.setStatInt('total_kills', currentKills + 1);
|
|
107
|
+
* if (success) {
|
|
108
|
+
* console.log('Kill count updated!');
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*
|
|
112
|
+
* @remarks
|
|
113
|
+
* - Automatically calls StoreStats() to save to Steam servers
|
|
114
|
+
* - Runs callbacks to process the store operation
|
|
115
|
+
* - Can trigger stat-based achievements
|
|
116
|
+
* - Use setStatFloat() for decimal values
|
|
117
|
+
*
|
|
118
|
+
* Steamworks SDK Functions:
|
|
119
|
+
* - `SteamAPI_ISteamUserStats_SetStatInt32()` - Set int32 stat value
|
|
120
|
+
* - `SteamAPI_ISteamUserStats_StoreStats()` - Store stats to Steam servers
|
|
121
|
+
* - `SteamAPI_RunCallbacks()` - Process Steam callbacks
|
|
122
|
+
*/
|
|
123
|
+
setStatInt(statName: string, value: number): Promise<boolean>;
|
|
124
|
+
/**
|
|
125
|
+
* Set a float stat value for the current user
|
|
126
|
+
*
|
|
127
|
+
* Updates a floating-point stat value and immediately stores it to Steam servers.
|
|
128
|
+
* Use this for stats requiring decimal precision.
|
|
129
|
+
*
|
|
130
|
+
* @param statName - Name of the stat to set (as defined in Steamworks Partner site)
|
|
131
|
+
* @param value - Float value to set
|
|
132
|
+
* @returns true if successful, false otherwise
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```typescript
|
|
136
|
+
* // Update accuracy based on hits/shots
|
|
137
|
+
* const hits = 85;
|
|
138
|
+
* const shots = 100;
|
|
139
|
+
* const accuracy = hits / shots; // 0.85
|
|
140
|
+
* await statsManager.setStatFloat('shooting_accuracy', accuracy);
|
|
141
|
+
* ```
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* - Automatically calls StoreStats() to save to Steam servers
|
|
145
|
+
* - Runs callbacks to process the store operation
|
|
146
|
+
* - Use setStatInt() for whole number values
|
|
147
|
+
*
|
|
148
|
+
* Steamworks SDK Functions:
|
|
149
|
+
* - `SteamAPI_ISteamUserStats_SetStatFloat()` - Set float stat value
|
|
150
|
+
* - `SteamAPI_ISteamUserStats_StoreStats()` - Store stats to Steam servers
|
|
151
|
+
* - `SteamAPI_RunCallbacks()` - Process Steam callbacks
|
|
152
|
+
*/
|
|
153
|
+
setStatFloat(statName: string, value: number): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Update an average rate stat
|
|
156
|
+
*
|
|
157
|
+
* Updates stats that represent rates or averages over time (e.g., "kills per hour",
|
|
158
|
+
* "average speed"). Steam automatically maintains the average calculation.
|
|
159
|
+
*
|
|
160
|
+
* @param statName - Name of the stat to update (as defined in Steamworks Partner site)
|
|
161
|
+
* @param countThisSession - Count/value for this session (e.g., kills this session)
|
|
162
|
+
* @param sessionLength - Length of session in seconds
|
|
163
|
+
* @returns true if successful, false otherwise
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* // Update kills per hour stat
|
|
168
|
+
* const sessionKills = 25;
|
|
169
|
+
* const sessionSeconds = 1800; // 30 minutes
|
|
170
|
+
* await statsManager.updateAvgRateStat('kills_per_hour', sessionKills, sessionSeconds);
|
|
171
|
+
* // Steam calculates: (25 / 1800) * 3600 = 50 kills/hour
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @remarks
|
|
175
|
+
* - Automatically calls StoreStats() to save to Steam servers
|
|
176
|
+
* - Steam maintains the running average across all sessions
|
|
177
|
+
* - sessionLength should be in seconds
|
|
178
|
+
* - Used for "per hour" or "per game" statistics
|
|
179
|
+
*
|
|
180
|
+
* Steamworks SDK Functions:
|
|
181
|
+
* - `SteamAPI_ISteamUserStats_UpdateAvgRateStat()` - Update average rate stat
|
|
182
|
+
* - `SteamAPI_ISteamUserStats_StoreStats()` - Store stats to Steam servers
|
|
183
|
+
* - `SteamAPI_RunCallbacks()` - Process Steam callbacks
|
|
184
|
+
*/
|
|
185
|
+
updateAvgRateStat(statName: string, countThisSession: number, sessionLength: number): Promise<boolean>;
|
|
186
|
+
/**
|
|
187
|
+
* Request stats for another user (friend)
|
|
188
|
+
*
|
|
189
|
+
* Requests stat data from Steam servers for a specific user. Must be called
|
|
190
|
+
* before getting user stats with getUserStatInt() or getUserStatFloat().
|
|
191
|
+
* This is an asynchronous operation - wait a moment before reading the stats.
|
|
192
|
+
*
|
|
193
|
+
* @param steamId - Steam ID of the user (as string or BigInt)
|
|
194
|
+
* @returns true if request was sent successfully, false otherwise
|
|
195
|
+
*
|
|
196
|
+
* @example
|
|
197
|
+
* ```typescript
|
|
198
|
+
* const friendSteamId = '76561198012345678';
|
|
199
|
+
*
|
|
200
|
+
* // Request the friend's stats
|
|
201
|
+
* const success = await statsManager.requestUserStats(friendSteamId);
|
|
202
|
+
* if (success) {
|
|
203
|
+
* // Wait a moment for Steam to fetch the data
|
|
204
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
205
|
+
*
|
|
206
|
+
* // Now get the friend's stats
|
|
207
|
+
* const friendKills = await statsManager.getUserStatInt(friendSteamId, 'total_kills');
|
|
208
|
+
* console.log(`Friend has ${friendKills} kills`);
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* - Must be called before getting user stats
|
|
214
|
+
* - Returns true immediately if request was sent (not when data arrives)
|
|
215
|
+
* - Wait 50-100ms after requesting before reading stats
|
|
216
|
+
* - User's stats must be public for this to work
|
|
217
|
+
*
|
|
218
|
+
* Steamworks SDK Functions:
|
|
219
|
+
* - `SteamAPI_ISteamUserStats_RequestUserStats()` - Request user stats from Steam servers
|
|
220
|
+
*/
|
|
221
|
+
requestUserStats(steamId: string | bigint): Promise<boolean>;
|
|
222
|
+
/**
|
|
223
|
+
* Get an integer stat value for another user (friend)
|
|
224
|
+
*
|
|
225
|
+
* Retrieves a 32-bit integer stat value for a specific user. Must call
|
|
226
|
+
* requestUserStats() first and wait for the data to arrive.
|
|
227
|
+
*
|
|
228
|
+
* @param steamId - Steam ID of the user
|
|
229
|
+
* @param statName - Name of the stat to retrieve
|
|
230
|
+
* @returns The stat value, or null if not found or on error
|
|
231
|
+
*
|
|
232
|
+
* @example
|
|
233
|
+
* ```typescript
|
|
234
|
+
* // Compare your kills to a friend's
|
|
235
|
+
* const friendId = '76561198012345678';
|
|
236
|
+
* await statsManager.requestUserStats(friendId);
|
|
237
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
238
|
+
*
|
|
239
|
+
* const myKills = await statsManager.getStatInt('total_kills') || 0;
|
|
240
|
+
* const friendKills = await statsManager.getUserStatInt(friendId, 'total_kills') || 0;
|
|
241
|
+
*
|
|
242
|
+
* console.log(`You: ${myKills}, Friend: ${friendKills}`);
|
|
243
|
+
* ```
|
|
244
|
+
*
|
|
245
|
+
* @remarks
|
|
246
|
+
* - Must call requestUserStats() first
|
|
247
|
+
* - Wait 50-100ms after requesting before calling this
|
|
248
|
+
* - Returns null if stats haven't arrived yet or user's stats are private
|
|
249
|
+
*
|
|
250
|
+
* Steamworks SDK Functions:
|
|
251
|
+
* - `SteamAPI_ISteamUserStats_GetUserStatInt32()` - Get user's int32 stat value
|
|
252
|
+
*/
|
|
253
|
+
getUserStatInt(steamId: string | bigint, statName: string): Promise<number | null>;
|
|
254
|
+
/**
|
|
255
|
+
* Get a float stat value for another user (friend)
|
|
256
|
+
*
|
|
257
|
+
* Retrieves a floating-point stat value for a specific user. Must call
|
|
258
|
+
* requestUserStats() first and wait for the data to arrive.
|
|
259
|
+
*
|
|
260
|
+
* @param steamId - Steam ID of the user
|
|
261
|
+
* @param statName - Name of the stat to retrieve
|
|
262
|
+
* @returns The stat value, or null if not found or on error
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* // Compare accuracy with a friend
|
|
267
|
+
* const friendId = '76561198012345678';
|
|
268
|
+
* await statsManager.requestUserStats(friendId);
|
|
269
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
270
|
+
*
|
|
271
|
+
* const friendAccuracy = await statsManager.getUserStatFloat(friendId, 'shooting_accuracy');
|
|
272
|
+
* if (friendAccuracy !== null) {
|
|
273
|
+
* console.log(`Friend accuracy: ${(friendAccuracy * 100).toFixed(2)}%`);
|
|
274
|
+
* }
|
|
275
|
+
* ```
|
|
276
|
+
*
|
|
277
|
+
* @remarks
|
|
278
|
+
* - Must call requestUserStats() first
|
|
279
|
+
* - Wait 50-100ms after requesting before calling this
|
|
280
|
+
* - Returns null if stats haven't arrived yet or user's stats are private
|
|
281
|
+
*
|
|
282
|
+
* Steamworks SDK Functions:
|
|
283
|
+
* - `SteamAPI_ISteamUserStats_GetUserStatFloat()` - Get user's float stat value
|
|
284
|
+
*/
|
|
285
|
+
getUserStatFloat(steamId: string | bigint, statName: string): Promise<number | null>;
|
|
286
|
+
/**
|
|
287
|
+
* Request global stats data from Steam
|
|
288
|
+
*
|
|
289
|
+
* Requests aggregated statistics across all players from Steam servers.
|
|
290
|
+
* Optionally includes historical data for trend analysis.
|
|
291
|
+
* Must be called before getting global stats.
|
|
292
|
+
*
|
|
293
|
+
* @param historyDays - Number of days of history to retrieve (0-60, default: 0)
|
|
294
|
+
* @returns true if request was sent successfully, false otherwise
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* // Request current global stats (no history)
|
|
299
|
+
* await statsManager.requestGlobalStats(0);
|
|
300
|
+
*
|
|
301
|
+
* // Request with 7 days of history for trends
|
|
302
|
+
* await statsManager.requestGlobalStats(7);
|
|
303
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
304
|
+
*
|
|
305
|
+
* const totalKills = await statsManager.getGlobalStatInt('total_kills');
|
|
306
|
+
* console.log(`All players combined: ${totalKills} kills`);
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* @remarks
|
|
310
|
+
* - Must be called before getting global stats
|
|
311
|
+
* - Returns true immediately if request was sent (not when data arrives)
|
|
312
|
+
* - Wait 50-100ms after requesting before reading stats
|
|
313
|
+
* - historyDays is automatically clamped to 0-60 range
|
|
314
|
+
* - Historical data allows tracking trends over time
|
|
315
|
+
*
|
|
316
|
+
* Steamworks SDK Functions:
|
|
317
|
+
* - `SteamAPI_ISteamUserStats_RequestGlobalStats()` - Request global stats from Steam servers
|
|
318
|
+
*/
|
|
319
|
+
requestGlobalStats(historyDays?: number): Promise<boolean>;
|
|
320
|
+
/**
|
|
321
|
+
* Get a global stat value (64-bit integer)
|
|
322
|
+
*
|
|
323
|
+
* Retrieves an aggregated integer stat value across all players.
|
|
324
|
+
* Must call requestGlobalStats() first and wait for the data to arrive.
|
|
325
|
+
*
|
|
326
|
+
* @param statName - Name of the global stat to retrieve
|
|
327
|
+
* @returns The stat value as BigInt, or null if not found or on error
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* ```typescript
|
|
331
|
+
* // Get total kills across all players
|
|
332
|
+
* await statsManager.requestGlobalStats();
|
|
333
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
334
|
+
*
|
|
335
|
+
* const globalKills = await statsManager.getGlobalStatInt('total_kills');
|
|
336
|
+
* if (globalKills !== null) {
|
|
337
|
+
* console.log(`All players have ${globalKills} total kills`);
|
|
338
|
+
* }
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* @remarks
|
|
342
|
+
* - Returns BigInt for large numbers (can exceed JavaScript's safe integer range)
|
|
343
|
+
* - Must call requestGlobalStats() first
|
|
344
|
+
* - Wait 50-100ms after requesting before calling this
|
|
345
|
+
* - Useful for tracking game-wide statistics
|
|
346
|
+
*
|
|
347
|
+
* Steamworks SDK Functions:
|
|
348
|
+
* - `SteamAPI_ISteamUserStats_GetGlobalStatInt64()` - Get global int64 stat value
|
|
349
|
+
*/
|
|
350
|
+
getGlobalStatInt(statName: string): Promise<bigint | null>;
|
|
351
|
+
/**
|
|
352
|
+
* Get a global stat value (double-precision float)
|
|
353
|
+
*
|
|
354
|
+
* Retrieves an aggregated floating-point stat value across all players.
|
|
355
|
+
* Must call requestGlobalStats() first and wait for the data to arrive.
|
|
356
|
+
* Use this for averages or stats requiring decimal precision.
|
|
357
|
+
*
|
|
358
|
+
* @param statName - Name of the global stat to retrieve
|
|
359
|
+
* @returns The stat value, or null if not found or on error
|
|
360
|
+
*
|
|
361
|
+
* @example
|
|
362
|
+
* ```typescript
|
|
363
|
+
* // Get average accuracy across all players
|
|
364
|
+
* await statsManager.requestGlobalStats();
|
|
365
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
366
|
+
*
|
|
367
|
+
* const avgAccuracy = await statsManager.getGlobalStatDouble('average_accuracy');
|
|
368
|
+
* if (avgAccuracy !== null) {
|
|
369
|
+
* console.log(`Global average accuracy: ${(avgAccuracy * 100).toFixed(2)}%`);
|
|
370
|
+
* }
|
|
371
|
+
* ```
|
|
372
|
+
*
|
|
373
|
+
* @remarks
|
|
374
|
+
* - Use for stats requiring decimal precision
|
|
375
|
+
* - Must call requestGlobalStats() first
|
|
376
|
+
* - Wait 50-100ms after requesting before calling this
|
|
377
|
+
* - Perfect for calculating game-wide averages
|
|
378
|
+
*
|
|
379
|
+
* Steamworks SDK Functions:
|
|
380
|
+
* - `SteamAPI_ISteamUserStats_GetGlobalStatDouble()` - Get global double stat value
|
|
381
|
+
*/
|
|
382
|
+
getGlobalStatDouble(statName: string): Promise<number | null>;
|
|
383
|
+
/**
|
|
384
|
+
* Get global stat history for an integer stat
|
|
385
|
+
*
|
|
386
|
+
* Retrieves historical daily values for a global stat. Array index [0] is today,
|
|
387
|
+
* [1] is yesterday, etc. Useful for tracking trends and creating graphs.
|
|
388
|
+
*
|
|
389
|
+
* @param statName - Name of the global stat
|
|
390
|
+
* @param days - Number of days of history to retrieve (1-60, default: 7)
|
|
391
|
+
* @returns Array of daily BigInt values, or null if error
|
|
392
|
+
*
|
|
393
|
+
* @example
|
|
394
|
+
* ```typescript
|
|
395
|
+
* // Get 7 days of global kill history
|
|
396
|
+
* await statsManager.requestGlobalStats(7);
|
|
397
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
398
|
+
*
|
|
399
|
+
* const history = await statsManager.getGlobalStatHistoryInt('total_kills', 7);
|
|
400
|
+
* if (history) {
|
|
401
|
+
* console.log('Kill history (newest to oldest):');
|
|
402
|
+
* history.forEach((kills, index) => {
|
|
403
|
+
* const daysAgo = index === 0 ? 'today' : `${index} days ago`;
|
|
404
|
+
* console.log(` ${daysAgo}: ${kills} kills`);
|
|
405
|
+
* });
|
|
406
|
+
* }
|
|
407
|
+
* ```
|
|
408
|
+
*
|
|
409
|
+
* @remarks
|
|
410
|
+
* - Array index [0] = today, [1] = yesterday, etc.
|
|
411
|
+
* - Must call requestGlobalStats(days) first with same or greater number of days
|
|
412
|
+
* - Returns BigInt values for large numbers
|
|
413
|
+
* - Maximum 60 days of history (automatically clamped)
|
|
414
|
+
* - Perfect for trend analysis and visualizations
|
|
415
|
+
*
|
|
416
|
+
* Steamworks SDK Functions:
|
|
417
|
+
* - `SteamAPI_ISteamUserStats_GetGlobalStatHistoryInt64()` - Get historical int64 values
|
|
418
|
+
*/
|
|
419
|
+
getGlobalStatHistoryInt(statName: string, days?: number): Promise<bigint[] | null>;
|
|
420
|
+
/**
|
|
421
|
+
* Get global stat history for a floating-point stat
|
|
422
|
+
*
|
|
423
|
+
* Retrieves historical daily values for a global stat with decimal precision.
|
|
424
|
+
* Array index [0] is today, [1] is yesterday, etc. Ideal for tracking averages
|
|
425
|
+
* and rates over time.
|
|
426
|
+
*
|
|
427
|
+
* @param statName - Name of the global stat
|
|
428
|
+
* @param days - Number of days of history to retrieve (1-60, default: 7)
|
|
429
|
+
* @returns Array of daily float values, or null if error
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* ```typescript
|
|
433
|
+
* // Track average accuracy trend over 30 days
|
|
434
|
+
* await statsManager.requestGlobalStats(30);
|
|
435
|
+
* await new Promise(resolve => setTimeout(resolve, 100));
|
|
436
|
+
*
|
|
437
|
+
* const history = await statsManager.getGlobalStatHistoryDouble('average_accuracy', 30);
|
|
438
|
+
* if (history) {
|
|
439
|
+
* console.log('Accuracy trend:');
|
|
440
|
+
* history.forEach((accuracy, index) => {
|
|
441
|
+
* if (index % 7 === 0) { // Weekly intervals
|
|
442
|
+
* console.log(` Week ${index/7}: ${(accuracy * 100).toFixed(2)}%`);
|
|
443
|
+
* }
|
|
444
|
+
* });
|
|
445
|
+
* }
|
|
446
|
+
* ```
|
|
447
|
+
*
|
|
448
|
+
* @remarks
|
|
449
|
+
* - Array index [0] = today, [1] = yesterday, etc.
|
|
450
|
+
* - Must call requestGlobalStats(days) first with same or greater number of days
|
|
451
|
+
* - Returns floating-point values for decimal precision
|
|
452
|
+
* - Maximum 60 days of history (automatically clamped)
|
|
453
|
+
* - Perfect for tracking averages, rates, and percentages over time
|
|
454
|
+
*
|
|
455
|
+
* Steamworks SDK Functions:
|
|
456
|
+
* - `SteamAPI_ISteamUserStats_GetGlobalStatHistoryDouble()` - Get historical double values
|
|
457
|
+
*/
|
|
458
|
+
getGlobalStatHistoryDouble(statName: string, days?: number): Promise<number[] | null>;
|
|
459
|
+
}
|
|
460
|
+
//# sourceMappingURL=SteamStatsManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SteamStatsManager.d.ts","sourceRoot":"","sources":["../../src/internal/SteamStatsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,iBAAiB;IA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