steamutils 1.3.27 → 1.3.30
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +42 -3
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -193,6 +193,19 @@ function SteamClient({
|
|
193
193
|
})
|
194
194
|
}
|
195
195
|
|
196
|
+
|
197
|
+
function offEvent(name) {
|
198
|
+
if (Array.isArray(events[name])) {
|
199
|
+
for (const eventElement of events[name]) {
|
200
|
+
if (eventElement.timeout) {
|
201
|
+
clearTimeout(eventElement.timeout)
|
202
|
+
}
|
203
|
+
}
|
204
|
+
}
|
205
|
+
|
206
|
+
delete events[name]
|
207
|
+
}
|
208
|
+
|
196
209
|
function onAnyEvent(callback) {
|
197
210
|
onAnyCallbacks.push(callback)
|
198
211
|
}
|
@@ -345,7 +358,22 @@ function SteamClient({
|
|
345
358
|
}
|
346
359
|
|
347
360
|
async function gamePlay() {
|
348
|
-
|
361
|
+
let ownedApps = []
|
362
|
+
for (let i = 0; i < 5; i++) {
|
363
|
+
ownedApps = await getUserOwnedApps()
|
364
|
+
if (ownedApps?.length) {
|
365
|
+
break
|
366
|
+
}
|
367
|
+
}
|
368
|
+
if (!ownedApps?.length) {
|
369
|
+
gamesPlayed(730)
|
370
|
+
} else {
|
371
|
+
ownedApps = ownedApps.map(({appid}) => appid)
|
372
|
+
ownedApps = _.shuffle(ownedApps)
|
373
|
+
ownedApps.length = Math.min(ownedApps.length, MAX_GAME_PLAY - 1)
|
374
|
+
_.remove(ownedApps, app => app == 730)
|
375
|
+
gamesPlayed([...ownedApps, 730])
|
376
|
+
}
|
349
377
|
}
|
350
378
|
|
351
379
|
async function autoGamePlay() {
|
@@ -410,7 +438,10 @@ function SteamClient({
|
|
410
438
|
}
|
411
439
|
|
412
440
|
async function createLobby() {
|
413
|
-
|
441
|
+
if (!steamClient.steamID) {
|
442
|
+
return
|
443
|
+
}
|
444
|
+
|
414
445
|
steamClient._send(
|
415
446
|
{
|
416
447
|
msg: Protos.csgo.EMsg.k_EMsgClientMMSCreateLobby,
|
@@ -453,7 +484,10 @@ function SteamClient({
|
|
453
484
|
}
|
454
485
|
|
455
486
|
async function updateLobby(lobbyID) {
|
456
|
-
|
487
|
+
if (!steamClient.steamID) {
|
488
|
+
return
|
489
|
+
}
|
490
|
+
|
457
491
|
steamClient._send(
|
458
492
|
{
|
459
493
|
msg: Protos.csgo.EMsg.k_EMsgClientMMSSetLobbyData,
|
@@ -504,6 +538,10 @@ function SteamClient({
|
|
504
538
|
}
|
505
539
|
|
506
540
|
async function invite2Lobby(lobbyID, steamId) {
|
541
|
+
if (!steamClient.steamID) {
|
542
|
+
return
|
543
|
+
}
|
544
|
+
|
507
545
|
steamClient._send(
|
508
546
|
{
|
509
547
|
msg: Protos.csgo.EMsg.k_EMsgClientMMSInviteToLobby,
|
@@ -1879,6 +1917,7 @@ function SteamClient({
|
|
1879
1917
|
return steamClient?._logOnDetails
|
1880
1918
|
},
|
1881
1919
|
onEvent,
|
1920
|
+
offEvent,
|
1882
1921
|
offAllEvent,
|
1883
1922
|
setPersona(state, name) {
|
1884
1923
|
steamClient.setPersona(state, name)
|