steamworks-ffi-node 0.5.1 → 0.5.2
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 +38 -6
- package/dist/internal/SteamFriendsManager.d.ts +368 -1
- package/dist/internal/SteamFriendsManager.d.ts.map +1 -1
- package/dist/internal/SteamFriendsManager.js +601 -0
- package/dist/internal/SteamFriendsManager.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 +15 -0
- package/dist/internal/SteamLibraryLoader.js.map +1 -1
- package/dist/types/friends.d.ts +16 -0
- package/dist/types/friends.d.ts.map +1 -1
- package/dist/types/friends.js +5 -1
- package/dist/types/friends.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -3,17 +3,19 @@
|
|
|
3
3
|
|
|
4
4
|
# Steamworks FFI - Steamworks SDK Integration
|
|
5
5
|
|
|
6
|
-
A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Koffi FFI, designed for Node.js and Electron applications with **Steamworks SDK integration**.
|
|
6
|
+
A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Koffi FFI, designed for Node.js and Electron applications with **Steamworks SDK v1.62 integration**.
|
|
7
7
|
|
|
8
8
|
> ✅ **No C++ Compilation Required**: Uses Koffi FFI for seamless installation without Visual Studio Build Tools!
|
|
9
9
|
|
|
10
|
+
> ⚡ **Latest Steamworks SDK**: Built with Steamworks SDK v1.62 - includes all latest Steam features and improvements!
|
|
11
|
+
|
|
10
12
|
> 🎉 **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
13
|
|
|
12
14
|
> 🎉 **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
15
|
|
|
14
16
|
> 🎉 **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
17
|
|
|
16
|
-
> 🎉 **NEW: Friends API** -
|
|
18
|
+
> 🎉 **NEW: Friends API** - 22 complete Steam friends and social functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)
|
|
17
19
|
|
|
18
20
|
> 🎉 **NEW: Rich Presence API** - 6 functions for custom status display and friend join functionality! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/RICH_PRESENCE_MANAGER.md)
|
|
19
21
|
|
|
@@ -37,11 +39,14 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
37
39
|
- ✅ Score operations (upload with optional details)
|
|
38
40
|
- ✅ Entry download (global, friends, specific users)
|
|
39
41
|
- ✅ UGC integration (attach replays/screenshots to entries)
|
|
40
|
-
- **Friends & Social API**:
|
|
42
|
+
- **Friends & Social API**: Complete Steam friends and social features (22 functions)
|
|
41
43
|
- ✅ Current user info (persona name, online state)
|
|
42
44
|
- ✅ Friends list management (count, iterate, get all friends)
|
|
43
45
|
- ✅ Friend information (names, states, relationships, Steam levels)
|
|
44
46
|
- ✅ Friend activity (check games being played)
|
|
47
|
+
- ✅ Friend avatars (small/medium/large avatar handles)
|
|
48
|
+
- ✅ Friend groups (tags/categories management)
|
|
49
|
+
- ✅ Coplay tracking (recently played with users)
|
|
45
50
|
- **Rich Presence API**: Complete Rich Presence support (6 functions)
|
|
46
51
|
- ✅ Set/clear rich presence key/value pairs
|
|
47
52
|
- ✅ Query friend rich presence data
|
|
@@ -148,13 +153,38 @@ if (initialized) {
|
|
|
148
153
|
const level = steam.friends.getFriendSteamLevel(friend.steamId);
|
|
149
154
|
console.log(`${name}: Level ${level}, Status: ${state}`);
|
|
150
155
|
|
|
156
|
+
// Get avatar handles
|
|
157
|
+
const smallAvatar = steam.friends.getSmallFriendAvatar(friend.steamId);
|
|
158
|
+
const mediumAvatar = steam.friends.getMediumFriendAvatar(friend.steamId);
|
|
159
|
+
if (smallAvatar > 0) {
|
|
160
|
+
console.log(` Avatar handles: small=${smallAvatar}, medium=${mediumAvatar}`);
|
|
161
|
+
}
|
|
162
|
+
|
|
151
163
|
// Check if playing a game
|
|
152
164
|
const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
|
|
153
|
-
if (gameInfo
|
|
154
|
-
console.log(` Playing:
|
|
165
|
+
if (gameInfo) {
|
|
166
|
+
console.log(` Playing: App ${gameInfo.gameId}`);
|
|
155
167
|
}
|
|
156
168
|
});
|
|
157
169
|
|
|
170
|
+
// Check friend groups (tags)
|
|
171
|
+
const groupCount = steam.friends.getFriendsGroupCount();
|
|
172
|
+
if (groupCount > 0) {
|
|
173
|
+
const groupId = steam.friends.getFriendsGroupIDByIndex(0);
|
|
174
|
+
const groupName = steam.friends.getFriendsGroupName(groupId);
|
|
175
|
+
const members = steam.friends.getFriendsGroupMembersList(groupId);
|
|
176
|
+
console.log(`Group "${groupName}" has ${members.length} members`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// Check recently played with
|
|
180
|
+
const coplayCount = steam.friends.getCoplayFriendCount();
|
|
181
|
+
if (coplayCount > 0) {
|
|
182
|
+
const recentPlayer = steam.friends.getCoplayFriend(0);
|
|
183
|
+
const playerName = steam.friends.getFriendPersonaName(recentPlayer);
|
|
184
|
+
const coplayTime = steam.friends.getFriendCoplayTime(recentPlayer);
|
|
185
|
+
console.log(`Recently played with ${playerName}`);
|
|
186
|
+
}
|
|
187
|
+
|
|
158
188
|
// Set rich presence for custom status
|
|
159
189
|
steam.richPresence.setRichPresence('status', 'In Main Menu');
|
|
160
190
|
steam.richPresence.setRichPresence('connect', '+connect server:27015');
|
|
@@ -210,7 +240,7 @@ Complete documentation for all APIs is available in the [docs folder](https://gi
|
|
|
210
240
|
- **[Achievement Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)** - Complete achievement system (20 functions)
|
|
211
241
|
- **[Stats Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)** - User and global statistics (14 functions)
|
|
212
242
|
- **[Leaderboard Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)** - Leaderboard operations (7 functions)
|
|
213
|
-
- **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (
|
|
243
|
+
- **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (22 functions)
|
|
214
244
|
- **[Rich Presence Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/RICH_PRESENCE_MANAGER.md)** - Custom status display and join functionality (6 functions)
|
|
215
245
|
- **[Overlay Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/OVERLAY_MANAGER.md)** - Steam overlay control (7 functions)
|
|
216
246
|
|
|
@@ -316,6 +346,8 @@ This ensures native libraries work correctly in packaged Electron apps!
|
|
|
316
346
|
- ✅ **macOS**: Included (libsteam_api.dylib)
|
|
317
347
|
- ✅ **Linux**: Included (libsteam_api.so)
|
|
318
348
|
|
|
349
|
+
**Steamworks SDK Version**: v1.62 (Latest)
|
|
350
|
+
|
|
319
351
|
All redistributable binaries are included in the package - no manual SDK download required!
|
|
320
352
|
|
|
321
353
|
## 🔧 Troubleshooting
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SteamLibraryLoader } from './SteamLibraryLoader';
|
|
2
2
|
import { SteamAPICore } from './SteamAPICore';
|
|
3
|
-
import { EFriendRelationship, EPersonaState, EFriendFlags, FriendInfo, FriendGameInfo } from '../types';
|
|
3
|
+
import { EFriendRelationship, EPersonaState, EFriendFlags, FriendInfo, FriendGameInfo, FriendsGroupID_t } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Manager for Steam Friends API operations
|
|
6
6
|
*
|
|
@@ -361,5 +361,372 @@ export declare class SteamFriendsManager {
|
|
|
361
361
|
* @see {@link FriendGameInfo}
|
|
362
362
|
*/
|
|
363
363
|
getFriendGamePlayed(steamId: string): FriendGameInfo | null;
|
|
364
|
+
/**
|
|
365
|
+
* Gets the handle for a friend's small (32x32) avatar image
|
|
366
|
+
*
|
|
367
|
+
* @param steamId - The friend's Steam ID as a string
|
|
368
|
+
* @returns Image handle for use with ISteamUtils, or 0 if unavailable
|
|
369
|
+
*
|
|
370
|
+
* @remarks
|
|
371
|
+
* This returns a handle that can be used with ISteamUtils::GetImageSize()
|
|
372
|
+
* and ISteamUtils::GetImageRGBA() to retrieve the actual image data.
|
|
373
|
+
*
|
|
374
|
+
* Small avatars are 32x32 pixels and are suitable for:
|
|
375
|
+
* - Friend list thumbnails
|
|
376
|
+
* - Chat message icons
|
|
377
|
+
* - Compact UI elements
|
|
378
|
+
*
|
|
379
|
+
* The avatar image is cached by Steam. If it returns 0, the image might
|
|
380
|
+
* still be loading. You can try again after a short delay.
|
|
381
|
+
*
|
|
382
|
+
* @example
|
|
383
|
+
* ```typescript
|
|
384
|
+
* const avatarHandle = steam.friends.getSmallFriendAvatar(friendSteamId);
|
|
385
|
+
* if (avatarHandle > 0) {
|
|
386
|
+
* console.log(`Small avatar handle: ${avatarHandle}`);
|
|
387
|
+
* // Use with ISteamUtils to get actual image data
|
|
388
|
+
* }
|
|
389
|
+
* ```
|
|
390
|
+
*
|
|
391
|
+
* @see {@link getMediumFriendAvatar}
|
|
392
|
+
* @see {@link getLargeFriendAvatar}
|
|
393
|
+
*/
|
|
394
|
+
getSmallFriendAvatar(steamId: string): number;
|
|
395
|
+
/**
|
|
396
|
+
* Gets the handle for a friend's medium (64x64) avatar image
|
|
397
|
+
*
|
|
398
|
+
* @param steamId - The friend's Steam ID as a string
|
|
399
|
+
* @returns Image handle for use with ISteamUtils, or 0 if unavailable
|
|
400
|
+
*
|
|
401
|
+
* @remarks
|
|
402
|
+
* This returns a handle that can be used with ISteamUtils::GetImageSize()
|
|
403
|
+
* and ISteamUtils::GetImageRGBA() to retrieve the actual image data.
|
|
404
|
+
*
|
|
405
|
+
* Medium avatars are 64x64 pixels and are suitable for:
|
|
406
|
+
* - User profiles
|
|
407
|
+
* - Game lobby player lists
|
|
408
|
+
* - Standard UI elements
|
|
409
|
+
*
|
|
410
|
+
* The avatar image is cached by Steam. If it returns 0, the image might
|
|
411
|
+
* still be loading. You can try again after a short delay.
|
|
412
|
+
*
|
|
413
|
+
* @example
|
|
414
|
+
* ```typescript
|
|
415
|
+
* const avatarHandle = steam.friends.getMediumFriendAvatar(friendSteamId);
|
|
416
|
+
* if (avatarHandle > 0) {
|
|
417
|
+
* console.log(`Medium avatar handle: ${avatarHandle}`);
|
|
418
|
+
* // Use with ISteamUtils to get actual image data
|
|
419
|
+
* }
|
|
420
|
+
* ```
|
|
421
|
+
*
|
|
422
|
+
* @see {@link getSmallFriendAvatar}
|
|
423
|
+
* @see {@link getLargeFriendAvatar}
|
|
424
|
+
*/
|
|
425
|
+
getMediumFriendAvatar(steamId: string): number;
|
|
426
|
+
/**
|
|
427
|
+
* Gets the handle for a friend's large (184x184) avatar image
|
|
428
|
+
*
|
|
429
|
+
* @param steamId - The friend's Steam ID as a string
|
|
430
|
+
* @returns Image handle for use with ISteamUtils, or 0 if unavailable
|
|
431
|
+
*
|
|
432
|
+
* @remarks
|
|
433
|
+
* This returns a handle that can be used with ISteamUtils::GetImageSize()
|
|
434
|
+
* and ISteamUtils::GetImageRGBA() to retrieve the actual image data.
|
|
435
|
+
*
|
|
436
|
+
* Large avatars are 184x184 pixels and are suitable for:
|
|
437
|
+
* - Detailed profile views
|
|
438
|
+
* - Full-screen overlays
|
|
439
|
+
* - High-resolution displays
|
|
440
|
+
*
|
|
441
|
+
* The avatar image is cached by Steam. If it returns 0, the image might
|
|
442
|
+
* still be loading. You can try again after a short delay.
|
|
443
|
+
*
|
|
444
|
+
* @example
|
|
445
|
+
* ```typescript
|
|
446
|
+
* const avatarHandle = steam.friends.getLargeFriendAvatar(friendSteamId);
|
|
447
|
+
* if (avatarHandle > 0) {
|
|
448
|
+
* console.log(`Large avatar handle: ${avatarHandle}`);
|
|
449
|
+
* // Use with ISteamUtils to get actual image data
|
|
450
|
+
* }
|
|
451
|
+
* ```
|
|
452
|
+
*
|
|
453
|
+
* @see {@link getSmallFriendAvatar}
|
|
454
|
+
* @see {@link getMediumFriendAvatar}
|
|
455
|
+
*/
|
|
456
|
+
getLargeFriendAvatar(steamId: string): number;
|
|
457
|
+
/**
|
|
458
|
+
* Gets the number of Steam friend groups (tags) the user has created
|
|
459
|
+
*
|
|
460
|
+
* @returns The number of friend groups, or 0 if unavailable
|
|
461
|
+
*
|
|
462
|
+
* @remarks
|
|
463
|
+
* Steam allows users to organize friends into custom groups (also called tags).
|
|
464
|
+
* This returns the total number of groups the current user has created.
|
|
465
|
+
*
|
|
466
|
+
* Use this with {@link getFriendsGroupIDByIndex} to iterate through all groups.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```typescript
|
|
470
|
+
* const groupCount = steam.friends.getFriendsGroupCount();
|
|
471
|
+
* console.log(`You have ${groupCount} friend groups`);
|
|
472
|
+
*
|
|
473
|
+
* for (let i = 0; i < groupCount; i++) {
|
|
474
|
+
* const groupId = steam.friends.getFriendsGroupIDByIndex(i);
|
|
475
|
+
* const groupName = steam.friends.getFriendsGroupName(groupId);
|
|
476
|
+
* console.log(`Group ${i}: ${groupName}`);
|
|
477
|
+
* }
|
|
478
|
+
* ```
|
|
479
|
+
*
|
|
480
|
+
* @see {@link getFriendsGroupIDByIndex}
|
|
481
|
+
* @see {@link getFriendsGroupName}
|
|
482
|
+
*/
|
|
483
|
+
getFriendsGroupCount(): number;
|
|
484
|
+
/**
|
|
485
|
+
* Gets a friend group ID by its index
|
|
486
|
+
*
|
|
487
|
+
* @param index - Zero-based index of the group (0 to {@link getFriendsGroupCount}() - 1)
|
|
488
|
+
* @returns The group ID, or {@link INVALID_FRIENDS_GROUP_ID} if the index is invalid
|
|
489
|
+
*
|
|
490
|
+
* @remarks
|
|
491
|
+
* Use this method to iterate through all friend groups:
|
|
492
|
+
* 1. Call {@link getFriendsGroupCount} to get the total number of groups
|
|
493
|
+
* 2. Loop from 0 to count-1 calling this method to get each group ID
|
|
494
|
+
* 3. Use the returned ID with {@link getFriendsGroupName} and {@link getFriendsGroupMembersList}
|
|
495
|
+
*
|
|
496
|
+
* @example
|
|
497
|
+
* ```typescript
|
|
498
|
+
* const groupCount = steam.friends.getFriendsGroupCount();
|
|
499
|
+
* for (let i = 0; i < groupCount; i++) {
|
|
500
|
+
* const groupId = steam.friends.getFriendsGroupIDByIndex(i);
|
|
501
|
+
* if (groupId !== INVALID_FRIENDS_GROUP_ID) {
|
|
502
|
+
* const name = steam.friends.getFriendsGroupName(groupId);
|
|
503
|
+
* const memberCount = steam.friends.getFriendsGroupMembersCount(groupId);
|
|
504
|
+
* console.log(`Group: ${name} (${memberCount} members)`);
|
|
505
|
+
* }
|
|
506
|
+
* }
|
|
507
|
+
* ```
|
|
508
|
+
*
|
|
509
|
+
* @see {@link getFriendsGroupCount}
|
|
510
|
+
* @see {@link getFriendsGroupName}
|
|
511
|
+
* @see {@link INVALID_FRIENDS_GROUP_ID}
|
|
512
|
+
*/
|
|
513
|
+
getFriendsGroupIDByIndex(index: number): FriendsGroupID_t;
|
|
514
|
+
/**
|
|
515
|
+
* Gets the name of a friend group
|
|
516
|
+
*
|
|
517
|
+
* @param groupId - The ID of the friend group
|
|
518
|
+
* @returns The group name, or empty string if unavailable
|
|
519
|
+
*
|
|
520
|
+
* @remarks
|
|
521
|
+
* Returns the user-defined name for the specified friend group.
|
|
522
|
+
* Group names are created and managed by the user in the Steam client.
|
|
523
|
+
*
|
|
524
|
+
* @example
|
|
525
|
+
* ```typescript
|
|
526
|
+
* const groupId = steam.friends.getFriendsGroupIDByIndex(0);
|
|
527
|
+
* if (groupId !== INVALID_FRIENDS_GROUP_ID) {
|
|
528
|
+
* const name = steam.friends.getFriendsGroupName(groupId);
|
|
529
|
+
* console.log(`First group is named: ${name}`);
|
|
530
|
+
* }
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
* @see {@link getFriendsGroupIDByIndex}
|
|
534
|
+
* @see {@link getFriendsGroupMembersCount}
|
|
535
|
+
*/
|
|
536
|
+
getFriendsGroupName(groupId: FriendsGroupID_t): string;
|
|
537
|
+
/**
|
|
538
|
+
* Gets the number of members in a friend group
|
|
539
|
+
*
|
|
540
|
+
* @param groupId - The ID of the friend group
|
|
541
|
+
* @returns The number of friends in the group, or 0 if unavailable
|
|
542
|
+
*
|
|
543
|
+
* @remarks
|
|
544
|
+
* Returns how many friends are assigned to the specified group.
|
|
545
|
+
* Use this with {@link getFriendsGroupMembersList} to retrieve the actual members.
|
|
546
|
+
*
|
|
547
|
+
* @example
|
|
548
|
+
* ```typescript
|
|
549
|
+
* const groupId = steam.friends.getFriendsGroupIDByIndex(0);
|
|
550
|
+
* const memberCount = steam.friends.getFriendsGroupMembersCount(groupId);
|
|
551
|
+
* console.log(`Group has ${memberCount} members`);
|
|
552
|
+
* ```
|
|
553
|
+
*
|
|
554
|
+
* @see {@link getFriendsGroupMembersList}
|
|
555
|
+
* @see {@link getFriendsGroupName}
|
|
556
|
+
*/
|
|
557
|
+
getFriendsGroupMembersCount(groupId: FriendsGroupID_t): number;
|
|
558
|
+
/**
|
|
559
|
+
* Gets the list of Steam IDs for all members in a friend group
|
|
560
|
+
*
|
|
561
|
+
* @param groupId - The ID of the friend group
|
|
562
|
+
* @returns Array of Steam IDs (as strings) of friends in the group
|
|
563
|
+
*
|
|
564
|
+
* @remarks
|
|
565
|
+
* Returns an array containing the Steam ID of each friend assigned to this group.
|
|
566
|
+
* The array will be empty if the group has no members or if an error occurs.
|
|
567
|
+
*
|
|
568
|
+
* This method allocates memory for the maximum possible members and then
|
|
569
|
+
* populates it with the actual members. The returned array only contains
|
|
570
|
+
* the actual members, not the full allocated buffer.
|
|
571
|
+
*
|
|
572
|
+
* @example
|
|
573
|
+
* ```typescript
|
|
574
|
+
* const groupId = steam.friends.getFriendsGroupIDByIndex(0);
|
|
575
|
+
* const groupName = steam.friends.getFriendsGroupName(groupId);
|
|
576
|
+
* const members = steam.friends.getFriendsGroupMembersList(groupId);
|
|
577
|
+
*
|
|
578
|
+
* console.log(`Group "${groupName}" has ${members.length} members:`);
|
|
579
|
+
* members.forEach(steamId => {
|
|
580
|
+
* const name = steam.friends.getFriendPersonaName(steamId);
|
|
581
|
+
* console.log(` - ${name} (${steamId})`);
|
|
582
|
+
* });
|
|
583
|
+
* ```
|
|
584
|
+
*
|
|
585
|
+
* @see {@link getFriendsGroupMembersCount}
|
|
586
|
+
* @see {@link getFriendsGroupName}
|
|
587
|
+
*/
|
|
588
|
+
getFriendsGroupMembersList(groupId: FriendsGroupID_t): string[];
|
|
589
|
+
/**
|
|
590
|
+
* Gets the number of users the current user has recently played with
|
|
591
|
+
*
|
|
592
|
+
* @returns The number of coplay friends, or 0 if unavailable
|
|
593
|
+
*
|
|
594
|
+
* @remarks
|
|
595
|
+
* "Coplay" refers to users you've recently been in multiplayer games with.
|
|
596
|
+
* Steam tracks these relationships automatically when you play games together.
|
|
597
|
+
*
|
|
598
|
+
* Use this with {@link getCoplayFriend} to iterate through all coplay friends.
|
|
599
|
+
*
|
|
600
|
+
* @example
|
|
601
|
+
* ```typescript
|
|
602
|
+
* const coplayCount = steam.friends.getCoplayFriendCount();
|
|
603
|
+
* console.log(`You've recently played with ${coplayCount} users`);
|
|
604
|
+
*
|
|
605
|
+
* for (let i = 0; i < coplayCount; i++) {
|
|
606
|
+
* const steamId = steam.friends.getCoplayFriend(i);
|
|
607
|
+
* const name = steam.friends.getFriendPersonaName(steamId);
|
|
608
|
+
* const time = steam.friends.getFriendCoplayTime(steamId);
|
|
609
|
+
* console.log(`Played with ${name} at ${new Date(time * 1000)}`);
|
|
610
|
+
* }
|
|
611
|
+
* ```
|
|
612
|
+
*
|
|
613
|
+
* @see {@link getCoplayFriend}
|
|
614
|
+
* @see {@link getFriendCoplayTime}
|
|
615
|
+
* @see {@link getFriendCoplayGame}
|
|
616
|
+
*/
|
|
617
|
+
getCoplayFriendCount(): number;
|
|
618
|
+
/**
|
|
619
|
+
* Gets a coplay friend's Steam ID by their index
|
|
620
|
+
*
|
|
621
|
+
* @param index - Zero-based index of the coplay friend (0 to {@link getCoplayFriendCount}() - 1)
|
|
622
|
+
* @returns The friend's Steam ID as a string, or empty string if the index is invalid
|
|
623
|
+
*
|
|
624
|
+
* @remarks
|
|
625
|
+
* Use this method to iterate through all users you've recently played with:
|
|
626
|
+
* 1. Call {@link getCoplayFriendCount} to get the total number
|
|
627
|
+
* 2. Loop from 0 to count-1 calling this method to get each Steam ID
|
|
628
|
+
* 3. Use the returned ID with {@link getFriendCoplayTime} and {@link getFriendCoplayGame}
|
|
629
|
+
*
|
|
630
|
+
* @example
|
|
631
|
+
* ```typescript
|
|
632
|
+
* const count = steam.friends.getCoplayFriendCount();
|
|
633
|
+
* for (let i = 0; i < count; i++) {
|
|
634
|
+
* const steamId = steam.friends.getCoplayFriend(i);
|
|
635
|
+
* if (steamId) {
|
|
636
|
+
* const name = steam.friends.getFriendPersonaName(steamId);
|
|
637
|
+
* const appId = steam.friends.getFriendCoplayGame(steamId);
|
|
638
|
+
* console.log(`Played with ${name} in app ${appId}`);
|
|
639
|
+
* }
|
|
640
|
+
* }
|
|
641
|
+
* ```
|
|
642
|
+
*
|
|
643
|
+
* @see {@link getCoplayFriendCount}
|
|
644
|
+
* @see {@link getFriendCoplayTime}
|
|
645
|
+
*/
|
|
646
|
+
getCoplayFriend(index: number): string;
|
|
647
|
+
/**
|
|
648
|
+
* Gets the last time you played with a specific user
|
|
649
|
+
*
|
|
650
|
+
* @param steamId - The friend's Steam ID as a string
|
|
651
|
+
* @returns Unix timestamp of when you last played together, or 0 if never/unavailable
|
|
652
|
+
*
|
|
653
|
+
* @remarks
|
|
654
|
+
* Returns the Unix timestamp (seconds since January 1, 1970) of the most recent
|
|
655
|
+
* time you were in a multiplayer game with this user.
|
|
656
|
+
*
|
|
657
|
+
* Returns 0 if:
|
|
658
|
+
* - You've never played with this user
|
|
659
|
+
* - The information is not available
|
|
660
|
+
* - The Steam API is not initialized
|
|
661
|
+
*
|
|
662
|
+
* @example
|
|
663
|
+
* ```typescript
|
|
664
|
+
* const steamId = steam.friends.getCoplayFriend(0);
|
|
665
|
+
* const timestamp = steam.friends.getFriendCoplayTime(steamId);
|
|
666
|
+
*
|
|
667
|
+
* if (timestamp > 0) {
|
|
668
|
+
* const date = new Date(timestamp * 1000);
|
|
669
|
+
* console.log(`Last played together on: ${date.toLocaleDateString()}`);
|
|
670
|
+
* }
|
|
671
|
+
* ```
|
|
672
|
+
*
|
|
673
|
+
* @see {@link getCoplayFriend}
|
|
674
|
+
* @see {@link getFriendCoplayGame}
|
|
675
|
+
*/
|
|
676
|
+
getFriendCoplayTime(steamId: string): number;
|
|
677
|
+
/**
|
|
678
|
+
* Gets the App ID of the game you last played with a specific user
|
|
679
|
+
*
|
|
680
|
+
* @param steamId - The friend's Steam ID as a string
|
|
681
|
+
* @returns The Steam App ID of the game, or 0 if never/unavailable
|
|
682
|
+
*
|
|
683
|
+
* @remarks
|
|
684
|
+
* Returns the Steam App ID of the game you most recently played together with this user.
|
|
685
|
+
*
|
|
686
|
+
* Returns 0 if:
|
|
687
|
+
* - You've never played with this user
|
|
688
|
+
* - The information is not available
|
|
689
|
+
* - The Steam API is not initialized
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const count = steam.friends.getCoplayFriendCount();
|
|
694
|
+
* for (let i = 0; i < count; i++) {
|
|
695
|
+
* const steamId = steam.friends.getCoplayFriend(i);
|
|
696
|
+
* const name = steam.friends.getFriendPersonaName(steamId);
|
|
697
|
+
* const appId = steam.friends.getFriendCoplayGame(steamId);
|
|
698
|
+
* const time = steam.friends.getFriendCoplayTime(steamId);
|
|
699
|
+
*
|
|
700
|
+
* console.log(`Played with ${name} in App ${appId}`);
|
|
701
|
+
* console.log(`Last played: ${new Date(time * 1000).toLocaleDateString()}`);
|
|
702
|
+
* }
|
|
703
|
+
* ```
|
|
704
|
+
*
|
|
705
|
+
* @example Get all coplay information
|
|
706
|
+
* ```typescript
|
|
707
|
+
* function getAllCoplayInfo(): CoplayFriendInfo[] {
|
|
708
|
+
* const count = steam.friends.getCoplayFriendCount();
|
|
709
|
+
* const coplayFriends: CoplayFriendInfo[] = [];
|
|
710
|
+
*
|
|
711
|
+
* for (let i = 0; i < count; i++) {
|
|
712
|
+
* const steamId = steam.friends.getCoplayFriend(i);
|
|
713
|
+
* if (steamId) {
|
|
714
|
+
* coplayFriends.push({
|
|
715
|
+
* steamId,
|
|
716
|
+
* coplayTime: steam.friends.getFriendCoplayTime(steamId),
|
|
717
|
+
* coplayGame: steam.friends.getFriendCoplayGame(steamId)
|
|
718
|
+
* });
|
|
719
|
+
* }
|
|
720
|
+
* }
|
|
721
|
+
*
|
|
722
|
+
* return coplayFriends;
|
|
723
|
+
* }
|
|
724
|
+
* ```
|
|
725
|
+
*
|
|
726
|
+
* @see {@link getCoplayFriend}
|
|
727
|
+
* @see {@link getFriendCoplayTime}
|
|
728
|
+
* @see {@link CoplayFriendInfo}
|
|
729
|
+
*/
|
|
730
|
+
getFriendCoplayGame(steamId: string): number;
|
|
364
731
|
}
|
|
365
732
|
//# sourceMappingURL=SteamFriendsManager.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SteamFriendsManager.d.ts","sourceRoot":"","sources":["../../src/internal/SteamFriendsManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE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