steamutils 1.2.74 → 1.2.77

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.
Files changed (218) hide show
  1. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  2. package/.idea/steamutils.iml +1 -1
  3. package/.idea/vcs.xml +1 -1
  4. package/SteamClient.js +723 -715
  5. package/free_packages.json +10048 -10048
  6. package/index.js +1 -1
  7. package/package.json +1 -1
  8. package/protos/csgo/base_gcmessages_csgo.proto +547 -547
  9. package/protos/csgo/c_peer2peer_netmessages.proto +55 -55
  10. package/protos/csgo/clientmessages.proto +48 -48
  11. package/protos/csgo/connectionless_netmessages.proto +19 -19
  12. package/protos/csgo/cs_gameevents.proto +34 -34
  13. package/protos/csgo/cs_usercmd.proto +34 -34
  14. package/protos/csgo/cstrike15_gcmessages.proto +1402 -1402
  15. package/protos/csgo/cstrike15_usermessages.proto +596 -596
  16. package/protos/csgo/demo.proto +160 -160
  17. package/protos/csgo/econ_gcmessages.proto +228 -228
  18. package/protos/csgo/engine_gcmessages.proto +14 -14
  19. package/protos/csgo/enums_clientserver.proto +1529 -1529
  20. package/protos/csgo/fatdemo.proto +125 -125
  21. package/protos/csgo/gameevents.proto +120 -120
  22. package/protos/csgo/gcsdk_gcmessages.proto +323 -323
  23. package/protos/csgo/gcsystemmsgs.proto +242 -242
  24. package/protos/csgo/netmessages.proto +604 -604
  25. package/protos/csgo/network_connection.proto +126 -126
  26. package/protos/csgo/networkbasetypes.proto +244 -244
  27. package/protos/csgo/networksystem_protomessages.proto +17 -17
  28. package/protos/csgo/steamdatagram_messages_auth.proto +65 -65
  29. package/protos/csgo/steamdatagram_messages_sdr.proto +534 -534
  30. package/protos/csgo/steammessages.proto +597 -597
  31. package/protos/csgo/steammessages_base.proto +301 -301
  32. package/protos/csgo/steammessages_cloud.steamworkssdk.proto +68 -68
  33. package/protos/csgo/steammessages_gamenetworkingui.proto +61 -61
  34. package/protos/csgo/steammessages_helprequest.steamworkssdk.proto +22 -22
  35. package/protos/csgo/steammessages_oauth.steamworkssdk.proto +18 -18
  36. package/protos/csgo/steammessages_player.steamworkssdk.proto +254 -254
  37. package/protos/csgo/steammessages_publishedfile.steamworkssdk.proto +233 -233
  38. package/protos/csgo/steammessages_steamlearn.steamworkssdk.proto +357 -357
  39. package/protos/csgo/steammessages_unified_base.steamworkssdk.proto +30 -30
  40. package/protos/csgo/steamnetworkingsockets_messages.proto +205 -205
  41. package/protos/csgo/steamnetworkingsockets_messages_certs.proto +39 -39
  42. package/protos/csgo/steamnetworkingsockets_messages_udp.proto +75 -75
  43. package/protos/csgo/te.proto +259 -259
  44. package/protos/csgo/uifontfile_format.proto +13 -13
  45. package/protos/csgo/usercmd.proto +38 -38
  46. package/protos/csgo/usermessages.proto +721 -721
  47. package/protos/csgo/valveextensions.proto +17 -17
  48. package/protos/google/protobuf/descriptor.proto +281 -281
  49. package/protos/steam/clientmetrics.proto +45 -45
  50. package/protos/steam/content_manifest.proto +62 -62
  51. package/protos/steam/contenthubs.proto +41 -41
  52. package/protos/steam/encrypted_app_ticket.proto +10 -10
  53. package/protos/steam/enums.proto +444 -444
  54. package/protos/steam/enums_clientserver.proto +1539 -1539
  55. package/protos/steam/enums_productinfo.proto +13 -13
  56. package/protos/steam/htmlmessages.proto +1027 -1027
  57. package/protos/steam/offline_ticket.proto +8 -8
  58. package/protos/steam/renderer/rendermessages.proto +893 -893
  59. package/protos/steam/steamdatagram_messages_auth.proto +65 -65
  60. package/protos/steam/steamdatagram_messages_sdr.proto +533 -533
  61. package/protos/steam/steammessages_accounthardware.steamclient.proto +201 -201
  62. package/protos/steam/steammessages_appoverview.proto +187 -187
  63. package/protos/steam/steammessages_auth.steamclient.proto +435 -435
  64. package/protos/steam/steammessages_base.proto +332 -332
  65. package/protos/steam/steammessages_broadcast.steamclient.proto +759 -759
  66. package/protos/steam/steammessages_chat.steamclient.proto +1281 -1281
  67. package/protos/steam/steammessages_client_objects.proto +645 -645
  68. package/protos/steam/steammessages_clientlanp2p.proto +42 -42
  69. package/protos/steam/steammessages_clientmetrics.steamclient.proto +194 -194
  70. package/protos/steam/steammessages_clientnotificationtypes.proto +231 -231
  71. package/protos/steam/steammessages_clientserver.proto +392 -392
  72. package/protos/steam/steammessages_clientserver_2.proto +760 -760
  73. package/protos/steam/steammessages_clientserver_appinfo.proto +131 -131
  74. package/protos/steam/steammessages_clientserver_friends.proto +260 -260
  75. package/protos/steam/steammessages_clientserver_gameservers.proto +159 -159
  76. package/protos/steam/steammessages_clientserver_lbs.proto +70 -70
  77. package/protos/steam/steammessages_clientserver_login.proto +167 -167
  78. package/protos/steam/steammessages_clientserver_ucm.proto +205 -205
  79. package/protos/steam/steammessages_clientserver_uds.proto +124 -124
  80. package/protos/steam/steammessages_clientserver_ufs.proto +172 -172
  81. package/protos/steam/steammessages_clientserver_userstats.proto +80 -80
  82. package/protos/steam/steammessages_clientsettings.proto +168 -168
  83. package/protos/steam/steammessages_cloud.steamclient.proto +513 -513
  84. package/protos/steam/steammessages_contentsystem.steamclient.proto +115 -115
  85. package/protos/steam/steammessages_credentials.steamclient.proto +115 -115
  86. package/protos/steam/steammessages_datapublisher.steamclient.proto +116 -116
  87. package/protos/steam/steammessages_depotbuilder.steamclient.proto +118 -118
  88. package/protos/steam/steammessages_deviceauth.steamclient.proto +203 -203
  89. package/protos/steam/steammessages_econ.steamclient.proto +150 -150
  90. package/protos/steam/steammessages_friendmessages.steamclient.proto +168 -168
  91. package/protos/steam/steammessages_gamenetworking.steamclient.proto +32 -32
  92. package/protos/steam/steammessages_gamenetworkingui.proto +61 -61
  93. package/protos/steam/steammessages_gamenotifications.steamclient.proto +156 -156
  94. package/protos/steam/steammessages_gameservers.steamclient.proto +152 -152
  95. package/protos/steam/steammessages_hiddevices.proto +157 -157
  96. package/protos/steam/steammessages_inventory.steamclient.proto +224 -224
  97. package/protos/steam/steammessages_linkfilter.steamclient.proto +49 -49
  98. package/protos/steam/steammessages_lobbymatchmaking.steamclient.proto +33 -33
  99. package/protos/steam/steammessages_market.steamclient.proto +26 -26
  100. package/protos/steam/steammessages_marketingmessages.steamclient.proto +274 -274
  101. package/protos/steam/steammessages_offline.steamclient.proto +40 -40
  102. package/protos/steam/steammessages_parental.steamclient.proto +228 -228
  103. package/protos/steam/steammessages_parties.steamclient.proto +94 -94
  104. package/protos/steam/steammessages_partnerapps.steamclient.proto +138 -138
  105. package/protos/steam/steammessages_player.steamclient.proto +1060 -1060
  106. package/protos/steam/steammessages_publishedfile.steamclient.proto +813 -813
  107. package/protos/steam/steammessages_qms.steamclient.proto +125 -125
  108. package/protos/steam/steammessages_remoteclient.proto +99 -99
  109. package/protos/steam/steammessages_remoteclient_discovery.proto +235 -235
  110. package/protos/steam/steammessages_remoteclient_service.steamclient.proto +86 -86
  111. package/protos/steam/steammessages_remoteclient_service_messages.proto +217 -217
  112. package/protos/steam/steammessages_remoteplay.proto +976 -976
  113. package/protos/steam/steammessages_secrets.steamclient.proto +39 -39
  114. package/protos/steam/steammessages_shader.steamclient.proto +108 -108
  115. package/protos/steam/steammessages_site_license.steamclient.proto +128 -128
  116. package/protos/steam/steammessages_sitelicenseclient.proto +38 -38
  117. package/protos/steam/steammessages_siteserverui.proto +130 -130
  118. package/protos/steam/steammessages_star.steamclient.proto +64 -64
  119. package/protos/steam/steammessages_steamtv.steamclient.proto +630 -630
  120. package/protos/steam/steammessages_store.steamclient.proto +371 -371
  121. package/protos/steam/steammessages_storebrowse.steamclient.proto +402 -402
  122. package/protos/steam/steammessages_timedtrial.steamclient.proto +50 -50
  123. package/protos/steam/steammessages_twofactor.steamclient.proto +186 -186
  124. package/protos/steam/steammessages_unified_base.steamclient.proto +33 -33
  125. package/protos/steam/steammessages_unified_test.steamclient.proto +61 -61
  126. package/protos/steam/steammessages_useraccount.steamclient.proto +249 -249
  127. package/protos/steam/steammessages_vac.steamclient.proto +44 -44
  128. package/protos/steam/steammessages_video.steamclient.proto +171 -171
  129. package/protos/steam/steammessages_virtualcontroller.proto +138 -138
  130. package/protos/steam/steammessages_workshop.steamclient.proto +23 -23
  131. package/protos/steam/steamnetworkingsockets_messages.proto +205 -205
  132. package/protos/steam/steamnetworkingsockets_messages_certs.proto +39 -39
  133. package/protos/steam/steamnetworkingsockets_messages_udp.proto +75 -75
  134. package/protos/steam/webuimessages_base.proto +24 -24
  135. package/protos/steam/webuimessages_gamenotes.proto +21 -21
  136. package/protos/steam/webuimessages_steamengine.proto +32 -32
  137. package/protos/steam/webuimessages_storagedevicemanager.proto +110 -110
  138. package/protos/steam/webuimessages_systemmanager.proto +17 -17
  139. package/protos/steam/webuimessages_transport.proto +18 -18
  140. package/protos/steam/webuimessages_transportvalidation.proto +97 -97
  141. package/protos/webui/common.proto +5508 -5508
  142. package/protos/webui/common_base.proto +27 -27
  143. package/protos/webui/service_accountlinking.proto +27 -27
  144. package/protos/webui/service_accountprivacy.proto +42 -42
  145. package/protos/webui/service_auction.proto +97 -97
  146. package/protos/webui/service_authentication.proto +222 -222
  147. package/protos/webui/service_authenticationsupport.proto +74 -74
  148. package/protos/webui/service_broadcast.proto +562 -562
  149. package/protos/webui/service_chat.proto +11 -11
  150. package/protos/webui/service_chatroom.proto +810 -810
  151. package/protos/webui/service_chatusability.proto +107 -107
  152. package/protos/webui/service_clan.proto +41 -41
  153. package/protos/webui/service_clanchatrooms.proto +25 -25
  154. package/protos/webui/service_clanfaqs.proto +202 -202
  155. package/protos/webui/service_clientcomm.proto +150 -150
  156. package/protos/webui/service_clientmetrics.proto +63 -63
  157. package/protos/webui/service_cloud.proto +222 -222
  158. package/protos/webui/service_cloudconfigstore.proto +51 -51
  159. package/protos/webui/service_cloudgaming.proto +30 -30
  160. package/protos/webui/service_community.proto +365 -365
  161. package/protos/webui/service_econ.proto +134 -134
  162. package/protos/webui/service_embedded.proto +24 -24
  163. package/protos/webui/service_experimentservice.proto +6 -6
  164. package/protos/webui/service_fovasvideo.proto +15 -15
  165. package/protos/webui/service_friendmessages.proto +133 -133
  166. package/protos/webui/service_friendslist.proto +70 -70
  167. package/protos/webui/service_gamenotes.proto +15 -15
  168. package/protos/webui/service_helprequestlogs.proto +26 -26
  169. package/protos/webui/service_loyaltyrewards.proto +252 -252
  170. package/protos/webui/service_marketingmessages.proto +184 -184
  171. package/protos/webui/service_mobileapp.proto +18 -18
  172. package/protos/webui/service_mobileauth.proto +24 -24
  173. package/protos/webui/service_mobiledevice.proto +26 -26
  174. package/protos/webui/service_mobileperaccount.proto +31 -31
  175. package/protos/webui/service_news.proto +101 -101
  176. package/protos/webui/service_parental.proto +178 -178
  177. package/protos/webui/service_partnermembershipinvite.proto +29 -29
  178. package/protos/webui/service_partnerstorebrowse.proto +6 -6
  179. package/protos/webui/service_phone.proto +51 -51
  180. package/protos/webui/service_physicalgoods.proto +15 -15
  181. package/protos/webui/service_player.proto +885 -885
  182. package/protos/webui/service_promotioneventinvites.proto +50 -50
  183. package/protos/webui/service_promotionplanning.proto +72 -72
  184. package/protos/webui/service_publishedfile.proto +687 -687
  185. package/protos/webui/service_publishing.proto +119 -119
  186. package/protos/webui/service_quest.proto +127 -127
  187. package/protos/webui/service_salefeature.proto +315 -315
  188. package/protos/webui/service_saleitemrewards.proto +54 -54
  189. package/protos/webui/service_shoppingcart.proto +108 -108
  190. package/protos/webui/service_steamawards.proto +19 -19
  191. package/protos/webui/service_steamcharts.proto +75 -75
  192. package/protos/webui/service_steamengine.proto +36 -36
  193. package/protos/webui/service_steamlearn.proto +727 -727
  194. package/protos/webui/service_steamnotification.proto +84 -84
  195. package/protos/webui/service_steamtv.proto +495 -495
  196. package/protos/webui/service_steamvrvoicechat.proto +67 -67
  197. package/protos/webui/service_steamvrwebrtc.proto +48 -48
  198. package/protos/webui/service_storagedevicemanager.proto +104 -104
  199. package/protos/webui/service_store.proto +289 -289
  200. package/protos/webui/service_storeappsimilarity.proto +76 -76
  201. package/protos/webui/service_storebrowse.proto +73 -73
  202. package/protos/webui/service_storequery.proto +97 -97
  203. package/protos/webui/service_storesales.proto +15 -15
  204. package/protos/webui/service_storetopsellers.proto +44 -44
  205. package/protos/webui/service_systemmanager.proto +11 -11
  206. package/protos/webui/service_test_transporterror.proto +6 -6
  207. package/protos/webui/service_transportauth.proto +12 -12
  208. package/protos/webui/service_transportvalidation.proto +69 -69
  209. package/protos/webui/service_twofactor.proto +181 -181
  210. package/protos/webui/service_useraccount.proto +138 -138
  211. package/protos/webui/service_usergameactivity.proto +34 -34
  212. package/protos/webui/service_usergamenotes.proto +53 -53
  213. package/protos/webui/service_usernews.proto +68 -68
  214. package/protos/webui/service_userreviews.proto +96 -96
  215. package/protos/webui/service_video.proto +128 -128
  216. package/protos/webui/service_voicechat.proto +139 -139
  217. package/protos/webui/service_webrtc.proto +52 -52
  218. package/.idea/deployment.xml +0 -21
package/SteamClient.js CHANGED
@@ -75,7 +75,7 @@ export const LOCS = {
75
75
 
76
76
 
77
77
  const appid = 730
78
- export let CSGO_VER = 13956
78
+ export let CSGO_VER = 13958
79
79
  const FreeAppList = JSON.parse(fs.readFileSync(path.join(__dirname, 'free_packages.json'))).packages
80
80
 
81
81
  // SteamUtils.GetCurrentVersion(appid).then(function (ver) {
@@ -101,7 +101,8 @@ function SteamClient({
101
101
  let playingBlocked = null
102
102
  const richPresence = {}
103
103
  let sendMessageTimestamp = 0
104
- let lastTimePartyRegister = null
104
+ let lastTimePartyRegister = 0
105
+ let lastTimePartySearch = 0
105
106
 
106
107
  const onAnyCallbacks = []
107
108
 
@@ -379,6 +380,7 @@ function SteamClient({
379
380
  launcher: 0,
380
381
  game_type: game_type === 'Competitive' ? 8 : 10
381
382
  }))
383
+ lastTimePartySearch = new Date().getTime()
382
384
  pushGCCallback('partySearch', resolve, timeout)
383
385
  })
384
386
  }
@@ -441,444 +443,429 @@ function SteamClient({
441
443
 
442
444
 
443
445
  function bindEvent() {
444
- steamClient.on('disconnected', async (eresult, msg) => {
445
- state = 'Offline'
446
- log('disconnected', eresult, msg)
447
-
448
- callEvent(events.disconnected, {eresult, msg})
449
-
450
- if (['ServiceUnavailable', 'NoConnection'].includes(msg) && autoReconnect && !isLogOff) {
451
- async function relogin(retry) {
452
- if (retry <= 0) {
453
- console.error("Cannot relogin")
454
- return false
455
- } else {
456
- const isSuccess = await login(true)
457
- if (isSuccess) {
458
- const loggedOnResponse = await new Promise(resolve => {
459
- onEvent('loggedOn', resolve, true, 180000)
460
- })
461
- if (loggedOnResponse) {
462
- console.log("Relogin success")
463
- return true
446
+ const events = {
447
+ async disconnected(eresult, msg) {
448
+ state = 'Offline'
449
+ log('disconnected', eresult, msg)
450
+
451
+ callEvent(events.disconnected, {eresult, msg})
452
+
453
+ if (['ServiceUnavailable', 'NoConnection'].includes(msg) && autoReconnect && !isLogOff) {
454
+ async function relogin(retry) {
455
+ if (retry <= 0) {
456
+ console.error("Cannot relogin")
457
+ return false
458
+ } else {
459
+ const isSuccess = await login(true)
460
+ if (isSuccess) {
461
+ const loggedOnResponse = await new Promise(resolve => {
462
+ onEvent('loggedOn', resolve, true, 180000)
463
+ })
464
+ if (loggedOnResponse) {
465
+ console.log("Relogin success")
466
+ return true
467
+ } else {
468
+ await sleep(120000)
469
+ return await relogin(retry - 1)
470
+ }
464
471
  } else {
465
472
  await sleep(120000)
466
473
  return await relogin(retry - 1)
467
474
  }
468
- } else {
469
- await sleep(120000)
470
- return await relogin(retry - 1)
471
475
  }
472
476
  }
473
- }
474
477
 
475
- await sleep(60000)
476
- const isSuccess = await relogin(50)
477
- if (!isSuccess) {
478
+ await sleep(60000)
479
+ const isSuccess = await relogin(50)
480
+ if (!isSuccess) {
481
+ offAllEvent()
482
+ doClearIntervals()
483
+ }
484
+ } else {
478
485
  offAllEvent()
479
486
  doClearIntervals()
480
487
  }
481
- } else {
482
- offAllEvent()
483
- doClearIntervals()
484
- }
485
- })
486
- steamClient.on('error', async (e) => {
487
- let errorStr = ``
488
- switch (e.eresult) {
489
- case 5:
490
- errorStr = `Invalid Password`
491
- break
492
- case 6:
493
- case 34:
494
- errorStr = `Logged In Elsewhere`
495
- break
496
- case 84:
497
- errorStr = `Rate Limit Exceeded`
498
- break
499
- case 65:
500
- errorStr = `steam guard is invalid`
501
- break
502
- default:
503
- errorStr = `Unknown: ${e.eresult}`
504
- break
505
- }
506
- log('error', e?.message)
507
- doClearIntervals()
508
- callEvent(events.error, {eresult: e.eresult, msg: e.message, error: errorStr})
509
- })
510
-
511
- steamClient.on('webSession', (sessionID, cookies) => {
512
- const webSession = {sessionID, cookies};
513
- steamClient.webSession = webSession
514
- callEvent(events.webSession, webSession)
515
- })
516
-
517
- // steamClient.on('lobbyInvite', (inviterID, lobbyID ) => {
518
- // joinLobby(lobbyID)
519
- // })
520
-
521
- // steamClient.on('debug', (msg) => {
522
- // if (!["ClientPersonaState","ClientClanState"].some(c => msg.includes(c))) {
523
- // if(msg.startsWith("Received")){
524
- // console.log(`------- ${msg}`)
525
- // } else {
526
- // console.log(msg)
527
- // }
528
- // }
529
- // })
530
-
531
- steamClient.on('receivedFromGC', async (appid, msgType, payload) => {
532
- const key = getECsgoGCMsgKey(msgType)
533
- switch (msgType) {
534
- case Protos.csgo.EMsg.k_EMsgClientChatInvite: {
535
- log(payload)
536
- break
537
- }
538
- case Protos.csgo.ECsgoGCMsg.k_EMsgClientMMSJoinLobbyResponse: {
539
- let msg = protoDecode(Protos.csgo.CMsgClientMMSJoinLobbyResponse, payload)
540
- log(msg)
541
- break
488
+ },
489
+ async error(e) {
490
+ let errorStr = ``
491
+ switch (e.eresult) {
492
+ case 5:
493
+ errorStr = `Invalid Password`
494
+ break
495
+ case 6:
496
+ case 34:
497
+ errorStr = `Logged In Elsewhere`
498
+ break
499
+ case 84:
500
+ errorStr = `Rate Limit Exceeded`
501
+ break
502
+ case 65:
503
+ errorStr = `steam guard is invalid`
504
+ break
505
+ default:
506
+ errorStr = `Unknown: ${e.eresult}`
507
+ break
542
508
  }
543
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Invite: {
544
- const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_Invite, payload);
545
- const sid64 = SteamID.fromIndividualAccountID(msg.accountid).getSteamID64();
546
- if (events.partyInvite?.length) {
547
- const personas = await getPersonas([sid64]);
548
- const player_name = personas.find(p => p.id == sid64)?.player_name
549
- if (player_name === undefined) {
550
- log(sid64, personas);
509
+ log('error', e?.message)
510
+ doClearIntervals()
511
+ callEvent(events.error, {eresult: e.eresult, msg: e.message, error: errorStr})
512
+ },
513
+ async webSession(sessionID, cookies) {
514
+ const webSession = {sessionID, cookies};
515
+ steamClient.webSession = webSession
516
+ callEvent(events.webSession, webSession)
517
+ },
518
+ async receivedFromGC(appid, msgType, payload) {
519
+ const key = getECsgoGCMsgKey(msgType)
520
+ switch (msgType) {
521
+ case Protos.csgo.EMsg.k_EMsgClientChatInvite: {
522
+ log(payload)
523
+ break
524
+ }
525
+ case Protos.csgo.ECsgoGCMsg.k_EMsgClientMMSJoinLobbyResponse: {
526
+ let msg = protoDecode(Protos.csgo.CMsgClientMMSJoinLobbyResponse, payload)
527
+ log(msg)
528
+ break
529
+ }
530
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Invite: {
531
+ const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_Invite, payload);
532
+ const sid64 = SteamID.fromIndividualAccountID(msg.accountid).getSteamID64();
533
+ if (events.partyInvite?.length) {
534
+ const personas = await getPersonas([sid64]);
535
+ const player_name = personas.find(p => p.id == sid64)?.player_name
536
+ if (player_name === undefined) {
537
+ log(sid64, personas);
538
+ }
539
+ callEvent(events.partyInvite, {player_name, steamId: sid64, lobbyId: msg.lobbyid})
551
540
  }
552
- callEvent(events.partyInvite, {player_name, steamId: sid64, lobbyId: msg.lobbyid})
541
+ // log(player_name, `https://steamcommunity.com/profiles/${sid64}`);
542
+ // joinLobby(msg.lobbyid, msg.accountid)
543
+ break
553
544
  }
554
- // log(player_name, `https://steamcommunity.com/profiles/${sid64}`);
555
- // joinLobby(msg.lobbyid, msg.accountid)
556
- break
557
- }
558
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Account_RequestCoPlays: {
559
- const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Account_RequestCoPlays, payload);
560
- const personas = msg.players.map(p => SteamID.fromIndividualAccountID(p.accountid));
561
- callGCCallback('RequestCoPlays', personas)
562
- break
563
- }
564
- case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientWelcome: {
565
- prime = false
566
- const CMsgClientWelcome = protoDecode(Protos.csgo.CMsgClientWelcome, payload);
567
- const obj = {}
568
- for (const outofdate_cache of CMsgClientWelcome.outofdate_subscribed_caches) {
569
- for (const cache_object of outofdate_cache.objects) {
570
- for (const object_data of cache_object.object_data) {
571
- switch (cache_object.type_id) {
572
- case 1: {
573
- const result = protoDecode(Protos.csgo.CSOEconItem, object_data);
574
- break
575
- }
576
- case 2: {
577
- const result = protoDecode(Protos.csgo.CSOPersonaDataPublic, object_data);
578
- obj.PersonaDataPublic = result
579
- const example = {
580
- "player_level": 4,
581
- "commendation": {
582
- "cmd_friendly": 149,
583
- "cmd_teaching": 108,
584
- "cmd_leader": 115
585
- },
586
- "elevated_state": true
545
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Account_RequestCoPlays: {
546
+ const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Account_RequestCoPlays, payload);
547
+ const personas = msg.players.map(p => SteamID.fromIndividualAccountID(p.accountid));
548
+ callGCCallback('RequestCoPlays', personas)
549
+ break
550
+ }
551
+ case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientWelcome: {
552
+ prime = false
553
+ const CMsgClientWelcome = protoDecode(Protos.csgo.CMsgClientWelcome, payload);
554
+ const obj = {}
555
+ for (const outofdate_cache of CMsgClientWelcome.outofdate_subscribed_caches) {
556
+ for (const cache_object of outofdate_cache.objects) {
557
+ for (const object_data of cache_object.object_data) {
558
+ switch (cache_object.type_id) {
559
+ case 1: {
560
+ const result = protoDecode(Protos.csgo.CSOEconItem, object_data);
561
+ break
587
562
  }
588
- break
589
- }
590
- case 5: {
591
- const result = protoDecode(Protos.csgo.CSOItemRecipe, object_data);
592
- break
593
- }
594
- case 7: {
595
- const CSOEconGameAccountClient = protoDecode(Protos.csgo.CSOEconGameAccountClient, object_data);
596
- const CSOEconGameAccountClientExample = {
597
- "additional_backpack_slots": 0,
598
- "bonus_xp_timestamp_refresh": 1688518800,//Wednesday 1:00:00 AM every week
599
- "bonus_xp_usedflags": 19,
600
- "elevated_state": 5,
601
- "elevated_timestamp": 5
602
- } //1688518800
603
- if ((CSOEconGameAccountClient.bonus_xp_usedflags & 16) != 0) { // EXPBonusFlag::PrestigeEarned
604
- prime = true
605
- CSOEconGameAccountClient.prime = true
563
+ case 2: {
564
+ const result = protoDecode(Protos.csgo.CSOPersonaDataPublic, object_data);
565
+ obj.PersonaDataPublic = result
566
+ const example = {
567
+ "player_level": 4,
568
+ "commendation": {
569
+ "cmd_friendly": 149,
570
+ "cmd_teaching": 108,
571
+ "cmd_leader": 115
572
+ },
573
+ "elevated_state": true
574
+ }
575
+ break
606
576
  }
607
- if (CSOEconGameAccountClient.elevated_state === 5) { // bought prime
608
- prime = true
609
- CSOEconGameAccountClient.prime = true
577
+ case 5: {
578
+ const result = protoDecode(Protos.csgo.CSOItemRecipe, object_data);
579
+ break
610
580
  }
611
- if (CSOEconGameAccountClient) {
612
- obj.GameAccountClient = CSOEconGameAccountClient
581
+ case 7: {
582
+ const CSOEconGameAccountClient = protoDecode(Protos.csgo.CSOEconGameAccountClient, object_data);
583
+ const CSOEconGameAccountClientExample = {
584
+ "additional_backpack_slots": 0,
585
+ "bonus_xp_timestamp_refresh": 1688518800,//Wednesday 1:00:00 AM every week
586
+ "bonus_xp_usedflags": 19,
587
+ "elevated_state": 5,
588
+ "elevated_timestamp": 5
589
+ } //1688518800
590
+ if ((CSOEconGameAccountClient.bonus_xp_usedflags & 16) != 0) { // EXPBonusFlag::PrestigeEarned
591
+ prime = true
592
+ CSOEconGameAccountClient.prime = true
593
+ }
594
+ if (CSOEconGameAccountClient.elevated_state === 5) { // bought prime
595
+ prime = true
596
+ CSOEconGameAccountClient.prime = true
597
+ }
598
+ if (CSOEconGameAccountClient) {
599
+ obj.GameAccountClient = CSOEconGameAccountClient
600
+ }
601
+ break
613
602
  }
614
- break
615
- }
616
603
 
617
- case 35: {
618
- // const result =protoDecode(Protos.csgo.CSOSelectedItemPreset, object_data);
619
- break
620
- }
604
+ case 35: {
605
+ // const result =protoDecode(Protos.csgo.CSOSelectedItemPreset, object_data);
606
+ break
607
+ }
621
608
 
622
- case 36: {
623
- // const result =protoDecode(Protos.csgo.CSOEconItemPresetInstance, object_data);
624
- break
625
- }
626
- case 38: {
627
- const result = protoDecode(Protos.csgo.CSOEconItemDropRateBonus, object_data);
628
- break
629
- }
630
- case 39: {
631
- const result = protoDecode(Protos.csgo.CSOEconItemLeagueViewPass, object_data);
632
- break
633
- }
634
- case 40: {
635
- const result = protoDecode(Protos.csgo.CSOEconItemEventTicket, object_data);
636
- break
637
- }
638
- case 41: {
639
- const result = protoDecode(Protos.csgo.CSOAccountSeasonalOperation, object_data);
640
- break
641
- }
642
- case 42: {
643
- // const result =protoDecode(Protos.csgo.CSOEconItemTournamentPassport, object_data);
644
- break
645
- }
646
- case 43: {
647
- const result = protoDecode(Protos.csgo.CSOEconDefaultEquippedDefinitionInstanceClient, object_data);
648
- const example = {
649
- "account_id": 1080136620,
650
- "item_definition": 61,
651
- "class_id": 3,
652
- "slot_id": 2
609
+ case 36: {
610
+ // const result =protoDecode(Protos.csgo.CSOEconItemPresetInstance, object_data);
611
+ break
612
+ }
613
+ case 38: {
614
+ const result = protoDecode(Protos.csgo.CSOEconItemDropRateBonus, object_data);
615
+ break
616
+ }
617
+ case 39: {
618
+ const result = protoDecode(Protos.csgo.CSOEconItemLeagueViewPass, object_data);
619
+ break
620
+ }
621
+ case 40: {
622
+ const result = protoDecode(Protos.csgo.CSOEconItemEventTicket, object_data);
623
+ break
624
+ }
625
+ case 41: {
626
+ const result = protoDecode(Protos.csgo.CSOAccountSeasonalOperation, object_data);
627
+ break
628
+ }
629
+ case 42: {
630
+ // const result =protoDecode(Protos.csgo.CSOEconItemTournamentPassport, object_data);
631
+ break
632
+ }
633
+ case 43: {
634
+ const result = protoDecode(Protos.csgo.CSOEconDefaultEquippedDefinitionInstanceClient, object_data);
635
+ const example = {
636
+ "account_id": 1080136620,
637
+ "item_definition": 61,
638
+ "class_id": 3,
639
+ "slot_id": 2
640
+ }
641
+ break
642
+ }
643
+ case 45: {
644
+ const result = protoDecode(Protos.csgo.CSOEconCoupon, object_data);
645
+ break
646
+ }
647
+ case 46: {
648
+ const result = protoDecode(Protos.csgo.CSOQuestProgress, object_data);
649
+ break
653
650
  }
654
- break
655
- }
656
- case 45: {
657
- const result = protoDecode(Protos.csgo.CSOEconCoupon, object_data);
658
- break
659
- }
660
- case 46: {
661
- const result = protoDecode(Protos.csgo.CSOQuestProgress, object_data);
662
- break
663
- }
664
651
 
665
- default: {
666
- log("cache_object.type_id", cache_object.type_id);
652
+ default: {
653
+ log("cache_object.type_id", cache_object.type_id);
654
+ }
667
655
  }
668
656
  }
669
- }
670
657
 
658
+ }
671
659
  }
672
- }
673
- callEvent(events.csgoOnline, obj)
660
+ callEvent(events.csgoOnline, obj)
674
661
 
675
- if (isPartyRegister) {
676
- partyRegister()
677
- doSetInterval(function () {
662
+ if (isPartyRegister) {
678
663
  partyRegister()
679
- }, [60000, 120000], 'autoPartyRegister')
664
+ doSetInterval(function () {
665
+ partyRegister()
666
+ }, [60000, 120000], 'autoPartyRegister')
667
+ }
668
+ break
680
669
  }
681
- break
682
- }
683
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate: {
684
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate, payload)
685
- break
686
- }
687
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientGlobalStats: {
688
- const result = protoDecode(Protos.csgo.CMsgClientUGSGetGlobalStatsResponse, payload)
689
- break
690
- }
691
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer: {
692
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportPlayer, payload)
693
- break
694
- }
695
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientTextMsg: {
696
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GC2ClientTextMsg, payload)
697
- break
698
- }
699
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: {
700
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientHello, payload)
701
- const example = {
702
- my_current_event_teams: [],
703
- my_current_event_stages: [],
704
- rankings: [],
705
- account_id: 1080136620,
706
- ongoingmatch: null,
707
- global_stats: {
708
- search_statistics: [
709
- {
710
- game_type: 520,
711
- search_time_avg: 0,
712
- players_searching: 5141
713
- },
714
- {
715
- game_type: 32776,
716
- search_time_avg: 0,
717
- players_searching: 6561
718
- },
719
- ],
720
- players_online: 617207,
721
- servers_online: 230638,
722
- players_searching: 13550,
723
- servers_available: 126352,
724
- ongoing_matches: 23264,
725
- search_time_avg: 95993,
726
- main_post_url: "*XA=https://blast.tv/live*XT=https://www.twitch.tv/blastpremier*XB=https://live.bilibili.com/35*XG=playcast://https://gotv.blast.tv/major-a*T=SGTAB*L=2@https://steamcommunity.com/broadcast/watch/76561199492362089",
727
- required_appid_version: 13879,
728
- pricesheet_version: 1688084844,
729
- twitch_streams_version: 2,
730
- active_tournament_eventid: 21,
731
- active_survey_id: 0,
732
- rtime32_cur: 0,
733
- rtime32_event_start: 0
734
- },
735
- penalty_seconds: 0,
736
- penalty_reason: 0,
737
- vac_banned: 0,
738
- ranking: {
739
- account_id: 1080136620,
740
- rank_id: 10,
741
- wins: 209,
742
- rank_change: 0,
743
- rank_type_id: 6,
744
- tv_control: 0
745
- },
746
- commendation: {
747
- cmd_friendly: 149,
748
- cmd_teaching: 108,
749
- cmd_leader: 115
750
- },
751
- medals: null,
752
- my_current_event: null,
753
- my_current_team: null,
754
- survey_vote: 0,
755
- activity: null,
756
- player_level: 4,
757
- player_cur_xp: 327684501,
758
- player_xp_bonus_flags: 0
670
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate: {
671
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate, payload)
672
+ break
759
673
  }
760
- callEvent(events.csgoClientHello, result)
761
- break
762
- }
763
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse: {
764
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportResponse, payload)
765
- break
766
- }
767
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse: {
768
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientCommendPlayer, payload)
769
- break
770
- }
771
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment: {
772
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment, payload)
773
- break
774
- }
775
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList: {
776
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchList, payload)
777
- break
778
- }
779
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GetEventFavorites_Response: {
780
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GetEventFavorites_Response, payload)
781
- break
782
- }
783
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_StartAgreementSessionInGame: {
674
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientGlobalStats: {
675
+ const result = protoDecode(Protos.csgo.CMsgClientUGSGetGlobalStatsResponse, payload)
676
+ break
677
+ }
678
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer: {
679
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportPlayer, payload)
680
+ break
681
+ }
682
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientTextMsg: {
683
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GC2ClientTextMsg, payload)
684
+ break
685
+ }
686
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: {
687
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientHello, payload)
688
+ const example = {
689
+ my_current_event_teams: [],
690
+ my_current_event_stages: [],
691
+ rankings: [],
692
+ account_id: 1080136620,
693
+ ongoingmatch: null,
694
+ global_stats: {
695
+ search_statistics: [
696
+ {
697
+ game_type: 520,
698
+ search_time_avg: 0,
699
+ players_searching: 5141
700
+ },
701
+ {
702
+ game_type: 32776,
703
+ search_time_avg: 0,
704
+ players_searching: 6561
705
+ },
706
+ ],
707
+ players_online: 617207,
708
+ servers_online: 230638,
709
+ players_searching: 13550,
710
+ servers_available: 126352,
711
+ ongoing_matches: 23264,
712
+ search_time_avg: 95993,
713
+ main_post_url: "*XA=https://blast.tv/live*XT=https://www.twitch.tv/blastpremier*XB=https://live.bilibili.com/35*XG=playcast://https://gotv.blast.tv/major-a*T=SGTAB*L=2@https://steamcommunity.com/broadcast/watch/76561199492362089",
714
+ required_appid_version: 13879,
715
+ pricesheet_version: 1688084844,
716
+ twitch_streams_version: 2,
717
+ active_tournament_eventid: 21,
718
+ active_survey_id: 0,
719
+ rtime32_cur: 0,
720
+ rtime32_event_start: 0
721
+ },
722
+ penalty_seconds: 0,
723
+ penalty_reason: 0,
724
+ vac_banned: 0,
725
+ ranking: {
726
+ account_id: 1080136620,
727
+ rank_id: 10,
728
+ wins: 209,
729
+ rank_change: 0,
730
+ rank_type_id: 6,
731
+ tv_control: 0
732
+ },
733
+ commendation: {
734
+ cmd_friendly: 149,
735
+ cmd_teaching: 108,
736
+ cmd_leader: 115
737
+ },
738
+ medals: null,
739
+ my_current_event: null,
740
+ my_current_team: null,
741
+ survey_vote: 0,
742
+ activity: null,
743
+ player_level: 4,
744
+ player_cur_xp: 327684501,
745
+ player_xp_bonus_flags: 0
746
+ }
747
+ callEvent(events.csgoClientHello, result)
748
+ break
749
+ }
750
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse: {
751
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportResponse, payload)
752
+ break
753
+ }
754
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse: {
755
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientCommendPlayer, payload)
756
+ break
757
+ }
758
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment: {
759
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment, payload)
760
+ break
761
+ }
762
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList: {
763
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchList, payload)
764
+ break
765
+ }
766
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GetEventFavorites_Response: {
767
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GetEventFavorites_Response, payload)
768
+ break
769
+ }
770
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_StartAgreementSessionInGame: {
784
771
 
785
- break
786
- }
787
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_ClientDeepStats: {
788
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_ClientDeepStats, payload)
789
- break
790
- }
791
- case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientConnectionStatus: {
792
- const result = protoDecode(Protos.csgo.CMsgConnectionStatus, payload)
793
- break
794
- }
795
- case Protos.csgo.EGCItemMsg.k_EMsgGCStoreGetUserDataResponse: {
796
- const result = protoDecode(Protos.csgo.CMsgStoreGetUserDataResponse, payload)
797
- break
798
- }
799
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseFinalizeResponse: {
800
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseFinalizeResponse, payload)
801
- break
802
- }
803
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseCancelResponse: {
804
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseCancelResponse, payload)
805
- break
806
- }
807
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseInitResponse: {
808
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseInitResponse, payload)
809
- break
810
- }
811
- case Protos.csgo.EMsg.k_EMsgClientMMSCreateLobbyResponse: {
812
- const result = protoDecode(Protos.csgo.CMsgClientMMSCreateLobbyResponse, payload)
813
- break
814
- }
815
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientGCRankUpdate: {
816
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientGCRankUpdate, payload)
817
- break
818
- }
819
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Search: {
820
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_SearchResults, payload)
821
- const entries = _.uniqBy(result.entries, 'id')
822
- //{
823
- // "id": 144900402,
824
- // "grp": 0,
825
- // "game_type": 8,
826
- // "apr": 1,
827
- // "ark": 17,
828
- // "loc": 20041,
829
- // "accountid": 0
830
- // }
831
-
832
- const players = []
833
-
834
- const steamIDs = entries
835
- .map(p => SteamID.fromIndividualAccountID(p.id).getSteamID64())
836
- const personas = await getPersonas(steamIDs)
837
- //{
838
- // "id": "76561199265943339",
839
- // "rich_presence": [],
840
- // "persona_state": null,
841
- // "game_played_app_id": null,
842
- // "game_server_ip": null,
843
- // "game_server_port": null,
844
- // "persona_state_flags": null,
845
- // "online_session_instances": null,
846
- // "persona_set_by_user": null,
847
- // "player_name": "杀人不见血",
848
- // "query_port": null,
849
- // "steamid_source": null,
850
- // "avatar_hash": "33994e26f1fe7e2093f8c7dee66c1ac91531050d",
851
- // "last_logoff": null,
852
- // "last_logon": null,
853
- // "last_seen_online": null,
854
- // "clan_rank": null,
855
- // "game_name": null,
856
- // "gameid": null,
857
- // "game_data_blob": null,
858
- // "clan_data": null,
859
- // "clan_tag": null,
860
- // "broadcast_id": null,
861
- // "game_lobby_id": null,
862
- // "watching_broadcast_accountid": null,
863
- // "watching_broadcast_appid": null,
864
- // "watching_broadcast_viewers": null,
865
- // "watching_broadcast_title": null,
866
- // "is_community_banned": null,
867
- // "player_name_pending_review": null,
868
- // "avatar_pending_review": null,
869
- // "avatar_url_icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d.jpg",
870
- // "avatar_url_medium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_medium.jpg",
871
- // "avatar_url_full": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_full.jpg"
872
- // }
873
- for (const player of entries) {
874
- try {
875
- const prime = player.apr === 1 ? 'PRIME' : 'NON-PRIME'
876
- const loc = LOCS[player.loc] || player.loc
877
- const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64()
878
- const persona = personas.find(p => p.id == steamId)
879
- const friendCode = FriendCode.encode(steamId)
880
-
881
- // if ((LOCS[player.loc] == 'VN' || !LOCS[player.loc])) {
772
+ break
773
+ }
774
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_ClientDeepStats: {
775
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_ClientDeepStats, payload)
776
+ break
777
+ }
778
+ case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientConnectionStatus: {
779
+ const result = protoDecode(Protos.csgo.CMsgConnectionStatus, payload)
780
+ break
781
+ }
782
+ case Protos.csgo.EGCItemMsg.k_EMsgGCStoreGetUserDataResponse: {
783
+ const result = protoDecode(Protos.csgo.CMsgStoreGetUserDataResponse, payload)
784
+ break
785
+ }
786
+ case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseFinalizeResponse: {
787
+ const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseFinalizeResponse, payload)
788
+ break
789
+ }
790
+ case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseCancelResponse: {
791
+ const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseCancelResponse, payload)
792
+ break
793
+ }
794
+ case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseInitResponse: {
795
+ const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseInitResponse, payload)
796
+ break
797
+ }
798
+ case Protos.csgo.EMsg.k_EMsgClientMMSCreateLobbyResponse: {
799
+ const result = protoDecode(Protos.csgo.CMsgClientMMSCreateLobbyResponse, payload)
800
+ break
801
+ }
802
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientGCRankUpdate: {
803
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientGCRankUpdate, payload)
804
+ break
805
+ }
806
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Search: {
807
+ const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_SearchResults, payload)
808
+ const entries = _.uniqBy(result.entries, 'id')
809
+ //{
810
+ // "id": 144900402,
811
+ // "grp": 0,
812
+ // "game_type": 8,
813
+ // "apr": 1,
814
+ // "ark": 17,
815
+ // "loc": 20041,
816
+ // "accountid": 0
817
+ // }
818
+
819
+ const players = []
820
+
821
+ const steamIDs = entries
822
+ .map(p => SteamID.fromIndividualAccountID(p.id).getSteamID64())
823
+ const personas = await getPersonas(steamIDs)
824
+ //{
825
+ // "id": "76561199265943339",
826
+ // "rich_presence": [],
827
+ // "persona_state": null,
828
+ // "game_played_app_id": null,
829
+ // "game_server_ip": null,
830
+ // "game_server_port": null,
831
+ // "persona_state_flags": null,
832
+ // "online_session_instances": null,
833
+ // "persona_set_by_user": null,
834
+ // "player_name": "杀人不见血",
835
+ // "query_port": null,
836
+ // "steamid_source": null,
837
+ // "avatar_hash": "33994e26f1fe7e2093f8c7dee66c1ac91531050d",
838
+ // "last_logoff": null,
839
+ // "last_logon": null,
840
+ // "last_seen_online": null,
841
+ // "clan_rank": null,
842
+ // "game_name": null,
843
+ // "gameid": null,
844
+ // "game_data_blob": null,
845
+ // "clan_data": null,
846
+ // "clan_tag": null,
847
+ // "broadcast_id": null,
848
+ // "game_lobby_id": null,
849
+ // "watching_broadcast_accountid": null,
850
+ // "watching_broadcast_appid": null,
851
+ // "watching_broadcast_viewers": null,
852
+ // "watching_broadcast_title": null,
853
+ // "is_community_banned": null,
854
+ // "player_name_pending_review": null,
855
+ // "avatar_pending_review": null,
856
+ // "avatar_url_icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d.jpg",
857
+ // "avatar_url_medium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_medium.jpg",
858
+ // "avatar_url_full": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_full.jpg"
859
+ // }
860
+ for (const player of entries) {
861
+ try {
862
+ const prime = player.apr === 1 ? 'PRIME' : 'NON-PRIME'
863
+ const loc = LOCS[player.loc] || player.loc
864
+ const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64()
865
+ const persona = personas.find(p => p.id == steamId)
866
+ const friendCode = FriendCode.encode(steamId)
867
+
868
+ // if ((LOCS[player.loc] == 'VN' || !LOCS[player.loc])) {
882
869
  players.push({
883
870
  prime,
884
871
  player_name: persona.player_name,
@@ -888,75 +875,330 @@ function SteamClient({
888
875
  friendCode,
889
876
  avatar_hash: persona.avatar_hash,
890
877
  })
891
- // }
892
- } catch (e) {
878
+ // }
879
+ } catch (e) {
880
+ }
893
881
  }
894
- }
895
882
 
896
- callGCCallback('partySearch', players)
897
- break
898
- }
899
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayersProfile: {
900
- let data = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayersProfile, payload)?.account_profiles
901
- const dataExample = [{
902
- my_current_event_teams: [],
903
- my_current_event_stages: [],
904
- rankings: [{
905
- account_id: 1225887169, rank_id: 0, wins: 6, rank_change: 0, rank_type_id: 7, tv_control: 0
906
- }, {
907
- account_id: 1225887169, rank_id: 0, wins: 0, rank_change: 0, rank_type_id: 10, tv_control: 0
908
- }],
909
- account_id: 1225887169,
910
- ongoingmatch: null,
911
- global_stats: null,
912
- penalty_seconds: 0,
913
- penalty_reason: 0,
914
- vac_banned: 0,
915
- ranking: {
883
+ callGCCallback('partySearch', players)
884
+ break
885
+ }
886
+ case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayersProfile: {
887
+ let data = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayersProfile, payload)?.account_profiles
888
+ const dataExample = [{
889
+ my_current_event_teams: [],
890
+ my_current_event_stages: [],
891
+ rankings: [{
892
+ account_id: 1225887169,
893
+ rank_id: 0,
894
+ wins: 6,
895
+ rank_change: 0,
896
+ rank_type_id: 7,
897
+ tv_control: 0
898
+ }, {
899
+ account_id: 1225887169,
900
+ rank_id: 0,
901
+ wins: 0,
902
+ rank_change: 0,
903
+ rank_type_id: 10,
904
+ tv_control: 0
905
+ }],
916
906
  account_id: 1225887169,
917
- rank_id: 8,
918
- wins: 469,
919
- rank_change: 0,
920
- rank_type_id: 6,
921
- tv_control: 0
907
+ ongoingmatch: null,
908
+ global_stats: null,
909
+ penalty_seconds: 0,
910
+ penalty_reason: 0,
911
+ vac_banned: 0,
912
+ ranking: {
913
+ account_id: 1225887169,
914
+ rank_id: 8,
915
+ wins: 469,
916
+ rank_change: 0,
917
+ rank_type_id: 6,
918
+ tv_control: 0
919
+ },
920
+ commendation: {
921
+ cmd_friendly: 51, cmd_teaching: 40, cmd_leader: 40
922
+ },
923
+ medals: {
924
+ display_items_defidx: [4819, 4737], featured_display_item_defidx: 4819
925
+ },
926
+ my_current_event: null,
927
+ my_current_team: null,
928
+ survey_vote: 0,
929
+ activity: null,
930
+ player_level: 32,
931
+ player_cur_xp: 327682846,
932
+ player_xp_bonus_flags: 0
933
+ }]
934
+
935
+ const player = data?.[0];
936
+ if (player) {
937
+ player.prime = !!(player.ranking?.account_id || player.player_level || player.player_cur_xp)
938
+ player.steamId = SteamID.fromIndividualAccountID(player.account_id).getSteamID64()
939
+ }
940
+ callGCCallback('PlayersProfile' + player?.account_id, player)
941
+ callEvent(events.playersProfile, player)
942
+ break
943
+ }
944
+ default:
945
+ log(`receivedFromGC ${msgType} ${key}`)
946
+ const results = Object.values(Protos.csgo).map(function (p) {
947
+ try {
948
+ return protoDecode(p, payload)
949
+ } catch (e) {
950
+ }
951
+ }).filter(function (result) {
952
+ return result && Object.keys(result).length
953
+ })
954
+ log(key, results)
955
+ }
956
+ },
957
+ async loggedOn(loggedOnResponse) {
958
+ steamClient.setPersona(SteamUser.EPersonaState.Online)
959
+ state = 'Online'
960
+ await sendHello()
961
+ callEvent(events.loggedOn, loggedOnResponse)
962
+ if (isAutoRequestFreeLicense) {
963
+ doSetInterval(function () {
964
+ autoRequestFreeLicense(false, 50)
965
+ }, [5 * 60000, 10 * 60000], 'autoRequestFreeLicense')
966
+ }
967
+ if (autoPlay) {
968
+ await sleep(10000)
969
+ onCookie(function () {
970
+ autoGamePlay()
971
+ })
972
+ }
973
+ },
974
+ async user(steamId, data) {
975
+ callEvent(events.user, {steamId: steamId.getSteamID64(), data})
976
+ const dataExample = {
977
+ "rich_presence": [
978
+ {
979
+ "key": "status",
980
+ "value": "Competitive Mirage [ 3 : 6 ]"
981
+ },
982
+ {
983
+ "key": "version",
984
+ "value": "13875"
985
+ },
986
+ {
987
+ "key": "game:state",
988
+ "value": "game"
989
+ },
990
+ {
991
+ "key": "steam_display",
992
+ "value": "#display_GameKnownMapScore"
993
+ },
994
+ {
995
+ "key": "game:mode",
996
+ "value": "competitive"
997
+ },
998
+ {
999
+ "key": "game:mapgroupname",
1000
+ "value": "mg_de_mirage"
1001
+ },
1002
+ {
1003
+ "key": "game:map",
1004
+ "value": "de_mirage"
922
1005
  },
923
- commendation: {
924
- cmd_friendly: 51, cmd_teaching: 40, cmd_leader: 40
1006
+ {
1007
+ "key": "game:server",
1008
+ "value": "kv"
925
1009
  },
926
- medals: {
927
- display_items_defidx: [4819, 4737], featured_display_item_defidx: 4819
1010
+ {
1011
+ "key": "watch",
1012
+ "value": "1"
928
1013
  },
929
- my_current_event: null,
930
- my_current_team: null,
931
- survey_vote: 0,
932
- activity: null,
933
- player_level: 32,
934
- player_cur_xp: 327682846,
935
- player_xp_bonus_flags: 0
936
- }]
937
-
938
- const player = data?.[0];
939
- if (player) {
940
- player.prime = !!(player.ranking?.account_id || player.player_level || player.player_cur_xp)
941
- player.steamId = SteamID.fromIndividualAccountID(player.account_id).getSteamID64()
1014
+ {
1015
+ "key": "steam_player_group",
1016
+ "value": "2134948645"
1017
+ },
1018
+ {
1019
+ "key": "game:score",
1020
+ "value": "[ 3 : 6 ]"
1021
+ }
1022
+ ],
1023
+ "friendid": "76561199405834425",
1024
+ "persona_state": 1,
1025
+ "game_played_app_id": 730,
1026
+ "game_server_ip": null,
1027
+ "game_server_port": null,
1028
+ "persona_state_flags": 1,
1029
+ "online_session_instances": 1,
1030
+ "persona_set_by_user": null,
1031
+ "player_name": "quỷ súng",
1032
+ "query_port": null,
1033
+ "steamid_source": "0",
1034
+ "avatar_hash": {
1035
+ "type": "Buffer",
1036
+ "data": [
1037
+ 23,
1038
+ 163,
1039
+ 216,
1040
+ 209,
1041
+ 236,
1042
+ 179,
1043
+ 73,
1044
+ 228,
1045
+ 225,
1046
+ 30,
1047
+ 48,
1048
+ 190,
1049
+ 192,
1050
+ 170,
1051
+ 177,
1052
+ 246,
1053
+ 139,
1054
+ 71,
1055
+ 122,
1056
+ 205
1057
+ ]
1058
+ },
1059
+ "last_logoff": 1683950268,
1060
+ "last_logon": 1683950281,
1061
+ "last_seen_online": 1683950268,
1062
+ "clan_rank": null,
1063
+ "game_name": "",
1064
+ "gameid": "730",
1065
+ "game_data_blob": {
1066
+ "type": "Buffer",
1067
+ "data": []
1068
+ },
1069
+ "clan_data": null,
1070
+ "clan_tag": null,
1071
+ "broadcast_id": "0",
1072
+ "game_lobby_id": "0",
1073
+ "watching_broadcast_accountid": null,
1074
+ "watching_broadcast_appid": null,
1075
+ "watching_broadcast_viewers": null,
1076
+ "watching_broadcast_title": null,
1077
+ "is_community_banned": null,
1078
+ "player_name_pending_review": null,
1079
+ "avatar_pending_review": null
1080
+ }
1081
+ },
1082
+ async friendMessage(data) {
1083
+ if (!data) return
1084
+ data.message_no_bbcode = data.message_no_bbcode?.replaceAll(`ː`, `:`)
1085
+ data.message = data.message?.replaceAll(`ː`, `:`)
1086
+ const example = {
1087
+ "steamid_friend": {
1088
+ "universe": 1,
1089
+ "type": 1,
1090
+ "instance": 1,
1091
+ "accountid": 1080136620
1092
+ },
1093
+ "chat_entry_type": 1,
1094
+ "from_limited_account": false,
1095
+ "message": "xxx",
1096
+ "ordinal": 0,
1097
+ "local_echo": false,
1098
+ "message_no_bbcode": "xxx",
1099
+ "low_priority": false,
1100
+ "server_timestamp": "2023-05-14T09:26:25.000Z",
1101
+ "message_bbcode_parsed": [
1102
+ "xxx"
1103
+ ]
1104
+ }
1105
+ const timestamp = new Date(data.server_timestamp).getTime()
1106
+ const steamId = data.steamid_friend.getSteamID64()
1107
+ const personas = await getPersonas([steamId])
1108
+ const player_name = personas.find(p => p.id == steamId)?.player_name || ''
1109
+ 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)
1110
+ const emotion = (data.message_no_bbcode || '').split(' ').find(m => m.startsWith(':') && m.endsWith(':'))
1111
+
1112
+ callEvent(events.friendMessage, {
1113
+ player_name,
1114
+ message: data.message_no_bbcode,
1115
+ invite,
1116
+ steamId,
1117
+ timestamp,
1118
+ from_limited_account: data.from_limited_account,
1119
+ emotion,
1120
+ })
1121
+ },
1122
+ async friendTyping(steamId, message) {
1123
+ callEvent(events.friendTyping, {
1124
+ steamId, message
1125
+ })
1126
+ },
1127
+ async playingState(playing_blocked, playing_app) {
1128
+ playingBlocked = playing_blocked
1129
+ if (playing_app === 0) {
1130
+ playing_app = null
1131
+ }
1132
+ if (playing_blocked) {//true, false
1133
+ console.log("Playing else where")
1134
+ }
1135
+ log('playingState', playing_blocked, playing_app);
1136
+ },
1137
+ async friendRelationship(sid, relationship, previousRelationship) {
1138
+ callEvent(events.friendRelationship, {steamId: sid.getSteamID64(), relationship, previousRelationship})
1139
+ switch (relationship) {
1140
+ case EFriendRelationship.None: {
1141
+ //we got unfriended.
1142
+ break
1143
+ }
1144
+ case EFriendRelationship.RequestRecipient: {
1145
+ //we got invited as a friend
1146
+ break
1147
+ }
1148
+ case EFriendRelationship.Friend: {
1149
+ //we got added as a friend
1150
+ break
942
1151
  }
943
- callGCCallback('PlayersProfile' + player?.account_id, player)
944
- callEvent(events.playersProfile, player)
945
- break
946
1152
  }
947
- default:
948
- log(`receivedFromGC ${msgType} ${key}`)
949
- const results = Object.values(Protos.csgo).map(function (p) {
950
- try {
951
- return protoDecode(p, payload)
952
- } catch (e) {
953
- }
954
- }).filter(function (result) {
955
- return result && Object.keys(result).length
956
- })
957
- log(key, results)
1153
+ },
1154
+ async tradeOffers(count) {
1155
+ callEvent(events.tradeOffers, count)
1156
+ },
1157
+ async offlineMessages(count, friends) {
1158
+ callEvent(events.offlineMessages, {count, steamIdList: friends})
1159
+ },
1160
+ async tradeRequest(steamID, respond) {
1161
+ if (autoAcceptTradeRequest) {
1162
+ log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, accepting`);
1163
+ respond(true);
1164
+ } else {
1165
+ log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, wating`);
1166
+ }
1167
+ },
1168
+ async friendsList() {
1169
+ callEvent(events.friendsList, getFriendList())
1170
+ },
1171
+ async gifts(gid, packageid, TimeCreated, TimeExpiration, TimeSent, TimeAcked, TimeRedeemed, RecipientAddress, SenderAddress, SenderName) {
1172
+ callEvent(events.gifts, {
1173
+ gid,
1174
+ packageid,
1175
+ TimeCreated,
1176
+ TimeExpiration,
1177
+ TimeSent,
1178
+ TimeAcked,
1179
+ TimeRedeemed,
1180
+ RecipientAddress,
1181
+ SenderAddress,
1182
+ SenderName
1183
+ })
958
1184
  }
959
- })
1185
+ }
1186
+
1187
+
1188
+ // steamClient.on('lobbyInvite', (inviterID, lobbyID ) => {
1189
+ // joinLobby(lobbyID)
1190
+ // })
1191
+
1192
+ // steamClient.on('debug', (msg) => {
1193
+ // if (!["ClientPersonaState","ClientClanState"].some(c => msg.includes(c))) {
1194
+ // if(msg.startsWith("Received")){
1195
+ // console.log(`------- ${msg}`)
1196
+ // } else {
1197
+ // console.log(msg)
1198
+ // }
1199
+ // }
1200
+ // })
1201
+
960
1202
 
961
1203
  function getECsgoGCMsgKey(_key) {
962
1204
  for (let key in Protos.csgo.ECsgoGCMsg) {
@@ -981,246 +1223,9 @@ function SteamClient({
981
1223
  }
982
1224
  }
983
1225
 
984
- steamClient.on('loggedOn', async (loggedOnResponse) => {
985
- steamClient.setPersona(SteamUser.EPersonaState.Online)
986
- state = 'Online'
987
- await sendHello()
988
- callEvent(events.loggedOn, loggedOnResponse)
989
- if (isAutoRequestFreeLicense) {
990
- doSetInterval(function () {
991
- autoRequestFreeLicense(false, 50)
992
- }, [5 * 60000, 10 * 60000], 'autoRequestFreeLicense')
993
- }
994
- if (autoPlay) {
995
- await sleep(10000)
996
- onCookie(function () {
997
- autoGamePlay()
998
- })
999
- }
1000
- })
1001
-
1002
-
1003
- steamClient.on('user', async (steamId, data) => {
1004
- callEvent(events.user, {steamId: steamId.getSteamID64(), data})
1005
- const dataExample = {
1006
- "rich_presence": [
1007
- {
1008
- "key": "status",
1009
- "value": "Competitive Mirage [ 3 : 6 ]"
1010
- },
1011
- {
1012
- "key": "version",
1013
- "value": "13875"
1014
- },
1015
- {
1016
- "key": "game:state",
1017
- "value": "game"
1018
- },
1019
- {
1020
- "key": "steam_display",
1021
- "value": "#display_GameKnownMapScore"
1022
- },
1023
- {
1024
- "key": "game:mode",
1025
- "value": "competitive"
1026
- },
1027
- {
1028
- "key": "game:mapgroupname",
1029
- "value": "mg_de_mirage"
1030
- },
1031
- {
1032
- "key": "game:map",
1033
- "value": "de_mirage"
1034
- },
1035
- {
1036
- "key": "game:server",
1037
- "value": "kv"
1038
- },
1039
- {
1040
- "key": "watch",
1041
- "value": "1"
1042
- },
1043
- {
1044
- "key": "steam_player_group",
1045
- "value": "2134948645"
1046
- },
1047
- {
1048
- "key": "game:score",
1049
- "value": "[ 3 : 6 ]"
1050
- }
1051
- ],
1052
- "friendid": "76561199405834425",
1053
- "persona_state": 1,
1054
- "game_played_app_id": 730,
1055
- "game_server_ip": null,
1056
- "game_server_port": null,
1057
- "persona_state_flags": 1,
1058
- "online_session_instances": 1,
1059
- "persona_set_by_user": null,
1060
- "player_name": "quỷ súng",
1061
- "query_port": null,
1062
- "steamid_source": "0",
1063
- "avatar_hash": {
1064
- "type": "Buffer",
1065
- "data": [
1066
- 23,
1067
- 163,
1068
- 216,
1069
- 209,
1070
- 236,
1071
- 179,
1072
- 73,
1073
- 228,
1074
- 225,
1075
- 30,
1076
- 48,
1077
- 190,
1078
- 192,
1079
- 170,
1080
- 177,
1081
- 246,
1082
- 139,
1083
- 71,
1084
- 122,
1085
- 205
1086
- ]
1087
- },
1088
- "last_logoff": 1683950268,
1089
- "last_logon": 1683950281,
1090
- "last_seen_online": 1683950268,
1091
- "clan_rank": null,
1092
- "game_name": "",
1093
- "gameid": "730",
1094
- "game_data_blob": {
1095
- "type": "Buffer",
1096
- "data": []
1097
- },
1098
- "clan_data": null,
1099
- "clan_tag": null,
1100
- "broadcast_id": "0",
1101
- "game_lobby_id": "0",
1102
- "watching_broadcast_accountid": null,
1103
- "watching_broadcast_appid": null,
1104
- "watching_broadcast_viewers": null,
1105
- "watching_broadcast_title": null,
1106
- "is_community_banned": null,
1107
- "player_name_pending_review": null,
1108
- "avatar_pending_review": null
1109
- }
1110
- })
1111
-
1112
- steamClient.chat.on('friendMessage', async (data) => {
1113
- if (!data) return
1114
- data.message_no_bbcode = data.message_no_bbcode?.replaceAll(`ː`,`:`)
1115
- data.message = data.message?.replaceAll(`ː`,`:`)
1116
- const example = {
1117
- "steamid_friend": {
1118
- "universe": 1,
1119
- "type": 1,
1120
- "instance": 1,
1121
- "accountid": 1080136620
1122
- },
1123
- "chat_entry_type": 1,
1124
- "from_limited_account": false,
1125
- "message": "xxx",
1126
- "ordinal": 0,
1127
- "local_echo": false,
1128
- "message_no_bbcode": "xxx",
1129
- "low_priority": false,
1130
- "server_timestamp": "2023-05-14T09:26:25.000Z",
1131
- "message_bbcode_parsed": [
1132
- "xxx"
1133
- ]
1134
- }
1135
- const timestamp = new Date(data.server_timestamp).getTime()
1136
- const steamId = data.steamid_friend.getSteamID64()
1137
- const personas = await getPersonas([steamId])
1138
- const player_name = personas.find(p => p.id == steamId)?.player_name || ''
1139
- 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)
1140
- const emotion = (data.message_no_bbcode || '').split(' ').find(m => m.startsWith(':') && m.endsWith(':'))
1141
-
1142
- callEvent(events.friendMessage, {
1143
- player_name,
1144
- message: data.message_no_bbcode,
1145
- invite,
1146
- steamId,
1147
- timestamp,
1148
- from_limited_account: data.from_limited_account,
1149
- emotion,
1150
- })
1151
-
1152
- });
1153
-
1154
- steamClient.on('friendTyping', async function (steamId, message) {
1155
- callEvent(events.friendTyping, {
1156
- steamId, message
1157
- })
1158
- });
1159
-
1160
- steamClient.on('playingState', async function (playing_blocked, playing_app) {
1161
- playingBlocked = playing_blocked
1162
- if (playing_app === 0) {
1163
- playing_app = null
1164
- }
1165
- if (playing_blocked) {//true, false
1166
- console.log("Playing else where")
1167
- }
1168
- log('playingState', playing_blocked, playing_app);
1169
- });
1170
-
1171
- steamClient.on('friendRelationship', async function (sid, relationship, previousRelationship) {
1172
- callEvent(events.friendRelationship, {steamId: sid.getSteamID64(), relationship, previousRelationship})
1173
- switch (relationship) {
1174
- case EFriendRelationship.None: {
1175
- //we got unfriended.
1176
- break
1177
- }
1178
- case EFriendRelationship.RequestRecipient: {
1179
- //we got invited as a friend
1180
- break
1181
- }
1182
- case EFriendRelationship.Friend: {
1183
- //we got added as a friend
1184
- break
1185
- }
1186
- }
1187
- });
1188
-
1189
- steamClient.on('tradeOffers', async function (count) {
1190
- callEvent(events.tradeOffers, count)
1191
- });
1192
-
1193
- steamClient.on('offlineMessages', async function (count, friends) {
1194
- callEvent(events.offlineMessages, {count, steamIdList: friends})
1195
- });
1196
-
1197
- steamClient.on('tradeRequest', async function (steamID, respond) {
1198
- if (autoAcceptTradeRequest) {
1199
- log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, accepting`);
1200
- respond(true);
1201
- } else {
1202
- log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, wating`);
1203
- }
1204
- });
1205
-
1206
- steamClient.on('friendsList', async function () {
1207
- callEvent(events.friendsList, getFriendList())
1208
- });
1209
-
1210
- steamClient.on('gifts', async function (gid, packageid, TimeCreated, TimeExpiration, TimeSent, TimeAcked, TimeRedeemed, RecipientAddress, SenderAddress, SenderName) {
1211
- callEvent(events.gifts, {
1212
- gid,
1213
- packageid,
1214
- TimeCreated,
1215
- TimeExpiration,
1216
- TimeSent,
1217
- TimeAcked,
1218
- TimeRedeemed,
1219
- RecipientAddress,
1220
- SenderAddress,
1221
- SenderName
1222
- })
1223
- });
1226
+ for (const name in events) {
1227
+ steamClient.on(name, events[name])
1228
+ }
1224
1229
  }
1225
1230
 
1226
1231
  function getFriendList() {
@@ -1398,7 +1403,7 @@ function SteamClient({
1398
1403
  }
1399
1404
 
1400
1405
  async function sendFriendMessage(steamId, message) {
1401
- while (sendMessageTimestamp && new Date().getTime() - sendMessageTimestamp < 1100){
1406
+ while (sendMessageTimestamp && new Date().getTime() - sendMessageTimestamp < 1100) {
1402
1407
  await sleep(500)
1403
1408
  }
1404
1409
 
@@ -1411,7 +1416,7 @@ function SteamClient({
1411
1416
  })
1412
1417
 
1413
1418
  if (result?.[1]?.server_timestamp) {
1414
- sendMessageTimestamp= new Date().getTime()
1419
+ sendMessageTimestamp = new Date().getTime()
1415
1420
  return result?.[1]
1416
1421
  } else if (result?.[0]?.message?.includes?.("RateLimitExceeded")) {
1417
1422
  await sleep(5000)
@@ -1698,7 +1703,7 @@ function SteamClient({
1698
1703
  })
1699
1704
  },
1700
1705
  onAnyEvent,
1701
- async redeemGift(gid){
1706
+ async redeemGift(gid) {
1702
1707
  try {
1703
1708
  const community = new SteamCommunity();
1704
1709
  let cookies = await getCookiesWait();
@@ -1707,13 +1712,13 @@ function SteamClient({
1707
1712
  } catch (e) {
1708
1713
  }
1709
1714
  },
1710
- async requestFreeLicense(...args){
1715
+ async requestFreeLicense(...args) {
1711
1716
  try {
1712
1717
  return await steamClient.requestFreeLicense(...args)
1713
1718
  } catch (e) {
1714
1719
  }
1715
1720
  },
1716
- getSteamId(){
1721
+ getSteamId() {
1717
1722
  try {
1718
1723
  return steamClient.steamID.getSteamID64()
1719
1724
  } catch (e) {
@@ -1721,6 +1726,9 @@ function SteamClient({
1721
1726
  },
1722
1727
  getLastTimePartyRegister(){
1723
1728
  return lastTimePartyRegister
1729
+ },
1730
+ getLastTimePartySearch(){
1731
+ return lastTimePartySearch
1724
1732
  }
1725
1733
  }
1726
1734
  }