steamutils 1.4.64 → 1.4.65
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.
- package/.idea/codeStyles/Project.xml +1 -0
- package/.idea/deployment.xml +14 -0
- package/.prettierrc.json +3 -3
- package/SteamClient.js +185 -110
- package/_steamproto.js +33 -33
- package/axios.js +84 -84
- package/bufferHelpers.js +115 -115
- package/cheerio.js +103 -103
- package/const.js +458 -458
- package/create_proto.js +96 -96
- package/create_remote_file.js +66 -66
- package/full_steamproto.js +35 -0
- package/helpers/protos.js +48 -48
- package/index.js +7764 -7764
- package/package.json +1 -1
- package/protos/csgo/base_gcmessages.proto +553 -553
- package/protos/csgo/base_gcmessages_csgo.proto +547 -547
- package/protos/csgo/c_peer2peer_netmessages.proto +55 -55
- package/protos/csgo/clientmessages.proto +48 -48
- package/protos/csgo/connectionless_netmessages.proto +17 -17
- package/protos/csgo/cs_gameevents.proto +35 -35
- package/protos/csgo/cs_usercmd.proto +34 -34
- package/protos/csgo/cstrike15_gcmessages.proto +1431 -1431
- package/protos/csgo/cstrike15_usermessages.proto +592 -592
- package/protos/csgo/demo.proto +165 -165
- package/protos/csgo/econ_gcmessages.proto +219 -219
- package/protos/csgo/enums_clientserver.proto +1529 -1529
- package/protos/csgo/fatdemo.proto +125 -125
- package/protos/csgo/gameevents.proto +120 -120
- package/protos/csgo/gcsdk_gcmessages.proto +323 -323
- package/protos/csgo/gcsystemmsgs.proto +243 -243
- package/protos/csgo/netmessages.proto +618 -618
- package/protos/csgo/networkbasetypes.proto +246 -246
- package/protos/csgo/networksystem_protomessages.proto +17 -17
- package/protos/csgo/steamdatagram_messages_auth.proto +65 -65
- package/protos/csgo/steamdatagram_messages_sdr.proto +534 -534
- package/protos/csgo/steammessages_cloud.steamworkssdk.proto +68 -68
- package/protos/csgo/steammessages_gamenetworkingui.proto +61 -61
- package/protos/csgo/steammessages_helprequest.steamworkssdk.proto +22 -22
- package/protos/csgo/steammessages_oauth.steamworkssdk.proto +18 -18
- package/protos/csgo/steammessages_player.steamworkssdk.proto +254 -254
- package/protos/csgo/steammessages_publishedfile.steamworkssdk.proto +233 -233
- package/protos/csgo/steamnetworkingsockets_messages.proto +205 -205
- package/protos/csgo/steamnetworkingsockets_messages_certs.proto +39 -39
- package/protos/csgo/steamnetworkingsockets_messages_udp.proto +75 -75
- package/protos/csgo/te.proto +259 -259
- package/protos/csgo/uifontfile_format.proto +13 -13
- package/protos/csgo/usercmd.proto +39 -39
- package/protos/csgo/usermessages.proto +752 -752
- package/protos/google/protobuf/descriptor.proto +281 -281
- package/protos/steam/clientmetrics.proto +45 -45
- package/protos/steam/content_manifest.proto +62 -62
- package/protos/steam/contenthubs.proto +41 -41
- package/protos/steam/encrypted_app_ticket.proto +10 -10
- package/protos/steam/enums.proto +501 -501
- package/protos/steam/enums_clientserver.proto +1508 -1508
- package/protos/steam/enums_productinfo.proto +14 -14
- package/protos/steam/htmlmessages.proto +1039 -1039
- package/protos/steam/offline_ticket.proto +8 -8
- package/protos/steam/steamdatagram_messages_auth.proto +65 -65
- package/protos/steam/steamdatagram_messages_sdr.proto +533 -533
- package/protos/steam/steammessages_accounthardware.steamclient.proto +167 -167
- package/protos/steam/steammessages_appoverview.proto +204 -204
- package/protos/steam/steammessages_auth.steamclient.proto +375 -375
- package/protos/steam/steammessages_broadcast.steamclient.proto +618 -618
- package/protos/steam/steammessages_chat.steamclient.proto +1070 -1070
- package/protos/steam/steammessages_client_objects.proto +649 -649
- package/protos/steam/steammessages_clientlanp2p.proto +43 -43
- package/protos/steam/steammessages_clientmetrics.steamclient.proto +192 -192
- package/protos/steam/steammessages_clientnotificationtypes.proto +250 -250
- package/protos/steam/steammessages_clientserver.proto +392 -392
- package/protos/steam/steammessages_clientserver_2.proto +771 -771
- package/protos/steam/steammessages_clientserver_appinfo.proto +131 -131
- package/protos/steam/steammessages_clientserver_friends.proto +260 -260
- package/protos/steam/steammessages_clientserver_gameservers.proto +159 -159
- package/protos/steam/steammessages_clientserver_lbs.proto +70 -70
- package/protos/steam/steammessages_clientserver_login.proto +167 -167
- package/protos/steam/steammessages_clientserver_mms.proto +233 -233
- package/protos/steam/steammessages_clientserver_ucm.proto +207 -207
- package/protos/steam/steammessages_clientserver_uds.proto +125 -125
- package/protos/steam/steammessages_clientserver_ufs.proto +45 -45
- package/protos/steam/steammessages_clientserver_userstats.proto +80 -80
- package/protos/steam/steammessages_cloud.steamclient.proto +422 -422
- package/protos/steam/steammessages_contentsystem.steamclient.proto +123 -123
- package/protos/steam/steammessages_credentials.steamclient.proto +96 -96
- package/protos/steam/steammessages_datapublisher.steamclient.proto +102 -102
- package/protos/steam/steammessages_depotbuilder.steamclient.proto +99 -99
- package/protos/steam/steammessages_deviceauth.steamclient.proto +169 -169
- package/protos/steam/steammessages_econ.steamclient.proto +137 -137
- package/protos/steam/steammessages_familygroups.steamclient.proto +441 -441
- package/protos/steam/steammessages_friendmessages.steamclient.proto +141 -141
- package/protos/steam/steammessages_gamenetworking.steamclient.proto +25 -25
- package/protos/steam/steammessages_gamenetworkingui.proto +61 -61
- package/protos/steam/steammessages_gamenotifications.steamclient.proto +131 -131
- package/protos/steam/steammessages_gameservers.steamclient.proto +136 -136
- package/protos/steam/steammessages_hiddevices.proto +157 -157
- package/protos/steam/steammessages_inventory.steamclient.proto +172 -172
- package/protos/steam/steammessages_linkfilter.steamclient.proto +39 -39
- package/protos/steam/steammessages_lobbymatchmaking.steamclient.proto +29 -29
- package/protos/steam/steammessages_market.steamclient.proto +22 -22
- package/protos/steam/steammessages_marketingmessages.steamclient.proto +273 -273
- package/protos/steam/steammessages_offline.steamclient.proto +33 -33
- package/protos/steam/steammessages_parental.steamclient.proto +262 -262
- package/protos/steam/steammessages_parties.steamclient.proto +75 -75
- package/protos/steam/steammessages_partnerapps.steamclient.proto +106 -106
- package/protos/steam/steammessages_player.steamclient.proto +915 -915
- package/protos/steam/steammessages_publishedfile.steamclient.proto +737 -737
- package/protos/steam/steammessages_qms.steamclient.proto +111 -111
- package/protos/steam/steammessages_remoteclient.proto +100 -100
- package/protos/steam/steammessages_remoteclient_discovery.proto +244 -244
- package/protos/steam/steammessages_remoteclient_service.steamclient.proto +31 -31
- package/protos/steam/steammessages_remoteclient_service_messages.proto +217 -217
- package/protos/steam/steammessages_remoteplay.proto +975 -975
- package/protos/steam/steammessages_secrets.steamclient.proto +35 -35
- package/protos/steam/steammessages_shader.steamclient.proto +89 -89
- package/protos/steam/steammessages_site_license.steamclient.proto +103 -103
- package/protos/steam/steammessages_sitelicenseclient.proto +38 -38
- package/protos/steam/steammessages_siteserverui.proto +130 -130
- package/protos/steam/steammessages_steamtv.steamclient.proto +533 -533
- package/protos/steam/steammessages_store.steamclient.proto +404 -404
- package/protos/steam/steammessages_storebrowse.steamclient.proto +457 -457
- package/protos/steam/steammessages_timedtrial.steamclient.proto +40 -40
- package/protos/steam/steammessages_twofactor.steamclient.proto +157 -157
- package/protos/steam/steammessages_unified_test.steamclient.proto +51 -51
- package/protos/steam/steammessages_useraccount.steamclient.proto +211 -211
- package/protos/steam/steammessages_vac.steamclient.proto +37 -37
- package/protos/steam/steammessages_video.steamclient.proto +68 -68
- package/protos/steam/steammessages_virtualcontroller.proto +138 -138
- package/protos/steam/steammessages_workshop.steamclient.proto +19 -19
- package/protos/steam/steamnetworkingsockets_messages.proto +205 -205
- package/protos/steam/steamnetworkingsockets_messages_certs.proto +39 -39
- package/protos/steam/steamnetworkingsockets_messages_udp.proto +75 -75
- package/protos/steam/webuimessages_achievements.proto +29 -29
- package/protos/steam/webuimessages_gamenotes.proto +21 -21
- package/protos/steam/webuimessages_gamescope.proto +57 -57
- package/protos/steam/webuimessages_steamengine.proto +41 -41
- package/protos/steam/webuimessages_steamos.proto +114 -114
- package/protos/steam/webuimessages_storagedevicemanager.proto +110 -110
- package/protos/steam/webuimessages_systemmanager.proto +17 -17
- package/protos/steam/webuimessages_transport.proto +22 -22
- package/protos/steam/webuimessages_transportvalidation.proto +111 -111
- package/protos/webui/common.proto +4024 -4024
- package/protos/webui/service_accountcart.proto +153 -153
- package/protos/webui/service_accountlinking.proto +27 -27
- package/protos/webui/service_accountprivacy.proto +42 -42
- package/protos/webui/service_accountprivateapps.proto +34 -34
- package/protos/webui/service_auction.proto +97 -97
- package/protos/webui/service_authentication.proto +222 -222
- package/protos/webui/service_authenticationsupport.proto +74 -74
- package/protos/webui/service_broadcast.proto +562 -562
- package/protos/webui/service_chat.proto +11 -11
- package/protos/webui/service_chatroom.proto +810 -810
- package/protos/webui/service_chatusability.proto +107 -107
- package/protos/webui/service_checkout.proto +84 -84
- package/protos/webui/service_clan.proto +41 -41
- package/protos/webui/service_clanchatrooms.proto +25 -25
- package/protos/webui/service_clanfaqs.proto +202 -202
- package/protos/webui/service_clientcomm.proto +151 -151
- package/protos/webui/service_clientmetrics.proto +22 -22
- package/protos/webui/service_cloud.proto +222 -222
- package/protos/webui/service_cloudconfigstore.proto +51 -51
- package/protos/webui/service_cloudgaming.proto +30 -30
- package/protos/webui/service_community.proto +365 -365
- package/protos/webui/service_dailydeal.proto +89 -89
- package/protos/webui/service_econ.proto +134 -134
- package/protos/webui/service_embedded.proto +24 -24
- package/protos/webui/service_experimentservice.proto +6 -6
- package/protos/webui/service_familygroups.proto +355 -355
- package/protos/webui/service_fovasvideo.proto +15 -15
- package/protos/webui/service_friendmessages.proto +133 -133
- package/protos/webui/service_friendslist.proto +70 -70
- package/protos/webui/service_gamenotes.proto +15 -15
- package/protos/webui/service_gamerecording.proto +265 -265
- package/protos/webui/service_gamerecordingclip.proto +85 -85
- package/protos/webui/service_gamerecordingdebug.proto +52 -52
- package/protos/webui/service_helprequestlogs.proto +16 -16
- package/protos/webui/service_loyaltyrewards.proto +252 -252
- package/protos/webui/service_marketingmessages.proto +215 -215
- package/protos/webui/service_mobileapp.proto +18 -18
- package/protos/webui/service_mobileauth.proto +24 -24
- package/protos/webui/service_mobiledevice.proto +26 -26
- package/protos/webui/service_mobileperaccount.proto +31 -31
- package/protos/webui/service_news.proto +110 -110
- package/protos/webui/service_parental.proto +258 -258
- package/protos/webui/service_partnermembershipinvite.proto +34 -34
- package/protos/webui/service_partnerstorebrowse.proto +28 -28
- package/protos/webui/service_phone.proto +51 -51
- package/protos/webui/service_physicalgoods.proto +15 -15
- package/protos/webui/service_player.proto +918 -918
- package/protos/webui/service_promotioneventinvites.proto +109 -109
- package/protos/webui/service_promotionplanning.proto +186 -186
- package/protos/webui/service_promotionstats.proto +23 -23
- package/protos/webui/service_publishedfile.proto +714 -714
- package/protos/webui/service_publishing.proto +200 -200
- package/protos/webui/service_quest.proto +127 -127
- package/protos/webui/service_salefeature.proto +373 -373
- package/protos/webui/service_saleitemrewards.proto +54 -54
- package/protos/webui/service_shoppingcart.proto +152 -152
- package/protos/webui/service_steamawards.proto +76 -76
- package/protos/webui/service_steamcharts.proto +75 -75
- package/protos/webui/service_steamengine.proto +36 -36
- package/protos/webui/service_steamlearn.proto +876 -876
- package/protos/webui/service_steamnotification.proto +73 -73
- package/protos/webui/service_steamtv.proto +495 -495
- package/protos/webui/service_steamvrvoicechat.proto +67 -67
- package/protos/webui/service_steamvrwebrtc.proto +48 -48
- package/protos/webui/service_storagedevicemanager.proto +104 -104
- package/protos/webui/service_store.proto +359 -359
- package/protos/webui/service_storeappsimilarity.proto +76 -76
- package/protos/webui/service_storebrowse.proto +103 -103
- package/protos/webui/service_storemarketing.proto +44 -44
- package/protos/webui/service_storequery.proto +103 -103
- package/protos/webui/service_storesales.proto +87 -87
- package/protos/webui/service_storetopsellers.proto +44 -44
- package/protos/webui/service_systemmanager.proto +11 -11
- package/protos/webui/service_test_transporterror.proto +6 -6
- package/protos/webui/service_transportauth.proto +17 -17
- package/protos/webui/service_transportvalidation.proto +69 -69
- package/protos/webui/service_twofactor.proto +170 -170
- package/protos/webui/service_useraccount.proto +142 -142
- package/protos/webui/service_usergameactivity.proto +34 -34
- package/protos/webui/service_usergamenotes.proto +70 -70
- package/protos/webui/service_usernews.proto +68 -68
- package/protos/webui/service_userreviews.proto +97 -97
- package/protos/webui/service_video.proto +50 -50
- package/protos/webui/service_videoclip.proto +62 -62
- package/protos/webui/service_voicechat.proto +139 -139
- package/protos/webui/service_webrtc.proto +52 -52
- package/remote.js +6784 -6784
- package/steamproto.js +34 -34
- package/utils.js +986 -986
- package/.idea/gbrowser_project.xml +0 -11
- package/.idea/git_toolbox_blame.xml +0 -6
- package/.idea/git_toolbox_prj.xml +0 -15
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<code_scheme name="Project" version="173">
|
|
3
3
|
<HTMLCodeStyleSettings>
|
|
4
4
|
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
+
<option name="HTML_ENFORCE_QUOTES" value="true" />
|
|
5
6
|
</HTMLCodeStyleSettings>
|
|
6
7
|
<JSCodeStyleSettings version="0">
|
|
7
8
|
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="PublishConfigData" remoteFilesAllowedToDisappearOnAutoupload="false">
|
|
4
|
+
<serverData>
|
|
5
|
+
<paths name="botnatridiscord">
|
|
6
|
+
<serverdata>
|
|
7
|
+
<mappings>
|
|
8
|
+
<mapping local="$PROJECT_DIR$" web="/" />
|
|
9
|
+
</mappings>
|
|
10
|
+
</serverdata>
|
|
11
|
+
</paths>
|
|
12
|
+
</serverData>
|
|
13
|
+
</component>
|
|
14
|
+
</project>
|
package/.prettierrc.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"printWidth": 1000
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"printWidth": 1000
|
|
3
|
+
}
|
package/SteamClient.js
CHANGED
|
@@ -94,7 +94,7 @@ export const SteamClientEvents = {
|
|
|
94
94
|
};
|
|
95
95
|
let isSendingFriendMessages = false;
|
|
96
96
|
|
|
97
|
-
function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense = true, isFakeGameScore = true, isPartyRegister = true, isAutoPlay = false, isInvisible = false, autoAcceptTradeRequest = false, autoReconnect = true,
|
|
97
|
+
function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense = true, isFakeGameScore = true, isPartyRegister = true, isAutoPlay = false, isInvisible = false, autoAcceptTradeRequest = false, autoReconnect = true, games = null }) {
|
|
98
98
|
const steamClient = new NodeSteamUser();
|
|
99
99
|
let prime = null;
|
|
100
100
|
let state = "Offline"; //InGame, Online, Invisible
|
|
@@ -119,11 +119,46 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
119
119
|
|
|
120
120
|
const onAnyCallbacks = [];
|
|
121
121
|
|
|
122
|
-
|
|
122
|
+
/**
|
|
123
|
+
* @type {Object.<string, Array>}
|
|
124
|
+
* @property {Array} user
|
|
125
|
+
* @property {Array} loggedOn
|
|
126
|
+
* @property {Array} csgoOnline
|
|
127
|
+
* @property {Array} csgoClientHello
|
|
128
|
+
* @property {Array} webSession
|
|
129
|
+
* @property {Array} friendMessage
|
|
130
|
+
* @property {Array} friendTyping
|
|
131
|
+
* @property {Array} disconnected
|
|
132
|
+
* @property {Array} error
|
|
133
|
+
* @property {Array} playersProfile
|
|
134
|
+
* @property {Array} fatalError
|
|
135
|
+
* @property {Array} partyInvite
|
|
136
|
+
* @property {Array} friendRelationship
|
|
137
|
+
* @property {Array} tradeOffers
|
|
138
|
+
* @property {Array} offlineMessages
|
|
139
|
+
* @property {Array} friendsList
|
|
140
|
+
* @property {Array} gifts
|
|
141
|
+
* @property {Array} playingState
|
|
142
|
+
* @property {Array} emailInfo
|
|
143
|
+
* @property {Array} accountLimitations
|
|
144
|
+
* @property {Array} wallet
|
|
145
|
+
* @property {Array} licenses
|
|
146
|
+
* @property {Array} logOff
|
|
147
|
+
*/
|
|
148
|
+
const events = {};
|
|
123
149
|
for (const name in SteamClientEvents) {
|
|
124
150
|
events[name] = [];
|
|
125
151
|
}
|
|
126
152
|
|
|
153
|
+
/**
|
|
154
|
+
* @typedef {Object} GCEvents
|
|
155
|
+
* @property {Array} requestJoinFriendData
|
|
156
|
+
* @property {Array} requestCoPlays
|
|
157
|
+
* @property {Array} partySearch
|
|
158
|
+
* @property {Array} playersProfile
|
|
159
|
+
*
|
|
160
|
+
* @type {GCEvents}
|
|
161
|
+
*/
|
|
127
162
|
const gcEvents = {
|
|
128
163
|
requestJoinFriendData: [],
|
|
129
164
|
requestCoPlays: [],
|
|
@@ -159,51 +194,23 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
159
194
|
}
|
|
160
195
|
|
|
161
196
|
function clearGCCallback(name) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
case "string":
|
|
168
|
-
if (Array.isArray(gcEvents[nameE])) {
|
|
169
|
-
//name
|
|
170
|
-
for (const eventElement of gcEvents[nameE]) {
|
|
171
|
-
if (eventElement.timeout) {
|
|
172
|
-
clearTimeout(eventElement.timeout);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
gcEvents[nameE] = [];
|
|
176
|
-
} else {
|
|
177
|
-
//id
|
|
178
|
-
for (const eventsKey in gcEvents) {
|
|
179
|
-
if (!Array.isArray(gcEvents[eventsKey])) {
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
const index = gcEvents[eventsKey].findIndex((e) => e.id === nameE);
|
|
183
|
-
if (index > -1) {
|
|
184
|
-
if (gcEvents[eventsKey].timeout) {
|
|
185
|
-
clearTimeout(gcEvents[eventsKey].timeout);
|
|
186
|
-
}
|
|
187
|
-
gcEvents[eventsKey].splice(index, 1);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
197
|
+
for (const [eventName, events] of Object.entries(gcEvents)) {
|
|
198
|
+
if (eventName === name) {
|
|
199
|
+
for (const event of events) {
|
|
200
|
+
if (event.timeout) {
|
|
201
|
+
clearTimeout(event.timeout);
|
|
190
202
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
if (gcEvents[eventsKey].timeout) {
|
|
201
|
-
clearTimeout(gcEvents[eventsKey].timeout);
|
|
202
|
-
}
|
|
203
|
-
gcEvents[eventsKey].splice(index, 1);
|
|
204
|
-
}
|
|
203
|
+
}
|
|
204
|
+
events.length = 0;
|
|
205
|
+
} else {
|
|
206
|
+
const removedEvents = _.remove(events, function (e) {
|
|
207
|
+
return Object.values(e).some((v) => v === name);
|
|
208
|
+
});
|
|
209
|
+
for (const removedEvent of removedEvents) {
|
|
210
|
+
if (removedEvent.timeout) {
|
|
211
|
+
clearTimeout(removedEvent.timeout);
|
|
205
212
|
}
|
|
206
|
-
|
|
213
|
+
}
|
|
207
214
|
}
|
|
208
215
|
}
|
|
209
216
|
}
|
|
@@ -217,14 +224,14 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
217
224
|
return;
|
|
218
225
|
}
|
|
219
226
|
|
|
220
|
-
const
|
|
227
|
+
const removedEvents = _.remove(gcEvents[name], (item) => !key || item.key === key);
|
|
221
228
|
let _data = null;
|
|
222
229
|
let calculated = false;
|
|
223
230
|
|
|
224
|
-
for (const
|
|
225
|
-
if (
|
|
226
|
-
clearTimeout(
|
|
227
|
-
delete
|
|
231
|
+
for (const removedEvent of removedEvents) {
|
|
232
|
+
if (removedEvent.timeout) {
|
|
233
|
+
clearTimeout(removedEvent.timeout);
|
|
234
|
+
delete removedEvent.timeout;
|
|
228
235
|
}
|
|
229
236
|
|
|
230
237
|
if (!calculated) {
|
|
@@ -232,23 +239,22 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
232
239
|
_data = typeof data === "function" ? await data() : data;
|
|
233
240
|
}
|
|
234
241
|
|
|
235
|
-
|
|
242
|
+
removedEvent.callback(_data);
|
|
236
243
|
}
|
|
237
244
|
}
|
|
238
245
|
|
|
239
|
-
function callEvent(
|
|
240
|
-
|
|
241
|
-
|
|
246
|
+
function callEvent(name, data) {
|
|
247
|
+
if (typeof name !== "string") {
|
|
248
|
+
name = Object.keys(events).find((eventName) => events[eventName] === name);
|
|
249
|
+
}
|
|
242
250
|
|
|
243
|
-
_events
|
|
251
|
+
const _events = events[name];
|
|
252
|
+
onAnyCallbacks.forEach((cb) => cb?.({ eventName: name, data }));
|
|
253
|
+
_events.forEach((e) => {
|
|
254
|
+
clearTimeout(e.timeout);
|
|
244
255
|
e.callback?.(data);
|
|
245
|
-
e.timeout && clearTimeout(e.timeout);
|
|
246
|
-
delete e.timeout;
|
|
247
|
-
if (e.once) {
|
|
248
|
-
delete e.callback;
|
|
249
|
-
}
|
|
250
256
|
});
|
|
251
|
-
_.remove(_events, (e) => !e || e
|
|
257
|
+
_.remove(_events, (e) => !e || e.once);
|
|
252
258
|
}
|
|
253
259
|
|
|
254
260
|
function onEvent({ name, id, callback, once, timeout }) {
|
|
@@ -279,51 +285,23 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
279
285
|
|
|
280
286
|
// name, id, callback
|
|
281
287
|
function offEvent(name) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
case "string":
|
|
288
|
-
if (Array.isArray(events[nameE])) {
|
|
289
|
-
//name
|
|
290
|
-
for (const eventElement of events[nameE]) {
|
|
291
|
-
if (eventElement.timeout) {
|
|
292
|
-
clearTimeout(eventElement.timeout);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
events[nameE] = [];
|
|
296
|
-
} else {
|
|
297
|
-
//id
|
|
298
|
-
for (const eventsKey in events) {
|
|
299
|
-
if (!Array.isArray(events[eventsKey])) {
|
|
300
|
-
continue;
|
|
301
|
-
}
|
|
302
|
-
const index = events[eventsKey].findIndex((e) => e.id === nameE);
|
|
303
|
-
if (index > -1) {
|
|
304
|
-
if (events[eventsKey].timeout) {
|
|
305
|
-
clearTimeout(events[eventsKey].timeout);
|
|
306
|
-
}
|
|
307
|
-
events[eventsKey].splice(index, 1);
|
|
308
|
-
}
|
|
309
|
-
}
|
|
288
|
+
for (const [eventName, _events] of Object.entries(events)) {
|
|
289
|
+
if (eventName === name) {
|
|
290
|
+
for (const event of _events) {
|
|
291
|
+
if (event.timeout) {
|
|
292
|
+
clearTimeout(event.timeout);
|
|
310
293
|
}
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
if (events[eventsKey].timeout) {
|
|
321
|
-
clearTimeout(events[eventsKey].timeout);
|
|
322
|
-
}
|
|
323
|
-
events[eventsKey].splice(index, 1);
|
|
324
|
-
}
|
|
294
|
+
}
|
|
295
|
+
_events.length = 0;
|
|
296
|
+
} else {
|
|
297
|
+
const removedEvents = _.remove(_events, function (e) {
|
|
298
|
+
return Object.values(e).some((v) => v === name);
|
|
299
|
+
});
|
|
300
|
+
for (const removedEvent of removedEvents) {
|
|
301
|
+
if (removedEvent.timeout) {
|
|
302
|
+
clearTimeout(removedEvent.timeout);
|
|
325
303
|
}
|
|
326
|
-
|
|
304
|
+
}
|
|
327
305
|
}
|
|
328
306
|
}
|
|
329
307
|
}
|
|
@@ -342,7 +320,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
342
320
|
delete event.timeout;
|
|
343
321
|
}
|
|
344
322
|
}
|
|
345
|
-
events[name] =
|
|
323
|
+
events[name].length = 0;
|
|
346
324
|
}
|
|
347
325
|
onAnyCallbacks.length = 0;
|
|
348
326
|
}
|
|
@@ -429,6 +407,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
429
407
|
}
|
|
430
408
|
|
|
431
409
|
async function getPersonas(steamIDs) {
|
|
410
|
+
if (isLogOff) return [];
|
|
432
411
|
if (!steamIDs) return [];
|
|
433
412
|
if (!Array.isArray(steamIDs)) {
|
|
434
413
|
steamIDs = [steamIDs];
|
|
@@ -491,6 +470,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
491
470
|
}
|
|
492
471
|
|
|
493
472
|
async function getCookiesWait() {
|
|
473
|
+
if (isLogOff) {
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
494
476
|
return (
|
|
495
477
|
getCookies() ||
|
|
496
478
|
new Promise((resolve) => {
|
|
@@ -507,6 +489,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
507
489
|
}
|
|
508
490
|
|
|
509
491
|
async function gamePlay() {
|
|
492
|
+
if (isLogOff) {
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
510
495
|
return await gamesPlayed(730);
|
|
511
496
|
}
|
|
512
497
|
|
|
@@ -522,9 +507,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
522
507
|
|
|
523
508
|
async function updateAutoGamePlay() {
|
|
524
509
|
if (isAutoPlay) {
|
|
525
|
-
autoGamePlay();
|
|
510
|
+
await autoGamePlay();
|
|
526
511
|
} else {
|
|
527
|
-
offAutoGamePlay();
|
|
512
|
+
await offAutoGamePlay();
|
|
528
513
|
}
|
|
529
514
|
}
|
|
530
515
|
|
|
@@ -537,6 +522,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
537
522
|
* @returns {Promise.<Array>}
|
|
538
523
|
*/
|
|
539
524
|
async function partySearch({ prime = false, game_type = "Premier", rank, timeout = 5000 } = {}) {
|
|
525
|
+
if (isLogOff) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
540
528
|
const gameTypeMap = {
|
|
541
529
|
Competitive: 8,
|
|
542
530
|
Wingman: 10,
|
|
@@ -588,6 +576,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
588
576
|
}
|
|
589
577
|
|
|
590
578
|
async function createLobby() {
|
|
579
|
+
if (isLogOff) {
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
591
582
|
if (!steamClient.steamID) {
|
|
592
583
|
return;
|
|
593
584
|
}
|
|
@@ -639,6 +630,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
639
630
|
}
|
|
640
631
|
|
|
641
632
|
async function updateLobby(lobbyID) {
|
|
633
|
+
if (isLogOff) {
|
|
634
|
+
return;
|
|
635
|
+
}
|
|
642
636
|
if (!steamClient.steamID) {
|
|
643
637
|
return;
|
|
644
638
|
}
|
|
@@ -702,6 +696,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
702
696
|
}
|
|
703
697
|
|
|
704
698
|
async function invite2Lobby(lobbyID, steamId) {
|
|
699
|
+
if (isLogOff) {
|
|
700
|
+
return;
|
|
701
|
+
}
|
|
705
702
|
if (!steamClient.steamID) {
|
|
706
703
|
return;
|
|
707
704
|
}
|
|
@@ -735,6 +732,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
735
732
|
}
|
|
736
733
|
|
|
737
734
|
async function createThenInvite2Lobby(steamIds, onInvite) {
|
|
735
|
+
if (isLogOff) {
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
738
|
if (!steamClient.steamID) {
|
|
739
739
|
return;
|
|
740
740
|
}
|
|
@@ -761,6 +761,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
761
761
|
}
|
|
762
762
|
|
|
763
763
|
async function getLobbyData(lobbyID) {
|
|
764
|
+
if (isLogOff) {
|
|
765
|
+
return;
|
|
766
|
+
}
|
|
764
767
|
if (!steamClient.steamID) {
|
|
765
768
|
return;
|
|
766
769
|
}
|
|
@@ -793,6 +796,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
793
796
|
}
|
|
794
797
|
|
|
795
798
|
async function joinLobby(lobbyID) {
|
|
799
|
+
if (isLogOff) {
|
|
800
|
+
return;
|
|
801
|
+
}
|
|
796
802
|
log("joinLobby", lobbyID); //SteamID.fromIndividualAccountID(lobbyId).accountid
|
|
797
803
|
|
|
798
804
|
steamClient._send(
|
|
@@ -829,6 +835,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
829
835
|
}
|
|
830
836
|
|
|
831
837
|
async function sendHello() {
|
|
838
|
+
if (isLogOff) {
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
832
841
|
steamClient.sendToGC(AppID, ESteamProto.ECsgoGCMsg.k_EMsgGCCStrike15_v2_MatchmakingClient2GCHello, {}, Buffer.alloc(0));
|
|
833
842
|
// steamClient.sendToGC(AppID, ESteamProto.EGCBaseClientMsg.k_EMsgGCClientHello, {}, Buffer.alloc(0));
|
|
834
843
|
|
|
@@ -846,6 +855,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
846
855
|
}
|
|
847
856
|
|
|
848
857
|
async function requestCoPlays() {
|
|
858
|
+
if (isLogOff) {
|
|
859
|
+
return;
|
|
860
|
+
}
|
|
849
861
|
const gcEventId = uuidv4();
|
|
850
862
|
const response = await ensureLogin(
|
|
851
863
|
new Promise((resolve) => {
|
|
@@ -1807,6 +1819,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
1807
1819
|
}
|
|
1808
1820
|
|
|
1809
1821
|
function sendFriendTyping(steamId, callback) {
|
|
1822
|
+
if (isLogOff) {
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1810
1825
|
steamClient.chat.sendFriendTyping(steamId, callback);
|
|
1811
1826
|
}
|
|
1812
1827
|
|
|
@@ -1814,6 +1829,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
1814
1829
|
* usually take 400 -> 800 miliseconds
|
|
1815
1830
|
* */
|
|
1816
1831
|
async function getPlayersProfile(steamId) {
|
|
1832
|
+
if (isLogOff) {
|
|
1833
|
+
return;
|
|
1834
|
+
}
|
|
1817
1835
|
const accountid = new SteamID(steamId).accountid;
|
|
1818
1836
|
const gcEventId = uuidv4();
|
|
1819
1837
|
const result = await ensureLogin(
|
|
@@ -1841,6 +1859,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
1841
1859
|
}
|
|
1842
1860
|
|
|
1843
1861
|
async function checkPlayerPrimeStatus(steamId) {
|
|
1862
|
+
if (isLogOff) {
|
|
1863
|
+
return;
|
|
1864
|
+
}
|
|
1844
1865
|
const profile = await getPlayersProfile(steamId);
|
|
1845
1866
|
if (!profile) return false;
|
|
1846
1867
|
|
|
@@ -1972,6 +1993,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
1972
1993
|
*/
|
|
1973
1994
|
async function logOn(token) {
|
|
1974
1995
|
try {
|
|
1996
|
+
isLogOff = false;
|
|
1975
1997
|
steamClient.logOn({
|
|
1976
1998
|
...token,
|
|
1977
1999
|
steamId: new SteamID(token.steamid),
|
|
@@ -2087,8 +2109,11 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2087
2109
|
}
|
|
2088
2110
|
|
|
2089
2111
|
async function logOff() {
|
|
2112
|
+
log("logOff");
|
|
2090
2113
|
isLogOff = true;
|
|
2091
2114
|
|
|
2115
|
+
MessageQueue.length = 0;
|
|
2116
|
+
|
|
2092
2117
|
callEvent(events.logOff);
|
|
2093
2118
|
events.logOff = [];
|
|
2094
2119
|
|
|
@@ -2111,9 +2136,11 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2111
2136
|
delete steamClient.logOnResult;
|
|
2112
2137
|
delete steamClient._httpClient;
|
|
2113
2138
|
delete steamClient._lastChosenCM;
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2139
|
+
steamClient._connection.end(true);
|
|
2140
|
+
|
|
2141
|
+
for (const connKey in steamClient._connection) {
|
|
2142
|
+
delete steamClient._connection[connKey];
|
|
2143
|
+
}
|
|
2117
2144
|
delete steamClient._connection;
|
|
2118
2145
|
delete steamClient.accountInfo;
|
|
2119
2146
|
delete steamClient.emailInfo;
|
|
@@ -2138,6 +2165,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2138
2165
|
}
|
|
2139
2166
|
|
|
2140
2167
|
async function init() {
|
|
2168
|
+
isLogOff = false;
|
|
2141
2169
|
bindEvent();
|
|
2142
2170
|
const logged = await login();
|
|
2143
2171
|
if (logged) {
|
|
@@ -2153,6 +2181,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2153
2181
|
}
|
|
2154
2182
|
|
|
2155
2183
|
function partyRegister() {
|
|
2184
|
+
if (isLogOff) {
|
|
2185
|
+
return;
|
|
2186
|
+
}
|
|
2156
2187
|
if (prime === null) {
|
|
2157
2188
|
_partyRegister(true);
|
|
2158
2189
|
_partyRegister(false);
|
|
@@ -2162,6 +2193,10 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2162
2193
|
}
|
|
2163
2194
|
|
|
2164
2195
|
function _partyRegister(prime) {
|
|
2196
|
+
if (isLogOff) {
|
|
2197
|
+
return;
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2165
2200
|
log("partyRegister", prime);
|
|
2166
2201
|
lastTimePartyRegister = Date.now();
|
|
2167
2202
|
steamClient.sendToGC(
|
|
@@ -2183,6 +2218,10 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2183
2218
|
const MessageQueue = [];
|
|
2184
2219
|
|
|
2185
2220
|
async function _execMessageQueue() {
|
|
2221
|
+
if (isLogOff) {
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2186
2225
|
if (isSendingFriendMessages) {
|
|
2187
2226
|
return;
|
|
2188
2227
|
}
|
|
@@ -2201,6 +2240,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2201
2240
|
async function _sendFriendMessage(steamId, message) {
|
|
2202
2241
|
let result = null;
|
|
2203
2242
|
for (let i = 0; i < 10; i++) {
|
|
2243
|
+
if (isLogOff) {
|
|
2244
|
+
return;
|
|
2245
|
+
}
|
|
2204
2246
|
result = await new Promise((resolve) => {
|
|
2205
2247
|
steamClient.chat.sendFriendMessage(steamId, message, undefined, function (...arg) {
|
|
2206
2248
|
resolve(arg);
|
|
@@ -2218,6 +2260,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2218
2260
|
}
|
|
2219
2261
|
|
|
2220
2262
|
async function sendFriendMessage(steamId, message) {
|
|
2263
|
+
if (isLogOff) {
|
|
2264
|
+
return;
|
|
2265
|
+
}
|
|
2221
2266
|
return new Promise((resolve) => {
|
|
2222
2267
|
MessageQueue.push({ steamId, message, callback: resolve });
|
|
2223
2268
|
_execMessageQueue();
|
|
@@ -2323,6 +2368,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2323
2368
|
}
|
|
2324
2369
|
|
|
2325
2370
|
function doFakeGameScore() {
|
|
2371
|
+
if (isLogOff) {
|
|
2372
|
+
return;
|
|
2373
|
+
}
|
|
2326
2374
|
const maxRound = Math.random() > 0.7 ? 16 : 12;
|
|
2327
2375
|
const maps = ["cs_agency", "cs_assault", "cs_italy", "cs_militia", "cs_office", "de_ancient", "de_anubis", "de_bank", "de_boyard", "de_cache", "de_canals", "de_cbble", "de_chalice", "de_dust2", "de_inferno", "de_lake", "de_mirage", "de_nuke", "de_overpass", "de_safehouse", "de_sugarcane", "de_train", "de_tuscan", "de_vertigo", "de_thera", "de_mills", "de_memento", "de_assembly", "training1"];
|
|
2328
2376
|
|
|
@@ -2404,6 +2452,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2404
2452
|
}
|
|
2405
2453
|
|
|
2406
2454
|
async function gamesPlayed(apps) {
|
|
2455
|
+
if (isLogOff) {
|
|
2456
|
+
return;
|
|
2457
|
+
}
|
|
2407
2458
|
if (!Array.isArray(apps)) {
|
|
2408
2459
|
apps = [apps];
|
|
2409
2460
|
}
|
|
@@ -2441,6 +2492,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2441
2492
|
}
|
|
2442
2493
|
|
|
2443
2494
|
function getFriendsList() {
|
|
2495
|
+
if (isLogOff) {
|
|
2496
|
+
return;
|
|
2497
|
+
}
|
|
2444
2498
|
const methodName = "FriendsList.GetFriendsList#1";
|
|
2445
2499
|
const { users, myFriends } = steamClient; //object
|
|
2446
2500
|
/*
|
|
@@ -2480,6 +2534,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2480
2534
|
}
|
|
2481
2535
|
|
|
2482
2536
|
async function getUserOwnedApps(steamId = steamClient.steamID) {
|
|
2537
|
+
if (isLogOff) {
|
|
2538
|
+
return;
|
|
2539
|
+
}
|
|
2483
2540
|
if (!steamId) {
|
|
2484
2541
|
return [];
|
|
2485
2542
|
}
|
|
@@ -2536,6 +2593,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2536
2593
|
}
|
|
2537
2594
|
|
|
2538
2595
|
async function requestJoinFriendData(token, version) {
|
|
2596
|
+
if (isLogOff) {
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2539
2599
|
if (!steamClient.steamID) {
|
|
2540
2600
|
return;
|
|
2541
2601
|
}
|
|
@@ -2578,6 +2638,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2578
2638
|
}
|
|
2579
2639
|
|
|
2580
2640
|
function redeemFreeReward(itemIds, generation_time) {
|
|
2641
|
+
if (isLogOff) {
|
|
2642
|
+
return;
|
|
2643
|
+
}
|
|
2581
2644
|
console.log(`Sent message to GC: AppID ${AppID}, MessageType ${ESteamProto.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientRedeemFreeReward}`);
|
|
2582
2645
|
|
|
2583
2646
|
const encodedMessages = new SteamProto(SteamProtoType.CMsgGCCstrike15_v2_ClientRedeemFreeReward).protoEncode({
|
|
@@ -2598,6 +2661,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2598
2661
|
}
|
|
2599
2662
|
|
|
2600
2663
|
function requestRankingInfo() {
|
|
2664
|
+
if (isLogOff) {
|
|
2665
|
+
return;
|
|
2666
|
+
}
|
|
2601
2667
|
return new Promise((resolve) => {
|
|
2602
2668
|
const timeout = setTimeout(function () {
|
|
2603
2669
|
resolve();
|
|
@@ -2633,6 +2699,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2633
2699
|
}
|
|
2634
2700
|
|
|
2635
2701
|
function acknowledgePenalty() {
|
|
2702
|
+
if (isLogOff) {
|
|
2703
|
+
return;
|
|
2704
|
+
}
|
|
2636
2705
|
steamClient.sendToGC(
|
|
2637
2706
|
730,
|
|
2638
2707
|
ESteamProto.ECsgoGCMsg.k_EMsgGCCStrike15_v2_AcknowledgePenalty,
|
|
@@ -2644,6 +2713,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2644
2713
|
}
|
|
2645
2714
|
|
|
2646
2715
|
async function ensureLogin(promise) {
|
|
2716
|
+
if (isLogOff) {
|
|
2717
|
+
return null;
|
|
2718
|
+
}
|
|
2647
2719
|
const logOffEventId = uuidv4();
|
|
2648
2720
|
const result = await Promise.race([
|
|
2649
2721
|
new Promise((resolve) => {
|
|
@@ -2697,6 +2769,9 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
|
|
|
2697
2769
|
getPersonaName,
|
|
2698
2770
|
async getPlayersProfile(steamId, retry = 3) {
|
|
2699
2771
|
for (let i = 0; i < retry; i++) {
|
|
2772
|
+
if (isLogOff) {
|
|
2773
|
+
return;
|
|
2774
|
+
}
|
|
2700
2775
|
const profile = await getPlayersProfile(steamId);
|
|
2701
2776
|
if (profile) {
|
|
2702
2777
|
return profile;
|
package/_steamproto.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { fileURLToPath } from "url";
|
|
3
|
-
import Protobuf from "protobufjs";
|
|
4
|
-
|
|
5
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = path.dirname(__filename);
|
|
7
|
-
|
|
8
|
-
export class SteamProto {
|
|
9
|
-
constructor(proto) {
|
|
10
|
-
this._proto = proto;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
toProto() {
|
|
14
|
-
const root = new Protobuf.Root().loadSync(path.join(`${__dirname}/protos/`, this._proto.filename), {
|
|
15
|
-
keepCase: true,
|
|
16
|
-
});
|
|
17
|
-
return root[this._proto.name];
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
protoEncode(obj) {
|
|
21
|
-
const protobuf = this.toProto();
|
|
22
|
-
return protobuf.encode(protobuf.create(obj)).finish();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
protoEncodeBase64(obj) {
|
|
26
|
-
return this.protoEncode(obj).toString("base64");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
protoDecode(obj) {
|
|
30
|
-
const protobuf = this.toProto();
|
|
31
|
-
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { fileURLToPath } from "url";
|
|
3
|
+
import Protobuf from "protobufjs";
|
|
4
|
+
|
|
5
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
6
|
+
const __dirname = path.dirname(__filename);
|
|
7
|
+
|
|
8
|
+
export class SteamProto {
|
|
9
|
+
constructor(proto) {
|
|
10
|
+
this._proto = proto;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
toProto() {
|
|
14
|
+
const root = new Protobuf.Root().loadSync(path.join(`${__dirname}/protos/`, this._proto.filename), {
|
|
15
|
+
keepCase: true,
|
|
16
|
+
});
|
|
17
|
+
return root[this._proto.name];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
protoEncode(obj) {
|
|
21
|
+
const protobuf = this.toProto();
|
|
22
|
+
return protobuf.encode(protobuf.create(obj)).finish();
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protoEncodeBase64(obj) {
|
|
26
|
+
return this.protoEncode(obj).toString("base64");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
protoDecode(obj) {
|
|
30
|
+
const protobuf = this.toProto();
|
|
31
|
+
return protobuf.toObject(protobuf.decode(obj), { defaults: true });
|
|
32
|
+
}
|
|
33
|
+
}
|