steamutils 1.2.12 → 1.2.14

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/SteamClient.js CHANGED
@@ -11,6 +11,7 @@ import path from "path";
11
11
  import SteamUtils from "./index.js";
12
12
  import {v4 as uuidv4} from 'uuid';
13
13
  import EFriendRelationship from "steam-user/enums/EFriendRelationship.js";
14
+ import SteamCommunity from "steamcommunity";
14
15
 
15
16
  const __filename = fileURLToPath(import.meta.url);
16
17
  const __dirname = path.dirname(__filename);
@@ -93,6 +94,7 @@ function SteamClient({
93
94
  let prime = null
94
95
  let state = 'Offline'//InGame, Online
95
96
  let isLogOff = false
97
+ let playingBlocked = null
96
98
  const richPresence = {}
97
99
 
98
100
  const events = {
@@ -392,25 +394,24 @@ function SteamClient({
392
394
  const isSuccess = await login(true)
393
395
  if (isSuccess) {
394
396
  const loggedOnResponse = await new Promise(resolve => {
395
- onEvent('loggedOn', function (loggedOnResponse) {
396
- resolve(loggedOnResponse)
397
- }, true, 120000)
397
+ onEvent('loggedOn', resolve, true, 180000)
398
398
  })
399
399
  if (loggedOnResponse) {
400
400
  console.log("Relogin success")
401
401
  return true
402
402
  } else {
403
+ await sleep(120000)
403
404
  return await relogin(retry - 1)
404
405
  }
405
406
  } else {
406
- await sleep(60000)
407
+ await sleep(120000)
407
408
  return await relogin(retry - 1)
408
409
  }
409
410
  }
410
411
  }
411
412
 
412
413
  await sleep(60000)
413
- const isSuccess = await relogin(10)
414
+ const isSuccess = await relogin(20)
414
415
  if (!isSuccess) {
415
416
  doClearIntervals()
416
417
  }
@@ -925,6 +926,7 @@ function SteamClient({
925
926
  });
926
927
 
927
928
  steamClient.on('playingState', async function (playing_blocked, playing_app) {
929
+ playingBlocked = playing_blocked
928
930
  if(playing_app === 0){
929
931
  playing_app = null
930
932
  }
@@ -972,6 +974,12 @@ function SteamClient({
972
974
  steamClient.on('friendsList', async function () {
973
975
  callEvent(events.friendsList, getFriendList())
974
976
  });
977
+
978
+ steamClient.on('gifts', async function (gid, packageid, TimeCreated, TimeExpiration, TimeSent, TimeAcked, TimeRedeemed, RecipientAddress, SenderAddress, SenderName) {
979
+ const community = new SteamCommunity();
980
+ community.setCookies(await getCookiesWait())
981
+ community.redeemGift(gid)
982
+ });
975
983
  }
976
984
 
977
985
  function getFriendList() {
@@ -1424,6 +1432,9 @@ function SteamClient({
1424
1432
  },
1425
1433
  getFriendList,
1426
1434
  logOff,
1435
+ isPlayingBlocked(){
1436
+ return playingBlocked
1437
+ }
1427
1438
  }
1428
1439
  }
1429
1440
 
package/index.js CHANGED
@@ -5408,6 +5408,9 @@ class SteamUser {
5408
5408
  case "Got an item drop": {
5409
5409
  break
5410
5410
  }
5411
+ case "Random item drop": {
5412
+ break
5413
+ }
5411
5414
  case "Purchased a gift": {
5412
5415
  break
5413
5416
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.12",
3
+ "version": "1.2.14",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.4.0",