steamutils 1.3.33 → 1.3.34
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/SteamClient.js +70 -10
- package/index.js +13 -4
- package/package.json +2 -1
package/SteamClient.js
CHANGED
|
@@ -132,6 +132,7 @@ function SteamClient({
|
|
|
132
132
|
gifts: [],
|
|
133
133
|
playingState: [],
|
|
134
134
|
emailInfo: [],
|
|
135
|
+
accountLimitations: [],
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
const gcCallback = {}
|
|
@@ -294,6 +295,10 @@ function SteamClient({
|
|
|
294
295
|
return [steamClient?.accountInfo?.name, steamClient?._logOnDetails?.account_name].filter(Boolean).join(" - ")
|
|
295
296
|
}
|
|
296
297
|
|
|
298
|
+
function getPersonaName() {
|
|
299
|
+
return steamClient?.accountInfo?.name
|
|
300
|
+
}
|
|
301
|
+
|
|
297
302
|
function log(...msg) {
|
|
298
303
|
const now = moment().tz('Asia/Ho_Chi_Minh').format("DD/MM/YYYY HH:mm:ss")
|
|
299
304
|
console.log(`[${now}] [${getAccountInfoName()}]`, ...msg)
|
|
@@ -571,6 +576,39 @@ function SteamClient({
|
|
|
571
576
|
}
|
|
572
577
|
|
|
573
578
|
|
|
579
|
+
async function getLobbyData(lobbyID) {
|
|
580
|
+
if (!steamClient.steamID) {
|
|
581
|
+
return
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
return new Promise(resolve => {
|
|
585
|
+
const timeout = setTimeout(function () {
|
|
586
|
+
resolve()
|
|
587
|
+
}, 30000)
|
|
588
|
+
|
|
589
|
+
steamClient._send(
|
|
590
|
+
{
|
|
591
|
+
msg: Protos.csgo.EMsg.k_EMsgClientMMSGetLobbyData,
|
|
592
|
+
proto: {
|
|
593
|
+
steamid: steamClient.steamID.getSteamID64(),
|
|
594
|
+
routing_appid: 730
|
|
595
|
+
}
|
|
596
|
+
},
|
|
597
|
+
protoEncode(Protos.csgo.CMsgClientMMSGetLobbyData, {
|
|
598
|
+
app_id: 730,
|
|
599
|
+
steam_id_lobby: lobbyID.toString(),
|
|
600
|
+
}),
|
|
601
|
+
function (payload) {
|
|
602
|
+
clearTimeout(timeout)
|
|
603
|
+
const result = protoDecode(Protos.csgo.CMsgClientMMSLobbyData, payload.toBuffer())
|
|
604
|
+
result.steam_id_lobby = result.steam_id_lobby.toString()
|
|
605
|
+
resolve(result)
|
|
606
|
+
}
|
|
607
|
+
);
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
|
|
574
612
|
async function joinLobby(lobbyID) {
|
|
575
613
|
log("joinLobby", lobbyID);//SteamID.fromIndividualAccountID(lobbyId).accountid
|
|
576
614
|
steamClient.sendToGC(730, Protos.csgo.EMsg.k_EMsgClientMMSJoinLobby, {}, protoEncode(Protos.csgo.CMsgClientMMSJoinLobby, {
|
|
@@ -737,6 +775,7 @@ function SteamClient({
|
|
|
737
775
|
switch (cache_object.type_id) {
|
|
738
776
|
case 1: {
|
|
739
777
|
const result = protoDecode(Protos.csgo.CSOEconItem, object_data);
|
|
778
|
+
result.id = result.id.toNumber()
|
|
740
779
|
break
|
|
741
780
|
}
|
|
742
781
|
case 2: {
|
|
@@ -774,9 +813,7 @@ function SteamClient({
|
|
|
774
813
|
prime = true
|
|
775
814
|
CSOEconGameAccountClient.prime = true
|
|
776
815
|
}
|
|
777
|
-
|
|
778
|
-
obj.GameAccountClient = CSOEconGameAccountClient
|
|
779
|
-
}
|
|
816
|
+
obj.GameAccountClient = CSOEconGameAccountClient
|
|
780
817
|
break
|
|
781
818
|
}
|
|
782
819
|
|
|
@@ -827,6 +864,15 @@ function SteamClient({
|
|
|
827
864
|
const result = protoDecode(Protos.csgo.CSOQuestProgress, object_data);
|
|
828
865
|
break
|
|
829
866
|
}
|
|
867
|
+
case 4: {
|
|
868
|
+
const result = protoDecode(Protos.csgo.CSOAccountItemPersonalStore, object_data);
|
|
869
|
+
result.generation_time = result.generation_time * 1000
|
|
870
|
+
if (Array.isArray(result.items)) {
|
|
871
|
+
result.items = result.items.map(item => item.toNumber())
|
|
872
|
+
}
|
|
873
|
+
obj.personalStore = result
|
|
874
|
+
break
|
|
875
|
+
}
|
|
830
876
|
|
|
831
877
|
default: {
|
|
832
878
|
log("cache_object.type_id", cache_object.type_id);
|
|
@@ -923,7 +969,7 @@ function SteamClient({
|
|
|
923
969
|
player_cur_xp: 327684501,
|
|
924
970
|
player_xp_bonus_flags: 0
|
|
925
971
|
}
|
|
926
|
-
if (result?.global_stats?.required_appid_version && result.global_stats.required_appid_version > CSGO_VER) {
|
|
972
|
+
if (result?.global_stats?.required_appid_version && (!CSGO_VER || result.global_stats.required_appid_version > CSGO_VER)) {
|
|
927
973
|
CSGO_VER = result.global_stats.required_appid_version
|
|
928
974
|
}
|
|
929
975
|
callEvent(events.csgoClientHello, result)
|
|
@@ -1313,10 +1359,22 @@ function SteamClient({
|
|
|
1313
1359
|
callEvent(events.emailInfo, {address, validated})
|
|
1314
1360
|
},
|
|
1315
1361
|
async appLaunched() {
|
|
1316
|
-
|
|
1362
|
+
setTimeout(function () {
|
|
1363
|
+
state = getPlayingAppIds().length ? 'InGame' : (isInvisible ? "Invisible" : 'Online')
|
|
1364
|
+
}, 1000)
|
|
1317
1365
|
},
|
|
1318
1366
|
async appQuit() {
|
|
1319
|
-
|
|
1367
|
+
setTimeout(function () {
|
|
1368
|
+
state = getPlayingAppIds().length ? 'InGame' : (isInvisible ? "Invisible" : 'Online')
|
|
1369
|
+
}, 1000)
|
|
1370
|
+
},
|
|
1371
|
+
async accountLimitations(bis_limited_account, bis_community_banned, bis_locked_account, bis_limited_account_allowed_to_invite_friends) {
|
|
1372
|
+
callEvent(events.accountLimitations, {
|
|
1373
|
+
limited: bis_limited_account,
|
|
1374
|
+
communityBanned: bis_community_banned,
|
|
1375
|
+
locked: bis_locked_account,
|
|
1376
|
+
canInviteFriends: bis_limited_account_allowed_to_invite_friends
|
|
1377
|
+
})
|
|
1320
1378
|
},
|
|
1321
1379
|
}
|
|
1322
1380
|
|
|
@@ -1608,13 +1666,13 @@ function SteamClient({
|
|
|
1608
1666
|
bindEvent()
|
|
1609
1667
|
login()
|
|
1610
1668
|
|
|
1611
|
-
steamClient._handlerManager.add(
|
|
1669
|
+
steamClient._handlerManager.add(Protos.csgo.EMsg.k_EMsgClientRequestedClientStats, function (payload) {
|
|
1612
1670
|
const result = protoDecode(Protos.csgo.CMsgClientRequestedClientStats, payload.toBuffer())
|
|
1613
1671
|
// console.log("CMsgClientRequestedClientStats", result);
|
|
1614
1672
|
})
|
|
1615
|
-
steamClient._handlerManager.add(
|
|
1673
|
+
steamClient._handlerManager.add(Protos.csgo.EMsg.k_EMsgClientMMSLobbyData, function (payload) {
|
|
1616
1674
|
const result = protoDecode(Protos.csgo.CMsgClientMMSLobbyData, payload.toBuffer())
|
|
1617
|
-
// console.log("CMsgClientMMSLobbyData", result);
|
|
1675
|
+
// console.log("CMsgClientMMSLobbyData", result, result.metadata);
|
|
1618
1676
|
})
|
|
1619
1677
|
}
|
|
1620
1678
|
|
|
@@ -1937,7 +1995,7 @@ function SteamClient({
|
|
|
1937
1995
|
]
|
|
1938
1996
|
}
|
|
1939
1997
|
}
|
|
1940
|
-
|
|
1998
|
+
|
|
1941
1999
|
function getPlayingAppIds() {
|
|
1942
2000
|
return steamClient._playingAppIds || []
|
|
1943
2001
|
}
|
|
@@ -1949,6 +2007,7 @@ function SteamClient({
|
|
|
1949
2007
|
createLobby,
|
|
1950
2008
|
updateLobby,
|
|
1951
2009
|
joinLobby,
|
|
2010
|
+
getLobbyData,
|
|
1952
2011
|
partyRegister,
|
|
1953
2012
|
requestCoPlays,
|
|
1954
2013
|
getPersonas,
|
|
@@ -1972,6 +2031,7 @@ function SteamClient({
|
|
|
1972
2031
|
return steamClient
|
|
1973
2032
|
},
|
|
1974
2033
|
getAccountInfoName,
|
|
2034
|
+
getPersonaName,
|
|
1975
2035
|
async getPlayersProfile(steamId, retry = 3) {
|
|
1976
2036
|
for (let i = 0; i < retry; i++) {
|
|
1977
2037
|
const profile = await getPlayersProfile(steamId)
|
package/index.js
CHANGED
|
@@ -1623,6 +1623,7 @@ class SteamUser {
|
|
|
1623
1623
|
async _httpRequest(params) {
|
|
1624
1624
|
const isRedirect = typeof params.isRedirect === "boolean" ? params.isRedirect : true
|
|
1625
1625
|
params = this._formatHttpRequest(params)
|
|
1626
|
+
const originalURL = params.url
|
|
1626
1627
|
|
|
1627
1628
|
if (!this._cookies) {
|
|
1628
1629
|
throw new Error(`[${this._sessionid}] You have not set cookie yet`)
|
|
@@ -1697,10 +1698,14 @@ class SteamUser {
|
|
|
1697
1698
|
this._myProfile = `id/${customURL}`
|
|
1698
1699
|
}
|
|
1699
1700
|
} else if (redirectURL?.startsWith('https://steamcommunity.com/login/')) {
|
|
1700
|
-
console.error('Login first', this._steamid_user)
|
|
1701
|
+
console.error('Login first', originalURL, this._steamid_user)
|
|
1702
|
+
|
|
1701
1703
|
return {
|
|
1702
1704
|
data: {
|
|
1703
|
-
|
|
1705
|
+
loginFirst: true,
|
|
1706
|
+
error: 'Login first',
|
|
1707
|
+
steamId: this._steamid_user,
|
|
1708
|
+
originalURL,
|
|
1704
1709
|
}
|
|
1705
1710
|
}
|
|
1706
1711
|
}
|
|
@@ -5510,8 +5515,12 @@ class SteamUser {
|
|
|
5510
5515
|
} else if (typeof _result === "string") {
|
|
5511
5516
|
|
|
5512
5517
|
} else if (_result.success !== true) {
|
|
5513
|
-
|
|
5514
|
-
|
|
5518
|
+
if (_result.loginFirst) {
|
|
5519
|
+
return _result
|
|
5520
|
+
} else {
|
|
5521
|
+
console.error(_result)
|
|
5522
|
+
await sleep(5000)
|
|
5523
|
+
}
|
|
5515
5524
|
} else {
|
|
5516
5525
|
result = _result
|
|
5517
5526
|
break
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "steamutils",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.34",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"alpha-common-utils": "^1.0.5",
|
|
7
7
|
"axios": "^1.6.1",
|
|
8
|
+
"bytebuffer": "^5.0.1",
|
|
8
9
|
"cheerio": "^1.0.0-rc.12",
|
|
9
10
|
"crypto-js": "^4.2.0",
|
|
10
11
|
"csgo-friendcode": "^3.0.3",
|