steamutils 1.3.2 → 1.3.3

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 +50 -16
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -92,7 +92,7 @@ function SteamClient({
92
92
  isAutoRequestFreeLicense = true,
93
93
  isFakeGameScore = true,
94
94
  isPartyRegister = true,
95
- autoPlay = false,
95
+ isAutoPlay = false,
96
96
  autoAcceptTradeRequest = false,
97
97
  autoReconnect = true,
98
98
  MAX_GAME_PLAY = 10
@@ -370,6 +370,15 @@ function SteamClient({
370
370
  }
371
371
 
372
372
 
373
+ async function updateAutoGamePlay() {
374
+ if (isAutoPlay) {
375
+ autoGamePlay()
376
+ } else {
377
+ offAutoGamePlay()
378
+ }
379
+ }
380
+
381
+
373
382
  /**
374
383
  * Get a list of lobbies (* = Unsure description could be wrong)
375
384
  * @param {Number} ver Game version we are searching for
@@ -980,14 +989,8 @@ function SteamClient({
980
989
  state = 'Online'
981
990
  await sendHello()
982
991
  callEvent(events.loggedOn, loggedOnResponse)
983
- if (isAutoRequestFreeLicense) {
984
- doSetInterval(function () {
985
- autoRequestFreeLicense(false, 50)
986
- }, [5 * 60000, 10 * 60000], 'autoRequestFreeLicense')
987
- }
988
- if (autoPlay) {
989
- autoGamePlay()
990
- }
992
+ updateAutoRequestFreeLicense()
993
+ updateAutoGamePlay()
991
994
  },
992
995
  async user(steamId, data) {
993
996
  callEvent(events.user, {steamId: steamId.getSteamID64(), data})
@@ -1602,6 +1605,16 @@ function SteamClient({
1602
1605
  }
1603
1606
  }
1604
1607
 
1608
+ function updateAutoRequestFreeLicense() {
1609
+ if (isAutoRequestFreeLicense) {
1610
+ doSetInterval(function () {
1611
+ autoRequestFreeLicense(false, 50)
1612
+ }, [5 * 60000, 10 * 60000], 'autoRequestFreeLicense')
1613
+ } else {
1614
+ doClearInterval('autoRequestFreeLicense')
1615
+ }
1616
+ }
1617
+
1605
1618
  async function gamesPlayed(apps) {
1606
1619
  if (!Array.isArray(apps)) {
1607
1620
  apps = [apps]
@@ -1771,18 +1784,39 @@ function SteamClient({
1771
1784
  gamePlay,
1772
1785
  autoGamePlay,
1773
1786
  offAutoGamePlay,
1787
+ updateAutoGamePlay,
1774
1788
  getFriendsList,
1775
1789
  setIsPartyRegister(_isPartyRegister) {
1776
- isPartyRegister = _isPartyRegister
1777
- if (!_isPartyRegister) {
1778
- doClearInterval('autoPartyRegister')
1779
- } else {
1780
- sendHello()
1790
+ _isPartyRegister = !!_isPartyRegister
1791
+ if (isPartyRegister !== isPartyRegister) {
1792
+ isPartyRegister = _isPartyRegister
1793
+ if (!isPartyRegister) {
1794
+ doClearInterval('autoPartyRegister')
1795
+ } else {
1796
+ sendHello()
1797
+ }
1798
+ }
1799
+ },
1800
+ setAutoPlay(_isAutoPlay) {
1801
+ _isAutoPlay = !!_isAutoPlay
1802
+ if (isAutoPlay !== _isAutoPlay) {
1803
+ isAutoPlay = _isAutoPlay
1804
+ updateAutoGamePlay()
1781
1805
  }
1782
1806
  },
1783
1807
  setFakeGameScore(_isFakeGameScore) {
1784
- isFakeGameScore = _isFakeGameScore
1785
- updateFakeGameScore()
1808
+ _isFakeGameScore = !!_isFakeGameScore
1809
+ if (isFakeGameScore !== _isFakeGameScore) {
1810
+ isFakeGameScore = _isFakeGameScore
1811
+ updateFakeGameScore()
1812
+ }
1813
+ },
1814
+ setAutoRequestFreeLicense(_isAutoRequestFreeLicense) {
1815
+ _isAutoRequestFreeLicense = !!_isAutoRequestFreeLicense
1816
+ if (isAutoRequestFreeLicense !== _isAutoRequestFreeLicense) {
1817
+ isAutoRequestFreeLicense = _isAutoRequestFreeLicense
1818
+ updateAutoRequestFreeLicense()
1819
+ }
1786
1820
  },
1787
1821
  getState() {
1788
1822
  return state
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.3.02",
3
+ "version": "1.3.03",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.5.1",