steamworks-ffi-node 0.4.1 → 0.5.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/README.md CHANGED
@@ -9,10 +9,12 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
9
9
 
10
10
  > 🎉 **NEW: 100% Achievement API Coverage** - All 20 Steam achievement functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)
11
11
 
12
- > 🎉 **NEW: 100% Stats API Coverage** - All 13 Steam statistics functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)
12
+ > 🎉 **NEW: 100% Stats API Coverage** - All 14 Steam statistics functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)
13
13
 
14
14
  > 🎉 **NEW: 100% Leaderboard API Coverage** - All 7 Steam leaderboard functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)
15
15
 
16
+ > 🎉 **NEW: Friends API** - 10 essential Steam friends and social functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)
17
+
16
18
  ## 🎯 Features
17
19
 
18
20
  - **Complete Achievement API**: 100% coverage of Steam Achievement functionality (20/20 functions)
@@ -22,7 +24,7 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
22
24
  - ✅ Friend comparisons (see friend achievements)
23
25
  - ✅ Global statistics (unlock percentages, popularity sorting)
24
26
  - ✅ Testing tools (reset stats/achievements)
25
- - **Complete Stats API**: 100% coverage of Steam User Stats functionality (13/13 functions)
27
+ - **Complete Stats API**: 100% coverage of Steam User Stats functionality (14/14 functions)
26
28
  - ✅ User stats (get/set int/float, average rate tracking)
27
29
  - ✅ Friend comparisons (compare stats with friends)
28
30
  - ✅ Global statistics (worldwide aggregated data with history)
@@ -31,6 +33,11 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
31
33
  - ✅ Score operations (upload with optional details)
32
34
  - ✅ Entry download (global, friends, specific users)
33
35
  - ✅ UGC integration (attach replays/screenshots to entries)
36
+ - **Friends & Social API**: Essential Steam friends and social features (10 core functions)
37
+ - ✅ Current user info (persona name, online state)
38
+ - ✅ Friends list management (count, iterate, get all friends)
39
+ - ✅ Friend information (names, states, relationships, Steam levels)
40
+ - ✅ Friend activity (check games being played)
34
41
  - **Steamworks Integration**: Direct FFI calls to Steamworks C++ SDK
35
42
  - **Cross-Platform**: Windows, macOS, and Linux support
36
43
  - **Batteries Included**: All Steamworks redistributables bundled - no SDK download needed!
@@ -112,6 +119,26 @@ if (initialized) {
112
119
  );
113
120
  console.log('Top 10 scores:', topScores);
114
121
  }
122
+
123
+ // Access friends and social features
124
+ const personaName = steam.friends.getPersonaName();
125
+ const friendCount = steam.friends.getFriendCount(4); // All friends
126
+ console.log(`${personaName} has ${friendCount} friends`);
127
+
128
+ // Get all friends with details
129
+ const allFriends = steam.friends.getAllFriends(4); // All friends
130
+ allFriends.slice(0, 5).forEach(friend => {
131
+ const name = steam.friends.getFriendPersonaName(friend.steamId);
132
+ const state = steam.friends.getFriendPersonaState(friend.steamId);
133
+ const level = steam.friends.getFriendSteamLevel(friend.steamId);
134
+ console.log(`${name}: Level ${level}, Status: ${state}`);
135
+
136
+ // Check if playing a game
137
+ const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
138
+ if (gameInfo.playing) {
139
+ console.log(` Playing: ${gameInfo.gameName} (AppID: ${gameInfo.gameId})`);
140
+ }
141
+ });
115
142
  }
116
143
 
117
144
  // Cleanup
@@ -156,6 +183,12 @@ Complete documentation for all APIs is available in the [docs folder](https://gi
156
183
 
157
184
  ➡️ **[View Complete Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/README.md)**
158
185
 
186
+ ### API Guides:
187
+ - **[Achievement Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)** - Complete achievement system (20 functions)
188
+ - **[Stats Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)** - User and global statistics (14 functions)
189
+ - **[Leaderboard Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)** - Leaderboard operations (7 functions)
190
+ - **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (10 functions)
191
+
159
192
  ## 🎮 Steamworks Integration
160
193
 
161
194
  This library connects directly to the Steam client and Steamworks SDK:
@@ -38,6 +38,8 @@ export declare class SteamAPICore {
38
38
  private userInterface;
39
39
  /** Pointer to the ISteamUtils interface */
40
40
  private utilsInterface;
41
+ /** Pointer to the ISteamFriends interface */
42
+ private friendsInterface;
41
43
  /**
42
44
  * Creates a new SteamAPICore instance
43
45
  *
@@ -255,5 +257,26 @@ export declare class SteamAPICore {
255
257
  * - This is a native pointer for use with FFI calls
256
258
  */
257
259
  getUtilsInterface(): any;
260
+ /**
261
+ * Get the ISteamFriends interface pointer
262
+ *
263
+ * Returns the native pointer to the ISteamFriends interface, which is used
264
+ * for friends list and social features.
265
+ *
266
+ * @returns Pointer to ISteamFriends interface, or null if not initialized
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const friends = apiCore.getFriendsInterface();
271
+ * if (friends) {
272
+ * // Use interface for friends operations
273
+ * }
274
+ * ```
275
+ *
276
+ * @remarks
277
+ * - Returns null if Steam API is not initialized
278
+ * - This is a native pointer for use with FFI calls
279
+ */
280
+ getFriendsInterface(): any;
258
281
  }
259
282
  //# sourceMappingURL=SteamAPICore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SteamAPICore.d.ts","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAA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ilsInterface = null;
81
+ /** Pointer to the ISteamFriends interface */
82
+ this.friendsInterface = null;
81
83
  this.libraryLoader = libraryLoader;
82
84
  }
83
85
  /**
@@ -151,6 +153,11 @@ class SteamAPICore {
151
153
  if (!this.utilsInterface || this.utilsInterface === null) {
152
154
  console.warn('[Steamworks] WARNING: Failed to get SteamUtils interface');
153
155
  }
156
+ // Get Friends interface
157
+ this.friendsInterface = this.libraryLoader.SteamAPI_SteamFriends_v018();
158
+ if (!this.friendsInterface || this.friendsInterface === null) {
159
+ console.warn('[Steamworks] WARNING: Failed to get SteamFriends interface');
160
+ }
154
161
  // Request current stats from Steam servers
155
162
  console.log('[Steamworks] Requesting current stats from Steam...');
156
163
  const statsRequested = this.libraryLoader.SteamAPI_ISteamUserStats_RequestCurrentStats(this.userStatsInterface, 0);
@@ -400,6 +407,29 @@ class SteamAPICore {
400
407
  getUtilsInterface() {
401
408
  return this.utilsInterface;
402
409
  }
410
+ /**
411
+ * Get the ISteamFriends interface pointer
412
+ *
413
+ * Returns the native pointer to the ISteamFriends interface, which is used
414
+ * for friends list and social features.
415
+ *
416
+ * @returns Pointer to ISteamFriends interface, or null if not initialized
417
+ *
418
+ * @example
419
+ * ```typescript
420
+ * const friends = apiCore.getFriendsInterface();
421
+ * if (friends) {
422
+ * // Use interface for friends operations
423
+ * }
424
+ * ```
425
+ *
426
+ * @remarks
427
+ * - Returns null if Steam API is not initialized
428
+ * - This is a native pointer for use with FFI calls
429
+ */
430
+ getFriendsInterface() {
431
+ return this.friendsInterface;
432
+ }
403
433
  }
404
434
  exports.SteamAPICore = SteamAPICore;
405
435
  //# sourceMappingURL=SteamAPICore.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SteamAPICore.js","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAC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I,CAAC,WAAW,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC;YACtD,IAAI,CAAC;gBACH,OAAO,IAAI,CAAC,aAAa,CAAC,uBAAuB,EAAE,CAAC;YACtD,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,CAAC,IAAI,CAAC,2DAA2D,EAAG,KAAe,CAAC,OAAO,CAAC,CAAC;gBACpG,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AApZD,oCAoZC"}
@@ -0,0 +1,365 @@
1
+ import { SteamLibraryLoader } from './SteamLibraryLoader';
2
+ import { SteamAPICore } from './SteamAPICore';
3
+ import { EFriendRelationship, EPersonaState, EFriendFlags, FriendInfo, FriendGameInfo } from '../types';
4
+ /**
5
+ * Manager for Steam Friends API operations
6
+ *
7
+ * The SteamFriendsManager provides comprehensive access to Steam's social features,
8
+ * allowing you to retrieve information about the current user and their friends.
9
+ *
10
+ * - Current user information (persona name, online state)
11
+ * - Friends list retrieval and iteration
12
+ * - Individual friend information (name, state, relationship)
13
+ * - Friend details (Steam level, currently playing game)
14
+ *
15
+ * @remarks
16
+ * All methods require the Steam API to be initialized. The manager checks initialization
17
+ * status and Friends interface availability before making API calls.
18
+ *
19
+ * @example Get current user information
20
+ * ```typescript
21
+ * const steam = SteamworksSDK.getInstance();
22
+ * steam.init({ appId: 480 });
23
+ *
24
+ * const myName = steam.friends.getPersonaName();
25
+ * const myState = steam.friends.getPersonaState();
26
+ * console.log(`${myName} is ${myState === EPersonaState.Online ? 'online' : 'offline'}`);
27
+ * ```
28
+ *
29
+ * @example Get all friends
30
+ * ```typescript
31
+ * const friends = steam.friends.getAllFriends(EFriendFlags.Immediate);
32
+ * friends.forEach(friend => {
33
+ * console.log(`${friend.personaName} (${friend.steamId})`);
34
+ * console.log(`Status: ${friend.personaState}`);
35
+ *
36
+ * const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
37
+ * if (gameInfo) {
38
+ * console.log(`Playing game: ${gameInfo.gameId}`);
39
+ * }
40
+ * });
41
+ * ```
42
+ *
43
+ * @example Iterate through friends manually
44
+ * ```typescript
45
+ * const count = steam.friends.getFriendCount(EFriendFlags.Immediate);
46
+ * for (let i = 0; i < count; i++) {
47
+ * const steamId = steam.friends.getFriendByIndex(i, EFriendFlags.Immediate);
48
+ * if (steamId) {
49
+ * const name = steam.friends.getFriendPersonaName(steamId);
50
+ * const level = steam.friends.getFriendSteamLevel(steamId);
51
+ * console.log(`${name} - Level ${level}`);
52
+ * }
53
+ * }
54
+ * ```
55
+ *
56
+ * @see {@link https://partner.steamgames.com/doc/api/ISteamFriends ISteamFriends Documentation}
57
+ */
58
+ export declare class SteamFriendsManager {
59
+ /** Steam library loader for FFI function calls */
60
+ private libraryLoader;
61
+ /** Steam API core for initialization and callback management */
62
+ private apiCore;
63
+ /** FriendGameInfo_t struct for game information */
64
+ private static FriendGameInfo_t;
65
+ /**
66
+ * Creates a new SteamFriendsManager instance
67
+ *
68
+ * @param libraryLoader - The Steam library loader for FFI calls
69
+ * @param apiCore - The Steam API core for lifecycle management
70
+ */
71
+ constructor(libraryLoader: SteamLibraryLoader, apiCore: SteamAPICore);
72
+ /**
73
+ * Gets the current user's persona name (Steam display name)
74
+ *
75
+ * @returns The user's Steam display name, or empty string if unavailable
76
+ *
77
+ * @remarks
78
+ * This returns the name that other users see when they view your profile.
79
+ * It may differ from your account name used for login.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * const myName = steam.friends.getPersonaName();
84
+ * console.log(`Logged in as: ${myName}`);
85
+ * ```
86
+ */
87
+ getPersonaName(): string;
88
+ /**
89
+ * Gets the current user's persona state (online status)
90
+ *
91
+ * @returns The user's current online status from {@link EPersonaState}
92
+ *
93
+ * @remarks
94
+ * The persona state indicates the user's current availability:
95
+ * - Offline: User is not logged in
96
+ * - Online: User is online and available
97
+ * - Busy: User is online but marked as busy
98
+ * - Away: User is away from keyboard
99
+ * - Snooze: User is auto-away
100
+ * - LookingToTrade: User is looking to trade items
101
+ * - LookingToPlay: User is looking for a game
102
+ * - Invisible: User appears offline to others
103
+ *
104
+ * @example
105
+ * ```typescript
106
+ * const state = steam.friends.getPersonaState();
107
+ * if (state === EPersonaState.Online) {
108
+ * console.log('You are online!');
109
+ * }
110
+ * ```
111
+ */
112
+ getPersonaState(): EPersonaState;
113
+ /**
114
+ * Gets the count of friends matching specified flags
115
+ *
116
+ * @param friendFlags - Flags to filter which friends to count (default: {@link EFriendFlags.Immediate})
117
+ * @returns The number of friends matching the specified flags
118
+ *
119
+ * @remarks
120
+ * Common flag combinations:
121
+ * - `EFriendFlags.Immediate`: Regular friends (most common)
122
+ * - `EFriendFlags.All`: All relationships including blocked, ignored, etc.
123
+ * - `EFriendFlags.OnGameServer`: Friends on the same game server
124
+ *
125
+ * The same flags must be used with {@link getFriendByIndex} to iterate the list.
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * const friendCount = steam.friends.getFriendCount(EFriendFlags.Immediate);
130
+ * console.log(`You have ${friendCount} friends`);
131
+ * ```
132
+ *
133
+ * @see {@link getFriendByIndex}
134
+ * @see {@link getAllFriends}
135
+ */
136
+ getFriendCount(friendFlags?: EFriendFlags): number;
137
+ /**
138
+ * Gets a friend's Steam ID by their index in the friends list
139
+ *
140
+ * @param index - Zero-based index of the friend (0 to {@link getFriendCount}() - 1)
141
+ * @param friendFlags - Same flags used in {@link getFriendCount} (default: {@link EFriendFlags.Immediate})
142
+ * @returns The friend's Steam ID as a string, or null if the index is invalid
143
+ *
144
+ * @remarks
145
+ * Use this method to iterate through the friends list:
146
+ * 1. Call {@link getFriendCount} with specific flags
147
+ * 2. Loop from 0 to count-1 calling this method with the same flags
148
+ * 3. Use the returned Steam ID with other methods like {@link getFriendPersonaName}
149
+ *
150
+ * The flags must match those used in {@link getFriendCount} or you'll get incorrect results.
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * const count = steam.friends.getFriendCount(EFriendFlags.Immediate);
155
+ * for (let i = 0; i < count; i++) {
156
+ * const steamId = steam.friends.getFriendByIndex(i, EFriendFlags.Immediate);
157
+ * if (steamId) {
158
+ * const name = steam.friends.getFriendPersonaName(steamId);
159
+ * console.log(`Friend ${i}: ${name} (${steamId})`);
160
+ * }
161
+ * }
162
+ * ```
163
+ *
164
+ * @see {@link getFriendCount}
165
+ * @see {@link getAllFriends}
166
+ */
167
+ getFriendByIndex(index: number, friendFlags?: EFriendFlags): string | null;
168
+ /**
169
+ * Gets a friend's persona name (Steam display name)
170
+ *
171
+ * @param steamId - The friend's Steam ID as a string
172
+ * @returns The friend's display name, or empty string if unavailable
173
+ *
174
+ * @remarks
175
+ * This returns the name that appears in the Steam friends list and chat.
176
+ * If the friend has not been seen by the current user recently, the name
177
+ * may not be immediately available and could return an empty string.
178
+ *
179
+ * @example
180
+ * ```typescript
181
+ * const steamId = steam.friends.getFriendByIndex(0, EFriendFlags.Immediate);
182
+ * if (steamId) {
183
+ * const name = steam.friends.getFriendPersonaName(steamId);
184
+ * console.log(`Friend's name: ${name}`);
185
+ * }
186
+ * ```
187
+ *
188
+ * @see {@link getPersonaName} for current user's name
189
+ */
190
+ getFriendPersonaName(steamId: string): string;
191
+ /**
192
+ * Gets a friend's persona state (online status)
193
+ *
194
+ * @param steamId - The friend's Steam ID as a string
195
+ * @returns The friend's current online status from {@link EPersonaState}
196
+ *
197
+ * @remarks
198
+ * Returns the friend's current availability status. Common states include:
199
+ * - Offline (0): Friend is not logged in
200
+ * - Online (1): Friend is online and available
201
+ * - Busy (2): Friend is marked as busy
202
+ * - Away (3): Friend is away from keyboard
203
+ *
204
+ * @example
205
+ * ```typescript
206
+ * const friends = steam.friends.getAllFriends();
207
+ * const onlineFriends = friends.filter(f =>
208
+ * steam.friends.getFriendPersonaState(f.steamId) !== EPersonaState.Offline
209
+ * );
210
+ * console.log(`${onlineFriends.length} friends are online`);
211
+ * ```
212
+ *
213
+ * @see {@link getPersonaState} for current user's state
214
+ * @see {@link EPersonaState}
215
+ */
216
+ getFriendPersonaState(steamId: string): EPersonaState;
217
+ /**
218
+ * Gets the relationship status between the current user and another user
219
+ *
220
+ * @param steamId - The other user's Steam ID as a string
221
+ * @returns The relationship status from {@link EFriendRelationship}
222
+ *
223
+ * @remarks
224
+ * Possible relationship states include:
225
+ * - None (0): No relationship
226
+ * - Blocked (1): User is blocked
227
+ * - RequestRecipient (2): Received a friend request from this user
228
+ * - Friend (3): Users are friends
229
+ * - RequestInitiator (4): Sent a friend request to this user
230
+ * - Ignored (5): User is ignored
231
+ * - IgnoredFriend (6): User was a friend but is now ignored
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const relationship = steam.friends.getFriendRelationship(friendSteamId);
236
+ * if (relationship === EFriendRelationship.Friend) {
237
+ * console.log('This user is your friend');
238
+ * } else if (relationship === EFriendRelationship.RequestRecipient) {
239
+ * console.log('This user sent you a friend request');
240
+ * }
241
+ * ```
242
+ *
243
+ * @see {@link EFriendRelationship}
244
+ */
245
+ getFriendRelationship(steamId: string): EFriendRelationship;
246
+ /**
247
+ * Gets all friends with their complete information in a single call
248
+ *
249
+ * @param friendFlags - Flags to filter which friends to retrieve (default: {@link EFriendFlags.Immediate})
250
+ * @returns Array of {@link FriendInfo} objects containing friend details
251
+ *
252
+ * @remarks
253
+ * This is a convenience method that combines {@link getFriendCount}, {@link getFriendByIndex},
254
+ * and several other methods to retrieve complete friend information in one call.
255
+ *
256
+ * Each {@link FriendInfo} object contains:
257
+ * - steamId: Friend's Steam ID
258
+ * - personaName: Friend's display name
259
+ * - personaState: Friend's online status
260
+ * - relationship: Relationship type with this friend
261
+ *
262
+ * For large friends lists (100+), this method makes many API calls and may take
263
+ * a moment to complete. Consider using {@link getFriendByIndex} for manual iteration
264
+ * if you need to process friends incrementally.
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * const friends = steam.friends.getAllFriends(EFriendFlags.Immediate);
269
+ * console.log(`You have ${friends.length} friends`);
270
+ *
271
+ * friends.forEach(friend => {
272
+ * console.log(`${friend.personaName} is ${friend.personaState === EPersonaState.Online ? 'online' : 'offline'}`);
273
+ * });
274
+ * ```
275
+ *
276
+ * @see {@link getFriendCount}
277
+ * @see {@link getFriendByIndex}
278
+ * @see {@link FriendInfo}
279
+ */
280
+ getAllFriends(friendFlags?: EFriendFlags): FriendInfo[];
281
+ /**
282
+ * Gets a friend's current Steam level
283
+ *
284
+ * @param steamId - The friend's Steam ID as a string
285
+ * @returns The friend's Steam level (1-5000+), or 0 if unavailable
286
+ *
287
+ * @remarks
288
+ * The Steam level indicates how much a user has participated in Steam features
289
+ * like collecting trading cards, crafting badges, and participating in events.
290
+ *
291
+ * Returns 0 if:
292
+ * - The friend's profile is private
293
+ * - The level hasn't been loaded yet
294
+ * - The API call fails
295
+ *
296
+ * @example
297
+ * ```typescript
298
+ * const friends = steam.friends.getAllFriends();
299
+ * friends.forEach(friend => {
300
+ * const level = steam.friends.getFriendSteamLevel(friend.steamId);
301
+ * console.log(`${friend.personaName} is Level ${level}`);
302
+ * });
303
+ * ```
304
+ *
305
+ * @example Find highest level friend
306
+ * ```typescript
307
+ * const friends = steam.friends.getAllFriends();
308
+ * const highestLevel = friends.reduce((max, friend) => {
309
+ * const level = steam.friends.getFriendSteamLevel(friend.steamId);
310
+ * return level > max.level ? { friend, level } : max;
311
+ * }, { friend: null, level: 0 });
312
+ *
313
+ * if (highestLevel.friend) {
314
+ * console.log(`Highest level friend: ${highestLevel.friend.personaName} (Level ${highestLevel.level})`);
315
+ * }
316
+ * ```
317
+ */
318
+ getFriendSteamLevel(steamId: string): number;
319
+ /**
320
+ * Checks if a friend is currently playing a game and returns game information
321
+ *
322
+ * @param steamId - The friend's Steam ID as a string
323
+ * @returns {@link FriendGameInfo} object if the friend is playing a game, null otherwise
324
+ *
325
+ * @remarks
326
+ * When a friend is actively playing a game, this returns detailed information including:
327
+ * - gameId: The Steam App ID of the game being played
328
+ * - gameIP: IP address of the game server (if on a server)
329
+ * - gamePort: Port of the game server
330
+ * - queryPort: Query port for the game server
331
+ * - steamIDLobby: Steam ID of the lobby (if in a lobby)
332
+ *
333
+ * Returns null if:
334
+ * - Friend is not playing any game
335
+ * - Friend is offline
336
+ * - Game information is not available
337
+ *
338
+ * @example Check what games friends are playing
339
+ * ```typescript
340
+ * const friends = steam.friends.getAllFriends();
341
+ * friends.forEach(friend => {
342
+ * const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
343
+ * if (gameInfo) {
344
+ * console.log(`${friend.personaName} is playing App ${gameInfo.gameId}`);
345
+ * }
346
+ * });
347
+ * ```
348
+ *
349
+ * @example Find friends playing a specific game
350
+ * ```typescript
351
+ * const TARGET_GAME_ID = '730'; // CS:GO
352
+ * const friends = steam.friends.getAllFriends();
353
+ * const playingTargetGame = friends.filter(friend => {
354
+ * const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
355
+ * return gameInfo && gameInfo.gameId === TARGET_GAME_ID;
356
+ * });
357
+ *
358
+ * console.log(`${playingTargetGame.length} friends are playing CS:GO`);
359
+ * ```
360
+ *
361
+ * @see {@link FriendGameInfo}
362
+ */
363
+ getFriendGamePlayed(steamId: string): FriendGameInfo | null;
364
+ }
365
+ //# sourceMappingURL=SteamFriendsManager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