@ianlucas/cs2-lib-inspect 2.0.0-rc.5 → 2.0.0

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.
@@ -80,6 +80,10 @@ export interface CEconItemPreviewDataBlock {
80
80
  * @generated from protobuf field: optional int32 entindex = 18;
81
81
  */
82
82
  entindex?: number;
83
+ /**
84
+ * @generated from protobuf field: optional uint32 petindex = 19;
85
+ */
86
+ petindex?: number;
83
87
  }
84
88
  /**
85
89
  * @generated from protobuf message CEconItemPreviewDataBlock.Sticker
@@ -110,11 +114,11 @@ export interface CEconItemPreviewDataBlock_Sticker {
110
114
  */
111
115
  tintId?: number;
112
116
  /**
113
- * @generated from protobuf field: optional uint32 offset_x = 7;
117
+ * @generated from protobuf field: optional float offset_x = 7;
114
118
  */
115
119
  offsetX?: number;
116
120
  /**
117
- * @generated from protobuf field: optional uint32 offset_y = 8;
121
+ * @generated from protobuf field: optional float offset_y = 8;
118
122
  */
119
123
  offsetY?: number;
120
124
  }
@@ -6,137 +6,29 @@ import { MessageType } from "@protobuf-ts/runtime";
6
6
  class CEconItemPreviewDataBlock$Type extends MessageType {
7
7
  constructor() {
8
8
  super("CEconItemPreviewDataBlock", [
9
- {
10
- no: 1,
11
- name: "accountid",
12
- kind: "scalar",
13
- opt: true,
14
- T: 13 /*ScalarType.UINT32*/,
15
- },
16
- {
17
- no: 2,
18
- name: "itemid",
19
- kind: "scalar",
20
- opt: true,
21
- T: 4 /*ScalarType.UINT64*/,
22
- L: 0 /*LongType.BIGINT*/,
23
- },
24
- {
25
- no: 3,
26
- name: "defindex",
27
- kind: "scalar",
28
- opt: true,
29
- T: 13 /*ScalarType.UINT32*/,
30
- },
31
- {
32
- no: 4,
33
- name: "paintindex",
34
- kind: "scalar",
35
- opt: true,
36
- T: 13 /*ScalarType.UINT32*/,
37
- },
38
- {
39
- no: 5,
40
- name: "rarity",
41
- kind: "scalar",
42
- opt: true,
43
- T: 13 /*ScalarType.UINT32*/,
44
- },
45
- {
46
- no: 6,
47
- name: "quality",
48
- kind: "scalar",
49
- opt: true,
50
- T: 13 /*ScalarType.UINT32*/,
51
- },
52
- {
53
- no: 7,
54
- name: "paintwear",
55
- kind: "scalar",
56
- opt: true,
57
- T: 13 /*ScalarType.UINT32*/,
58
- },
59
- {
60
- no: 8,
61
- name: "paintseed",
62
- kind: "scalar",
63
- opt: true,
64
- T: 13 /*ScalarType.UINT32*/,
65
- },
66
- {
67
- no: 9,
68
- name: "killeaterscoretype",
69
- kind: "scalar",
70
- opt: true,
71
- T: 13 /*ScalarType.UINT32*/,
72
- },
73
- {
74
- no: 10,
75
- name: "killeatervalue",
76
- kind: "scalar",
77
- opt: true,
78
- T: 13 /*ScalarType.UINT32*/,
79
- },
80
- {
81
- no: 11,
82
- name: "customname",
83
- kind: "scalar",
84
- opt: true,
85
- T: 9 /*ScalarType.STRING*/,
86
- },
87
- {
88
- no: 12,
89
- name: "stickers",
90
- kind: "message",
91
- repeat: 1 /*RepeatType.PACKED*/,
92
- T: () => CEconItemPreviewDataBlock_Sticker,
93
- },
94
- {
95
- no: 13,
96
- name: "inventory",
97
- kind: "scalar",
98
- opt: true,
99
- T: 13 /*ScalarType.UINT32*/,
100
- },
101
- {
102
- no: 14,
103
- name: "origin",
104
- kind: "scalar",
105
- opt: true,
106
- T: 13 /*ScalarType.UINT32*/,
107
- },
108
- {
109
- no: 15,
110
- name: "questid",
111
- kind: "scalar",
112
- opt: true,
113
- T: 13 /*ScalarType.UINT32*/,
114
- },
115
- {
116
- no: 16,
117
- name: "dropreason",
118
- kind: "scalar",
119
- opt: true,
120
- T: 13 /*ScalarType.UINT32*/,
121
- },
122
- {
123
- no: 17,
124
- name: "musicindex",
125
- kind: "scalar",
126
- opt: true,
127
- T: 13 /*ScalarType.UINT32*/,
128
- },
129
- {
130
- no: 18,
131
- name: "entindex",
132
- kind: "scalar",
133
- opt: true,
134
- T: 5 /*ScalarType.INT32*/,
135
- },
9
+ { no: 1, name: "accountid", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
10
+ { no: 2, name: "itemid", kind: "scalar", opt: true, T: 4 /*ScalarType.UINT64*/, L: 0 /*LongType.BIGINT*/ },
11
+ { no: 3, name: "defindex", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
12
+ { no: 4, name: "paintindex", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
13
+ { no: 5, name: "rarity", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
14
+ { no: 6, name: "quality", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
15
+ { no: 7, name: "paintwear", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
16
+ { no: 8, name: "paintseed", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
17
+ { no: 9, name: "killeaterscoretype", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
18
+ { no: 10, name: "killeatervalue", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
19
+ { no: 11, name: "customname", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ },
20
+ { no: 12, name: "stickers", kind: "message", repeat: 1 /*RepeatType.PACKED*/, T: () => CEconItemPreviewDataBlock_Sticker },
21
+ { no: 13, name: "inventory", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
22
+ { no: 14, name: "origin", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
23
+ { no: 15, name: "questid", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
24
+ { no: 16, name: "dropreason", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
25
+ { no: 17, name: "musicindex", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
26
+ { no: 18, name: "entindex", kind: "scalar", opt: true, T: 5 /*ScalarType.INT32*/ },
27
+ { no: 19, name: "petindex", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }
136
28
  ]);
137
29
  }
138
30
  create(value) {
139
- const message = globalThis.Object.create(this.messagePrototype);
31
+ const message = globalThis.Object.create((this.messagePrototype));
140
32
  message.stickers = [];
141
33
  if (value !== undefined)
142
34
  reflectionMergePartial(this, message, value);
@@ -201,6 +93,9 @@ class CEconItemPreviewDataBlock$Type extends MessageType {
201
93
  case /* optional int32 entindex */ 18:
202
94
  message.entindex = reader.int32();
203
95
  break;
96
+ case /* optional uint32 petindex */ 19:
97
+ message.petindex = reader.uint32();
98
+ break;
204
99
  default:
205
100
  let u = options.readUnknownField;
206
101
  if (u === "throw")
@@ -267,6 +162,9 @@ class CEconItemPreviewDataBlock$Type extends MessageType {
267
162
  /* optional int32 entindex = 18; */
268
163
  if (message.entindex !== undefined)
269
164
  writer.tag(18, WireType.Varint).int32(message.entindex);
165
+ /* optional uint32 petindex = 19; */
166
+ if (message.petindex !== undefined)
167
+ writer.tag(19, WireType.Varint).uint32(message.petindex);
270
168
  let u = options.writeUnknownFields;
271
169
  if (u !== false)
272
170
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
@@ -281,66 +179,18 @@ export const CEconItemPreviewDataBlock = new CEconItemPreviewDataBlock$Type();
281
179
  class CEconItemPreviewDataBlock_Sticker$Type extends MessageType {
282
180
  constructor() {
283
181
  super("CEconItemPreviewDataBlock.Sticker", [
284
- {
285
- no: 1,
286
- name: "slot",
287
- kind: "scalar",
288
- opt: true,
289
- T: 13 /*ScalarType.UINT32*/,
290
- },
291
- {
292
- no: 2,
293
- name: "sticker_id",
294
- kind: "scalar",
295
- opt: true,
296
- T: 13 /*ScalarType.UINT32*/,
297
- },
298
- {
299
- no: 3,
300
- name: "wear",
301
- kind: "scalar",
302
- opt: true,
303
- T: 2 /*ScalarType.FLOAT*/,
304
- },
305
- {
306
- no: 4,
307
- name: "scale",
308
- kind: "scalar",
309
- opt: true,
310
- T: 2 /*ScalarType.FLOAT*/,
311
- },
312
- {
313
- no: 5,
314
- name: "rotation",
315
- kind: "scalar",
316
- opt: true,
317
- T: 2 /*ScalarType.FLOAT*/,
318
- },
319
- {
320
- no: 6,
321
- name: "tint_id",
322
- kind: "scalar",
323
- opt: true,
324
- T: 13 /*ScalarType.UINT32*/,
325
- },
326
- {
327
- no: 7,
328
- name: "offset_x",
329
- kind: "scalar",
330
- opt: true,
331
- T: 13 /*ScalarType.UINT32*/,
332
- },
333
- {
334
- no: 8,
335
- name: "offset_y",
336
- kind: "scalar",
337
- opt: true,
338
- T: 13 /*ScalarType.UINT32*/,
339
- },
182
+ { no: 1, name: "slot", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
183
+ { no: 2, name: "sticker_id", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
184
+ { no: 3, name: "wear", kind: "scalar", opt: true, T: 2 /*ScalarType.FLOAT*/ },
185
+ { no: 4, name: "scale", kind: "scalar", opt: true, T: 2 /*ScalarType.FLOAT*/ },
186
+ { no: 5, name: "rotation", kind: "scalar", opt: true, T: 2 /*ScalarType.FLOAT*/ },
187
+ { no: 6, name: "tint_id", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ },
188
+ { no: 7, name: "offset_x", kind: "scalar", opt: true, T: 2 /*ScalarType.FLOAT*/ },
189
+ { no: 8, name: "offset_y", kind: "scalar", opt: true, T: 2 /*ScalarType.FLOAT*/ }
340
190
  ]);
341
191
  }
342
192
  create(value) {
343
- const message = globalThis.Object.create(this.messagePrototype);
193
+ const message = globalThis.Object.create((this.messagePrototype));
344
194
  if (value !== undefined)
345
195
  reflectionMergePartial(this, message, value);
346
196
  return message;
@@ -368,11 +218,11 @@ class CEconItemPreviewDataBlock_Sticker$Type extends MessageType {
368
218
  case /* optional uint32 tint_id */ 6:
369
219
  message.tintId = reader.uint32();
370
220
  break;
371
- case /* optional uint32 offset_x */ 7:
372
- message.offsetX = reader.uint32();
221
+ case /* optional float offset_x */ 7:
222
+ message.offsetX = reader.float();
373
223
  break;
374
- case /* optional uint32 offset_y */ 8:
375
- message.offsetY = reader.uint32();
224
+ case /* optional float offset_y */ 8:
225
+ message.offsetY = reader.float();
376
226
  break;
377
227
  default:
378
228
  let u = options.readUnknownField;
@@ -404,12 +254,12 @@ class CEconItemPreviewDataBlock_Sticker$Type extends MessageType {
404
254
  /* optional uint32 tint_id = 6; */
405
255
  if (message.tintId !== undefined)
406
256
  writer.tag(6, WireType.Varint).uint32(message.tintId);
407
- /* optional uint32 offset_x = 7; */
257
+ /* optional float offset_x = 7; */
408
258
  if (message.offsetX !== undefined)
409
- writer.tag(7, WireType.Varint).uint32(message.offsetX);
410
- /* optional uint32 offset_y = 8; */
259
+ writer.tag(7, WireType.Bit32).float(message.offsetX);
260
+ /* optional float offset_y = 8; */
411
261
  if (message.offsetY !== undefined)
412
- writer.tag(8, WireType.Varint).uint32(message.offsetY);
262
+ writer.tag(8, WireType.Bit32).float(message.offsetY);
413
263
  let u = options.writeUnknownFields;
414
264
  if (u !== false)
415
265
  (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
package/dist/index.js CHANGED
@@ -49,7 +49,7 @@ function getEconomyItemPreviewData(item) {
49
49
  musicindex: item.isMusicKit() ? index : undefined,
50
50
  paintindex: hasPaintIndex ? index : undefined,
51
51
  paintseed: item.hasSeed() ? CS2_MIN_SEED : undefined,
52
- paintwear: item.hasWear() ? item.getMinimumWear() : undefined,
52
+ paintwear: item.hasWear() ? floatToBytes(item.getMinimumWear()) : undefined,
53
53
  rarity: CS2PreviewRarity[rarity] ?? 0,
54
54
  stickers: hasStickers
55
55
  ? [
@@ -74,8 +74,8 @@ function getInventoryItemPreviewData(item) {
74
74
  paintwear: item.hasWear() ? floatToBytes(item.getWear()) : undefined,
75
75
  stickers: stickers !== undefined
76
76
  ? item.someStickers().map(([slot, { id, wear, x, y }]) => ({
77
- offsetX: x !== undefined ? floatToBytes(x) : undefined,
78
- offsetY: y !== undefined ? floatToBytes(y) : undefined,
77
+ offsetX: x,
78
+ offsetY: y,
79
79
  slot,
80
80
  stickerId: item.economy.getById(id).index,
81
81
  wear: wear ?? CS2_MIN_STICKER_WEAR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ianlucas/cs2-lib-inspect",
3
- "version": "2.0.0-rc.5",
3
+ "version": "2.0.0",
4
4
  "description": "A utility for creating inspect links for CS2 items",
5
5
  "license": "MIT",
6
6
  "repository": "ianlucas/cs2-lib-inspect",
@@ -9,7 +9,7 @@
9
9
  "scripts": {
10
10
  "format": "prettier . --write",
11
11
  "prepack": "([ -d dist ] && rm -rf dist); tsc",
12
- "protoc": "npx protoc --ts_out src --proto_path src/protos protos/econ.proto",
12
+ "protoc": "npx protoc --ts_out ./src --proto_path src/protos src/protos/econ-item-preview-data-block.proto",
13
13
  "test": "jest"
14
14
  },
15
15
  "dependencies": {
@@ -18,7 +18,7 @@
18
18
  "crc-32": "^1.2.2"
19
19
  },
20
20
  "peerDependencies": {
21
- "@ianlucas/cs2-lib": "^5.0.0-rc.24"
21
+ "@ianlucas/cs2-lib": "^5.0.0"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@protobuf-ts/plugin": "^2.9.3",