steamutils 1.3.39 → 1.3.41
Sign up to get free protection for your applications and to get access to all the features.
- package/SteamClient.js +13 -10
- package/create_remote_file.js +55 -0
- package/package.json +1 -1
- package/remote.js +4036 -0
package/SteamClient.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import
|
1
|
+
import NodeSteamUser from "steam-user";
|
2
2
|
import _ from "lodash";
|
3
3
|
import fs from "fs";
|
4
4
|
import {protoDecode, protoEncode} from "./helpers/util.js";
|
@@ -8,7 +8,7 @@ import axios from "axios";
|
|
8
8
|
import helpers, {loadProfos} from "./helpers/protos.js";
|
9
9
|
import {fileURLToPath} from "url";
|
10
10
|
import path from "path";
|
11
|
-
import
|
11
|
+
import SteamUser from "./index.js";
|
12
12
|
import {v4 as uuidv4} from 'uuid';
|
13
13
|
import EFriendRelationship from "steam-user/enums/EFriendRelationship.js";
|
14
14
|
import SteamCommunity from "steamcommunity";
|
@@ -78,7 +78,7 @@ const AppID = 730
|
|
78
78
|
export let CSGO_VER = 13960
|
79
79
|
export const FreeAppList = JSON.parse(fs.readFileSync(path.join(__dirname, 'free_packages.json'))).packages
|
80
80
|
|
81
|
-
|
81
|
+
SteamUser.getAppVersion(AppID).then(function (ver) {
|
82
82
|
CSGO_VER = ver
|
83
83
|
})
|
84
84
|
|
@@ -99,7 +99,7 @@ function SteamClient({
|
|
99
99
|
autoReconnect = true,
|
100
100
|
MAX_GAME_PLAY = 10
|
101
101
|
}) {
|
102
|
-
const steamClient = new
|
102
|
+
const steamClient = new NodeSteamUser()
|
103
103
|
let prime = null
|
104
104
|
let state = 'Offline'//InGame, Online, Invisible
|
105
105
|
let isLogOff = false
|
@@ -586,7 +586,7 @@ function SteamClient({
|
|
586
586
|
// })
|
587
587
|
}
|
588
588
|
|
589
|
-
async function createThenInvite2Lobby(steamIds) {
|
589
|
+
async function createThenInvite2Lobby(steamIds, onInvite) {
|
590
590
|
if (!steamClient.steamID) {
|
591
591
|
return
|
592
592
|
}
|
@@ -604,8 +604,11 @@ function SteamClient({
|
|
604
604
|
}
|
605
605
|
|
606
606
|
for (const steamId of steamIds) {
|
607
|
+
onInvite?.(lobbyID, steamId)
|
607
608
|
await invite2Lobby(lobbyID, steamId)
|
608
609
|
}
|
610
|
+
|
611
|
+
return lobbyID
|
609
612
|
}
|
610
613
|
|
611
614
|
|
@@ -1557,7 +1560,7 @@ function SteamClient({
|
|
1557
1560
|
}
|
1558
1561
|
|
1559
1562
|
function getFriendList() {
|
1560
|
-
return Object.keys(steamClient.myFriends).filter(steamId => steamClient.myFriends[steamId] ===
|
1563
|
+
return Object.keys(steamClient.myFriends).filter(steamId => steamClient.myFriends[steamId] === NodeSteamUser.EFriendRelationship.Friend)
|
1561
1564
|
}
|
1562
1565
|
|
1563
1566
|
function sendFriendTyping(steamId, callback) {
|
@@ -1688,7 +1691,7 @@ function SteamClient({
|
|
1688
1691
|
return true
|
1689
1692
|
} else if (cookie) {
|
1690
1693
|
log(reconnect ? 'reconnect with cookie' : 'login with cookie')
|
1691
|
-
const _clientJsToken = await new
|
1694
|
+
const _clientJsToken = await new SteamUser(typeof cookie === "function" ? await cookie() : cookie).getClientJsToken()
|
1692
1695
|
if (_clientJsToken?.logged_in === true) {
|
1693
1696
|
try {
|
1694
1697
|
await steamClient.logOn(_clientJsToken)
|
@@ -1937,10 +1940,10 @@ function SteamClient({
|
|
1937
1940
|
|
1938
1941
|
function updateInvisible() {
|
1939
1942
|
if (isInvisible) {
|
1940
|
-
steamClient.setPersona(
|
1943
|
+
steamClient.setPersona(NodeSteamUser.EPersonaState.Invisible)
|
1941
1944
|
state = 'Invisible'
|
1942
1945
|
} else {
|
1943
|
-
steamClient.setPersona(
|
1946
|
+
steamClient.setPersona(NodeSteamUser.EPersonaState.Online)
|
1944
1947
|
state = 'Online'
|
1945
1948
|
}
|
1946
1949
|
}
|
@@ -1952,7 +1955,7 @@ function SteamClient({
|
|
1952
1955
|
|
1953
1956
|
steamClient.gamesPlayed(apps);
|
1954
1957
|
await sleep(2000)
|
1955
|
-
// steamClient.setPersona(
|
1958
|
+
// steamClient.setPersona(NodeSteamUser.EPersonaState.Online)
|
1956
1959
|
await sendHello()
|
1957
1960
|
updateFakeGameScore()
|
1958
1961
|
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import SteamUser from "./index.js";
|
2
|
+
|
3
|
+
(async function () {
|
4
|
+
let json = ``
|
5
|
+
for (const methodName of Object.getOwnPropertyNames(SteamUser.prototype)) {
|
6
|
+
if (methodName === "constructor") {
|
7
|
+
continue
|
8
|
+
}
|
9
|
+
const fnString = SteamUser.prototype[methodName].toString().trim()
|
10
|
+
const async = "async";
|
11
|
+
// const async = fnString.startsWith("async") ? "async" : "";
|
12
|
+
let params = fnString.split('(')[1].split(')')[0];
|
13
|
+
const paramsList = params.split(',')
|
14
|
+
for (let i = 0; i < paramsList.length; i++) {
|
15
|
+
if (paramsList[i].includes("=")) {
|
16
|
+
paramsList[i] = paramsList[i].split("=")[0].trim()
|
17
|
+
}
|
18
|
+
}
|
19
|
+
params = paramsList.join(', ').trim()
|
20
|
+
if(params.startsWith("{") && !params.endsWith("}")){
|
21
|
+
params = params + "}"
|
22
|
+
}
|
23
|
+
|
24
|
+
json += `
|
25
|
+
${async} ${methodName}(${params}){
|
26
|
+
if(!RemoteSteamUser.__appIndex){
|
27
|
+
RemoteSteamUser.__appIndex = 0
|
28
|
+
}
|
29
|
+
RemoteSteamUser.__appIndex++
|
30
|
+
if(RemoteSteamUser.__appIndex >= RemoteSteamUser.__apps.length){
|
31
|
+
RemoteSteamUser.__appIndex = 0
|
32
|
+
}
|
33
|
+
|
34
|
+
const __params = [${params}];
|
35
|
+
if(__params.length === 1 && __params[0] === undefined){
|
36
|
+
__params.length = 0
|
37
|
+
}
|
38
|
+
|
39
|
+
try {
|
40
|
+
const result = (
|
41
|
+
await axios.post(RemoteSteamUser.__apps[RemoteSteamUser.__appIndex], {
|
42
|
+
method: "${methodName}",
|
43
|
+
params: __params,
|
44
|
+
cookies: this._cookies,
|
45
|
+
})
|
46
|
+
).data?.result;
|
47
|
+
return result
|
48
|
+
} catch (e) {
|
49
|
+
}
|
50
|
+
}`.trim() + '\n'
|
51
|
+
}
|
52
|
+
|
53
|
+
console.log('')
|
54
|
+
|
55
|
+
})()
|