@csfloat/cs2-inspect-serializer 1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 FitChiON
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # CS2 Inspect Link Serializer
2
+
3
+ Lightweight serializer for CS2 inspect links. Fork of the package
4
+ [cs2-inspect-create](https://github.com/candyboyz/cs2-inspect-create).
5
+
6
+ # Installation
7
+
8
+ ```bash
9
+ npm i @csfloat/cs2-inspect-serializer
10
+ ```
11
+
12
+ # Usage
13
+
14
+ See the [tests](tests/gen.test.ts) for examples.
15
+
16
+ # Development
17
+
18
+ ```bash
19
+ # Generate the protobuf file based on econ.proto
20
+ npm run protoc
21
+ # Build the project
22
+ npm run build
23
+ # Run the tests
24
+ npm run test
25
+ ```
@@ -0,0 +1,172 @@
1
+ import { MessageType, PartialMessage, IBinaryReader, BinaryReadOptions, IBinaryWriter, BinaryWriteOptions } from '@protobuf-ts/runtime';
2
+
3
+ declare class CEconItemPreviewDataBlock$Type extends MessageType<CEconItemPreviewDataBlock> {
4
+ constructor();
5
+ create(value?: PartialMessage<CEconItemPreviewDataBlock>): CEconItemPreviewDataBlock;
6
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CEconItemPreviewDataBlock): CEconItemPreviewDataBlock;
7
+ internalBinaryWrite(message: CEconItemPreviewDataBlock, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
8
+ }
9
+ /**
10
+ * @generated from protobuf message CEconItemPreviewDataBlock
11
+ */
12
+ interface CEconItemPreviewDataBlock {
13
+ /**
14
+ * @generated from protobuf field: optional uint32 accountid = 1
15
+ */
16
+ accountid?: number;
17
+ /**
18
+ * @generated from protobuf field: optional uint64 itemid = 2
19
+ */
20
+ itemid?: bigint;
21
+ /**
22
+ * @generated from protobuf field: optional uint32 defindex = 3
23
+ */
24
+ defindex?: number;
25
+ /**
26
+ * @generated from protobuf field: optional uint32 paintindex = 4
27
+ */
28
+ paintindex?: number;
29
+ /**
30
+ * @generated from protobuf field: optional uint32 rarity = 5
31
+ */
32
+ rarity?: number;
33
+ /**
34
+ * @generated from protobuf field: optional uint32 quality = 6
35
+ */
36
+ quality?: number;
37
+ /**
38
+ * @generated from protobuf field: optional uint32 paintwear = 7
39
+ */
40
+ paintwear?: number;
41
+ /**
42
+ * @generated from protobuf field: optional uint32 paintseed = 8
43
+ */
44
+ paintseed?: number;
45
+ /**
46
+ * @generated from protobuf field: optional uint32 killeaterscoretype = 9
47
+ */
48
+ killeaterscoretype?: number;
49
+ /**
50
+ * @generated from protobuf field: optional uint32 killeatervalue = 10
51
+ */
52
+ killeatervalue?: number;
53
+ /**
54
+ * @generated from protobuf field: optional string customname = 11
55
+ */
56
+ customname?: string;
57
+ /**
58
+ * @generated from protobuf field: repeated CEconItemPreviewDataBlock.Sticker stickers = 12
59
+ */
60
+ stickers: CEconItemPreviewDataBlock_Sticker[];
61
+ /**
62
+ * @generated from protobuf field: optional uint32 inventory = 13
63
+ */
64
+ inventory?: number;
65
+ /**
66
+ * @generated from protobuf field: optional uint32 origin = 14
67
+ */
68
+ origin?: number;
69
+ /**
70
+ * @generated from protobuf field: optional uint32 questid = 15
71
+ */
72
+ questid?: number;
73
+ /**
74
+ * @generated from protobuf field: optional uint32 dropreason = 16
75
+ */
76
+ dropreason?: number;
77
+ /**
78
+ * @generated from protobuf field: optional uint32 musicindex = 17
79
+ */
80
+ musicindex?: number;
81
+ /**
82
+ * @generated from protobuf field: optional int32 entindex = 18
83
+ */
84
+ entindex?: number;
85
+ /**
86
+ * @generated from protobuf field: optional uint32 petindex = 19
87
+ */
88
+ petindex?: number;
89
+ /**
90
+ * @generated from protobuf field: repeated CEconItemPreviewDataBlock.Sticker keychains = 20
91
+ */
92
+ keychains: CEconItemPreviewDataBlock_Sticker[];
93
+ }
94
+ /**
95
+ * @generated MessageType for protobuf message CEconItemPreviewDataBlock
96
+ */
97
+ declare const CEconItemPreviewDataBlock: CEconItemPreviewDataBlock$Type;
98
+ declare class CEconItemPreviewDataBlock_Sticker$Type extends MessageType<CEconItemPreviewDataBlock_Sticker> {
99
+ constructor();
100
+ create(value?: PartialMessage<CEconItemPreviewDataBlock_Sticker>): CEconItemPreviewDataBlock_Sticker;
101
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CEconItemPreviewDataBlock_Sticker): CEconItemPreviewDataBlock_Sticker;
102
+ internalBinaryWrite(message: CEconItemPreviewDataBlock_Sticker, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
103
+ }
104
+ /**
105
+ * @generated from protobuf message CEconItemPreviewDataBlock.Sticker
106
+ */
107
+ interface CEconItemPreviewDataBlock_Sticker {
108
+ /**
109
+ * @generated from protobuf field: optional uint32 slot = 1
110
+ */
111
+ slot?: number;
112
+ /**
113
+ * @generated from protobuf field: optional uint32 sticker_id = 2
114
+ */
115
+ stickerId?: number;
116
+ /**
117
+ * @generated from protobuf field: optional float wear = 3
118
+ */
119
+ wear?: number;
120
+ /**
121
+ * @generated from protobuf field: optional float scale = 4
122
+ */
123
+ scale?: number;
124
+ /**
125
+ * @generated from protobuf field: optional float rotation = 5
126
+ */
127
+ rotation?: number;
128
+ /**
129
+ * @generated from protobuf field: optional uint32 tint_id = 6
130
+ */
131
+ tintId?: number;
132
+ /**
133
+ * @generated from protobuf field: optional float offset_x = 7
134
+ */
135
+ offsetX?: number;
136
+ /**
137
+ * @generated from protobuf field: optional float offset_y = 8
138
+ */
139
+ offsetY?: number;
140
+ /**
141
+ * @generated from protobuf field: optional float offset_z = 9
142
+ */
143
+ offsetZ?: number;
144
+ /**
145
+ * @generated from protobuf field: optional uint32 pattern = 10
146
+ */
147
+ pattern?: number;
148
+ /**
149
+ * @generated from protobuf field: optional uint32 highlight_reel = 11
150
+ */
151
+ highlightReel?: number;
152
+ }
153
+ /**
154
+ * @generated MessageType for protobuf message CEconItemPreviewDataBlock.Sticker
155
+ */
156
+ declare const CEconItemPreviewDataBlock_Sticker: CEconItemPreviewDataBlock_Sticker$Type;
157
+
158
+ declare const previewLink = "steam://rungame/730/76561202255233023/+csgo_econ_action_preview";
159
+ /**
160
+ * Creates the hex representation of the inspect data
161
+ * @args {@link CEconItemPreviewDataBlock}
162
+ * @returns {string} example: "00180720C80A280638A4E1F5FB03409A0562040800104C62040801104C62040802104C62040803104C6D4F5E30""
163
+ */
164
+ declare const generateHex: ({ paintwear, ...props }: CEconItemPreviewDataBlock) => string;
165
+ /**
166
+ * Generates the inspect link
167
+ * @args {@link CEconItemPreviewDataBlock}
168
+ * @returns {string} "steam://rungame/730/76561202255233023/+csgo_econ_action_preview 00180720C80A280638A4E1F5FB03409A0562040800104C62040801104C62040802104C62040803104C6D4F5E30"
169
+ */
170
+ declare const generateLink: (props: CEconItemPreviewDataBlock) => string;
171
+
172
+ export { generateHex, generateLink, previewLink };
@@ -0,0 +1,172 @@
1
+ import { MessageType, PartialMessage, IBinaryReader, BinaryReadOptions, IBinaryWriter, BinaryWriteOptions } from '@protobuf-ts/runtime';
2
+
3
+ declare class CEconItemPreviewDataBlock$Type extends MessageType<CEconItemPreviewDataBlock> {
4
+ constructor();
5
+ create(value?: PartialMessage<CEconItemPreviewDataBlock>): CEconItemPreviewDataBlock;
6
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CEconItemPreviewDataBlock): CEconItemPreviewDataBlock;
7
+ internalBinaryWrite(message: CEconItemPreviewDataBlock, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
8
+ }
9
+ /**
10
+ * @generated from protobuf message CEconItemPreviewDataBlock
11
+ */
12
+ interface CEconItemPreviewDataBlock {
13
+ /**
14
+ * @generated from protobuf field: optional uint32 accountid = 1
15
+ */
16
+ accountid?: number;
17
+ /**
18
+ * @generated from protobuf field: optional uint64 itemid = 2
19
+ */
20
+ itemid?: bigint;
21
+ /**
22
+ * @generated from protobuf field: optional uint32 defindex = 3
23
+ */
24
+ defindex?: number;
25
+ /**
26
+ * @generated from protobuf field: optional uint32 paintindex = 4
27
+ */
28
+ paintindex?: number;
29
+ /**
30
+ * @generated from protobuf field: optional uint32 rarity = 5
31
+ */
32
+ rarity?: number;
33
+ /**
34
+ * @generated from protobuf field: optional uint32 quality = 6
35
+ */
36
+ quality?: number;
37
+ /**
38
+ * @generated from protobuf field: optional uint32 paintwear = 7
39
+ */
40
+ paintwear?: number;
41
+ /**
42
+ * @generated from protobuf field: optional uint32 paintseed = 8
43
+ */
44
+ paintseed?: number;
45
+ /**
46
+ * @generated from protobuf field: optional uint32 killeaterscoretype = 9
47
+ */
48
+ killeaterscoretype?: number;
49
+ /**
50
+ * @generated from protobuf field: optional uint32 killeatervalue = 10
51
+ */
52
+ killeatervalue?: number;
53
+ /**
54
+ * @generated from protobuf field: optional string customname = 11
55
+ */
56
+ customname?: string;
57
+ /**
58
+ * @generated from protobuf field: repeated CEconItemPreviewDataBlock.Sticker stickers = 12
59
+ */
60
+ stickers: CEconItemPreviewDataBlock_Sticker[];
61
+ /**
62
+ * @generated from protobuf field: optional uint32 inventory = 13
63
+ */
64
+ inventory?: number;
65
+ /**
66
+ * @generated from protobuf field: optional uint32 origin = 14
67
+ */
68
+ origin?: number;
69
+ /**
70
+ * @generated from protobuf field: optional uint32 questid = 15
71
+ */
72
+ questid?: number;
73
+ /**
74
+ * @generated from protobuf field: optional uint32 dropreason = 16
75
+ */
76
+ dropreason?: number;
77
+ /**
78
+ * @generated from protobuf field: optional uint32 musicindex = 17
79
+ */
80
+ musicindex?: number;
81
+ /**
82
+ * @generated from protobuf field: optional int32 entindex = 18
83
+ */
84
+ entindex?: number;
85
+ /**
86
+ * @generated from protobuf field: optional uint32 petindex = 19
87
+ */
88
+ petindex?: number;
89
+ /**
90
+ * @generated from protobuf field: repeated CEconItemPreviewDataBlock.Sticker keychains = 20
91
+ */
92
+ keychains: CEconItemPreviewDataBlock_Sticker[];
93
+ }
94
+ /**
95
+ * @generated MessageType for protobuf message CEconItemPreviewDataBlock
96
+ */
97
+ declare const CEconItemPreviewDataBlock: CEconItemPreviewDataBlock$Type;
98
+ declare class CEconItemPreviewDataBlock_Sticker$Type extends MessageType<CEconItemPreviewDataBlock_Sticker> {
99
+ constructor();
100
+ create(value?: PartialMessage<CEconItemPreviewDataBlock_Sticker>): CEconItemPreviewDataBlock_Sticker;
101
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: CEconItemPreviewDataBlock_Sticker): CEconItemPreviewDataBlock_Sticker;
102
+ internalBinaryWrite(message: CEconItemPreviewDataBlock_Sticker, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter;
103
+ }
104
+ /**
105
+ * @generated from protobuf message CEconItemPreviewDataBlock.Sticker
106
+ */
107
+ interface CEconItemPreviewDataBlock_Sticker {
108
+ /**
109
+ * @generated from protobuf field: optional uint32 slot = 1
110
+ */
111
+ slot?: number;
112
+ /**
113
+ * @generated from protobuf field: optional uint32 sticker_id = 2
114
+ */
115
+ stickerId?: number;
116
+ /**
117
+ * @generated from protobuf field: optional float wear = 3
118
+ */
119
+ wear?: number;
120
+ /**
121
+ * @generated from protobuf field: optional float scale = 4
122
+ */
123
+ scale?: number;
124
+ /**
125
+ * @generated from protobuf field: optional float rotation = 5
126
+ */
127
+ rotation?: number;
128
+ /**
129
+ * @generated from protobuf field: optional uint32 tint_id = 6
130
+ */
131
+ tintId?: number;
132
+ /**
133
+ * @generated from protobuf field: optional float offset_x = 7
134
+ */
135
+ offsetX?: number;
136
+ /**
137
+ * @generated from protobuf field: optional float offset_y = 8
138
+ */
139
+ offsetY?: number;
140
+ /**
141
+ * @generated from protobuf field: optional float offset_z = 9
142
+ */
143
+ offsetZ?: number;
144
+ /**
145
+ * @generated from protobuf field: optional uint32 pattern = 10
146
+ */
147
+ pattern?: number;
148
+ /**
149
+ * @generated from protobuf field: optional uint32 highlight_reel = 11
150
+ */
151
+ highlightReel?: number;
152
+ }
153
+ /**
154
+ * @generated MessageType for protobuf message CEconItemPreviewDataBlock.Sticker
155
+ */
156
+ declare const CEconItemPreviewDataBlock_Sticker: CEconItemPreviewDataBlock_Sticker$Type;
157
+
158
+ declare const previewLink = "steam://rungame/730/76561202255233023/+csgo_econ_action_preview";
159
+ /**
160
+ * Creates the hex representation of the inspect data
161
+ * @args {@link CEconItemPreviewDataBlock}
162
+ * @returns {string} example: "00180720C80A280638A4E1F5FB03409A0562040800104C62040801104C62040802104C62040803104C6D4F5E30""
163
+ */
164
+ declare const generateHex: ({ paintwear, ...props }: CEconItemPreviewDataBlock) => string;
165
+ /**
166
+ * Generates the inspect link
167
+ * @args {@link CEconItemPreviewDataBlock}
168
+ * @returns {string} "steam://rungame/730/76561202255233023/+csgo_econ_action_preview 00180720C80A280638A4E1F5FB03409A0562040800104C62040801104C62040802104C62040803104C6D4F5E30"
169
+ */
170
+ declare const generateLink: (props: CEconItemPreviewDataBlock) => string;
171
+
172
+ export { generateHex, generateLink, previewLink };