vault_coh 2.1.0 → 3.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 +9 -9
- data/Gemfile.lock +3 -3
- data/README.md +2 -2
- data/ext/vault_coh/Cargo.toml +1 -1
- data/ext/vault_coh/src/hash.rs +22 -1
- data/ext/vault_coh/src/lib.rs +46 -1
- data/lib/vault_coh/command.rb +5 -1
- data/lib/vault_coh/commands/select_battlegroup_ability.rb +35 -0
- data/lib/vault_coh/commands/select_battlegroup_ability_command.rb +9 -0
- data/lib/vault_coh/commands/use_battlegroup_ability.rb +35 -0
- data/lib/vault_coh/commands/use_battlegroup_ability_command.rb +9 -0
- data/lib/vault_coh/player.rb +10 -0
- data/lib/vault_coh/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763f4d0ebdbd58cd93d40ea506dc1f3d5ec176b152639127fa63dce0f144b50b
|
4
|
+
data.tar.gz: 58a846515ed9a32da75e3bc0c7f29c1585207ed1635d11dffe1c16a0af6c5bf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 905aa7c2464b935e14fd7196af6012c1afefb52adad173602e7b0b77ccb43f0e62fe964509d99e743e924649909dd4f8b744ad179b32eecf3d407e976ea5f02c
|
7
|
+
data.tar.gz: ca9bae0ee2fb8c2e16b01e09c2edf0a0aa444b6c536f9cb5bf3b0499c35d64ecec8938509aed78af95795ab4d4d71442c0fdc8b971547fdb623cc3f7f3d270c5
|
data/Cargo.lock
CHANGED
@@ -28,7 +28,7 @@ dependencies = [
|
|
28
28
|
"regex",
|
29
29
|
"rustc-hash",
|
30
30
|
"shlex",
|
31
|
-
"syn 2.0.
|
31
|
+
"syn 2.0.39",
|
32
32
|
]
|
33
33
|
|
34
34
|
[[package]]
|
@@ -95,9 +95,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
95
95
|
|
96
96
|
[[package]]
|
97
97
|
name = "libc"
|
98
|
-
version = "0.2.
|
98
|
+
version = "0.2.150"
|
99
99
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
100
|
-
checksum = "
|
100
|
+
checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c"
|
101
101
|
|
102
102
|
[[package]]
|
103
103
|
name = "libloading"
|
@@ -129,7 +129,7 @@ checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
|
|
129
129
|
dependencies = [
|
130
130
|
"proc-macro2",
|
131
131
|
"quote",
|
132
|
-
"syn 2.0.
|
132
|
+
"syn 2.0.39",
|
133
133
|
]
|
134
134
|
|
135
135
|
[[package]]
|
@@ -231,7 +231,7 @@ dependencies = [
|
|
231
231
|
"quote",
|
232
232
|
"regex",
|
233
233
|
"shell-words",
|
234
|
-
"syn 2.0.
|
234
|
+
"syn 2.0.39",
|
235
235
|
]
|
236
236
|
|
237
237
|
[[package]]
|
@@ -339,9 +339,9 @@ dependencies = [
|
|
339
339
|
|
340
340
|
[[package]]
|
341
341
|
name = "syn"
|
342
|
-
version = "2.0.
|
342
|
+
version = "2.0.39"
|
343
343
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
344
|
-
checksum = "
|
344
|
+
checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a"
|
345
345
|
dependencies = [
|
346
346
|
"proc-macro2",
|
347
347
|
"quote",
|
@@ -362,9 +362,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
|
362
362
|
|
363
363
|
[[package]]
|
364
364
|
name = "vault"
|
365
|
-
version = "
|
365
|
+
version = "6.0.0"
|
366
366
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
367
|
-
checksum = "
|
367
|
+
checksum = "56d2f7e8331af1c81e0e894ae95960807789cfe849dcc95e828382f9f41b2959"
|
368
368
|
dependencies = [
|
369
369
|
"byteorder",
|
370
370
|
"magnus",
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
vault_coh (
|
4
|
+
vault_coh (3.0.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -14,12 +14,12 @@ GEM
|
|
14
14
|
parser (3.2.2.4)
|
15
15
|
ast (~> 2.4.1)
|
16
16
|
racc
|
17
|
-
racc (1.7.
|
17
|
+
racc (1.7.3)
|
18
18
|
rainbow (3.1.1)
|
19
19
|
rake (13.1.0)
|
20
20
|
rake-compiler (1.2.5)
|
21
21
|
rake
|
22
|
-
rb_sys (0.9.
|
22
|
+
rb_sys (0.9.83)
|
23
23
|
regexp_parser (2.8.2)
|
24
24
|
rexml (3.2.6)
|
25
25
|
rspec (3.12.0)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
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/v3.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
|
|
@@ -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/v3.0.0).
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
data/ext/vault_coh/Cargo.toml
CHANGED
data/ext/vault_coh/src/hash.rs
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
use magnus::Value;
|
2
|
-
use vault::commands::{
|
2
|
+
use vault::commands::{
|
3
|
+
BuildGlobalUpgrade, BuildSquad, SelectBattlegroup, SelectBattlegroupAbility, Unknown,
|
4
|
+
UseBattlegroupAbility,
|
5
|
+
};
|
3
6
|
use vault::{Command, Map, Message, Player, Replay};
|
4
7
|
|
5
8
|
pub trait HashExt {
|
@@ -36,6 +39,12 @@ impl HashExt for Command {
|
|
36
39
|
}
|
37
40
|
}
|
38
41
|
|
42
|
+
impl HashExt for BuildGlobalUpgrade {
|
43
|
+
fn to_h(&self) -> Value {
|
44
|
+
serde_magnus::serialize(self).unwrap()
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
39
48
|
impl HashExt for BuildSquad {
|
40
49
|
fn to_h(&self) -> Value {
|
41
50
|
serde_magnus::serialize(self).unwrap()
|
@@ -48,6 +57,18 @@ impl HashExt for SelectBattlegroup {
|
|
48
57
|
}
|
49
58
|
}
|
50
59
|
|
60
|
+
impl HashExt for SelectBattlegroupAbility {
|
61
|
+
fn to_h(&self) -> Value {
|
62
|
+
serde_magnus::serialize(self).unwrap()
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
impl HashExt for UseBattlegroupAbility {
|
67
|
+
fn to_h(&self) -> Value {
|
68
|
+
serde_magnus::serialize(self).unwrap()
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
51
72
|
impl HashExt for Unknown {
|
52
73
|
fn to_h(&self) -> Value {
|
53
74
|
serde_magnus::serialize(self).unwrap()
|
data/ext/vault_coh/src/lib.rs
CHANGED
@@ -2,7 +2,10 @@ mod hash;
|
|
2
2
|
|
3
3
|
use crate::hash::HashExt;
|
4
4
|
use magnus::{class, define_module, exception, function, method, prelude::*, Error};
|
5
|
-
use vault::commands::{
|
5
|
+
use vault::commands::{
|
6
|
+
BuildGlobalUpgrade, BuildSquad, SelectBattlegroup, SelectBattlegroupAbility, Unknown,
|
7
|
+
UseBattlegroupAbility,
|
8
|
+
};
|
6
9
|
use vault::{Command, Faction, Map, Message, Player, Replay, Team};
|
7
10
|
|
8
11
|
#[magnus::init]
|
@@ -47,6 +50,10 @@ fn init() -> Result<(), Error> {
|
|
47
50
|
player.define_method("messages", method!(Player::messages, 0))?;
|
48
51
|
player.define_method("commands", method!(Player::commands, 0))?;
|
49
52
|
player.define_method("build_commands", method!(Player::build_commands, 0))?;
|
53
|
+
player.define_method(
|
54
|
+
"battlegroup_commands",
|
55
|
+
method!(Player::battlegroup_commands, 0),
|
56
|
+
)?;
|
50
57
|
player.define_method("to_h", method!(Player::to_h, 0))?;
|
51
58
|
|
52
59
|
let message = module.define_class("Message", class::object())?;
|
@@ -65,6 +72,17 @@ fn init() -> Result<(), Error> {
|
|
65
72
|
|
66
73
|
let commands_module = module.define_module("Commands")?;
|
67
74
|
|
75
|
+
let build_global_upgrade_command =
|
76
|
+
commands_module.define_class("BuildGlobalUpgradeCommand", command)?;
|
77
|
+
build_global_upgrade_command
|
78
|
+
.define_method("value", method!(Command::extract_build_global_upgrade, 0))?;
|
79
|
+
|
80
|
+
let build_global_upgrade =
|
81
|
+
commands_module.define_class("BuildGlobalUpgrade", class::object())?;
|
82
|
+
build_global_upgrade.define_method("tick", method!(BuildGlobalUpgrade::tick, 0))?;
|
83
|
+
build_global_upgrade.define_method("pbgid", method!(BuildGlobalUpgrade::pbgid, 0))?;
|
84
|
+
build_global_upgrade.define_method("to_h", method!(BuildGlobalUpgrade::to_h, 0))?;
|
85
|
+
|
68
86
|
let build_squad_command = commands_module.define_class("BuildSquadCommand", command)?;
|
69
87
|
build_squad_command.define_method("value", method!(Command::extract_build_squad, 0))?;
|
70
88
|
|
@@ -83,6 +101,33 @@ fn init() -> Result<(), Error> {
|
|
83
101
|
select_battlegroup.define_method("pbgid", method!(SelectBattlegroup::pbgid, 0))?;
|
84
102
|
select_battlegroup.define_method("to_h", method!(SelectBattlegroup::to_h, 0))?;
|
85
103
|
|
104
|
+
let select_battlegroup_ability_command =
|
105
|
+
commands_module.define_class("SelectBattlegroupAbilityCommand", command)?;
|
106
|
+
select_battlegroup_ability_command.define_method(
|
107
|
+
"value",
|
108
|
+
method!(Command::extract_select_battlegroup_ability, 0),
|
109
|
+
)?;
|
110
|
+
|
111
|
+
let select_battlegroup_ability =
|
112
|
+
commands_module.define_class("SelectBattlegroupAbility", class::object())?;
|
113
|
+
select_battlegroup_ability.define_method("tick", method!(SelectBattlegroupAbility::tick, 0))?;
|
114
|
+
select_battlegroup_ability
|
115
|
+
.define_method("pbgid", method!(SelectBattlegroupAbility::pbgid, 0))?;
|
116
|
+
select_battlegroup_ability.define_method("to_h", method!(SelectBattlegroupAbility::to_h, 0))?;
|
117
|
+
|
118
|
+
let use_battlegroup_ability_command =
|
119
|
+
commands_module.define_class("UseBattlegroupAbilityCommand", command)?;
|
120
|
+
use_battlegroup_ability_command.define_method(
|
121
|
+
"value",
|
122
|
+
method!(Command::extract_use_battlegroup_ability, 0),
|
123
|
+
)?;
|
124
|
+
|
125
|
+
let use_battlegroup_ability =
|
126
|
+
commands_module.define_class("UseBattlegroupAbility", class::object())?;
|
127
|
+
use_battlegroup_ability.define_method("tick", method!(UseBattlegroupAbility::tick, 0))?;
|
128
|
+
use_battlegroup_ability.define_method("pbgid", method!(UseBattlegroupAbility::pbgid, 0))?;
|
129
|
+
use_battlegroup_ability.define_method("to_h", method!(UseBattlegroupAbility::to_h, 0))?;
|
130
|
+
|
86
131
|
let unknown_command = commands_module.define_class("UnknownCommand", command)?;
|
87
132
|
unknown_command.define_method("value", method!(Command::extract_unknown, 0))?;
|
88
133
|
|
data/lib/vault_coh/command.rb
CHANGED
@@ -6,7 +6,11 @@ module VaultCoh
|
|
6
6
|
# Data object that contains information specific to the
|
7
7
|
# type of command it represents.
|
8
8
|
#
|
9
|
-
# @return [Commands::BuildSquad|
|
9
|
+
# @return [Commands::BuildSquad |
|
10
|
+
# Commands::SelectBattlegroup |
|
11
|
+
# Commands::SelectBattlegroupAbility |
|
12
|
+
# Commands::UseBattlegroupAbility |
|
13
|
+
# Commands::Unknown]
|
10
14
|
def value; end
|
11
15
|
|
12
16
|
# Returns a hash representation of the object.
|
@@ -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 ability selection command.
|
7
|
+
class SelectBattlegroupAbility
|
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
|
+
# ability selected. This value can be matched to CoH3
|
21
|
+
# attribute files in order to determine the battlegroup
|
22
|
+
# ability being selected. Note that, while rare, it is
|
23
|
+
# possible that this value may change between patches
|
24
|
+
# for the same 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,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module VaultCoh
|
4
|
+
module Commands
|
5
|
+
# Data object representing information parsed from a
|
6
|
+
# battlegroup ability usage command.
|
7
|
+
class UseBattlegroupAbility
|
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
|
+
# ability used. This value can be matched to CoH3
|
21
|
+
# attribute files in order to determine the battlegroup
|
22
|
+
# ability being used. Note that, while rare, it is
|
23
|
+
# possible that this value may change between patches
|
24
|
+
# for the same 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
|
data/lib/vault_coh/player.rb
CHANGED
@@ -65,6 +65,16 @@ module VaultCoh
|
|
65
65
|
# @return [Array<Commands::BuildSquad>]
|
66
66
|
def build_commands; end
|
67
67
|
|
68
|
+
# A list of only battlegroup-related commands executed by the player
|
69
|
+
# in the match. A battlegroup command is any that involves the select
|
70
|
+
# or use of battlegroups and their abilities. Sorted chronologically
|
71
|
+
# from first to last.
|
72
|
+
#
|
73
|
+
# @return [Array<Commands::SelectBattlegroupCommand |
|
74
|
+
# Commands::SelectBattlegroupAbilityCommand |
|
75
|
+
# Commands::UseBattlegroupAbilityCommand>]
|
76
|
+
def battlegroup_commands; end
|
77
|
+
|
68
78
|
# Returns a hash representation of the object.
|
69
79
|
#
|
70
80
|
# @return [Hash]
|
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:
|
4
|
+
version: 3.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-
|
11
|
+
date: 2023-11-23 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.
|
@@ -39,9 +39,13 @@ files:
|
|
39
39
|
- lib/vault_coh/commands/build_squad.rb
|
40
40
|
- lib/vault_coh/commands/build_squad_command.rb
|
41
41
|
- lib/vault_coh/commands/select_battlegroup.rb
|
42
|
+
- lib/vault_coh/commands/select_battlegroup_ability.rb
|
43
|
+
- lib/vault_coh/commands/select_battlegroup_ability_command.rb
|
42
44
|
- lib/vault_coh/commands/select_battlegroup_command.rb
|
43
45
|
- lib/vault_coh/commands/unknown.rb
|
44
46
|
- lib/vault_coh/commands/unknown_command.rb
|
47
|
+
- lib/vault_coh/commands/use_battlegroup_ability.rb
|
48
|
+
- lib/vault_coh/commands/use_battlegroup_ability_command.rb
|
45
49
|
- lib/vault_coh/faction.rb
|
46
50
|
- lib/vault_coh/map.rb
|
47
51
|
- lib/vault_coh/message.rb
|