vault_coh 0.1.1 → 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.
- checksums.yaml +4 -4
- data/Cargo.lock +2 -2
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/ext/vault_coh/Cargo.toml +1 -1
- data/ext/vault_coh/src/lib.rs +32 -1
- data/lib/vault_coh/command.rb +12 -0
- data/lib/vault_coh/commands/build_squad.rb +29 -0
- data/lib/vault_coh/commands/build_squad_command.rb +9 -0
- data/lib/vault_coh/commands/select_battlegroup.rb +30 -0
- data/lib/vault_coh/commands/select_battlegroup_command.rb +9 -0
- data/lib/vault_coh/commands/unknown.rb +27 -0
- data/lib/vault_coh/commands/unknown_command.rb +9 -0
- data/lib/vault_coh/commands.rb +7 -0
- data/lib/vault_coh/player.rb +20 -0
- data/lib/vault_coh/version.rb +1 -1
- metadata +9 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95461c3147428ac051ee0003a88304da0fe3bd82a3d62fb333b82efadfc54a69
|
4
|
+
data.tar.gz: ba0b1420bdadb6b0143f19d2b071060d600113fb5b8ecc44862e3bb9459b45f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c73ae3273b3a66ec94dec001ec9a971888a33f53c1e6a3389cf9bec5f9e716f19a049ac0a25ea9c6a0900edb3958b4c0d25b4f083a9e3db299d0ea381de8d12
|
7
|
+
data.tar.gz: 18ef4b4dd7ba45c938b092dda340e0406bc396676d7d022126b7298a2d70bb52e9f3f094bf73a86ffab69cee0f88fa5c4b02dc79d87a2fb93b5f02987e2ec2d0
|
data/Cargo.lock
CHANGED
@@ -292,9 +292,9 @@ checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
|
|
292
292
|
|
293
293
|
[[package]]
|
294
294
|
name = "vault"
|
295
|
-
version = "
|
295
|
+
version = "4.0.0"
|
296
296
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
297
|
-
checksum = "
|
297
|
+
checksum = "fbc584e1c893f783e5eb795b849c5a512992b3d0f39c0b2c124e8d17584f9b82"
|
298
298
|
dependencies = [
|
299
299
|
"byteorder",
|
300
300
|
"magnus",
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Vault
|
2
2
|
|
3
|
-
[](https://badge.fury.io/rb/vault_coh) [](https://rubydoc.info/github/ryantaylor/vault-rb/
|
3
|
+
[](https://badge.fury.io/rb/vault_coh) [](https://rubydoc.info/github/ryantaylor/vault-rb/v1.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/v1.0.0).
|
28
28
|
|
29
29
|
## Contributing
|
30
30
|
|
data/ext/vault_coh/Cargo.toml
CHANGED
data/ext/vault_coh/src/lib.rs
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
use magnus::{class, define_module, exception, function, method, prelude::*, Error};
|
2
|
-
use vault::{
|
2
|
+
use vault::commands::{BuildSquad, SelectBattlegroup, Unknown};
|
3
|
+
use vault::{Command, Faction, Map, Message, Player, Replay, Team};
|
3
4
|
|
4
5
|
#[magnus::init]
|
5
6
|
fn init() -> Result<(), Error> {
|
@@ -35,9 +36,12 @@ fn init() -> Result<(), Error> {
|
|
35
36
|
player.define_method("name", method!(Player::name, 0))?;
|
36
37
|
player.define_method("faction", method!(Player::faction, 0))?;
|
37
38
|
player.define_method("team", method!(Player::team, 0))?;
|
39
|
+
player.define_method("battlegroup", method!(Player::battlegroup, 0))?;
|
38
40
|
player.define_method("steam_id", method!(Player::steam_id, 0))?;
|
39
41
|
player.define_method("profile_id", method!(Player::profile_id, 0))?;
|
40
42
|
player.define_method("messages", method!(Player::messages, 0))?;
|
43
|
+
player.define_method("commands", method!(Player::commands, 0))?;
|
44
|
+
player.define_method("build_commands", method!(Player::build_commands, 0))?;
|
41
45
|
|
42
46
|
let message = module.define_class("Message", class::object())?;
|
43
47
|
message.define_method("tick", method!(Message::tick, 0))?;
|
@@ -49,6 +53,33 @@ fn init() -> Result<(), Error> {
|
|
49
53
|
let team = module.define_class("Team", class::object())?;
|
50
54
|
team.define_method("value", method!(Team::value, 0))?;
|
51
55
|
|
56
|
+
let command = module.define_class("Command", class::object())?;
|
57
|
+
|
58
|
+
let commands_module = module.define_module("Commands")?;
|
59
|
+
|
60
|
+
let build_squad_command = commands_module.define_class("BuildSquadCommand", command)?;
|
61
|
+
build_squad_command.define_method("value", method!(Command::extract_build_squad, 0))?;
|
62
|
+
|
63
|
+
let build_squad = commands_module.define_class("BuildSquad", class::object())?;
|
64
|
+
build_squad.define_method("tick", method!(BuildSquad::tick, 0))?;
|
65
|
+
build_squad.define_method("pbgid", method!(BuildSquad::pbgid, 0))?;
|
66
|
+
|
67
|
+
let select_battlegroup_command =
|
68
|
+
commands_module.define_class("SelectBattlegroupCommand", command)?;
|
69
|
+
select_battlegroup_command
|
70
|
+
.define_method("value", method!(Command::extract_select_battlegroup, 0))?;
|
71
|
+
|
72
|
+
let select_battlegroup = commands_module.define_class("SelectBattlegroup", class::object())?;
|
73
|
+
select_battlegroup.define_method("tick", method!(SelectBattlegroup::tick, 0))?;
|
74
|
+
select_battlegroup.define_method("pbgid", method!(SelectBattlegroup::pbgid, 0))?;
|
75
|
+
|
76
|
+
let unknown_command = commands_module.define_class("UnknownCommand", command)?;
|
77
|
+
unknown_command.define_method("value", method!(Command::extract_unknown, 0))?;
|
78
|
+
|
79
|
+
let unknown = commands_module.define_class("Unknown", class::object())?;
|
80
|
+
unknown.define_method("tick", method!(Unknown::tick, 0))?;
|
81
|
+
unknown.define_method("action_type", method!(Unknown::action_type, 0))?;
|
82
|
+
|
52
83
|
Ok(())
|
53
84
|
}
|
54
85
|
|
@@ -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,29 @@
|
|
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
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,30 @@
|
|
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
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
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
|
+
end
|
26
|
+
end
|
27
|
+
end
|
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,18 @@ 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
|
47
67
|
end
|
48
68
|
end
|
data/lib/vault_coh/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vault_coh
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ryantaylor
|
@@ -33,6 +33,14 @@ files:
|
|
33
33
|
- ext/vault_coh/extconf.rb
|
34
34
|
- ext/vault_coh/src/lib.rs
|
35
35
|
- lib/vault_coh.rb
|
36
|
+
- lib/vault_coh/command.rb
|
37
|
+
- lib/vault_coh/commands.rb
|
38
|
+
- lib/vault_coh/commands/build_squad.rb
|
39
|
+
- lib/vault_coh/commands/build_squad_command.rb
|
40
|
+
- lib/vault_coh/commands/select_battlegroup.rb
|
41
|
+
- lib/vault_coh/commands/select_battlegroup_command.rb
|
42
|
+
- lib/vault_coh/commands/unknown.rb
|
43
|
+
- lib/vault_coh/commands/unknown_command.rb
|
36
44
|
- lib/vault_coh/faction.rb
|
37
45
|
- lib/vault_coh/map.rb
|
38
46
|
- lib/vault_coh/message.rb
|