steamutils 1.0.30 → 1.0.32

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.
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="JavaScriptLibraryMappings">
4
+ <includedPredefinedLibrary name="Node.js Core" />
5
+ </component>
6
+ </project>
@@ -2,8 +2,8 @@
2
2
  <module type="WEB_MODULE" version="4">
3
3
  <component name="NewModuleRootManager">
4
4
  <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
5
  <excludeFolder url="file://$MODULE_DIR$/temp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
7
  <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
8
  </content>
9
9
  <orderEntry type="inheritedJdk" />
package/.idea/vcs.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="VcsDirectoryMappings">
4
- <mapping directory="" vcs="Git" />
4
+ <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
5
  </component>
6
6
  </project>
package/SteamClient.js CHANGED
@@ -89,7 +89,7 @@ function SteamClient({
89
89
  cookie,
90
90
  }) {
91
91
  const steamClient = new SteamUser()
92
- let prime = false
92
+ let prime = null
93
93
  let gamename = null;
94
94
 
95
95
  const events = {
@@ -99,6 +99,8 @@ function SteamClient({
99
99
  friendTyping: [],
100
100
  }
101
101
 
102
+ const intervals = []
103
+
102
104
  function getAccountInfoName() {
103
105
  return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
104
106
  }
@@ -199,7 +201,8 @@ function SteamClient({
199
201
 
200
202
  function bindEvent() {
201
203
  steamClient.on('disconnected', async (eresult, msg) => {
202
- console.log('disconnected')
204
+ console.log('disconnected', eresult, msg)
205
+ intervals?.forEach(intervalID => clearInterval(intervalID))
203
206
  })
204
207
  steamClient.on('error', async (e) => {
205
208
  let errorStr = ``
@@ -222,6 +225,7 @@ function SteamClient({
222
225
  break
223
226
  }
224
227
  console.log('error', e?.message)
228
+ intervals?.forEach(intervalID => clearInterval(intervalID))
225
229
  })
226
230
 
227
231
  steamClient.on('webSession', (sessionID, cookies) => {
@@ -261,6 +265,7 @@ function SteamClient({
261
265
  break
262
266
  }
263
267
  case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientWelcome: {
268
+ prime = false
264
269
  const CMsgClientWelcome = protoDecode(Protos.csgo.CMsgClientWelcome, payload);
265
270
  for (const outofdate_cache of CMsgClientWelcome.outofdate_subscribed_caches) {
266
271
  for (const cache_object of outofdate_cache.objects) {
@@ -530,13 +535,13 @@ function SteamClient({
530
535
  game_id: appid, game_extra_info: gamename
531
536
  }], true);
532
537
  } else {
533
- steamClient.gamesPlayed(appid, true)
538
+ // steamClient.gamesPlayed(appid, true)
534
539
  }
535
540
 
536
541
  steamClient.setPersona(SteamUser.EPersonaState.LookingToPlay)
537
542
 
538
543
  while (!steamClient.accountInfo) {
539
- await sleep(500)
544
+ await sleep(1000)
540
545
  }
541
546
 
542
547
  console.log(`app ${appid} launched on account ${getAccountInfoName()}`)
@@ -666,6 +671,13 @@ function SteamClient({
666
671
 
667
672
 
668
673
  function partyRegister() {
674
+ _partyRegister(prime)
675
+ if (prime === null) {
676
+ _partyRegister(true)
677
+ }
678
+ }
679
+
680
+ function _partyRegister(prime) {
669
681
  console.log("partyRegister", getAccountInfoName(), prime);
670
682
  steamClient.sendToGC(730, Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Register, {}, protoEncode(Protos.csgo.CMsgGCCStrike15_v2_Party_Register, {
671
683
  // id : 0,
@@ -731,6 +743,16 @@ function SteamClient({
731
743
  return cookie || steamClient?.webSession?.cookies?.join?.(';')
732
744
  }
733
745
 
746
+ async function playCSGO() {
747
+ try {
748
+ await steamClient.requestFreeLicense(appid)
749
+ await sleep(5000)
750
+ } catch (e) {
751
+ }
752
+ steamClient.gamesPlayed(appid, true)
753
+ steamClient.setPersona(SteamUser.EPersonaState.LookingToPlay)
754
+ }
755
+
734
756
  return {
735
757
  init,
736
758
  partySearch,
@@ -750,6 +772,9 @@ function SteamClient({
750
772
  }
751
773
  events[name].push(cb)
752
774
  },
775
+ onEventLoggedOn(cb) {
776
+ events.loggedOn.push(cb)
777
+ },
753
778
  setPersona(state, name) {
754
779
  steamClient.setPersona(state, name)
755
780
  },
@@ -763,7 +788,11 @@ function SteamClient({
763
788
  },
764
789
  getAccountInfoName,
765
790
  getPlayersProfile,
766
- autoRequestFreeLicense
791
+ autoRequestFreeLicense,
792
+ playCSGO,
793
+ setInterval(cb, timeout){
794
+ intervals.push(setInterval(cb, timeout))
795
+ }
767
796
  }
768
797
  }
769
798
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",