steamutils 1.2.3 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +28 -3
- package/index.js +23 -8
- 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)
|
package/index.js
CHANGED
@@ -962,6 +962,7 @@ class SteamUser {
|
|
962
962
|
const name = $('.persona_name .actual_persona_name').text().trim()
|
963
963
|
const $personaLevel = $('.persona_level .friendPlayerLevelNum')
|
964
964
|
const level = $personaLevel.length ? parseInt($personaLevel.text()) : null
|
965
|
+
const notYetSetup = NotYetSetupProfileTextList.includes(profile_private_info)
|
965
966
|
|
966
967
|
const g_rgProfileDataExample = {
|
967
968
|
url: 'https://steamcommunity.com/id/natri99/',
|
@@ -969,9 +970,23 @@ class SteamUser {
|
|
969
970
|
personaname: 'Natri',
|
970
971
|
summary: 'Sub: <a class="bb_link" href="https://steamcommunity.com/id/Natri2099/" target="_blank" rel="noreferrer" >https://steamcommunity.com/id/Natri2099/</a> ',
|
971
972
|
}
|
972
|
-
|
973
|
-
if (!g_rgProfileData) {
|
974
|
-
|
973
|
+
let g_rgProfileData = JSON_parse(html.substringBetweenOrNull('g_rgProfileData = ', '"};') + '"}')
|
974
|
+
if (!g_rgProfileData && notYetSetup) {
|
975
|
+
const editLink = $('#btn > a').attr('href')
|
976
|
+
if (editLink?.endsWith("edit?welcomed=1")) {
|
977
|
+
const steamId = editLink.split('https://steamcommunity.com/profiles/')[1].split('/')[0]
|
978
|
+
const helloText = $('#hello').text()
|
979
|
+
let personaname = helloText.substring(helloText.indexOf(",") + 1).trim()
|
980
|
+
if (personaname.endsWith(".")) {
|
981
|
+
personaname = personaname.substring(0, text.length - 1).trim()
|
982
|
+
}
|
983
|
+
g_rgProfileData = {
|
984
|
+
url: 'https://steamcommunity.com/profiles/' + steamId,
|
985
|
+
steamid: steamId,
|
986
|
+
personaname,
|
987
|
+
summary: ''
|
988
|
+
}
|
989
|
+
}
|
975
990
|
}
|
976
991
|
|
977
992
|
const lobbyLink = $(`.profile_in_game_joingame a[href*='steam://joinlobby/']`).attr('href')
|
@@ -1015,7 +1030,7 @@ class SteamUser {
|
|
1015
1030
|
}
|
1016
1031
|
|
1017
1032
|
return {
|
1018
|
-
name: g_rgProfileData.personaname,
|
1033
|
+
name: g_rgProfileData.personaname || '',
|
1019
1034
|
realname: $('.header_real_name bdi').text()?.trim() || '',
|
1020
1035
|
onlineState,
|
1021
1036
|
steamID: g_rgProfileData.steamid,
|
@@ -1024,10 +1039,10 @@ class SteamUser {
|
|
1024
1039
|
customURL,
|
1025
1040
|
location,
|
1026
1041
|
summary: SteamUser._formatSummary(g_rgProfileData.summary),
|
1027
|
-
notYetSetup
|
1028
|
-
profile_private_info: profile_private_info ? ((
|
1029
|
-
|
1030
|
-
|
1042
|
+
notYetSetup,
|
1043
|
+
profile_private_info: profile_private_info ? ((notYetSetup
|
1044
|
+
? '___NotYetSetupProfile___'
|
1045
|
+
: (PrivateProfileTextList.includes(profile_private_info) ? '___PrivateProfile___' : profile_private_info))) : null,
|
1031
1046
|
lobbyLink,
|
1032
1047
|
addFriendEnable,
|
1033
1048
|
isPrivate: PrivateProfileTextList.includes(profile_private_info),
|