steamutils 1.0.30 → 1.0.31

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
@@ -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) => {
@@ -530,13 +534,13 @@ function SteamClient({
530
534
  game_id: appid, game_extra_info: gamename
531
535
  }], true);
532
536
  } else {
533
- steamClient.gamesPlayed(appid, true)
537
+ // steamClient.gamesPlayed(appid, true)
534
538
  }
535
539
 
536
540
  steamClient.setPersona(SteamUser.EPersonaState.LookingToPlay)
537
541
 
538
542
  while (!steamClient.accountInfo) {
539
- await sleep(500)
543
+ await sleep(1000)
540
544
  }
541
545
 
542
546
  console.log(`app ${appid} launched on account ${getAccountInfoName()}`)
@@ -731,6 +735,16 @@ function SteamClient({
731
735
  return cookie || steamClient?.webSession?.cookies?.join?.(';')
732
736
  }
733
737
 
738
+ async function playCSGO() {
739
+ try {
740
+ await steamClient.requestFreeLicense(appid)
741
+ await sleep(5000)
742
+ } catch (e) {
743
+ }
744
+ steamClient.gamesPlayed(appid, true)
745
+ steamClient.setPersona(SteamUser.EPersonaState.LookingToPlay)
746
+ }
747
+
734
748
  return {
735
749
  init,
736
750
  partySearch,
@@ -750,6 +764,9 @@ function SteamClient({
750
764
  }
751
765
  events[name].push(cb)
752
766
  },
767
+ onEventLoggedOn(cb) {
768
+ events.loggedOn.push(cb)
769
+ },
753
770
  setPersona(state, name) {
754
771
  steamClient.setPersona(state, name)
755
772
  },
@@ -763,7 +780,11 @@ function SteamClient({
763
780
  },
764
781
  getAccountInfoName,
765
782
  getPlayersProfile,
766
- autoRequestFreeLicense
783
+ autoRequestFreeLicense,
784
+ playCSGO,
785
+ setInterval(cb, timeout){
786
+ intervals.push(setInterval(cb, timeout))
787
+ }
767
788
  }
768
789
  }
769
790
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",