steamutils 1.0.27 → 1.0.29
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 +40 -3
- package/package.json +1 -1
package/SteamClient.js
CHANGED
@@ -8,6 +8,7 @@ import axios from "axios";
|
|
8
8
|
import helpers from "./helpers/protos.js";
|
9
9
|
import {fileURLToPath} from "url";
|
10
10
|
import path from "path";
|
11
|
+
import SteamUtils from "./index.js";
|
11
12
|
|
12
13
|
const __filename = fileURLToPath(import.meta.url);
|
13
14
|
const __dirname = path.dirname(__filename);
|
@@ -81,6 +82,7 @@ async function GetCurrentVersion(appid) {
|
|
81
82
|
}
|
82
83
|
|
83
84
|
const PersonasCache = []
|
85
|
+
|
84
86
|
function SteamClient({
|
85
87
|
username,
|
86
88
|
password,
|
@@ -245,7 +247,7 @@ function SteamClient({
|
|
245
247
|
const sid64 = SteamID.fromIndividualAccountID(msg.accountid).getSteamID64();
|
246
248
|
const personas = await getPersonas([sid64]);
|
247
249
|
const player_name = personas.find(p => p.id == sid64)?.player_name
|
248
|
-
if(player_name === undefined){
|
250
|
+
if (player_name === undefined) {
|
249
251
|
console.log(sid64, personas);
|
250
252
|
}
|
251
253
|
console.log(getAccountInfoName(), player_name, `https://steamcommunity.com/profiles/${sid64}`);
|
@@ -590,7 +592,7 @@ function SteamClient({
|
|
590
592
|
})
|
591
593
|
}
|
592
594
|
|
593
|
-
async function getNewCookie(cookie){
|
595
|
+
async function getNewCookie(cookie) {
|
594
596
|
let response = (await axios.request({
|
595
597
|
url: 'https://store.steampowered.com/', headers: {
|
596
598
|
cookie,
|
@@ -691,6 +693,40 @@ function SteamClient({
|
|
691
693
|
}
|
692
694
|
}
|
693
695
|
|
696
|
+
async function autoRequestFreeLicense(log = false, max = 10) {
|
697
|
+
const steamUtils = new SteamUtils(cookie)
|
698
|
+
|
699
|
+
const ownedAppsCount = log ? (await steamUtils.getDynamicStoreUserData()).rgOwnedApps.length : 0
|
700
|
+
const recommendedApps = _.shuffle((await steamUtils.getDynamicStoreUserData())?.rgRecommendedApps)
|
701
|
+
if (!recommendedApps.length) {
|
702
|
+
recommendedApps = (await axios.request({url: 'https://raw.githubusercontent.com/5x/easy-steam-free-packages/master/src/script/packages_db.json'}))?.data?.packages
|
703
|
+
}
|
704
|
+
if (max) {
|
705
|
+
recommendedApps.length = Math.min(recommendedApps.length, max)
|
706
|
+
}
|
707
|
+
for (const recommendedApp of recommendedApps) {
|
708
|
+
if (Math.random() > 0.5) {
|
709
|
+
try {
|
710
|
+
await steamUtils.requestFreeLicense(recommendedApp)
|
711
|
+
} catch (e) {
|
712
|
+
}
|
713
|
+
} else {
|
714
|
+
try {
|
715
|
+
await steamClient.requestFreeLicense(recommendedApp)
|
716
|
+
} catch (e) {
|
717
|
+
console.log(e);
|
718
|
+
}
|
719
|
+
}
|
720
|
+
await sleep(2000)
|
721
|
+
}
|
722
|
+
if (log) {
|
723
|
+
await sleep(20000)
|
724
|
+
const ownedAppsCount2 = (await steamUtils.getDynamicStoreUserData()).rgOwnedApps.length
|
725
|
+
const increaseNumber = ownedAppsCount2 - ownedAppsCount;
|
726
|
+
console.log(getAccountInfoName(), `OwnedApps length ${ownedAppsCount2}, increase ${increaseNumber}`)
|
727
|
+
}
|
728
|
+
}
|
729
|
+
|
694
730
|
return {
|
695
731
|
init,
|
696
732
|
partySearch,
|
@@ -724,7 +760,8 @@ function SteamClient({
|
|
724
760
|
return steamClient
|
725
761
|
},
|
726
762
|
getAccountInfoName,
|
727
|
-
getPlayersProfile
|
763
|
+
getPlayersProfile,
|
764
|
+
autoRequestFreeLicense
|
728
765
|
}
|
729
766
|
}
|
730
767
|
|