steamutils 1.2.36 → 1.2.38

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
+ </state>
5
+ </component>
@@ -2,8 +2,8 @@
2
2
  <module type="WEB_MODULE" version="4">
3
3
  <component name="NewModuleRootManager">
4
4
  <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
5
  <excludeFolder url="file://$MODULE_DIR$/.tmp" />
6
+ <excludeFolder url="file://$MODULE_DIR$/temp" />
7
7
  <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
8
  </content>
9
9
  <orderEntry type="inheritedJdk" />
package/.idea/vcs.xml CHANGED
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <project version="4">
3
3
  <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
4
+ <mapping directory="" vcs="Git" />
5
5
  </component>
6
6
  </project>
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
@@ -1041,6 +1104,9 @@ function SteamClient({
1041
1104
  })
1042
1105
 
1043
1106
  steamClient.chat.on('friendMessage', async (data) => {
1107
+ if (!data) return
1108
+ data.message_no_bbcode = data.message_no_bbcode?.replaceAll(`ː`,`:`)
1109
+ data.message = data.message?.replaceAll(`ː`,`:`)
1044
1110
  const example = {
1045
1111
  "steamid_friend": {
1046
1112
  "universe": 1,
@@ -1064,7 +1130,6 @@ function SteamClient({
1064
1130
  const steamId = data.steamid_friend.getSteamID64()
1065
1131
  const personas = await getPersonas([steamId])
1066
1132
  const player_name = personas.find(p => p.id == steamId)?.player_name || ''
1067
- log('friendMessage', data)
1068
1133
  const invite = [`Invited you to play a game!`, `Đã mời bạn chơi một trò chơi!`].includes(data.message_no_bbcode || data.message)
1069
1134
 
1070
1135
  callEvent(events.friendMessage, {
@@ -1557,6 +1622,8 @@ function SteamClient({
1557
1622
  return {
1558
1623
  init,
1559
1624
  partySearch,
1625
+ invite2Lobby,
1626
+ createLobby,
1560
1627
  partyRegister,
1561
1628
  requestCoPlays,
1562
1629
  getPersonas,
@@ -1648,6 +1715,12 @@ function SteamClient({
1648
1715
  return await steamClient.requestFreeLicense(...args)
1649
1716
  } catch (e) {
1650
1717
  }
1718
+ },
1719
+ getSteamId(){
1720
+ try {
1721
+ return steamClient.steamID.getSteamID64()
1722
+ } catch (e) {
1723
+ }
1651
1724
  }
1652
1725
  }
1653
1726
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "steamutils",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "main": "index.js",
5
5
  "dependencies": {
6
6
  "axios": "^1.4.0",
@@ -1,21 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
4
- <serverData>
5
- <paths name="steamsupport">
6
- <serverdata>
7
- <mappings>
8
- <mapping local="$PROJECT_DIR$" web="/" />
9
- </mappings>
10
- </serverdata>
11
- </paths>
12
- <paths name="steamsupportui">
13
- <serverdata>
14
- <mappings>
15
- <mapping local="$PROJECT_DIR$" web="/" />
16
- </mappings>
17
- </serverdata>
18
- </paths>
19
- </serverData>
20
- </component>
21
- </project>