steamutils 1.2.88 → 1.2.90

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/SteamClient.js +17 -9
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -340,9 +340,16 @@ function SteamClient({
340
340
 
341
341
  async function gamePlay() {
342
342
  let ownedApps = null
343
- while (!Array.isArray(ownedApps)) {
344
- ownedApps = (await (new SteamUtils(await getCookiesWait())).getDynamicStoreUserData())?.rgOwnedApps
343
+ for (let i = 0; i < 10; i++) {
344
+ if (!Array.isArray(ownedApps)) {
345
+ ownedApps = Array.isArray(steamClient.licenses) ? steamClient.licenses.map(({package_id}) => package_id) : (await (new SteamUtils(await getCookiesWait())).getDynamicStoreUserData())?.rgOwnedApps
346
+ await sleep(1000)
347
+ } else {
348
+ break
349
+ }
345
350
  }
351
+
352
+ ownedApps = _.shuffle(ownedApps || [])
346
353
  ownedApps.length = Math.min(ownedApps.length, 10)
347
354
  _.remove(ownedApps, 730)
348
355
  gamesPlayed([...ownedApps, 730])
@@ -946,8 +953,8 @@ function SteamClient({
946
953
  if (player) {
947
954
  player.prime = !!(player.ranking?.account_id || player.player_level || player.player_cur_xp)
948
955
  player.steamId = SteamID.fromIndividualAccountID(player.account_id).getSteamID64()
956
+ callGCCallback('PlayersProfile_' + player.account_id, player)
949
957
  }
950
- callGCCallback('PlayersProfile' + player?.account_id, player)
951
958
  callEvent(events.playersProfile, player)
952
959
  break
953
960
  }
@@ -1258,18 +1265,19 @@ function SteamClient({
1258
1265
  /*
1259
1266
  * usually take 400 -> 800 miliseconds
1260
1267
  * */
1261
- function getPlayersProfile(accountid) {
1268
+ function getPlayersProfile(steamId) {
1269
+ const accountid = new SteamID(steamId).accountid
1262
1270
  steamClient.sendToGC(730, Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientRequestPlayersProfile, {}, protoEncode(Protos.csgo.CMsgGCCStrike15_v2_ClientRequestPlayersProfile, {
1263
1271
  account_id: accountid, // account_id: new SteamID('76561199184696945').accountid,
1264
1272
  request_level: 32
1265
1273
  }))
1266
1274
  return new Promise(resolve => {
1267
- pushGCCallback('PlayersProfile' + accountid, resolve, 2000)
1275
+ pushGCCallback('PlayersProfile_' + accountid, resolve, 2000)
1268
1276
  })
1269
1277
  }
1270
1278
 
1271
- async function checkPlayerPrimeStatus(accountid) {
1272
- const profile = await getPlayersProfile(accountid)
1279
+ async function checkPlayerPrimeStatus(steamId) {
1280
+ const profile = await getPlayersProfile(steamId)
1273
1281
  if (!profile) return false
1274
1282
 
1275
1283
  if (profile.ranking?.account_id) {
@@ -1680,9 +1688,9 @@ function SteamClient({
1680
1688
  return steamClient
1681
1689
  },
1682
1690
  getAccountInfoName,
1683
- async getPlayersProfile(accountid, retry = 3){
1691
+ async getPlayersProfile(steamId, retry = 3){
1684
1692
  for (let i = 0; i < retry; i++) {
1685
- const profile = await getPlayersProfile(accountid)
1693
+ const profile = await getPlayersProfile(steamId)
1686
1694
  if(profile){
1687
1695
  return profile
1688
1696
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.88",
3
+ "version": "1.2.90",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.5.1",