steamutils 1.3.41 → 1.3.42
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.
- package/SteamClient.js +46 -0
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -2267,3 +2267,49 @@ export default SteamClient
|
|
2267
2267
|
export function increaseCSGO_VER() {
|
2268
2268
|
return ++CSGO_VER
|
2269
2269
|
}
|
2270
|
+
|
2271
|
+
SteamClient.isAccountPlayable = function isAccountPlayable(cookie, timeoutMs) {
|
2272
|
+
return new Promise((resolve) => {
|
2273
|
+
const timeout = setTimeout(() => {
|
2274
|
+
doResolve();
|
2275
|
+
}, timeoutMs || 30000);
|
2276
|
+
|
2277
|
+
const steamClient = new SteamClient({
|
2278
|
+
cookie,
|
2279
|
+
isFakeGameScore: false,
|
2280
|
+
isAutoPlay: true,
|
2281
|
+
isPartyRegister: false,
|
2282
|
+
isInvisible: false,
|
2283
|
+
MAX_GAME_PLAY: 10,
|
2284
|
+
});
|
2285
|
+
|
2286
|
+
steamClient.onEvent("error", ({eresult, msg, error}) => {
|
2287
|
+
doResolve();
|
2288
|
+
});
|
2289
|
+
|
2290
|
+
steamClient.onEvent("csgoOnline", ClientWelcome => {
|
2291
|
+
doResolve(ClientWelcome);
|
2292
|
+
});
|
2293
|
+
|
2294
|
+
steamClient.onEvent("csgoClientHello", ClientHello => {
|
2295
|
+
doResolve(ClientHello);
|
2296
|
+
});
|
2297
|
+
|
2298
|
+
steamClient.onEvent("playingState", ({playing_blocked, playing_app}) => {
|
2299
|
+
if (playing_blocked) {
|
2300
|
+
doResolve();
|
2301
|
+
}
|
2302
|
+
},
|
2303
|
+
);
|
2304
|
+
|
2305
|
+
steamClient.init();
|
2306
|
+
|
2307
|
+
function doResolve(data) {
|
2308
|
+
clearTimeout(timeout);
|
2309
|
+
steamClient.doClearIntervals();
|
2310
|
+
steamClient.offAllEvent();
|
2311
|
+
steamClient.logOff();
|
2312
|
+
return resolve(!!data);
|
2313
|
+
}
|
2314
|
+
});
|
2315
|
+
}
|