steamutils 1.1.50 → 1.1.53
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +15 -2
- package/index.js +23 -9
- 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: [],
|
@@ -699,6 +700,7 @@ function SteamClient({
|
|
699
700
|
|
700
701
|
steamClient.on('loggedOn', async (loggedOnResponse) => {
|
701
702
|
steamClient.setPersona(SteamUser.EPersonaState.Online)
|
703
|
+
state = 'Online'
|
702
704
|
await sendHello()
|
703
705
|
callEvent(events.loggedOn)
|
704
706
|
if (isAutoRequestFreeLicense) {
|
@@ -707,6 +709,7 @@ function SteamClient({
|
|
707
709
|
}, 60000, 'autoRequestFreeLicense')
|
708
710
|
}
|
709
711
|
if (autoPlay) {
|
712
|
+
await sleep(10000)
|
710
713
|
onCookie(function () {
|
711
714
|
autoGamePlay()
|
712
715
|
})
|
@@ -1112,11 +1115,18 @@ function SteamClient({
|
|
1112
1115
|
await sleep(5000)
|
1113
1116
|
} catch (e) {
|
1114
1117
|
}
|
1115
|
-
|
1116
|
-
steamClient.setPersona(SteamUser.EPersonaState.Online)
|
1118
|
+
gamesPlayed(appid)
|
1117
1119
|
}
|
1118
1120
|
|
1119
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
|
+
}
|
1120
1130
|
steamClient.gamesPlayed(apps);
|
1121
1131
|
await sleep(2000)
|
1122
1132
|
// steamClient.setPersona(SteamUser.EPersonaState.Online)
|
@@ -1217,6 +1227,9 @@ function SteamClient({
|
|
1217
1227
|
sendHello()
|
1218
1228
|
}
|
1219
1229
|
},
|
1230
|
+
getState(){
|
1231
|
+
return state
|
1232
|
+
}
|
1220
1233
|
}
|
1221
1234
|
}
|
1222
1235
|
|
package/index.js
CHANGED
@@ -5426,16 +5426,16 @@ class SteamUser {
|
|
5426
5426
|
return trade_offer_access_url
|
5427
5427
|
}
|
5428
5428
|
|
5429
|
-
async sendTradeOffer({tradeURL,
|
5429
|
+
async sendTradeOffer({tradeURL, myAssets, theirAssets, tradeoffermessage = ''}) {//partner: steamid not accountid
|
5430
5430
|
// const meExample = {
|
5431
|
-
//
|
5432
|
-
//
|
5433
|
-
//
|
5431
|
+
// assets: [{appid: 730, contextid: "2", amount: 1, assetid: "30492209501"}],
|
5432
|
+
// currency: [],
|
5433
|
+
// ready: false
|
5434
5434
|
// }
|
5435
5435
|
// const themExample = {
|
5436
|
-
//
|
5437
|
-
//
|
5438
|
-
//
|
5436
|
+
// assets: [{appid: 730, contextid: "2", amount: 1, assetid: "30494845811"}],
|
5437
|
+
// currency: [],
|
5438
|
+
// ready: false
|
5439
5439
|
// }
|
5440
5440
|
const tradeURLParams = url.parse(tradeURL).query.split('&').reduce((accumulator, currentValue, index) => ({
|
5441
5441
|
...accumulator, [currentValue.split('=')[0]]: currentValue.split('=')[1]
|
@@ -5454,8 +5454,16 @@ class SteamUser {
|
|
5454
5454
|
json_tradeoffer: encodeURIComponent(JSON.stringify({
|
5455
5455
|
newversion: true,
|
5456
5456
|
version: 3,
|
5457
|
-
me
|
5458
|
-
|
5457
|
+
me: {
|
5458
|
+
assets: myAssets,
|
5459
|
+
currency: [],
|
5460
|
+
ready: false
|
5461
|
+
},
|
5462
|
+
them: {
|
5463
|
+
assets: theirAssets,
|
5464
|
+
currency: [],
|
5465
|
+
ready: false
|
5466
|
+
},
|
5459
5467
|
})),
|
5460
5468
|
captcha: '',
|
5461
5469
|
trade_offer_create_params: encodeURIComponent(JSON.stringify({trade_offer_access_token: tradeURLParams.token})),
|
@@ -5463,6 +5471,12 @@ class SteamUser {
|
|
5463
5471
|
method: 'POST',
|
5464
5472
|
})
|
5465
5473
|
return result.data
|
5474
|
+
const resultExample = {
|
5475
|
+
tradeofferid: "6093097382",
|
5476
|
+
needs_mobile_confirmation: true,
|
5477
|
+
needs_email_confirmation: false,
|
5478
|
+
email_domain: "gmail.com"
|
5479
|
+
}
|
5466
5480
|
}
|
5467
5481
|
}
|
5468
5482
|
|