steamutils 1.4.57 → 1.4.59

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 +56 -16
  2. package/package.json +1 -1
package/SteamClient.js CHANGED
@@ -191,7 +191,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
191
191
  }
192
192
  }
193
193
 
194
- delete events[name];
194
+ events[name] = [];
195
195
  }
196
196
 
197
197
  function onAnyEvent(callback) {
@@ -208,7 +208,7 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
208
208
  delete event.timeout;
209
209
  }
210
210
  }
211
- delete events[name];
211
+ events[name] = [];
212
212
  }
213
213
  onAnyCallbacks.length = 0;
214
214
  }
@@ -1994,11 +1994,38 @@ function SteamClient({ username, password, cookie, clientJsToken, isAutoRequestF
1994
1994
  }
1995
1995
 
1996
1996
  async function playCSGO() {
1997
- try {
1998
- await steamClient.requestFreeLicense(AppID);
1999
- await sleep(5000);
2000
- } catch (e) {}
2001
- gamesPlayed(AppID);
1997
+ games = 730;
1998
+ isInvisible = false;
1999
+ isAutoPlay = true;
2000
+ isPartyRegister = false;
2001
+ const online = await new Promise((resolve) => {
2002
+ onEvent(
2003
+ SteamClientEvents.csgoOnline,
2004
+ function () {
2005
+ resolve(true);
2006
+ },
2007
+ true,
2008
+ );
2009
+ onEvent(
2010
+ SteamClientEvents.error,
2011
+ function () {
2012
+ resolve(false);
2013
+ },
2014
+ true,
2015
+ );
2016
+ onEvent(
2017
+ SteamClientEvents.playingState,
2018
+ function ({ playing_blocked, playing_app }) {
2019
+ if (playing_blocked) {
2020
+ resolve(false);
2021
+ }
2022
+ },
2023
+ true,
2024
+ );
2025
+ init();
2026
+ });
2027
+ steamClient.offAllEvent();
2028
+ return online;
2002
2029
  }
2003
2030
 
2004
2031
  function doFakeGameScore() {
@@ -2558,17 +2585,29 @@ SteamClient.isAccountPlayable = async function isAccountPlayable({ cookie, clien
2558
2585
  ...rest,
2559
2586
  });
2560
2587
 
2561
- steamClient.onEvent(SteamClientEvents.error, ({ eresult, msg, error }) => {
2562
- doResolve({ eresult, msg, error });
2563
- });
2588
+ steamClient.onEvent(
2589
+ SteamClientEvents.error,
2590
+ ({ eresult, msg, error }) => {
2591
+ doResolve({ eresult, msg, error });
2592
+ },
2593
+ true,
2594
+ );
2564
2595
 
2565
- steamClient.onEvent(SteamClientEvents.csgoOnline, (ClientWelcome) => {
2566
- doResolve({ playable: true });
2567
- });
2596
+ steamClient.onEvent(
2597
+ SteamClientEvents.csgoOnline,
2598
+ (ClientWelcome) => {
2599
+ doResolve({ playable: true });
2600
+ },
2601
+ true,
2602
+ );
2568
2603
 
2569
- steamClient.onEvent(SteamClientEvents.csgoClientHello, (ClientHello) => {
2570
- doResolve({ playable: true });
2571
- });
2604
+ steamClient.onEvent(
2605
+ SteamClientEvents.csgoClientHello,
2606
+ (ClientHello) => {
2607
+ doResolve({ playable: true });
2608
+ },
2609
+ true,
2610
+ );
2572
2611
 
2573
2612
  steamClient.onEvent(SteamClientEvents.playingState, ({ playing_blocked, playing_app }) => {
2574
2613
  if (playing_blocked) {
@@ -2616,6 +2655,7 @@ SteamClient.isAccountPlayable = async function isAccountPlayable({ cookie, clien
2616
2655
  steamClient.logOff();
2617
2656
  return resolve(data);
2618
2657
  } else {
2658
+ steamClient.offAllEvent();
2619
2659
  return resolve({ ...data, steamClient });
2620
2660
  }
2621
2661
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.4.57",
3
+ "version": "1.4.59",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "alpha-common-utils": "^1.0.6",