steamutils 1.2.35 → 1.2.37
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +77 -3
- package/index.js +1 -1
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -12,6 +12,7 @@ import SteamUtils from "./index.js";
|
|
12
12
|
import {v4 as uuidv4} from 'uuid';
|
13
13
|
import EFriendRelationship from "steam-user/enums/EFriendRelationship.js";
|
14
14
|
import SteamCommunity from "steamcommunity";
|
15
|
+
import ELobbyType from "steam-user/enums/ELobbyType.js";
|
15
16
|
|
16
17
|
const __filename = fileURLToPath(import.meta.url);
|
17
18
|
const __dirname = path.dirname(__filename);
|
@@ -378,6 +379,50 @@ function SteamClient({
|
|
378
379
|
})
|
379
380
|
}
|
380
381
|
|
382
|
+
async function createLobby() {
|
383
|
+
console.log("createLobby");
|
384
|
+
steamClient.sendToGC(730, Protos.csgo.EMsg.k_EMsgClientMMSCreateLobby, null, protoEncode(Protos.csgo.CMsgClientMMSCreateLobby, {
|
385
|
+
app_id: 730,
|
386
|
+
routing_appid: 730,
|
387
|
+
max_members: 10,
|
388
|
+
lobby_type: ELobbyType.Public,
|
389
|
+
lobby_flags: 1,
|
390
|
+
cell_id: steamClient.cellID,
|
391
|
+
public_ip: {
|
392
|
+
v4: steamClient.publicIP,
|
393
|
+
},
|
394
|
+
persona_name_owner: steamClient.accountInfo.name,
|
395
|
+
metadata: null,
|
396
|
+
}))
|
397
|
+
}
|
398
|
+
|
399
|
+
async function invite2Lobby(lobbyID, steamId) {
|
400
|
+
const accountid = new SteamID(steamId).accountid;
|
401
|
+
// lobbyID = new SteamID(lobbyID).accountid;
|
402
|
+
|
403
|
+
// Protos.csgo.EMsg.k_EMsgGCHInviteUserToLobby
|
404
|
+
// Protos.csgo.EMsg.k_EMsgClientMMSInviteToLobby
|
405
|
+
steamClient.sendToGC(730, Protos.csgo.EMsg.k_EMsgClientMMSInviteToLobby, {}, protoEncode(Protos.csgo.CMsgClientMMSInviteToLobby, {
|
406
|
+
app_id: 730,
|
407
|
+
steam_id_lobby: lobbyID,
|
408
|
+
steam_id_user_invited: accountid,
|
409
|
+
}), function (...args) {
|
410
|
+
console.log("invite2Lobby response", args)
|
411
|
+
})
|
412
|
+
}
|
413
|
+
|
414
|
+
|
415
|
+
async function joinLobby(lobbyID) {
|
416
|
+
console.log("joinLobby", lobbyID.accountid);
|
417
|
+
steamClient.sendToGC(730, Protos.csgo.EMsg.k_EMsgClientMMSJoinLobby, {}, protoEncode(Protos.csgo.CMsgClientMMSJoinLobby, {
|
418
|
+
app_id: 730,
|
419
|
+
steam_id_lobby: lobbyID.accountid,
|
420
|
+
persona_name: steamClient.accountInfo.name,
|
421
|
+
}), function (...args) {
|
422
|
+
console.log("joinLobby response", args)
|
423
|
+
})
|
424
|
+
}
|
425
|
+
|
381
426
|
async function sendHello() {
|
382
427
|
steamClient.sendToGC(appid, Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello, {}, Buffer.alloc(0))
|
383
428
|
steamClient.sendToGC(appid, Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientHello, {}, Buffer.alloc(0))
|
@@ -465,6 +510,20 @@ function SteamClient({
|
|
465
510
|
callEvent(events.webSession, webSession)
|
466
511
|
})
|
467
512
|
|
513
|
+
// steamClient.on('lobbyInvite', (inviterID, lobbyID ) => {
|
514
|
+
// joinLobby(lobbyID)
|
515
|
+
// })
|
516
|
+
|
517
|
+
// steamClient.on('debug', (msg) => {
|
518
|
+
// if (!["ClientPersonaState","ClientClanState"].some(c => msg.includes(c))) {
|
519
|
+
// if(msg.startsWith("Received")){
|
520
|
+
// console.log(`------- ${msg}`)
|
521
|
+
// } else {
|
522
|
+
// console.log(msg)
|
523
|
+
// }
|
524
|
+
// }
|
525
|
+
// })
|
526
|
+
|
468
527
|
steamClient.on('receivedFromGC', async (appid, msgType, payload) => {
|
469
528
|
const key = getECsgoGCMsgKey(msgType)
|
470
529
|
switch (msgType) {
|
@@ -623,6 +682,10 @@ function SteamClient({
|
|
623
682
|
const result = protoDecode(Protos.csgo.CMsgClientUGSGetGlobalStatsResponse, payload)
|
624
683
|
break
|
625
684
|
}
|
685
|
+
case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer: {
|
686
|
+
const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportPlayer, payload)
|
687
|
+
break
|
688
|
+
}
|
626
689
|
case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientTextMsg: {
|
627
690
|
const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GC2ClientTextMsg, payload)
|
628
691
|
break
|
@@ -1423,6 +1486,9 @@ function SteamClient({
|
|
1423
1486
|
// steamClient.setPersona(SteamUser.EPersonaState.Online)
|
1424
1487
|
await sendHello()
|
1425
1488
|
|
1489
|
+
const isLongGame = true
|
1490
|
+
const maxRound = isLongGame ? 16 : 9
|
1491
|
+
|
1426
1492
|
if (apps.some(a => (a.game_id || a) == 730)) {
|
1427
1493
|
doSetInterval(function () {
|
1428
1494
|
const maps = [
|
@@ -1463,15 +1529,15 @@ function SteamClient({
|
|
1463
1529
|
]
|
1464
1530
|
|
1465
1531
|
if (richPresence.myScore === undefined) {
|
1466
|
-
richPresence.myScore = _.random(0,
|
1532
|
+
richPresence.myScore = _.random(0, maxRound)
|
1467
1533
|
}
|
1468
1534
|
if (richPresence.theirScore === undefined) {
|
1469
|
-
richPresence.theirScore = _.random(0,
|
1535
|
+
richPresence.theirScore = _.random(0, maxRound)
|
1470
1536
|
}
|
1471
1537
|
if (richPresence.map === undefined) {
|
1472
1538
|
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1473
1539
|
}
|
1474
|
-
if (richPresence.myScore ===
|
1540
|
+
if (richPresence.myScore === maxRound || richPresence.theirScore === maxRound) {
|
1475
1541
|
richPresence.myScore = 0
|
1476
1542
|
richPresence.theirScore = 0
|
1477
1543
|
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
@@ -1554,6 +1620,8 @@ function SteamClient({
|
|
1554
1620
|
return {
|
1555
1621
|
init,
|
1556
1622
|
partySearch,
|
1623
|
+
invite2Lobby,
|
1624
|
+
createLobby,
|
1557
1625
|
partyRegister,
|
1558
1626
|
requestCoPlays,
|
1559
1627
|
getPersonas,
|
@@ -1645,6 +1713,12 @@ function SteamClient({
|
|
1645
1713
|
return await steamClient.requestFreeLicense(...args)
|
1646
1714
|
} catch (e) {
|
1647
1715
|
}
|
1716
|
+
},
|
1717
|
+
getSteamId(){
|
1718
|
+
try {
|
1719
|
+
return steamClient.steamID.getSteamID64()
|
1720
|
+
} catch (e) {
|
1721
|
+
}
|
1648
1722
|
}
|
1649
1723
|
}
|
1650
1724
|
}
|
package/index.js
CHANGED
@@ -5993,7 +5993,7 @@ class SteamUser {
|
|
5993
5993
|
market_headertip_container_warning_el.find('ul.market_restrictions > li').each(function () {
|
5994
5994
|
const el = $(this);
|
5995
5995
|
el.find('a').remove()
|
5996
|
-
market_restrictions.push(el.text()
|
5996
|
+
market_restrictions.push(el.text().replaceAll(/\t/g,' ').replaceAll(/\s+/g,' ').trim())
|
5997
5997
|
})
|
5998
5998
|
return {
|
5999
5999
|
market_warning_header,
|