steamutils 1.4.94 → 1.4.96

Sign up to get free protection for your applications and to get access to all the features.
package/SteamClient.js CHANGED
@@ -485,7 +485,7 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
485
485
  }
486
486
 
487
487
  async function offAutoGamePlay() {
488
- steamClient.gamesPlayed([]);
488
+ steamClient?.gamesPlayed([]);
489
489
  doClearInterval("autoGamePlay");
490
490
  }
491
491
 
@@ -2739,26 +2739,36 @@ function SteamClient({ username, cookie, clientJsToken, isAutoRequestFreeLicense
2739
2739
  return response;
2740
2740
  }
2741
2741
 
2742
- function redeemFreeReward(itemIds, generation_time) {
2742
+ async function redeemFreeReward(itemIds, generation_time) {
2743
2743
  if (isLogOff) {
2744
2744
  return;
2745
2745
  }
2746
- console.log(`Sent message to GC: AppID ${AppID}, MessageType ${ESteamProto.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientRedeemFreeReward}`);
2747
-
2748
2746
  const encodedMessages = new SteamProto(SteamProtoType.CMsgGCCstrike15_v2_ClientRedeemFreeReward).protoEncode({
2749
- items: itemIds,
2747
+ items: itemIds.map(String),
2748
+ generation_time: generation_time, // Example
2749
+ redeemable_balance: 1, // Adjust as necessary
2750
2750
  });
2751
2751
  steamClient.sendToGC(
2752
2752
  730,
2753
- ESteamProto.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientRedeemFreeReward,
2753
+ 9219,
2754
2754
  {
2755
2755
  steamid: steamClient.steamID.getSteamID64(),
2756
2756
  routing_appid: 730,
2757
2757
  },
2758
2758
  encodedMessages,
2759
- function (payload) {
2760
- console.log(payload);
2759
+ );
2760
+
2761
+ await sleep(30000);
2762
+
2763
+ steamClient._send(
2764
+ {
2765
+ msg: 9219,
2766
+ proto: {
2767
+ steamid: steamClient.steamID.getSteamID64(),
2768
+ routing_appid: 730,
2769
+ },
2761
2770
  },
2771
+ encodedMessages,
2762
2772
  );
2763
2773
  }
2764
2774
 
package/_steamproto.js CHANGED
@@ -1,33 +1,39 @@
1
- import path from "path";
2
- import { fileURLToPath } from "url";
3
- import Protobuf from "protobufjs";
4
-
5
- const __filename = fileURLToPath(import.meta.url);
6
- const __dirname = path.dirname(__filename);
7
-
8
- export class SteamProto {
9
- constructor(proto) {
10
- this._proto = proto;
11
- }
12
-
13
- toProto() {
14
- const root = new Protobuf.Root().loadSync(path.join(`${__dirname}/protos/`, this._proto.filename), {
15
- keepCase: true,
16
- });
17
- return root[this._proto.name];
18
- }
19
-
20
- protoEncode(obj) {
21
- const protobuf = this.toProto();
22
- return protobuf.encode(protobuf.create(obj)).finish();
23
- }
24
-
25
- protoEncodeBase64(obj) {
26
- return this.protoEncode(obj).toString("base64");
27
- }
28
-
29
- protoDecode(obj) {
30
- const protobuf = this.toProto();
31
- return protobuf.toObject(protobuf.decode(obj), { defaults: true });
32
- }
33
- }
1
+ import path from "path";
2
+ import { fileURLToPath } from "url";
3
+ import Protobuf from "protobufjs";
4
+
5
+ const __filename = fileURLToPath(import.meta.url);
6
+ const __dirname = path.dirname(__filename);
7
+
8
+ export class SteamProto {
9
+ constructor(proto) {
10
+ this._proto = proto;
11
+ }
12
+
13
+ toProto() {
14
+ const root = new Protobuf.Root().loadSync(path.join(`${__dirname}/protos/`, this._proto.filename), {
15
+ keepCase: true,
16
+ });
17
+ return root[this._proto.name];
18
+ }
19
+
20
+ protoEncode(obj) {
21
+ const protobuf = this.toProto();
22
+ return protobuf.encode(protobuf.create(obj)).finish();
23
+ }
24
+
25
+ protoEncodeBase64(obj) {
26
+ return this.protoEncode(obj).toString("base64");
27
+ }
28
+
29
+ protoDecode(obj) {
30
+ const protobuf = this.toProto();
31
+ try {
32
+ return protobuf.toObject(protobuf.decode(obj), { defaults: true });
33
+ } catch (e) {
34
+ console.error(`[${this._proto.name}] protoDecode 1`, typeof obj, obj);
35
+ console.error(`[${this._proto.name}] protoDecode 2`, e);
36
+ return null;
37
+ }
38
+ }
39
+ }
@@ -57,16 +57,10 @@ function getAppURL() {
57
57
  RemoteSteamUser.__appIndex = 0;
58
58
  }
59
59
  RemoteSteamUser.__appIndex++;
60
-
61
- if (!RemoteSteamUser.__apps__half) {
62
- const half = Math.ceil(RemoteSteamUser.__apps.length / 2);
63
- RemoteSteamUser.__apps__half = new Date().getDate() > 15 ? RemoteSteamUser.__apps.slice(0, half) : RemoteSteamUser.__apps.slice(half);
64
- }
65
-
66
- if (RemoteSteamUser.__appIndex >= RemoteSteamUser.__apps__half.length) {
60
+ if (RemoteSteamUser.__appIndex >= RemoteSteamUser.__apps.length) {
67
61
  RemoteSteamUser.__appIndex = 0;
68
62
  }
69
- return RemoteSteamUser.__apps__half[RemoteSteamUser.__appIndex];
63
+ return RemoteSteamUser.__apps[RemoteSteamUser.__appIndex];
70
64
  }
71
65
 
72
66
  function formatParams(__params, __cookies) {