steamutils 1.2.3 → 1.2.4
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 +28 -3
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -93,6 +93,7 @@ function SteamClient({
|
|
93
93
|
let prime = null
|
94
94
|
let state = 'Offline'//InGame, Online
|
95
95
|
let isLogOff = false
|
96
|
+
const richPresence = {}
|
96
97
|
|
97
98
|
const events = {
|
98
99
|
user: [],
|
@@ -1237,18 +1238,42 @@ function SteamClient({
|
|
1237
1238
|
"gd_cbble",
|
1238
1239
|
"training1"
|
1239
1240
|
]
|
1241
|
+
|
1242
|
+
if (richPresence.myScore === undefined) {
|
1243
|
+
richPresence.myScore = _.random(0, 9)
|
1244
|
+
}
|
1245
|
+
if (richPresence.theirScore === undefined) {
|
1246
|
+
richPresence.theirScore = _.random(0, 9)
|
1247
|
+
}
|
1248
|
+
if (richPresence.map === undefined) {
|
1249
|
+
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1250
|
+
}
|
1251
|
+
if (richPresence.myScore === 9 || richPresence.theirScore === 9) {
|
1252
|
+
richPresence.myScore = 0
|
1253
|
+
richPresence.theirScore = 0
|
1254
|
+
richPresence.map = maps[Math.floor(Math.random() * maps.length)]
|
1255
|
+
} else {
|
1256
|
+
const isMyTeamWin = Math.random() > 0.5
|
1257
|
+
if (isMyTeamWin) {
|
1258
|
+
richPresence.myScore++
|
1259
|
+
} else {
|
1260
|
+
richPresence.theirScore++
|
1261
|
+
}
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
const score = richPresence.myScore === 0 && richPresence.theirScore === 0 ? '' : `[ ${richPresence.myScore} : ${richPresence.theirScore} ]`
|
1240
1265
|
steamClient.uploadRichPresence(730, {
|
1241
1266
|
'game:state': 'game',
|
1242
1267
|
steam_display: '#display_GameKnownMapScore',
|
1243
1268
|
connect: '+gcconnectG082AA752',
|
1244
1269
|
version: CSGO_VER.toString(),
|
1245
1270
|
'game:mode': 'competitive',
|
1246
|
-
'game:map':
|
1271
|
+
'game:map': richPresence.map,
|
1247
1272
|
'game:server': 'kv',
|
1248
1273
|
'watch': _.random(1, 5).toString(),
|
1249
|
-
'game:score':
|
1274
|
+
'game:score': score,
|
1250
1275
|
})
|
1251
|
-
}, [
|
1276
|
+
}, [60000, 180000], 'uploadRichPresenceCSGO')
|
1252
1277
|
}
|
1253
1278
|
|
1254
1279
|
// await sleep(10000)
|