steamutils 1.0.72 → 1.0.74

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.
@@ -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
@@ -84,7 +84,8 @@ function SteamClient({
84
84
  password,
85
85
  cookie,
86
86
  isAutoRequestFreeLicense = true,
87
- isPartyRegister = true
87
+ isPartyRegister = true,
88
+ autoPlay = false
88
89
  }) {
89
90
  const steamClient = new SteamUser()
90
91
  let prime = null
@@ -198,6 +199,21 @@ function SteamClient({
198
199
  }
199
200
  }
200
201
 
202
+ function doClearInterval(key) {
203
+ try {
204
+ clearInterval(intervals[key])
205
+ } catch (e) {
206
+ }
207
+ delete intervals[key]
208
+
209
+
210
+ try {
211
+ clearTimeout(intervalRandoms[key])
212
+ } catch (e) {
213
+ }
214
+ delete intervalRandoms[key]
215
+ }
216
+
201
217
  function getAccountInfoName() {
202
218
  return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
203
219
  }
@@ -251,6 +267,21 @@ function SteamClient({
251
267
  })
252
268
  }
253
269
 
270
+ async function autoGamePlay() {
271
+ let ownedApps = null
272
+ while (!Array.isArray(ownedApps)) {
273
+ ownedApps = (await (new SteamUtils(cookie)).getDynamicStoreUserData())?.rgOwnedApps
274
+ }
275
+ ownedApps.length = Math.min(ownedApps.length, 30)
276
+ _.remove(ownedApps, 730)
277
+ steamClient.gamesPlayed([...ownedApps, 730])
278
+ }
279
+
280
+ async function offAutoGamePlay() {
281
+ steamClient.gamesPlayed([])
282
+ doClearInterval('autoGamePlay')
283
+ }
284
+
254
285
 
255
286
  /**
256
287
  * Get a list of lobbies (* = Unsure description could be wrong)
@@ -651,6 +682,11 @@ function SteamClient({
651
682
  autoRequestFreeLicense(false, 50)
652
683
  }, 60000, 'autoRequestFreeLicense')
653
684
  }
685
+
686
+ if (autoPlay) {
687
+ autoGamePlay()
688
+ doSetInterval(autoGamePlay, [15 * 60000, 30 * 60000], 'autoGamePlay')
689
+ }
654
690
  })
655
691
 
656
692
 
@@ -1083,6 +1119,9 @@ function SteamClient({
1083
1119
  gamesPlayed,
1084
1120
  sendHello,
1085
1121
  checkPlayerPrimeStatus,
1122
+ doClearInterval,
1123
+ autoGamePlay,
1124
+ offAutoGamePlay,
1086
1125
  }
1087
1126
  }
1088
1127
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "dependencies": {
5
5
  "axios": "^1.3.4",
6
6
  "cheerio": "^1.0.0-rc.12",
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
4
- </state>
5
- </component>