steamutils 1.2.2 → 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 +74 -14
- 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: [],
|
@@ -1200,20 +1201,79 @@ function SteamClient({
|
|
1200
1201
|
await sendHello()
|
1201
1202
|
|
1202
1203
|
if (apps.some(a => (a.game_id || a) == 730)) {
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1204
|
+
doSetInterval(function () {
|
1205
|
+
const maps = [
|
1206
|
+
"ar_baggage",
|
1207
|
+
"ar_dizzy",
|
1208
|
+
"ar_monastery",
|
1209
|
+
"ar_shoots",
|
1210
|
+
"cs_agency",
|
1211
|
+
"cs_assault",
|
1212
|
+
"cs_italy",
|
1213
|
+
"cs_militia",
|
1214
|
+
"cs_office",
|
1215
|
+
"de_ancient",
|
1216
|
+
"de_anubis",
|
1217
|
+
"de_bank",
|
1218
|
+
"de_boyard",
|
1219
|
+
"de_cache",
|
1220
|
+
"de_canals",
|
1221
|
+
"de_cbble",
|
1222
|
+
"de_chalice",
|
1223
|
+
"de_dust2",
|
1224
|
+
"de_inferno",
|
1225
|
+
"de_lake",
|
1226
|
+
"de_mirage",
|
1227
|
+
"de_nuke",
|
1228
|
+
"de_overpass",
|
1229
|
+
"de_safehouse",
|
1230
|
+
"de_shortnuke",
|
1231
|
+
"de_stmarc",
|
1232
|
+
"de_sugarcane",
|
1233
|
+
"de_train",
|
1234
|
+
"de_tuscan",
|
1235
|
+
"de_vertigo",
|
1236
|
+
"dz_ember",
|
1237
|
+
"dz_vineyard",
|
1238
|
+
"gd_cbble",
|
1239
|
+
"training1"
|
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} ]`
|
1265
|
+
steamClient.uploadRichPresence(730, {
|
1266
|
+
'game:state': 'game',
|
1267
|
+
steam_display: '#display_GameKnownMapScore',
|
1268
|
+
connect: '+gcconnectG082AA752',
|
1269
|
+
version: CSGO_VER.toString(),
|
1270
|
+
'game:mode': 'competitive',
|
1271
|
+
'game:map': richPresence.map,
|
1272
|
+
'game:server': 'kv',
|
1273
|
+
'watch': _.random(1, 5).toString(),
|
1274
|
+
'game:score': score,
|
1275
|
+
})
|
1276
|
+
}, [60000, 180000], 'uploadRichPresenceCSGO')
|
1217
1277
|
}
|
1218
1278
|
|
1219
1279
|
// await sleep(10000)
|