steamutils 1.2.81 → 1.2.84
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +101 -84
- package/package.json +1 -1
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 =
|
78
|
+
export let CSGO_VER = 13960
|
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) {
|
@@ -88,7 +88,9 @@ function SteamClient({
|
|
88
88
|
username,
|
89
89
|
password,
|
90
90
|
cookie,
|
91
|
+
clientJsToken,
|
91
92
|
isAutoRequestFreeLicense = true,
|
93
|
+
isFakeGameScore = true,
|
92
94
|
isPartyRegister = true,
|
93
95
|
autoPlay = false,
|
94
96
|
autoAcceptTradeRequest = false,
|
@@ -103,6 +105,7 @@ function SteamClient({
|
|
103
105
|
let sendMessageTimestamp = 0
|
104
106
|
let lastTimePartyRegister = 0
|
105
107
|
let lastTimePartySearch = 0
|
108
|
+
let appsPlayed = []
|
106
109
|
|
107
110
|
const onAnyCallbacks = []
|
108
111
|
|
@@ -123,6 +126,7 @@ function SteamClient({
|
|
123
126
|
offlineMessages: [],
|
124
127
|
friendsList: [],
|
125
128
|
gifts: [],
|
129
|
+
playingState: [],
|
126
130
|
}
|
127
131
|
|
128
132
|
const gcCallback = {}
|
@@ -1088,6 +1092,7 @@ function SteamClient({
|
|
1088
1092
|
console.log("Playing else where")
|
1089
1093
|
}
|
1090
1094
|
log('playingState', playing_blocked, playing_app);
|
1095
|
+
callEvent(events.playingState, {playing_blocked, playing_app})
|
1091
1096
|
},
|
1092
1097
|
async friendRelationship(sid, relationship, previousRelationship) {
|
1093
1098
|
callEvent(events.friendRelationship, {steamId: sid.getSteamID64(), relationship, previousRelationship})
|
@@ -1350,7 +1355,11 @@ function SteamClient({
|
|
1350
1355
|
}
|
1351
1356
|
|
1352
1357
|
async function login(reconnect = false) {
|
1353
|
-
if (
|
1358
|
+
if (clientJsToken?.logged_in) {
|
1359
|
+
log(reconnect ? 'reconnect with clientJsToken' : 'login with clientJsToken')
|
1360
|
+
steamClient.logOn(clientJsToken)
|
1361
|
+
return true
|
1362
|
+
} else if (cookie) {
|
1354
1363
|
log(reconnect ? 'reconnect with cookie' : 'login with cookie')
|
1355
1364
|
const newCookie = await loginWithCookie(cookie)
|
1356
1365
|
if (newCookie) {
|
@@ -1482,100 +1491,104 @@ function SteamClient({
|
|
1482
1491
|
gamesPlayed(appid)
|
1483
1492
|
}
|
1484
1493
|
|
1494
|
+
function doFakeGameScore() {
|
1495
|
+
const maxRound = Math.random() > 0.7 ? 16 : 12
|
1496
|
+
const maps = [
|
1497
|
+
"ar_baggage",
|
1498
|
+
"ar_dizzy",
|
1499
|
+
"ar_monastery",
|
1500
|
+
"ar_shoots",
|
1501
|
+
"cs_agency",
|
1502
|
+
"cs_assault",
|
1503
|
+
"cs_italy",
|
1504
|
+
"cs_militia",
|
1505
|
+
"cs_office",
|
1506
|
+
"de_ancient",
|
1507
|
+
"de_anubis",
|
1508
|
+
"de_bank",
|
1509
|
+
"de_boyard",
|
1510
|
+
"de_cache",
|
1511
|
+
"de_canals",
|
1512
|
+
"de_cbble",
|
1513
|
+
"de_chalice",
|
1514
|
+
"de_dust2",
|
1515
|
+
"de_inferno",
|
1516
|
+
"de_lake",
|
1517
|
+
"de_mirage",
|
1518
|
+
"de_nuke",
|
1519
|
+
"de_overpass",
|
1520
|
+
"de_safehouse",
|
1521
|
+
// "de_shortnuke",
|
1522
|
+
"de_stmarc",
|
1523
|
+
"de_sugarcane",
|
1524
|
+
"de_train",
|
1525
|
+
"de_tuscan",
|
1526
|
+
"de_vertigo",
|
1527
|
+
"dz_ember",
|
1528
|
+
"dz_vineyard",
|
1529
|
+
"gd_cbble",
|
1530
|
+
"training1"
|
1531
|
+
]
|
1532
|
+
|
1533
|
+
if (richPresence.myScore === undefined) {
|
1534
|
+
richPresence.myScore = _.random(0, maxRound)
|
1535
|
+
}
|
1536
|
+
if (richPresence.theirScore === undefined) {
|
1537
|
+
richPresence.theirScore = _.random(0, maxRound)
|
1538
|
+
}
|
1539
|
+
if (richPresence.map === undefined) {
|
1540
|
+
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1541
|
+
}
|
1542
|
+
if (richPresence.myScore === maxRound || richPresence.theirScore === maxRound) {
|
1543
|
+
richPresence.myScore = 0
|
1544
|
+
richPresence.theirScore = 0
|
1545
|
+
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1546
|
+
} else {
|
1547
|
+
const isMyTeamWin = Math.random() > 0.5
|
1548
|
+
if (isMyTeamWin) {
|
1549
|
+
richPresence.myScore++
|
1550
|
+
} else {
|
1551
|
+
richPresence.theirScore++
|
1552
|
+
}
|
1553
|
+
}
|
1554
|
+
|
1555
|
+
const score = richPresence.myScore === 0 && richPresence.theirScore === 0 ? '' : `[ ${richPresence.myScore} : ${richPresence.theirScore} ]`
|
1556
|
+
steamClient.uploadRichPresence(730, {
|
1557
|
+
'game:state': 'game',
|
1558
|
+
steam_display: '#display_GameKnownMapScore',
|
1559
|
+
connect: '+gcconnectG082AA752',
|
1560
|
+
version: CSGO_VER.toString(),
|
1561
|
+
'game:mode': 'competitive',
|
1562
|
+
'game:map': richPresence.map,
|
1563
|
+
'game:server': 'kv',
|
1564
|
+
'watch': _.random(1, 5).toString(),
|
1565
|
+
'game:score': score,
|
1566
|
+
})
|
1567
|
+
}
|
1568
|
+
|
1569
|
+
function updateFakeGameScore() {
|
1570
|
+
if (isFakeGameScore && appsPlayed.some(a => (a.game_id || a) == 730)) {
|
1571
|
+
doSetInterval(doFakeGameScore, [60000, 180000], 'uploadRichPresenceCSGO')
|
1572
|
+
} else {
|
1573
|
+
doClearInterval('uploadRichPresenceCSGO')
|
1574
|
+
}
|
1575
|
+
}
|
1576
|
+
|
1485
1577
|
async function gamesPlayed(apps) {
|
1486
1578
|
if (!Array.isArray(apps)) {
|
1487
1579
|
apps = [apps]
|
1488
1580
|
}
|
1581
|
+
appsPlayed = apps
|
1489
1582
|
if (apps.length) {
|
1490
1583
|
state = 'InGame'
|
1491
1584
|
} else {
|
1492
1585
|
state = 'Online'
|
1493
1586
|
}
|
1494
|
-
steamClient.gamesPlayed(
|
1587
|
+
steamClient.gamesPlayed(appsPlayed);
|
1495
1588
|
await sleep(2000)
|
1496
1589
|
// steamClient.setPersona(SteamUser.EPersonaState.Online)
|
1497
1590
|
await sendHello()
|
1498
|
-
|
1499
|
-
const isLongGame = true
|
1500
|
-
const maxRound = isLongGame ? 16 : 9
|
1501
|
-
|
1502
|
-
if (apps.some(a => (a.game_id || a) == 730)) {
|
1503
|
-
doSetInterval(function () {
|
1504
|
-
const maps = [
|
1505
|
-
"ar_baggage",
|
1506
|
-
"ar_dizzy",
|
1507
|
-
"ar_monastery",
|
1508
|
-
"ar_shoots",
|
1509
|
-
"cs_agency",
|
1510
|
-
"cs_assault",
|
1511
|
-
"cs_italy",
|
1512
|
-
"cs_militia",
|
1513
|
-
"cs_office",
|
1514
|
-
"de_ancient",
|
1515
|
-
"de_anubis",
|
1516
|
-
"de_bank",
|
1517
|
-
"de_boyard",
|
1518
|
-
"de_cache",
|
1519
|
-
"de_canals",
|
1520
|
-
"de_cbble",
|
1521
|
-
"de_chalice",
|
1522
|
-
"de_dust2",
|
1523
|
-
"de_inferno",
|
1524
|
-
"de_lake",
|
1525
|
-
"de_mirage",
|
1526
|
-
"de_nuke",
|
1527
|
-
"de_overpass",
|
1528
|
-
"de_safehouse",
|
1529
|
-
// "de_shortnuke",
|
1530
|
-
"de_stmarc",
|
1531
|
-
"de_sugarcane",
|
1532
|
-
"de_train",
|
1533
|
-
"de_tuscan",
|
1534
|
-
"de_vertigo",
|
1535
|
-
"dz_ember",
|
1536
|
-
"dz_vineyard",
|
1537
|
-
"gd_cbble",
|
1538
|
-
"training1"
|
1539
|
-
]
|
1540
|
-
|
1541
|
-
if (richPresence.myScore === undefined) {
|
1542
|
-
richPresence.myScore = _.random(0, maxRound)
|
1543
|
-
}
|
1544
|
-
if (richPresence.theirScore === undefined) {
|
1545
|
-
richPresence.theirScore = _.random(0, maxRound)
|
1546
|
-
}
|
1547
|
-
if (richPresence.map === undefined) {
|
1548
|
-
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1549
|
-
}
|
1550
|
-
if (richPresence.myScore === maxRound || richPresence.theirScore === maxRound) {
|
1551
|
-
richPresence.myScore = 0
|
1552
|
-
richPresence.theirScore = 0
|
1553
|
-
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1554
|
-
} else {
|
1555
|
-
const isMyTeamWin = Math.random() > 0.5
|
1556
|
-
if (isMyTeamWin) {
|
1557
|
-
richPresence.myScore++
|
1558
|
-
} else {
|
1559
|
-
richPresence.theirScore++
|
1560
|
-
}
|
1561
|
-
}
|
1562
|
-
|
1563
|
-
const score = richPresence.myScore === 0 && richPresence.theirScore === 0 ? '' : `[ ${richPresence.myScore} : ${richPresence.theirScore} ]`
|
1564
|
-
steamClient.uploadRichPresence(730, {
|
1565
|
-
'game:state': 'game',
|
1566
|
-
steam_display: '#display_GameKnownMapScore',
|
1567
|
-
connect: '+gcconnectG082AA752',
|
1568
|
-
version: CSGO_VER.toString(),
|
1569
|
-
'game:mode': 'competitive',
|
1570
|
-
'game:map': richPresence.map,
|
1571
|
-
'game:server': 'kv',
|
1572
|
-
'watch': _.random(1, 5).toString(),
|
1573
|
-
'game:score': score,
|
1574
|
-
})
|
1575
|
-
}, [60000, 180000], 'uploadRichPresenceCSGO')
|
1576
|
-
} else {
|
1577
|
-
doClearInterval('uploadRichPresenceCSGO')
|
1578
|
-
}
|
1591
|
+
updateFakeGameScore()
|
1579
1592
|
|
1580
1593
|
// await sleep(10000)
|
1581
1594
|
// self.steamUser.uploadRichPresence(730, {
|
@@ -1676,6 +1689,10 @@ function SteamClient({
|
|
1676
1689
|
sendHello()
|
1677
1690
|
}
|
1678
1691
|
},
|
1692
|
+
setFakeGameScore(_isFakeGameScore) {
|
1693
|
+
isFakeGameScore = _isFakeGameScore
|
1694
|
+
updateFakeGameScore()
|
1695
|
+
},
|
1679
1696
|
getState() {
|
1680
1697
|
return state
|
1681
1698
|
},
|