vault_coh 0.1.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e398c4277d3f495c8d75bd7a878fbba0a92c4f509caab4b782afeae21707ac30
4
- data.tar.gz: 0d8a47ac15efb8513b5e71f52c3ba34b782ff75fba9cbccecc6f72095ab2a618
3
+ metadata.gz: 95461c3147428ac051ee0003a88304da0fe3bd82a3d62fb333b82efadfc54a69
4
+ data.tar.gz: ba0b1420bdadb6b0143f19d2b071060d600113fb5b8ecc44862e3bb9459b45f1
5
5
  SHA512:
6
- metadata.gz: d7a5a45c518ba83d4ba6e911f6c251eee18f8606baab1b30b893657a50f859e2abda98c641cc8d6c7d29d500cb4cd1f5766aeea5bf184d48c2a0a37215984c58
7
- data.tar.gz: 726566f51cd8a59df7f44952899862c68482bbbe7f8ae3516ecf161d1791e092a29f169b30db0e82609fbe3f09330722482475831e2e60e507262db7e161ac57
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 = "3.0.0"
295
+ version = "4.0.0"
296
296
  source = "registry+https://github.com/rust-lang/crates.io-index"
297
- checksum = "f10e953cb5ef5a80d7bc904867faf0ba8ed5e5253093fb159818dc55a8f4ff46"
297
+ checksum = "fbc584e1c893f783e5eb795b849c5a512992b3d0f39c0b2c124e8d17584f9b82"
298
298
  dependencies = [
299
299
  "byteorder",
300
300
  "magnus",
data/Gemfile CHANGED
@@ -12,4 +12,4 @@ gem 'rb_sys'
12
12
 
13
13
  gem 'rspec', '~> 3.0'
14
14
 
15
- gem 'rubocop', '~> 1.21'
15
+ gem 'rubocop', '~> 1.55'
data/Gemfile.lock CHANGED
@@ -9,53 +9,58 @@ GEM
9
9
  ast (2.4.2)
10
10
  diff-lcs (1.5.0)
11
11
  json (2.6.3)
12
- parallel (1.22.1)
13
- parser (3.2.1.0)
12
+ language_server-protocol (3.17.0.3)
13
+ parallel (1.23.0)
14
+ parser (3.2.2.3)
14
15
  ast (~> 2.4.1)
16
+ racc
17
+ racc (1.7.1)
15
18
  rainbow (3.1.1)
16
19
  rake (13.0.6)
17
- rake-compiler (1.2.1)
20
+ rake-compiler (1.2.5)
18
21
  rake
19
- rb_sys (0.9.65)
20
- regexp_parser (2.7.0)
21
- rexml (3.2.5)
22
+ rb_sys (0.9.81)
23
+ regexp_parser (2.8.1)
24
+ rexml (3.2.6)
22
25
  rspec (3.12.0)
23
26
  rspec-core (~> 3.12.0)
24
27
  rspec-expectations (~> 3.12.0)
25
28
  rspec-mocks (~> 3.12.0)
26
- rspec-core (3.12.1)
29
+ rspec-core (3.12.2)
27
30
  rspec-support (~> 3.12.0)
28
- rspec-expectations (3.12.2)
31
+ rspec-expectations (3.12.3)
29
32
  diff-lcs (>= 1.2.0, < 2.0)
30
33
  rspec-support (~> 3.12.0)
31
- rspec-mocks (3.12.3)
34
+ rspec-mocks (3.12.6)
32
35
  diff-lcs (>= 1.2.0, < 2.0)
33
36
  rspec-support (~> 3.12.0)
34
- rspec-support (3.12.0)
35
- rubocop (1.46.0)
37
+ rspec-support (3.12.1)
38
+ rubocop (1.55.1)
36
39
  json (~> 2.3)
40
+ language_server-protocol (>= 3.17.0)
37
41
  parallel (~> 1.10)
38
- parser (>= 3.2.0.0)
42
+ parser (>= 3.2.2.3)
39
43
  rainbow (>= 2.2.2, < 4.0)
40
44
  regexp_parser (>= 1.8, < 3.0)
41
45
  rexml (>= 3.2.5, < 4.0)
42
- rubocop-ast (>= 1.26.0, < 2.0)
46
+ rubocop-ast (>= 1.28.1, < 2.0)
43
47
  ruby-progressbar (~> 1.7)
44
48
  unicode-display_width (>= 2.4.0, < 3.0)
45
- rubocop-ast (1.27.0)
49
+ rubocop-ast (1.29.0)
46
50
  parser (>= 3.2.1.0)
47
- ruby-progressbar (1.11.0)
51
+ ruby-progressbar (1.13.0)
48
52
  unicode-display_width (2.4.2)
49
53
 
50
54
  PLATFORMS
51
55
  arm64-darwin-21
56
+ x86_64-linux
52
57
 
53
58
  DEPENDENCIES
54
59
  rake (~> 13.0)
55
60
  rake-compiler
56
61
  rb_sys
57
62
  rspec (~> 3.0)
58
- rubocop (~> 1.21)
63
+ rubocop (~> 1.55)
59
64
  vault_coh!
60
65
 
61
66
  BUNDLED WITH
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Vault
2
2
 
3
- [![Documentation](https://img.shields.io/badge/View-Documentation-blue.svg)](https://rubydoc.info/github/ryantaylor/vault-rb/v0.1.0)
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/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/v0.1.0).
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
 
@@ -11,4 +11,4 @@ crate-type = ["cdylib"]
11
11
 
12
12
  [dependencies]
13
13
  magnus = { version = "0.5" }
14
- vault = { version = "3", features = ["magnus"] }
14
+ vault = { version = "4", features = ["magnus"] }
@@ -1,5 +1,6 @@
1
1
  use magnus::{class, define_module, exception, function, method, prelude::*, Error};
2
- use vault::{Faction, Map, Message, Player, Replay, Team};
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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ module Commands
5
+ # Wrapper for a unit construction command.
6
+ class BuildSquadCommand < Command
7
+ end
8
+ end
9
+ 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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ module Commands
5
+ # Wrapper for a battlegroup selection command.
6
+ class SelectBattlegroupCommand < Command
7
+ end
8
+ end
9
+ 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
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ module Commands
5
+ # Wrapper for an unknown (i.e. not yet handled) command.
6
+ class UnknownCommand < Command
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ # Various classes responsible for handling command data.
5
+ module Commands
6
+ end
7
+ end
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VaultCoh
4
- VERSION = '0.1.0'
4
+ VERSION = '1.0.0'
5
5
  end
data/vault_coh.gemspec CHANGED
@@ -9,7 +9,8 @@ Gem::Specification.new do |spec|
9
9
  spec.email = ['2320507+ryantaylor@users.noreply.github.com']
10
10
 
11
11
  spec.summary = 'CoH3 replay parsing in Ruby with Rust'
12
- spec.description = 'Company of Heroes replay parsing in Ruby using the vault parsing library via a Rust native extension.'
12
+ spec.description =
13
+ 'Company of Heroes replay parsing in Ruby using the vault parsing library via a Rust native extension.'
13
14
  spec.homepage = 'https://github.com/ryantaylor/vault-rb'
14
15
  spec.license = 'MIT'
15
16
  spec.required_ruby_version = '>= 3.1.0'
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.1.0
4
+ version: 1.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-05-09 00:00:00.000000000 Z
11
+ date: 2023-08-13 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.
@@ -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