steamutils 1.2.75 → 1.2.78

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 +718 -715
  5. package/free_packages.json +10048 -10048
  6. package/index.js +16 -6
  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) {
@@ -168,7 +168,7 @@ function SteamClient({
168
168
  delete e.callback
169
169
  }
170
170
  })
171
- _.remove(_events, e => e.once)
171
+ _.remove(_events, e => !e || e?.once)
172
172
  }
173
173
 
174
174
  function onEvent(name, callback, once, timeout) {
@@ -443,444 +443,429 @@ function SteamClient({
443
443
 
444
444
 
445
445
  function bindEvent() {
446
- steamClient.on('disconnected', async (eresult, msg) => {
447
- state = 'Offline'
448
- log('disconnected', eresult, msg)
449
-
450
- callEvent(events.disconnected, {eresult, msg})
451
-
452
- if (['ServiceUnavailable', 'NoConnection'].includes(msg) && autoReconnect && !isLogOff) {
453
- async function relogin(retry) {
454
- if (retry <= 0) {
455
- console.error("Cannot relogin")
456
- return false
457
- } else {
458
- const isSuccess = await login(true)
459
- if (isSuccess) {
460
- const loggedOnResponse = await new Promise(resolve => {
461
- onEvent('loggedOn', resolve, true, 180000)
462
- })
463
- if (loggedOnResponse) {
464
- console.log("Relogin success")
465
- 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
+ }
466
471
  } else {
467
472
  await sleep(120000)
468
473
  return await relogin(retry - 1)
469
474
  }
470
- } else {
471
- await sleep(120000)
472
- return await relogin(retry - 1)
473
475
  }
474
476
  }
475
- }
476
477
 
477
- await sleep(60000)
478
- const isSuccess = await relogin(50)
479
- if (!isSuccess) {
478
+ await sleep(60000)
479
+ const isSuccess = await relogin(50)
480
+ if (!isSuccess) {
481
+ offAllEvent()
482
+ doClearIntervals()
483
+ }
484
+ } else {
480
485
  offAllEvent()
481
486
  doClearIntervals()
482
487
  }
483
- } else {
484
- offAllEvent()
485
- doClearIntervals()
486
- }
487
- })
488
- steamClient.on('error', async (e) => {
489
- let errorStr = ``
490
- switch (e.eresult) {
491
- case 5:
492
- errorStr = `Invalid Password`
493
- break
494
- case 6:
495
- case 34:
496
- errorStr = `Logged In Elsewhere`
497
- break
498
- case 84:
499
- errorStr = `Rate Limit Exceeded`
500
- break
501
- case 65:
502
- errorStr = `steam guard is invalid`
503
- break
504
- default:
505
- errorStr = `Unknown: ${e.eresult}`
506
- break
507
- }
508
- log('error', e?.message)
509
- doClearIntervals()
510
- callEvent(events.error, {eresult: e.eresult, msg: e.message, error: errorStr})
511
- })
512
-
513
- steamClient.on('webSession', (sessionID, cookies) => {
514
- const webSession = {sessionID, cookies};
515
- steamClient.webSession = webSession
516
- callEvent(events.webSession, webSession)
517
- })
518
-
519
- // steamClient.on('lobbyInvite', (inviterID, lobbyID ) => {
520
- // joinLobby(lobbyID)
521
- // })
522
-
523
- // steamClient.on('debug', (msg) => {
524
- // if (!["ClientPersonaState","ClientClanState"].some(c => msg.includes(c))) {
525
- // if(msg.startsWith("Received")){
526
- // console.log(`------- ${msg}`)
527
- // } else {
528
- // console.log(msg)
529
- // }
530
- // }
531
- // })
532
-
533
- steamClient.on('receivedFromGC', async (appid, msgType, payload) => {
534
- const key = getECsgoGCMsgKey(msgType)
535
- switch (msgType) {
536
- case Protos.csgo.EMsg.k_EMsgClientChatInvite: {
537
- log(payload)
538
- break
539
- }
540
- case Protos.csgo.ECsgoGCMsg.k_EMsgClientMMSJoinLobbyResponse: {
541
- let msg = protoDecode(Protos.csgo.CMsgClientMMSJoinLobbyResponse, payload)
542
- log(msg)
543
- 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
544
508
  }
545
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Invite: {
546
- const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_Invite, payload);
547
- const sid64 = SteamID.fromIndividualAccountID(msg.accountid).getSteamID64();
548
- if (events.partyInvite?.length) {
549
- const personas = await getPersonas([sid64]);
550
- const player_name = personas.find(p => p.id == sid64)?.player_name
551
- if (player_name === undefined) {
552
- 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})
553
540
  }
554
- 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
555
544
  }
556
- // log(player_name, `https://steamcommunity.com/profiles/${sid64}`);
557
- // joinLobby(msg.lobbyid, msg.accountid)
558
- break
559
- }
560
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Account_RequestCoPlays: {
561
- const msg = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Account_RequestCoPlays, payload);
562
- const personas = msg.players.map(p => SteamID.fromIndividualAccountID(p.accountid));
563
- callGCCallback('RequestCoPlays', personas)
564
- break
565
- }
566
- case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientWelcome: {
567
- prime = false
568
- const CMsgClientWelcome = protoDecode(Protos.csgo.CMsgClientWelcome, payload);
569
- const obj = {}
570
- for (const outofdate_cache of CMsgClientWelcome.outofdate_subscribed_caches) {
571
- for (const cache_object of outofdate_cache.objects) {
572
- for (const object_data of cache_object.object_data) {
573
- switch (cache_object.type_id) {
574
- case 1: {
575
- const result = protoDecode(Protos.csgo.CSOEconItem, object_data);
576
- break
577
- }
578
- case 2: {
579
- const result = protoDecode(Protos.csgo.CSOPersonaDataPublic, object_data);
580
- obj.PersonaDataPublic = result
581
- const example = {
582
- "player_level": 4,
583
- "commendation": {
584
- "cmd_friendly": 149,
585
- "cmd_teaching": 108,
586
- "cmd_leader": 115
587
- },
588
- "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
589
562
  }
590
- break
591
- }
592
- case 5: {
593
- const result = protoDecode(Protos.csgo.CSOItemRecipe, object_data);
594
- break
595
- }
596
- case 7: {
597
- const CSOEconGameAccountClient = protoDecode(Protos.csgo.CSOEconGameAccountClient, object_data);
598
- const CSOEconGameAccountClientExample = {
599
- "additional_backpack_slots": 0,
600
- "bonus_xp_timestamp_refresh": 1688518800,//Wednesday 1:00:00 AM every week
601
- "bonus_xp_usedflags": 19,
602
- "elevated_state": 5,
603
- "elevated_timestamp": 5
604
- } //1688518800
605
- if ((CSOEconGameAccountClient.bonus_xp_usedflags & 16) != 0) { // EXPBonusFlag::PrestigeEarned
606
- prime = true
607
- 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
608
576
  }
609
- if (CSOEconGameAccountClient.elevated_state === 5) { // bought prime
610
- prime = true
611
- CSOEconGameAccountClient.prime = true
577
+ case 5: {
578
+ const result = protoDecode(Protos.csgo.CSOItemRecipe, object_data);
579
+ break
612
580
  }
613
- if (CSOEconGameAccountClient) {
614
- 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
615
602
  }
616
- break
617
- }
618
603
 
619
- case 35: {
620
- // const result =protoDecode(Protos.csgo.CSOSelectedItemPreset, object_data);
621
- break
622
- }
604
+ case 35: {
605
+ // const result =protoDecode(Protos.csgo.CSOSelectedItemPreset, object_data);
606
+ break
607
+ }
623
608
 
624
- case 36: {
625
- // const result =protoDecode(Protos.csgo.CSOEconItemPresetInstance, object_data);
626
- break
627
- }
628
- case 38: {
629
- const result = protoDecode(Protos.csgo.CSOEconItemDropRateBonus, object_data);
630
- break
631
- }
632
- case 39: {
633
- const result = protoDecode(Protos.csgo.CSOEconItemLeagueViewPass, object_data);
634
- break
635
- }
636
- case 40: {
637
- const result = protoDecode(Protos.csgo.CSOEconItemEventTicket, object_data);
638
- break
639
- }
640
- case 41: {
641
- const result = protoDecode(Protos.csgo.CSOAccountSeasonalOperation, object_data);
642
- break
643
- }
644
- case 42: {
645
- // const result =protoDecode(Protos.csgo.CSOEconItemTournamentPassport, object_data);
646
- break
647
- }
648
- case 43: {
649
- const result = protoDecode(Protos.csgo.CSOEconDefaultEquippedDefinitionInstanceClient, object_data);
650
- const example = {
651
- "account_id": 1080136620,
652
- "item_definition": 61,
653
- "class_id": 3,
654
- "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
655
650
  }
656
- break
657
- }
658
- case 45: {
659
- const result = protoDecode(Protos.csgo.CSOEconCoupon, object_data);
660
- break
661
- }
662
- case 46: {
663
- const result = protoDecode(Protos.csgo.CSOQuestProgress, object_data);
664
- break
665
- }
666
651
 
667
- default: {
668
- log("cache_object.type_id", cache_object.type_id);
652
+ default: {
653
+ log("cache_object.type_id", cache_object.type_id);
654
+ }
669
655
  }
670
656
  }
671
- }
672
657
 
658
+ }
673
659
  }
674
- }
675
- callEvent(events.csgoOnline, obj)
660
+ callEvent(events.csgoOnline, obj)
676
661
 
677
- if (isPartyRegister) {
678
- partyRegister()
679
- doSetInterval(function () {
662
+ if (isPartyRegister) {
680
663
  partyRegister()
681
- }, [60000, 120000], 'autoPartyRegister')
664
+ doSetInterval(function () {
665
+ partyRegister()
666
+ }, [60000, 120000], 'autoPartyRegister')
667
+ }
668
+ break
682
669
  }
683
- break
684
- }
685
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate: {
686
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientUpdate, payload)
687
- break
688
- }
689
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientGlobalStats: {
690
- const result = protoDecode(Protos.csgo.CMsgClientUGSGetGlobalStatsResponse, payload)
691
- break
692
- }
693
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer: {
694
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportPlayer, payload)
695
- break
696
- }
697
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GC2ClientTextMsg: {
698
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GC2ClientTextMsg, payload)
699
- break
700
- }
701
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingGC2ClientHello: {
702
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchmakingGC2ClientHello, payload)
703
- const example = {
704
- my_current_event_teams: [],
705
- my_current_event_stages: [],
706
- rankings: [],
707
- account_id: 1080136620,
708
- ongoingmatch: null,
709
- global_stats: {
710
- search_statistics: [
711
- {
712
- game_type: 520,
713
- search_time_avg: 0,
714
- players_searching: 5141
715
- },
716
- {
717
- game_type: 32776,
718
- search_time_avg: 0,
719
- players_searching: 6561
720
- },
721
- ],
722
- players_online: 617207,
723
- servers_online: 230638,
724
- players_searching: 13550,
725
- servers_available: 126352,
726
- ongoing_matches: 23264,
727
- search_time_avg: 95993,
728
- 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",
729
- required_appid_version: 13879,
730
- pricesheet_version: 1688084844,
731
- twitch_streams_version: 2,
732
- active_tournament_eventid: 21,
733
- active_survey_id: 0,
734
- rtime32_cur: 0,
735
- rtime32_event_start: 0
736
- },
737
- penalty_seconds: 0,
738
- penalty_reason: 0,
739
- vac_banned: 0,
740
- ranking: {
741
- account_id: 1080136620,
742
- rank_id: 10,
743
- wins: 209,
744
- rank_change: 0,
745
- rank_type_id: 6,
746
- tv_control: 0
747
- },
748
- commendation: {
749
- cmd_friendly: 149,
750
- cmd_teaching: 108,
751
- cmd_leader: 115
752
- },
753
- medals: null,
754
- my_current_event: null,
755
- my_current_team: null,
756
- survey_vote: 0,
757
- activity: null,
758
- player_level: 4,
759
- player_cur_xp: 327684501,
760
- 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
761
673
  }
762
- callEvent(events.csgoClientHello, result)
763
- break
764
- }
765
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportResponse: {
766
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientReportResponse, payload)
767
- break
768
- }
769
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientCommendPlayerQueryResponse: {
770
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientCommendPlayer, payload)
771
- break
772
- }
773
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment: {
774
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayerOverwatchCaseAssignment, payload)
775
- break
776
- }
777
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchList: {
778
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_MatchList, payload)
779
- break
780
- }
781
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_GetEventFavorites_Response: {
782
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_GetEventFavorites_Response, payload)
783
- break
784
- }
785
- 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: {
786
771
 
787
- break
788
- }
789
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_ClientDeepStats: {
790
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_ClientDeepStats, payload)
791
- break
792
- }
793
- case Protos.csgo.EGCBaseClientMsg.k_EMsgGCClientConnectionStatus: {
794
- const result = protoDecode(Protos.csgo.CMsgConnectionStatus, payload)
795
- break
796
- }
797
- case Protos.csgo.EGCItemMsg.k_EMsgGCStoreGetUserDataResponse: {
798
- const result = protoDecode(Protos.csgo.CMsgStoreGetUserDataResponse, payload)
799
- break
800
- }
801
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseFinalizeResponse: {
802
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseFinalizeResponse, payload)
803
- break
804
- }
805
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseCancelResponse: {
806
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseCancelResponse, payload)
807
- break
808
- }
809
- case Protos.csgo.EGCItemMsg.k_EMsgGCStorePurchaseInitResponse: {
810
- const result = protoDecode(Protos.csgo.CMsgGCStorePurchaseInitResponse, payload)
811
- break
812
- }
813
- case Protos.csgo.EMsg.k_EMsgClientMMSCreateLobbyResponse: {
814
- const result = protoDecode(Protos.csgo.CMsgClientMMSCreateLobbyResponse, payload)
815
- break
816
- }
817
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientGCRankUpdate: {
818
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_ClientGCRankUpdate, payload)
819
- break
820
- }
821
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_Party_Search: {
822
- const result = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_Party_SearchResults, payload)
823
- const entries = _.uniqBy(result.entries, 'id')
824
- //{
825
- // "id": 144900402,
826
- // "grp": 0,
827
- // "game_type": 8,
828
- // "apr": 1,
829
- // "ark": 17,
830
- // "loc": 20041,
831
- // "accountid": 0
832
- // }
833
-
834
- const players = []
835
-
836
- const steamIDs = entries
837
- .map(p => SteamID.fromIndividualAccountID(p.id).getSteamID64())
838
- const personas = await getPersonas(steamIDs)
839
- //{
840
- // "id": "76561199265943339",
841
- // "rich_presence": [],
842
- // "persona_state": null,
843
- // "game_played_app_id": null,
844
- // "game_server_ip": null,
845
- // "game_server_port": null,
846
- // "persona_state_flags": null,
847
- // "online_session_instances": null,
848
- // "persona_set_by_user": null,
849
- // "player_name": "杀人不见血",
850
- // "query_port": null,
851
- // "steamid_source": null,
852
- // "avatar_hash": "33994e26f1fe7e2093f8c7dee66c1ac91531050d",
853
- // "last_logoff": null,
854
- // "last_logon": null,
855
- // "last_seen_online": null,
856
- // "clan_rank": null,
857
- // "game_name": null,
858
- // "gameid": null,
859
- // "game_data_blob": null,
860
- // "clan_data": null,
861
- // "clan_tag": null,
862
- // "broadcast_id": null,
863
- // "game_lobby_id": null,
864
- // "watching_broadcast_accountid": null,
865
- // "watching_broadcast_appid": null,
866
- // "watching_broadcast_viewers": null,
867
- // "watching_broadcast_title": null,
868
- // "is_community_banned": null,
869
- // "player_name_pending_review": null,
870
- // "avatar_pending_review": null,
871
- // "avatar_url_icon": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d.jpg",
872
- // "avatar_url_medium": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_medium.jpg",
873
- // "avatar_url_full": "https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/33/33994e26f1fe7e2093f8c7dee66c1ac91531050d_full.jpg"
874
- // }
875
- for (const player of entries) {
876
- try {
877
- const prime = player.apr === 1 ? 'PRIME' : 'NON-PRIME'
878
- const loc = LOCS[player.loc] || player.loc
879
- const steamId = SteamID.fromIndividualAccountID(player.id).getSteamID64()
880
- const persona = personas.find(p => p.id == steamId)
881
- const friendCode = FriendCode.encode(steamId)
882
-
883
- // 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])) {
884
869
  players.push({
885
870
  prime,
886
871
  player_name: persona.player_name,
@@ -890,75 +875,330 @@ function SteamClient({
890
875
  friendCode,
891
876
  avatar_hash: persona.avatar_hash,
892
877
  })
893
- // }
894
- } catch (e) {
878
+ // }
879
+ } catch (e) {
880
+ }
895
881
  }
896
- }
897
882
 
898
- callGCCallback('partySearch', players)
899
- break
900
- }
901
- case Protos.csgo.ECsgoGCMsg.k_EMsgGCCStrike15_v2_PlayersProfile: {
902
- let data = protoDecode(Protos.csgo.CMsgGCCStrike15_v2_PlayersProfile, payload)?.account_profiles
903
- const dataExample = [{
904
- my_current_event_teams: [],
905
- my_current_event_stages: [],
906
- rankings: [{
907
- account_id: 1225887169, rank_id: 0, wins: 6, rank_change: 0, rank_type_id: 7, tv_control: 0
908
- }, {
909
- account_id: 1225887169, rank_id: 0, wins: 0, rank_change: 0, rank_type_id: 10, tv_control: 0
910
- }],
911
- account_id: 1225887169,
912
- ongoingmatch: null,
913
- global_stats: null,
914
- penalty_seconds: 0,
915
- penalty_reason: 0,
916
- vac_banned: 0,
917
- 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
+ }],
918
906
  account_id: 1225887169,
919
- rank_id: 8,
920
- wins: 469,
921
- rank_change: 0,
922
- rank_type_id: 6,
923
- 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"
924
1001
  },
925
- commendation: {
926
- cmd_friendly: 51, cmd_teaching: 40, cmd_leader: 40
1002
+ {
1003
+ "key": "game:map",
1004
+ "value": "de_mirage"
927
1005
  },
928
- medals: {
929
- display_items_defidx: [4819, 4737], featured_display_item_defidx: 4819
1006
+ {
1007
+ "key": "game:server",
1008
+ "value": "kv"
930
1009
  },
931
- my_current_event: null,
932
- my_current_team: null,
933
- survey_vote: 0,
934
- activity: null,
935
- player_level: 32,
936
- player_cur_xp: 327682846,
937
- player_xp_bonus_flags: 0
938
- }]
939
-
940
- const player = data?.[0];
941
- if (player) {
942
- player.prime = !!(player.ranking?.account_id || player.player_level || player.player_cur_xp)
943
- player.steamId = SteamID.fromIndividualAccountID(player.account_id).getSteamID64()
1010
+ {
1011
+ "key": "watch",
1012
+ "value": "1"
1013
+ },
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
944
1151
  }
945
- callGCCallback('PlayersProfile' + player?.account_id, player)
946
- callEvent(events.playersProfile, player)
947
- break
948
1152
  }
949
- default:
950
- log(`receivedFromGC ${msgType} ${key}`)
951
- const results = Object.values(Protos.csgo).map(function (p) {
952
- try {
953
- return protoDecode(p, payload)
954
- } catch (e) {
955
- }
956
- }).filter(function (result) {
957
- return result && Object.keys(result).length
958
- })
959
- 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
+ })
960
1184
  }
961
- })
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
+
962
1202
 
963
1203
  function getECsgoGCMsgKey(_key) {
964
1204
  for (let key in Protos.csgo.ECsgoGCMsg) {
@@ -983,246 +1223,9 @@ function SteamClient({
983
1223
  }
984
1224
  }
985
1225
 
986
- steamClient.on('loggedOn', async (loggedOnResponse) => {
987
- steamClient.setPersona(SteamUser.EPersonaState.Online)
988
- state = 'Online'
989
- await sendHello()
990
- callEvent(events.loggedOn, loggedOnResponse)
991
- if (isAutoRequestFreeLicense) {
992
- doSetInterval(function () {
993
- autoRequestFreeLicense(false, 50)
994
- }, [5 * 60000, 10 * 60000], 'autoRequestFreeLicense')
995
- }
996
- if (autoPlay) {
997
- await sleep(10000)
998
- onCookie(function () {
999
- autoGamePlay()
1000
- })
1001
- }
1002
- })
1003
-
1004
-
1005
- steamClient.on('user', async (steamId, data) => {
1006
- callEvent(events.user, {steamId: steamId.getSteamID64(), data})
1007
- const dataExample = {
1008
- "rich_presence": [
1009
- {
1010
- "key": "status",
1011
- "value": "Competitive Mirage [ 3 : 6 ]"
1012
- },
1013
- {
1014
- "key": "version",
1015
- "value": "13875"
1016
- },
1017
- {
1018
- "key": "game:state",
1019
- "value": "game"
1020
- },
1021
- {
1022
- "key": "steam_display",
1023
- "value": "#display_GameKnownMapScore"
1024
- },
1025
- {
1026
- "key": "game:mode",
1027
- "value": "competitive"
1028
- },
1029
- {
1030
- "key": "game:mapgroupname",
1031
- "value": "mg_de_mirage"
1032
- },
1033
- {
1034
- "key": "game:map",
1035
- "value": "de_mirage"
1036
- },
1037
- {
1038
- "key": "game:server",
1039
- "value": "kv"
1040
- },
1041
- {
1042
- "key": "watch",
1043
- "value": "1"
1044
- },
1045
- {
1046
- "key": "steam_player_group",
1047
- "value": "2134948645"
1048
- },
1049
- {
1050
- "key": "game:score",
1051
- "value": "[ 3 : 6 ]"
1052
- }
1053
- ],
1054
- "friendid": "76561199405834425",
1055
- "persona_state": 1,
1056
- "game_played_app_id": 730,
1057
- "game_server_ip": null,
1058
- "game_server_port": null,
1059
- "persona_state_flags": 1,
1060
- "online_session_instances": 1,
1061
- "persona_set_by_user": null,
1062
- "player_name": "quỷ súng",
1063
- "query_port": null,
1064
- "steamid_source": "0",
1065
- "avatar_hash": {
1066
- "type": "Buffer",
1067
- "data": [
1068
- 23,
1069
- 163,
1070
- 216,
1071
- 209,
1072
- 236,
1073
- 179,
1074
- 73,
1075
- 228,
1076
- 225,
1077
- 30,
1078
- 48,
1079
- 190,
1080
- 192,
1081
- 170,
1082
- 177,
1083
- 246,
1084
- 139,
1085
- 71,
1086
- 122,
1087
- 205
1088
- ]
1089
- },
1090
- "last_logoff": 1683950268,
1091
- "last_logon": 1683950281,
1092
- "last_seen_online": 1683950268,
1093
- "clan_rank": null,
1094
- "game_name": "",
1095
- "gameid": "730",
1096
- "game_data_blob": {
1097
- "type": "Buffer",
1098
- "data": []
1099
- },
1100
- "clan_data": null,
1101
- "clan_tag": null,
1102
- "broadcast_id": "0",
1103
- "game_lobby_id": "0",
1104
- "watching_broadcast_accountid": null,
1105
- "watching_broadcast_appid": null,
1106
- "watching_broadcast_viewers": null,
1107
- "watching_broadcast_title": null,
1108
- "is_community_banned": null,
1109
- "player_name_pending_review": null,
1110
- "avatar_pending_review": null
1111
- }
1112
- })
1113
-
1114
- steamClient.chat.on('friendMessage', async (data) => {
1115
- if (!data) return
1116
- data.message_no_bbcode = data.message_no_bbcode?.replaceAll(`ː`,`:`)
1117
- data.message = data.message?.replaceAll(`ː`,`:`)
1118
- const example = {
1119
- "steamid_friend": {
1120
- "universe": 1,
1121
- "type": 1,
1122
- "instance": 1,
1123
- "accountid": 1080136620
1124
- },
1125
- "chat_entry_type": 1,
1126
- "from_limited_account": false,
1127
- "message": "xxx",
1128
- "ordinal": 0,
1129
- "local_echo": false,
1130
- "message_no_bbcode": "xxx",
1131
- "low_priority": false,
1132
- "server_timestamp": "2023-05-14T09:26:25.000Z",
1133
- "message_bbcode_parsed": [
1134
- "xxx"
1135
- ]
1136
- }
1137
- const timestamp = new Date(data.server_timestamp).getTime()
1138
- const steamId = data.steamid_friend.getSteamID64()
1139
- const personas = await getPersonas([steamId])
1140
- const player_name = personas.find(p => p.id == steamId)?.player_name || ''
1141
- 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)
1142
- const emotion = (data.message_no_bbcode || '').split(' ').find(m => m.startsWith(':') && m.endsWith(':'))
1143
-
1144
- callEvent(events.friendMessage, {
1145
- player_name,
1146
- message: data.message_no_bbcode,
1147
- invite,
1148
- steamId,
1149
- timestamp,
1150
- from_limited_account: data.from_limited_account,
1151
- emotion,
1152
- })
1153
-
1154
- });
1155
-
1156
- steamClient.on('friendTyping', async function (steamId, message) {
1157
- callEvent(events.friendTyping, {
1158
- steamId, message
1159
- })
1160
- });
1161
-
1162
- steamClient.on('playingState', async function (playing_blocked, playing_app) {
1163
- playingBlocked = playing_blocked
1164
- if (playing_app === 0) {
1165
- playing_app = null
1166
- }
1167
- if (playing_blocked) {//true, false
1168
- console.log("Playing else where")
1169
- }
1170
- log('playingState', playing_blocked, playing_app);
1171
- });
1172
-
1173
- steamClient.on('friendRelationship', async function (sid, relationship, previousRelationship) {
1174
- callEvent(events.friendRelationship, {steamId: sid.getSteamID64(), relationship, previousRelationship})
1175
- switch (relationship) {
1176
- case EFriendRelationship.None: {
1177
- //we got unfriended.
1178
- break
1179
- }
1180
- case EFriendRelationship.RequestRecipient: {
1181
- //we got invited as a friend
1182
- break
1183
- }
1184
- case EFriendRelationship.Friend: {
1185
- //we got added as a friend
1186
- break
1187
- }
1188
- }
1189
- });
1190
-
1191
- steamClient.on('tradeOffers', async function (count) {
1192
- callEvent(events.tradeOffers, count)
1193
- });
1194
-
1195
- steamClient.on('offlineMessages', async function (count, friends) {
1196
- callEvent(events.offlineMessages, {count, steamIdList: friends})
1197
- });
1198
-
1199
- steamClient.on('tradeRequest', async function (steamID, respond) {
1200
- if (autoAcceptTradeRequest) {
1201
- log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, accepting`);
1202
- respond(true);
1203
- } else {
1204
- log(`Incoming trade request from ${steamID.getSteam3RenderedID()}, wating`);
1205
- }
1206
- });
1207
-
1208
- steamClient.on('friendsList', async function () {
1209
- callEvent(events.friendsList, getFriendList())
1210
- });
1211
-
1212
- steamClient.on('gifts', async function (gid, packageid, TimeCreated, TimeExpiration, TimeSent, TimeAcked, TimeRedeemed, RecipientAddress, SenderAddress, SenderName) {
1213
- callEvent(events.gifts, {
1214
- gid,
1215
- packageid,
1216
- TimeCreated,
1217
- TimeExpiration,
1218
- TimeSent,
1219
- TimeAcked,
1220
- TimeRedeemed,
1221
- RecipientAddress,
1222
- SenderAddress,
1223
- SenderName
1224
- })
1225
- });
1226
+ for (const name in events) {
1227
+ steamClient.on(name, events[name])
1228
+ }
1226
1229
  }
1227
1230
 
1228
1231
  function getFriendList() {
@@ -1400,7 +1403,7 @@ function SteamClient({
1400
1403
  }
1401
1404
 
1402
1405
  async function sendFriendMessage(steamId, message) {
1403
- while (sendMessageTimestamp && new Date().getTime() - sendMessageTimestamp < 1100){
1406
+ while (sendMessageTimestamp && new Date().getTime() - sendMessageTimestamp < 1100) {
1404
1407
  await sleep(500)
1405
1408
  }
1406
1409
 
@@ -1413,7 +1416,7 @@ function SteamClient({
1413
1416
  })
1414
1417
 
1415
1418
  if (result?.[1]?.server_timestamp) {
1416
- sendMessageTimestamp= new Date().getTime()
1419
+ sendMessageTimestamp = new Date().getTime()
1417
1420
  return result?.[1]
1418
1421
  } else if (result?.[0]?.message?.includes?.("RateLimitExceeded")) {
1419
1422
  await sleep(5000)
@@ -1700,7 +1703,7 @@ function SteamClient({
1700
1703
  })
1701
1704
  },
1702
1705
  onAnyEvent,
1703
- async redeemGift(gid){
1706
+ async redeemGift(gid) {
1704
1707
  try {
1705
1708
  const community = new SteamCommunity();
1706
1709
  let cookies = await getCookiesWait();
@@ -1709,13 +1712,13 @@ function SteamClient({
1709
1712
  } catch (e) {
1710
1713
  }
1711
1714
  },
1712
- async requestFreeLicense(...args){
1715
+ async requestFreeLicense(...args) {
1713
1716
  try {
1714
1717
  return await steamClient.requestFreeLicense(...args)
1715
1718
  } catch (e) {
1716
1719
  }
1717
1720
  },
1718
- getSteamId(){
1721
+ getSteamId() {
1719
1722
  try {
1720
1723
  return steamClient.steamID.getSteamID64()
1721
1724
  } catch (e) {