vault_coh 0.1.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +113 -41
- data/Gemfile +1 -1
- data/Gemfile.lock +11 -11
- data/README.md +3 -3
- data/ext/vault_coh/Cargo.toml +3 -2
- data/ext/vault_coh/src/hash.rs +49 -0
- data/ext/vault_coh/src/lib.rs +42 -1
- data/lib/vault_coh/command.rb +12 -0
- data/lib/vault_coh/commands/build_squad.rb +34 -0
- data/lib/vault_coh/commands/build_squad_command.rb +9 -0
- data/lib/vault_coh/commands/select_battlegroup.rb +35 -0
- data/lib/vault_coh/commands/select_battlegroup_command.rb +9 -0
- data/lib/vault_coh/commands/unknown.rb +32 -0
- data/lib/vault_coh/commands/unknown_command.rb +9 -0
- data/lib/vault_coh/commands.rb +7 -0
- data/lib/vault_coh/map.rb +5 -0
- data/lib/vault_coh/message.rb +5 -0
- data/lib/vault_coh/player.rb +25 -0
- data/lib/vault_coh/replay.rb +5 -0
- data/lib/vault_coh/version.rb +1 -1
- metadata +11 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdbd7e919eda17b55ac97b058087b32094c56066a612ddff20d78ade238b2797
|
4
|
+
data.tar.gz: 2cdc54cbc219eace927ec8e58d586c012c1a97933636e1ad1207adcf7acd0343
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e989e5dc6f37f6730a6e406e29d35acb7eb6b779e48b8e36d156df2abfd825bb2fd5909c1f7875c155a167d5d7eb7cebf690014eb853e9389c917069ba5a41ce
|
7
|
+
data.tar.gz: 9aaa7fee672a3a617b03151b2967c122503ab67d3fe197b7df615b151bc79b6ca9889203bad6b82c4d5689548c102921922fbcb28e5c5633093d60370a4d9fb2
|
data/Cargo.lock
CHANGED
@@ -4,18 +4,18 @@ version = 3
|
|
4
4
|
|
5
5
|
[[package]]
|
6
6
|
name = "aho-corasick"
|
7
|
-
version = "1.
|
7
|
+
version = "1.1.2"
|
8
8
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
-
checksum = "
|
9
|
+
checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0"
|
10
10
|
dependencies = [
|
11
11
|
"memchr",
|
12
12
|
]
|
13
13
|
|
14
14
|
[[package]]
|
15
15
|
name = "bindgen"
|
16
|
-
version = "0.
|
16
|
+
version = "0.66.1"
|
17
17
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
18
|
-
checksum = "
|
18
|
+
checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7"
|
19
19
|
dependencies = [
|
20
20
|
"bitflags",
|
21
21
|
"cexpr",
|
@@ -28,25 +28,26 @@ dependencies = [
|
|
28
28
|
"regex",
|
29
29
|
"rustc-hash",
|
30
30
|
"shlex",
|
31
|
+
"syn 2.0.38",
|
31
32
|
]
|
32
33
|
|
33
34
|
[[package]]
|
34
35
|
name = "bitflags"
|
35
|
-
version = "
|
36
|
+
version = "2.4.1"
|
36
37
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
37
|
-
checksum = "
|
38
|
+
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
|
38
39
|
|
39
40
|
[[package]]
|
40
41
|
name = "bytecount"
|
41
|
-
version = "0.6.
|
42
|
+
version = "0.6.7"
|
42
43
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
43
|
-
checksum = "
|
44
|
+
checksum = "e1e5f035d16fc623ae5f74981db80a439803888314e3a555fd6f04acd51a3205"
|
44
45
|
|
45
46
|
[[package]]
|
46
47
|
name = "byteorder"
|
47
|
-
version = "1.
|
48
|
+
version = "1.5.0"
|
48
49
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
49
|
-
checksum = "
|
50
|
+
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
|
50
51
|
|
51
52
|
[[package]]
|
52
53
|
name = "cexpr"
|
@@ -94,9 +95,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
94
95
|
|
95
96
|
[[package]]
|
96
97
|
name = "libc"
|
97
|
-
version = "0.2.
|
98
|
+
version = "0.2.149"
|
98
99
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
99
|
-
checksum = "
|
100
|
+
checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b"
|
100
101
|
|
101
102
|
[[package]]
|
102
103
|
name = "libloading"
|
@@ -110,31 +111,32 @@ dependencies = [
|
|
110
111
|
|
111
112
|
[[package]]
|
112
113
|
name = "magnus"
|
113
|
-
version = "0.
|
114
|
+
version = "0.6.2"
|
114
115
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
115
|
-
checksum = "
|
116
|
+
checksum = "4778544796676e8428e9c622460ebf284bea52d8b10db3aeb449d8b5e61b3a13"
|
116
117
|
dependencies = [
|
117
118
|
"magnus-macros",
|
118
119
|
"rb-sys",
|
119
120
|
"rb-sys-env",
|
121
|
+
"seq-macro",
|
120
122
|
]
|
121
123
|
|
122
124
|
[[package]]
|
123
125
|
name = "magnus-macros"
|
124
|
-
version = "0.
|
126
|
+
version = "0.6.0"
|
125
127
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
126
|
-
checksum = "
|
128
|
+
checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
|
127
129
|
dependencies = [
|
128
130
|
"proc-macro2",
|
129
131
|
"quote",
|
130
|
-
"syn",
|
132
|
+
"syn 2.0.38",
|
131
133
|
]
|
132
134
|
|
133
135
|
[[package]]
|
134
136
|
name = "memchr"
|
135
|
-
version = "2.
|
137
|
+
version = "2.6.4"
|
136
138
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
137
|
-
checksum = "
|
139
|
+
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
|
138
140
|
|
139
141
|
[[package]]
|
140
142
|
name = "minimal-lexical"
|
@@ -170,14 +172,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
170
172
|
checksum = "a7ac681ea0c3d468b003bdebe3a65d1632e340302452f95c3ffadf515704c48d"
|
171
173
|
dependencies = [
|
172
174
|
"quote",
|
173
|
-
"syn",
|
175
|
+
"syn 1.0.109",
|
174
176
|
]
|
175
177
|
|
176
178
|
[[package]]
|
177
179
|
name = "nom_locate"
|
178
|
-
version = "4.
|
180
|
+
version = "4.2.0"
|
179
181
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
180
|
-
checksum = "
|
182
|
+
checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3"
|
181
183
|
dependencies = [
|
182
184
|
"bytecount",
|
183
185
|
"memchr",
|
@@ -192,36 +194,36 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
|
192
194
|
|
193
195
|
[[package]]
|
194
196
|
name = "proc-macro2"
|
195
|
-
version = "1.0.
|
197
|
+
version = "1.0.69"
|
196
198
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
197
|
-
checksum = "
|
199
|
+
checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da"
|
198
200
|
dependencies = [
|
199
201
|
"unicode-ident",
|
200
202
|
]
|
201
203
|
|
202
204
|
[[package]]
|
203
205
|
name = "quote"
|
204
|
-
version = "1.0.
|
206
|
+
version = "1.0.33"
|
205
207
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
206
|
-
checksum = "
|
208
|
+
checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae"
|
207
209
|
dependencies = [
|
208
210
|
"proc-macro2",
|
209
211
|
]
|
210
212
|
|
211
213
|
[[package]]
|
212
214
|
name = "rb-sys"
|
213
|
-
version = "0.9.
|
215
|
+
version = "0.9.81"
|
214
216
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
215
|
-
checksum = "
|
217
|
+
checksum = "a57240b308b155b09dce81e32829966a99f52d1088b45957e4283e526c5317a1"
|
216
218
|
dependencies = [
|
217
219
|
"rb-sys-build",
|
218
220
|
]
|
219
221
|
|
220
222
|
[[package]]
|
221
223
|
name = "rb-sys-build"
|
222
|
-
version = "0.9.
|
224
|
+
version = "0.9.81"
|
223
225
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
224
|
-
checksum = "
|
226
|
+
checksum = "f24ce877a4c5d07f06f6aa6fec3ac95e4b357b9f73b0f5445d8cbb7266d410e8"
|
225
227
|
dependencies = [
|
226
228
|
"bindgen",
|
227
229
|
"lazy_static",
|
@@ -229,7 +231,7 @@ dependencies = [
|
|
229
231
|
"quote",
|
230
232
|
"regex",
|
231
233
|
"shell-words",
|
232
|
-
"syn",
|
234
|
+
"syn 2.0.38",
|
233
235
|
]
|
234
236
|
|
235
237
|
[[package]]
|
@@ -240,9 +242,21 @@ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
|
240
242
|
|
241
243
|
[[package]]
|
242
244
|
name = "regex"
|
243
|
-
version = "1.
|
245
|
+
version = "1.10.2"
|
246
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
247
|
+
checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343"
|
248
|
+
dependencies = [
|
249
|
+
"aho-corasick",
|
250
|
+
"memchr",
|
251
|
+
"regex-automata",
|
252
|
+
"regex-syntax",
|
253
|
+
]
|
254
|
+
|
255
|
+
[[package]]
|
256
|
+
name = "regex-automata"
|
257
|
+
version = "0.4.3"
|
244
258
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
245
|
-
checksum = "
|
259
|
+
checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f"
|
246
260
|
dependencies = [
|
247
261
|
"aho-corasick",
|
248
262
|
"memchr",
|
@@ -251,9 +265,9 @@ dependencies = [
|
|
251
265
|
|
252
266
|
[[package]]
|
253
267
|
name = "regex-syntax"
|
254
|
-
version = "0.
|
268
|
+
version = "0.8.2"
|
255
269
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
256
|
-
checksum = "
|
270
|
+
checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f"
|
257
271
|
|
258
272
|
[[package]]
|
259
273
|
name = "rustc-hash"
|
@@ -261,6 +275,45 @@ version = "1.1.0"
|
|
261
275
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
262
276
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
263
277
|
|
278
|
+
[[package]]
|
279
|
+
name = "seq-macro"
|
280
|
+
version = "0.3.5"
|
281
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
282
|
+
checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4"
|
283
|
+
|
284
|
+
[[package]]
|
285
|
+
name = "serde"
|
286
|
+
version = "1.0.156"
|
287
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
288
|
+
checksum = "314b5b092c0ade17c00142951e50ced110ec27cea304b1037c6969246c2469a4"
|
289
|
+
dependencies = [
|
290
|
+
"serde_derive",
|
291
|
+
]
|
292
|
+
|
293
|
+
[[package]]
|
294
|
+
name = "serde_derive"
|
295
|
+
version = "1.0.156"
|
296
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
297
|
+
checksum = "d7e29c4601e36bcec74a223228dce795f4cd3616341a4af93520ca1a837c087d"
|
298
|
+
dependencies = [
|
299
|
+
"proc-macro2",
|
300
|
+
"quote",
|
301
|
+
"syn 1.0.109",
|
302
|
+
]
|
303
|
+
|
304
|
+
[[package]]
|
305
|
+
name = "serde_magnus"
|
306
|
+
version = "0.8.0"
|
307
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
308
|
+
checksum = "4a9a56602c902d792aac8f369117c4490616b6772aaa85fad88cc8cc35edd192"
|
309
|
+
dependencies = [
|
310
|
+
"magnus",
|
311
|
+
"rb-sys",
|
312
|
+
"rb-sys-build",
|
313
|
+
"serde",
|
314
|
+
"tap",
|
315
|
+
]
|
316
|
+
|
264
317
|
[[package]]
|
265
318
|
name = "shell-words"
|
266
319
|
version = "1.1.0"
|
@@ -269,9 +322,9 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
|
|
269
322
|
|
270
323
|
[[package]]
|
271
324
|
name = "shlex"
|
272
|
-
version = "1.
|
325
|
+
version = "1.2.0"
|
273
326
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
274
|
-
checksum = "
|
327
|
+
checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
|
275
328
|
|
276
329
|
[[package]]
|
277
330
|
name = "syn"
|
@@ -284,23 +337,41 @@ dependencies = [
|
|
284
337
|
"unicode-ident",
|
285
338
|
]
|
286
339
|
|
340
|
+
[[package]]
|
341
|
+
name = "syn"
|
342
|
+
version = "2.0.38"
|
343
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
344
|
+
checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b"
|
345
|
+
dependencies = [
|
346
|
+
"proc-macro2",
|
347
|
+
"quote",
|
348
|
+
"unicode-ident",
|
349
|
+
]
|
350
|
+
|
351
|
+
[[package]]
|
352
|
+
name = "tap"
|
353
|
+
version = "1.0.1"
|
354
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
355
|
+
checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
356
|
+
|
287
357
|
[[package]]
|
288
358
|
name = "unicode-ident"
|
289
|
-
version = "1.0.
|
359
|
+
version = "1.0.12"
|
290
360
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
291
|
-
checksum = "
|
361
|
+
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
292
362
|
|
293
363
|
[[package]]
|
294
364
|
name = "vault"
|
295
|
-
version = "
|
365
|
+
version = "5.0.0"
|
296
366
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
297
|
-
checksum = "
|
367
|
+
checksum = "c67502a964c8ac4301dcd55e042f7b581fb4bce681dc4236b3c75f5971a219ce"
|
298
368
|
dependencies = [
|
299
369
|
"byteorder",
|
300
370
|
"magnus",
|
301
371
|
"nom",
|
302
372
|
"nom-tracable",
|
303
373
|
"nom_locate",
|
374
|
+
"serde",
|
304
375
|
]
|
305
376
|
|
306
377
|
[[package]]
|
@@ -308,6 +379,7 @@ name = "vault_coh"
|
|
308
379
|
version = "1.0.0"
|
309
380
|
dependencies = [
|
310
381
|
"magnus",
|
382
|
+
"serde_magnus",
|
311
383
|
"vault",
|
312
384
|
]
|
313
385
|
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vault_coh (0.
|
4
|
+
vault_coh (2.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -11,16 +11,16 @@ GEM
|
|
11
11
|
json (2.6.3)
|
12
12
|
language_server-protocol (3.17.0.3)
|
13
13
|
parallel (1.23.0)
|
14
|
-
parser (3.2.2.
|
14
|
+
parser (3.2.2.4)
|
15
15
|
ast (~> 2.4.1)
|
16
16
|
racc
|
17
|
-
racc (1.7.
|
17
|
+
racc (1.7.2)
|
18
18
|
rainbow (3.1.1)
|
19
|
-
rake (13.0
|
19
|
+
rake (13.1.0)
|
20
20
|
rake-compiler (1.2.5)
|
21
21
|
rake
|
22
|
-
rb_sys (0.9.
|
23
|
-
regexp_parser (2.8.
|
22
|
+
rb_sys (0.9.82)
|
23
|
+
regexp_parser (2.8.2)
|
24
24
|
rexml (3.2.6)
|
25
25
|
rspec (3.12.0)
|
26
26
|
rspec-core (~> 3.12.0)
|
@@ -35,21 +35,21 @@ GEM
|
|
35
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
36
|
rspec-support (~> 3.12.0)
|
37
37
|
rspec-support (3.12.1)
|
38
|
-
rubocop (1.
|
38
|
+
rubocop (1.57.2)
|
39
39
|
json (~> 2.3)
|
40
40
|
language_server-protocol (>= 3.17.0)
|
41
41
|
parallel (~> 1.10)
|
42
|
-
parser (>= 3.2.2.
|
42
|
+
parser (>= 3.2.2.4)
|
43
43
|
rainbow (>= 2.2.2, < 4.0)
|
44
44
|
regexp_parser (>= 1.8, < 3.0)
|
45
45
|
rexml (>= 3.2.5, < 4.0)
|
46
46
|
rubocop-ast (>= 1.28.1, < 2.0)
|
47
47
|
ruby-progressbar (~> 1.7)
|
48
48
|
unicode-display_width (>= 2.4.0, < 3.0)
|
49
|
-
rubocop-ast (1.
|
49
|
+
rubocop-ast (1.30.0)
|
50
50
|
parser (>= 3.2.1.0)
|
51
51
|
ruby-progressbar (1.13.0)
|
52
|
-
unicode-display_width (2.
|
52
|
+
unicode-display_width (2.5.0)
|
53
53
|
|
54
54
|
PLATFORMS
|
55
55
|
arm64-darwin-21
|
@@ -60,7 +60,7 @@ DEPENDENCIES
|
|
60
60
|
rake-compiler
|
61
61
|
rb_sys
|
62
62
|
rspec (~> 3.0)
|
63
|
-
rubocop (~> 1.
|
63
|
+
rubocop (~> 1.57)
|
64
64
|
vault_coh!
|
65
65
|
|
66
66
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# Vault
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/vault_coh.svg)](https://badge.fury.io/rb/vault_coh) [![Documentation](https://img.shields.io/badge/View-Documentation-blue.svg)](https://rubydoc.info/github/ryantaylor/vault-rb/
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/vault_coh.svg)](https://badge.fury.io/rb/vault_coh) [![Documentation](https://img.shields.io/badge/View-Documentation-blue.svg)](https://rubydoc.info/github/ryantaylor/vault-rb/v2.0.0)
|
4
4
|
|
5
5
|
A native Ruby client wrapper for the [vault](https://github.com/ryantaylor/vault) Company of Heroes replay parser, integrated via a Rust native extension.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
9
|
-
First, make sure you have a relatively recent version of the Rust toolchain installed (minimum supported Rust version for `vault` is 1.
|
9
|
+
First, make sure you have a relatively recent version of the Rust toolchain installed (minimum supported Rust version for `vault` is 1.65.0). You can install Rust easily using [rustup](https://rustup.rs/).
|
10
10
|
|
11
11
|
Then you can add to Gemfile:
|
12
12
|
```
|
@@ -24,7 +24,7 @@ bytes = File.read('/path/to/replay.rec').unpack('C*')
|
|
24
24
|
replay = VaultCoh::Replay.from_bytes(bytes)
|
25
25
|
puts replay.version
|
26
26
|
```
|
27
|
-
All information available from parsing can be found in the [documentation](https://rubydoc.info/github/ryantaylor/vault-rb/
|
27
|
+
All information available from parsing can be found in the [documentation](https://rubydoc.info/github/ryantaylor/vault-rb/v2.0.0).
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
data/ext/vault_coh/Cargo.toml
CHANGED
@@ -10,5 +10,6 @@ publish = false
|
|
10
10
|
crate-type = ["cdylib"]
|
11
11
|
|
12
12
|
[dependencies]
|
13
|
-
magnus = { version = "0.
|
14
|
-
|
13
|
+
magnus = { version = "0.6" }
|
14
|
+
serde_magnus = { version = "0.8" }
|
15
|
+
vault = { version = "5", features = ["magnus", "serde"] }
|
@@ -0,0 +1,49 @@
|
|
1
|
+
use magnus::Value;
|
2
|
+
use vault::commands::{BuildSquad, SelectBattlegroup, Unknown};
|
3
|
+
use vault::{Map, Message, Player, Replay};
|
4
|
+
|
5
|
+
pub trait HashExt {
|
6
|
+
fn to_h(&self) -> Value;
|
7
|
+
}
|
8
|
+
|
9
|
+
impl HashExt for Replay {
|
10
|
+
fn to_h(&self) -> Value {
|
11
|
+
serde_magnus::serialize(self).unwrap()
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
impl HashExt for Map {
|
16
|
+
fn to_h(&self) -> Value {
|
17
|
+
serde_magnus::serialize(self).unwrap()
|
18
|
+
}
|
19
|
+
}
|
20
|
+
|
21
|
+
impl HashExt for Player {
|
22
|
+
fn to_h(&self) -> Value {
|
23
|
+
serde_magnus::serialize(self).unwrap()
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
impl HashExt for Message {
|
28
|
+
fn to_h(&self) -> Value {
|
29
|
+
serde_magnus::serialize(self).unwrap()
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
impl HashExt for BuildSquad {
|
34
|
+
fn to_h(&self) -> Value {
|
35
|
+
serde_magnus::serialize(self).unwrap()
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
impl HashExt for SelectBattlegroup {
|
40
|
+
fn to_h(&self) -> Value {
|
41
|
+
serde_magnus::serialize(self).unwrap()
|
42
|
+
}
|
43
|
+
}
|
44
|
+
|
45
|
+
impl HashExt for Unknown {
|
46
|
+
fn to_h(&self) -> Value {
|
47
|
+
serde_magnus::serialize(self).unwrap()
|
48
|
+
}
|
49
|
+
}
|
data/ext/vault_coh/src/lib.rs
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
mod hash;
|
2
|
+
|
3
|
+
use crate::hash::HashExt;
|
1
4
|
use magnus::{class, define_module, exception, function, method, prelude::*, Error};
|
2
|
-
use vault::{
|
5
|
+
use vault::commands::{BuildSquad, SelectBattlegroup, Unknown};
|
6
|
+
use vault::{Command, Faction, Map, Message, Player, Replay, Team};
|
3
7
|
|
4
8
|
#[magnus::init]
|
5
9
|
fn init() -> Result<(), Error> {
|
@@ -22,6 +26,7 @@ fn init() -> Result<(), Error> {
|
|
22
26
|
)?;
|
23
27
|
replay.define_method("players", method!(Replay::players, 0))?;
|
24
28
|
replay.define_method("length", method!(Replay::length, 0))?;
|
29
|
+
replay.define_method("to_h", method!(Replay::to_h, 0))?;
|
25
30
|
|
26
31
|
let map = module.define_class("Map", class::object())?;
|
27
32
|
map.define_method("filename", method!(Map::filename, 0))?;
|
@@ -30,18 +35,24 @@ fn init() -> Result<(), Error> {
|
|
30
35
|
"localized_description_id",
|
31
36
|
method!(Map::localized_description_id, 0),
|
32
37
|
)?;
|
38
|
+
map.define_method("to_h", method!(Map::to_h, 0))?;
|
33
39
|
|
34
40
|
let player = module.define_class("Player", class::object())?;
|
35
41
|
player.define_method("name", method!(Player::name, 0))?;
|
36
42
|
player.define_method("faction", method!(Player::faction, 0))?;
|
37
43
|
player.define_method("team", method!(Player::team, 0))?;
|
44
|
+
player.define_method("battlegroup", method!(Player::battlegroup, 0))?;
|
38
45
|
player.define_method("steam_id", method!(Player::steam_id, 0))?;
|
39
46
|
player.define_method("profile_id", method!(Player::profile_id, 0))?;
|
40
47
|
player.define_method("messages", method!(Player::messages, 0))?;
|
48
|
+
player.define_method("commands", method!(Player::commands, 0))?;
|
49
|
+
player.define_method("build_commands", method!(Player::build_commands, 0))?;
|
50
|
+
player.define_method("to_h", method!(Player::to_h, 0))?;
|
41
51
|
|
42
52
|
let message = module.define_class("Message", class::object())?;
|
43
53
|
message.define_method("tick", method!(Message::tick, 0))?;
|
44
54
|
message.define_method("message", method!(Message::message, 0))?;
|
55
|
+
message.define_method("to_h", method!(Message::to_h, 0))?;
|
45
56
|
|
46
57
|
let faction = module.define_class("Faction", class::object())?;
|
47
58
|
faction.define_method("value", method!(Faction::to_string, 0))?;
|
@@ -49,6 +60,36 @@ fn init() -> Result<(), Error> {
|
|
49
60
|
let team = module.define_class("Team", class::object())?;
|
50
61
|
team.define_method("value", method!(Team::value, 0))?;
|
51
62
|
|
63
|
+
let command = module.define_class("Command", class::object())?;
|
64
|
+
|
65
|
+
let commands_module = module.define_module("Commands")?;
|
66
|
+
|
67
|
+
let build_squad_command = commands_module.define_class("BuildSquadCommand", command)?;
|
68
|
+
build_squad_command.define_method("value", method!(Command::extract_build_squad, 0))?;
|
69
|
+
|
70
|
+
let build_squad = commands_module.define_class("BuildSquad", class::object())?;
|
71
|
+
build_squad.define_method("tick", method!(BuildSquad::tick, 0))?;
|
72
|
+
build_squad.define_method("pbgid", method!(BuildSquad::pbgid, 0))?;
|
73
|
+
build_squad.define_method("to_h", method!(BuildSquad::to_h, 0))?;
|
74
|
+
|
75
|
+
let select_battlegroup_command =
|
76
|
+
commands_module.define_class("SelectBattlegroupCommand", command)?;
|
77
|
+
select_battlegroup_command
|
78
|
+
.define_method("value", method!(Command::extract_select_battlegroup, 0))?;
|
79
|
+
|
80
|
+
let select_battlegroup = commands_module.define_class("SelectBattlegroup", class::object())?;
|
81
|
+
select_battlegroup.define_method("tick", method!(SelectBattlegroup::tick, 0))?;
|
82
|
+
select_battlegroup.define_method("pbgid", method!(SelectBattlegroup::pbgid, 0))?;
|
83
|
+
select_battlegroup.define_method("to_h", method!(SelectBattlegroup::to_h, 0))?;
|
84
|
+
|
85
|
+
let unknown_command = commands_module.define_class("UnknownCommand", command)?;
|
86
|
+
unknown_command.define_method("value", method!(Command::extract_unknown, 0))?;
|
87
|
+
|
88
|
+
let unknown = commands_module.define_class("Unknown", class::object())?;
|
89
|
+
unknown.define_method("tick", method!(Unknown::tick, 0))?;
|
90
|
+
unknown.define_method("action_type", method!(Unknown::action_type, 0))?;
|
91
|
+
unknown.define_method("to_h", method!(Unknown::to_h, 0))?;
|
92
|
+
|
52
93
|
Ok(())
|
53
94
|
}
|
54
95
|
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VaultCoh
|
4
|
+
# Base class that all command wrappers extend.
|
5
|
+
class Command
|
6
|
+
# Data object that contains information specific to the
|
7
|
+
# type of command it represents.
|
8
|
+
#
|
9
|
+
# @return [Commands::BuildSquad|Commands::SelectBattlegroup|Commands::Unknown]
|
10
|
+
def value; end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VaultCoh
|
4
|
+
module Commands
|
5
|
+
# Data object representing information parsed from a
|
6
|
+
# unit construction command.
|
7
|
+
class BuildSquad
|
8
|
+
# This value is the tick at which the command was
|
9
|
+
# found while parsing the replay, which represents
|
10
|
+
# the time in the replay at which it was executed.
|
11
|
+
# Because CoH3's engine runs at 8 ticks per second,
|
12
|
+
# you can divide this value by 8 to get the number
|
13
|
+
# of seconds since the replay began, which will tell
|
14
|
+
# you when this command was executed.
|
15
|
+
#
|
16
|
+
# @return [Integer] unsigned, 32 bits
|
17
|
+
def tick; end
|
18
|
+
|
19
|
+
# Internal ID that uniquely identifies the unit being
|
20
|
+
# built. This value can be matched to CoH3 attribute
|
21
|
+
# files in order to determine the unit being built.
|
22
|
+
# Note that, while rare, it is possible that this value
|
23
|
+
# may change between patches for the same unit.
|
24
|
+
#
|
25
|
+
# @return [Integer] unsigned, 32 bits
|
26
|
+
def pbgid; end
|
27
|
+
|
28
|
+
# Returns a hash representation of the object.
|
29
|
+
#
|
30
|
+
# @return [Hash]
|
31
|
+
def to_h; end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VaultCoh
|
4
|
+
module Commands
|
5
|
+
# Data object representing information parsed from a
|
6
|
+
# battlegroup selection command.
|
7
|
+
class SelectBattlegroup
|
8
|
+
# This value is the tick at which the command was
|
9
|
+
# found while parsing the replay, which represents
|
10
|
+
# the time in the replay at which it was executed.
|
11
|
+
# Because CoH3's engine runs at 8 ticks per second,
|
12
|
+
# you can divide this value by 8 to get the number
|
13
|
+
# of seconds since the replay began, which will tell
|
14
|
+
# you when this command was executed.
|
15
|
+
#
|
16
|
+
# @return [Integer] unsigned, 32 bits
|
17
|
+
def tick; end
|
18
|
+
|
19
|
+
# Internal ID that uniquely identifies the battlegroup
|
20
|
+
# selected. This value can be matched to CoH3 attribute
|
21
|
+
# files in order to determine the battlegroup being
|
22
|
+
# selected. Note that, while rare, it is possible that
|
23
|
+
# this value may change between patches for the same
|
24
|
+
# battlegroup.
|
25
|
+
#
|
26
|
+
# @return [Integer] unsigned, 32 bits
|
27
|
+
def pbgid; end
|
28
|
+
|
29
|
+
# Returns a hash representation of the object.
|
30
|
+
#
|
31
|
+
# @return [Hash]
|
32
|
+
def to_h; end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VaultCoh
|
4
|
+
module Commands
|
5
|
+
# Data object representing an unknown (i.e. not yet
|
6
|
+
# handled) command.
|
7
|
+
class Unknown
|
8
|
+
# This value is the tick at which the command was
|
9
|
+
# found while parsing the replay, which represents
|
10
|
+
# the time in the replay at which it was executed.
|
11
|
+
# Because CoH3's engine runs at 8 ticks per second,
|
12
|
+
# you can divide this value by 8 to get the number
|
13
|
+
# of seconds since the replay began, which will tell
|
14
|
+
# you when this command was executed.
|
15
|
+
#
|
16
|
+
# @return [Integer] unsigned, 32 bits
|
17
|
+
def tick; end
|
18
|
+
|
19
|
+
# This value identifies the type of the command
|
20
|
+
# (build, move, stop, etc.). Commands with similar
|
21
|
+
# functionality can be grouped by this value.
|
22
|
+
#
|
23
|
+
# @return [Integer] unsigned, 8 bits
|
24
|
+
def action_type; end
|
25
|
+
|
26
|
+
# Returns a hash representation of the object.
|
27
|
+
#
|
28
|
+
# @return [Hash]
|
29
|
+
def to_h; end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/vault_coh/map.rb
CHANGED
data/lib/vault_coh/message.rb
CHANGED
data/lib/vault_coh/player.rb
CHANGED
@@ -24,6 +24,13 @@ module VaultCoh
|
|
24
24
|
# @return [Team]
|
25
25
|
def team; end
|
26
26
|
|
27
|
+
# The pbgid of the battlegroup the player selected, or +nil+ if no
|
28
|
+
# battlegroup was selected. For details on what this ID represents
|
29
|
+
# please see {Commands::SelectBattlegroup#pbgid}.
|
30
|
+
#
|
31
|
+
# @return [Integer|NilClass]
|
32
|
+
def battlegroup; end
|
33
|
+
|
27
34
|
# The Steam ID of the player. This ID can be used to uniquely
|
28
35
|
# identify a player between replays, and connect them to their
|
29
36
|
# Steam profile.
|
@@ -44,5 +51,23 @@ module VaultCoh
|
|
44
51
|
#
|
45
52
|
# @return [Array<Message>]
|
46
53
|
def messages; end
|
54
|
+
|
55
|
+
# A list of all commands executed by the player in the match.
|
56
|
+
# Sorted chronologically from first to last.
|
57
|
+
#
|
58
|
+
# @return [Array<Command>]
|
59
|
+
def commands; end
|
60
|
+
|
61
|
+
# A list of only build-related commands executed by the player in
|
62
|
+
# the match. A build command is any that enqueues the construction
|
63
|
+
# of a new unit. Sorted chronologically from first to last.
|
64
|
+
#
|
65
|
+
# @return [Array<Commands::BuildSquad>]
|
66
|
+
def build_commands; end
|
67
|
+
|
68
|
+
# Returns a hash representation of the object.
|
69
|
+
#
|
70
|
+
# @return [Hash]
|
71
|
+
def to_h; end
|
47
72
|
end
|
48
73
|
end
|
data/lib/vault_coh/replay.rb
CHANGED
data/lib/vault_coh/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault_coh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Company of Heroes replay parsing in Ruby using the vault parsing library
|
14
14
|
via a Rust native extension.
|
@@ -31,8 +31,17 @@ files:
|
|
31
31
|
- Rakefile
|
32
32
|
- ext/vault_coh/Cargo.toml
|
33
33
|
- ext/vault_coh/extconf.rb
|
34
|
+
- ext/vault_coh/src/hash.rs
|
34
35
|
- ext/vault_coh/src/lib.rs
|
35
36
|
- lib/vault_coh.rb
|
37
|
+
- lib/vault_coh/command.rb
|
38
|
+
- lib/vault_coh/commands.rb
|
39
|
+
- lib/vault_coh/commands/build_squad.rb
|
40
|
+
- lib/vault_coh/commands/build_squad_command.rb
|
41
|
+
- lib/vault_coh/commands/select_battlegroup.rb
|
42
|
+
- lib/vault_coh/commands/select_battlegroup_command.rb
|
43
|
+
- lib/vault_coh/commands/unknown.rb
|
44
|
+
- lib/vault_coh/commands/unknown_command.rb
|
36
45
|
- lib/vault_coh/faction.rb
|
37
46
|
- lib/vault_coh/map.rb
|
38
47
|
- lib/vault_coh/message.rb
|