steamutils 1.1.52 → 1.1.53
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +14 -3
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -88,6 +88,7 @@ function SteamClient({
|
|
88
88
|
}) {
|
89
89
|
const steamClient = new SteamUser()
|
90
90
|
let prime = null
|
91
|
+
let state = 'Offline'//InGame, Online
|
91
92
|
|
92
93
|
const events = {
|
93
94
|
user: [],
|
@@ -698,8 +699,8 @@ function SteamClient({
|
|
698
699
|
}
|
699
700
|
|
700
701
|
steamClient.on('loggedOn', async (loggedOnResponse) => {
|
701
|
-
await sleep(10000)
|
702
702
|
steamClient.setPersona(SteamUser.EPersonaState.Online)
|
703
|
+
state = 'Online'
|
703
704
|
await sendHello()
|
704
705
|
callEvent(events.loggedOn)
|
705
706
|
if (isAutoRequestFreeLicense) {
|
@@ -1114,11 +1115,18 @@ function SteamClient({
|
|
1114
1115
|
await sleep(5000)
|
1115
1116
|
} catch (e) {
|
1116
1117
|
}
|
1117
|
-
|
1118
|
-
steamClient.setPersona(SteamUser.EPersonaState.Online)
|
1118
|
+
gamesPlayed(appid)
|
1119
1119
|
}
|
1120
1120
|
|
1121
1121
|
async function gamesPlayed(apps) {
|
1122
|
+
if (!Array.isArray(apps)) {
|
1123
|
+
apps = [apps]
|
1124
|
+
}
|
1125
|
+
if (apps.length) {
|
1126
|
+
state = 'InGame'
|
1127
|
+
} else {
|
1128
|
+
state = 'Online'
|
1129
|
+
}
|
1122
1130
|
steamClient.gamesPlayed(apps);
|
1123
1131
|
await sleep(2000)
|
1124
1132
|
// steamClient.setPersona(SteamUser.EPersonaState.Online)
|
@@ -1219,6 +1227,9 @@ function SteamClient({
|
|
1219
1227
|
sendHello()
|
1220
1228
|
}
|
1221
1229
|
},
|
1230
|
+
getState(){
|
1231
|
+
return state
|
1232
|
+
}
|
1222
1233
|
}
|
1223
1234
|
}
|
1224
1235
|
|