vault_coh 3.0.0 → 5.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: 763f4d0ebdbd58cd93d40ea506dc1f3d5ec176b152639127fa63dce0f144b50b
4
- data.tar.gz: 58a846515ed9a32da75e3bc0c7f29c1585207ed1635d11dffe1c16a0af6c5bf7
3
+ metadata.gz: 7c619172a3ef03297101f59e93f97fabc3fe657c4fc4901626440997dd63f5de
4
+ data.tar.gz: 2ec4cf367060108ba2ef4f2602b3216fc7dd7bf2aa50c0060cfee0d915734692
5
5
  SHA512:
6
- metadata.gz: 905aa7c2464b935e14fd7196af6012c1afefb52adad173602e7b0b77ccb43f0e62fe964509d99e743e924649909dd4f8b744ad179b32eecf3d407e976ea5f02c
7
- data.tar.gz: ca9bae0ee2fb8c2e16b01e09c2edf0a0aa444b6c536f9cb5bf3b0499c35d64ecec8938509aed78af95795ab4d4d71442c0fdc8b971547fdb623cc3f7f3d270c5
6
+ metadata.gz: 12794b3709c6897ae31912f8c8c9e510f181354393c65f6d3e94ef38a1243e167c9ccd2b7c8deb5400f68c6138cfc05766a02dcf7440744af828675c08092305
7
+ data.tar.gz: 0406cfd5802162ce6f3cd90c2ad2fc2fd65ec1abef19d91d20413d2f12a527ae1438e5f9c73e86dd1da44ef5a429d688a84786c4fad77d59ae6627fa5a25470e
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
data/Cargo.lock CHANGED
@@ -322,9 +322,9 @@ checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
322
322
 
323
323
  [[package]]
324
324
  name = "shlex"
325
- version = "1.2.0"
325
+ version = "1.3.0"
326
326
  source = "registry+https://github.com/rust-lang/crates.io-index"
327
- checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
327
+ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
328
328
 
329
329
  [[package]]
330
330
  name = "syn"
@@ -360,11 +360,20 @@ version = "1.0.12"
360
360
  source = "registry+https://github.com/rust-lang/crates.io-index"
361
361
  checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
362
362
 
363
+ [[package]]
364
+ name = "uuid"
365
+ version = "1.7.0"
366
+ source = "registry+https://github.com/rust-lang/crates.io-index"
367
+ checksum = "f00cc9702ca12d3c81455259621e676d0f7251cec66a21e98fe2e9a37db93b2a"
368
+ dependencies = [
369
+ "serde",
370
+ ]
371
+
363
372
  [[package]]
364
373
  name = "vault"
365
- version = "6.0.0"
374
+ version = "8.0.0"
366
375
  source = "registry+https://github.com/rust-lang/crates.io-index"
367
- checksum = "56d2f7e8331af1c81e0e894ae95960807789cfe849dcc95e828382f9f41b2959"
376
+ checksum = "401c25d59ac1ca36a13d384627e8e86b425524f08f69d9eace9b4aa45ddcd88a"
368
377
  dependencies = [
369
378
  "byteorder",
370
379
  "magnus",
@@ -372,6 +381,7 @@ dependencies = [
372
381
  "nom-tracable",
373
382
  "nom_locate",
374
383
  "serde",
384
+ "uuid",
375
385
  ]
376
386
 
377
387
  [[package]]
data/Gemfile CHANGED
@@ -10,6 +10,6 @@ gem 'rake', '~> 13.0'
10
10
  gem 'rake-compiler'
11
11
  gem 'rb_sys'
12
12
 
13
- gem 'rspec', '~> 3.0'
13
+ gem 'rspec', '~> 3.13'
14
14
 
15
- gem 'rubocop', '~> 1.57'
15
+ gem 'rubocop', '~> 1.60'
data/Gemfile.lock CHANGED
@@ -1,49 +1,49 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- vault_coh (3.0.0)
4
+ vault_coh (5.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.2)
10
- diff-lcs (1.5.0)
11
- json (2.6.3)
10
+ diff-lcs (1.5.1)
11
+ json (2.7.1)
12
12
  language_server-protocol (3.17.0.3)
13
- parallel (1.23.0)
14
- parser (3.2.2.4)
13
+ parallel (1.24.0)
14
+ parser (3.3.0.5)
15
15
  ast (~> 2.4.1)
16
16
  racc
17
17
  racc (1.7.3)
18
18
  rainbow (3.1.1)
19
19
  rake (13.1.0)
20
- rake-compiler (1.2.5)
20
+ rake-compiler (1.2.7)
21
21
  rake
22
- rb_sys (0.9.83)
23
- regexp_parser (2.8.2)
22
+ rb_sys (0.9.87)
23
+ regexp_parser (2.9.0)
24
24
  rexml (3.2.6)
25
- rspec (3.12.0)
26
- rspec-core (~> 3.12.0)
27
- rspec-expectations (~> 3.12.0)
28
- rspec-mocks (~> 3.12.0)
29
- rspec-core (3.12.2)
30
- rspec-support (~> 3.12.0)
31
- rspec-expectations (3.12.3)
25
+ rspec (3.13.0)
26
+ rspec-core (~> 3.13.0)
27
+ rspec-expectations (~> 3.13.0)
28
+ rspec-mocks (~> 3.13.0)
29
+ rspec-core (3.13.0)
30
+ rspec-support (~> 3.13.0)
31
+ rspec-expectations (3.13.0)
32
32
  diff-lcs (>= 1.2.0, < 2.0)
33
- rspec-support (~> 3.12.0)
34
- rspec-mocks (3.12.6)
33
+ rspec-support (~> 3.13.0)
34
+ rspec-mocks (3.13.0)
35
35
  diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.12.0)
37
- rspec-support (3.12.1)
38
- rubocop (1.57.2)
36
+ rspec-support (~> 3.13.0)
37
+ rspec-support (3.13.0)
38
+ rubocop (1.60.2)
39
39
  json (~> 2.3)
40
40
  language_server-protocol (>= 3.17.0)
41
41
  parallel (~> 1.10)
42
- parser (>= 3.2.2.4)
42
+ parser (>= 3.3.0.2)
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
- rubocop-ast (>= 1.28.1, < 2.0)
46
+ rubocop-ast (>= 1.30.0, < 2.0)
47
47
  ruby-progressbar (~> 1.7)
48
48
  unicode-display_width (>= 2.4.0, < 3.0)
49
49
  rubocop-ast (1.30.0)
@@ -59,8 +59,8 @@ DEPENDENCIES
59
59
  rake (~> 13.0)
60
60
  rake-compiler
61
61
  rb_sys
62
- rspec (~> 3.0)
63
- rubocop (~> 1.57)
62
+ rspec (~> 3.13)
63
+ rubocop (~> 1.60)
64
64
  vault_coh!
65
65
 
66
66
  BUNDLED WITH
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/v3.0.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/v5.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/v3.0.0).
27
+ All information available from parsing can be found in the [documentation](https://rubydoc.info/github/ryantaylor/vault-rb/v5.0.0).
28
28
 
29
29
  ## Contributing
30
30
 
@@ -12,4 +12,4 @@ crate-type = ["cdylib"]
12
12
  [dependencies]
13
13
  magnus = { version = "0.6" }
14
14
  serde_magnus = { version = "0.8" }
15
- vault = { version = "6", features = ["magnus", "serde"] }
15
+ vault = { version = "8", features = ["magnus", "serde"] }
@@ -6,7 +6,7 @@ use vault::commands::{
6
6
  BuildGlobalUpgrade, BuildSquad, SelectBattlegroup, SelectBattlegroupAbility, Unknown,
7
7
  UseBattlegroupAbility,
8
8
  };
9
- use vault::{Command, Faction, Map, Message, Player, Replay, Team};
9
+ use vault::{Command, Map, Message, Player, Replay};
10
10
 
11
11
  #[magnus::init]
12
12
  fn init() -> Result<(), Error> {
@@ -16,7 +16,9 @@ fn init() -> Result<(), Error> {
16
16
  replay.define_singleton_method("from_bytes", function!(from_bytes, 1))?;
17
17
  replay.define_method("version", method!(Replay::version, 0))?;
18
18
  replay.define_method("timestamp", method!(Replay::timestamp, 0))?;
19
+ replay.define_method("game_type", method!(game_type_string, 0))?;
19
20
  replay.define_method("matchhistory_id", method!(Replay::matchhistory_id, 0))?;
21
+ replay.define_method("mod_uuid", method!(mod_uuid_string, 0))?;
20
22
  replay.define_method("map", method!(Replay::map, 0))?;
21
23
  replay.define_method("map_filename", method!(Replay::map_filename, 0))?;
22
24
  replay.define_method(
@@ -42,8 +44,9 @@ fn init() -> Result<(), Error> {
42
44
 
43
45
  let player = module.define_class("Player", class::object())?;
44
46
  player.define_method("name", method!(Player::name, 0))?;
45
- player.define_method("faction", method!(Player::faction, 0))?;
46
- player.define_method("team", method!(Player::team, 0))?;
47
+ player.define_method("human?", method!(Player::human, 0))?;
48
+ player.define_method("faction", method!(faction_string, 0))?;
49
+ player.define_method("team", method!(team_value, 0))?;
47
50
  player.define_method("battlegroup", method!(Player::battlegroup, 0))?;
48
51
  player.define_method("steam_id", method!(Player::steam_id, 0))?;
49
52
  player.define_method("profile_id", method!(Player::profile_id, 0))?;
@@ -61,12 +64,6 @@ fn init() -> Result<(), Error> {
61
64
  message.define_method("message", method!(Message::message, 0))?;
62
65
  message.define_method("to_h", method!(Message::to_h, 0))?;
63
66
 
64
- let faction = module.define_class("Faction", class::object())?;
65
- faction.define_method("value", method!(Faction::to_string, 0))?;
66
-
67
- let team = module.define_class("Team", class::object())?;
68
- team.define_method("value", method!(Team::value, 0))?;
69
-
70
67
  let command = module.define_class("Command", class::object())?;
71
68
  command.define_method("to_h", method!(Command::to_h, 0))?;
72
69
 
@@ -143,3 +140,19 @@ fn from_bytes(input: Vec<u8>) -> Result<Replay, Error> {
143
140
  Replay::from_bytes(&input)
144
141
  .map_err(|err| Error::new(exception::runtime_error(), err.to_string()))
145
142
  }
143
+
144
+ fn mod_uuid_string(rb_self: &Replay) -> String {
145
+ rb_self.mod_uuid().to_string()
146
+ }
147
+
148
+ fn game_type_string(rb_self: &Replay) -> String {
149
+ rb_self.game_type().to_string()
150
+ }
151
+
152
+ fn faction_string(rb_self: &Player) -> String {
153
+ rb_self.faction().to_string()
154
+ }
155
+
156
+ fn team_value(rb_self: &Player) -> usize {
157
+ rb_self.team().value()
158
+ }
@@ -6,7 +6,8 @@ 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::BuildGlobalUpgrade |
10
+ # Commands::BuildSquad |
10
11
  # Commands::SelectBattlegroup |
11
12
  # Commands::SelectBattlegroupAbility |
12
13
  # Commands::UseBattlegroupAbility |
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ module Commands
5
+ # Data object representing information parsed from an
6
+ # upgrade construction command.
7
+ class BuildGlobalUpgrade
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 upgrade being
20
+ # built. This value can be matched to CoH3 attribute
21
+ # files in order to determine the upgrade being built.
22
+ # Note that, while rare, it is possible that this value
23
+ # may change between patches for the same upgrade.
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,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ module Commands
5
+ # Wrapper for an upgrade construction command.
6
+ class BuildGlobalUpgradeCommand < Command
7
+ end
8
+ end
9
+ end
@@ -3,16 +3,9 @@
3
3
  module VaultCoh
4
4
  # Identifiers for the Company of Heroes 3 factions.
5
5
  class Faction
6
- AMERICANS = 'Americans'
7
- BRITISH = 'British'
8
- WEHRMACHT = 'Wehrmacht'
9
- AFRIKAKORPS = 'AfrikaKorps'
10
-
11
- # String identifier of the given faction.
12
- #
13
- # @see https://docs.rs/vault/3.0.0/vault/enum.Faction.html
14
- #
15
- # @return [AMERICANS|BRITISH|WEHRMACHT|AFRIKAKORPS]
16
- def value; end
6
+ AMERICANS = 'americans'
7
+ BRITISH = 'british_africa'
8
+ WEHRMACHT = 'germans'
9
+ AFRIKAKORPS = 'afrika_korps'
17
10
  end
18
11
  end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module VaultCoh
4
+ # Identifiers for the Company of Heroes 3 game types.
5
+ class GameType
6
+ SKIRMISH = 'skirmish'
7
+ MULTIPLAYER = 'multiplayer'
8
+ AUTOMATCH = 'automatch'
9
+ CUSTOM = 'custom'
10
+ end
11
+ end
@@ -13,15 +13,20 @@ module VaultCoh
13
13
  # @return [String]
14
14
  def name; end
15
15
 
16
+ # Whether or not the player was a human or an AI/CPU player.
17
+ #
18
+ # @return [Boolean]
19
+ def human?; end
20
+
16
21
  # The faction selected by the player in this match.
17
22
  #
18
- # @return [Faction]
23
+ # @return [Faction::AMERICANS|Faction::WEHRMACHT|Faction::BRITISH|Faction::AFRIKAKORPS]
19
24
  def faction; end
20
25
 
21
26
  # The team the player was assigned to. Currently only head-to-head
22
27
  # matchups are supported (max two teams).
23
28
  #
24
- # @return [Team]
29
+ # @return [Team::FIRST|Team::SECOND]
25
30
  def team; end
26
31
 
27
32
  # The pbgid of the battlegroup the player selected, or +nil+ if no
@@ -31,19 +36,19 @@ module VaultCoh
31
36
  # @return [Integer|NilClass]
32
37
  def battlegroup; end
33
38
 
34
- # The Steam ID of the player. This ID can be used to uniquely
35
- # identify a player between replays, and connect them to their
36
- # Steam profile.
39
+ # The Steam ID of the player, or +nil+ if the player is AI. This ID
40
+ # can be used to uniquely identify a player between replays, and
41
+ # connect them to their Steam profile.
37
42
  #
38
- # @return [Integer] unsigned, 64 bits
43
+ # @return [Integer|NilClass] unsigned, 64 bits
39
44
  def steam_id; end
40
45
 
41
- # The Relic profile ID of the player. This ID can be used to
42
- # uniquely identify a player between replays, and can be used to
43
- # query statistical information about the player from Relic’s
44
- # stats API.
46
+ # The Relic profile ID of the player, or +nil+ if the player is AI.
47
+ # This ID can be used to uniquely identify a player between replays,
48
+ # and can be used to query statistical information about the player
49
+ # from Relic’s stats API.
45
50
  #
46
- # @return [Integer] unsigned, 64 bits
51
+ # @return [Integer|NilClass] unsigned, 64 bits
47
52
  def profile_id; end
48
53
 
49
54
  # A list of all messages sent by the player in the match. Sorted
@@ -60,9 +65,9 @@ module VaultCoh
60
65
 
61
66
  # A list of only build-related commands executed by the player in
62
67
  # the match. A build command is any that enqueues the construction
63
- # of a new unit. Sorted chronologically from first to last.
68
+ # of a new unit or upgrade. Sorted chronologically from first to last.
64
69
  #
65
- # @return [Array<Commands::BuildSquad>]
70
+ # @return [Array<Command>]
66
71
  def build_commands; end
67
72
 
68
73
  # A list of only battlegroup-related commands executed by the player
@@ -40,14 +40,34 @@ module VaultCoh
40
40
  # @return [String]
41
41
  def timestamp; end
42
42
 
43
+ # The type of game this replay represents. Note that this information
44
+ # is parsed on a best-effort basis and therefore may not always be
45
+ # correct. Also note that it's currently not known if there's a way to
46
+ # differentiate between automatch and custom games for replays recorded
47
+ # before the replay system release in patch 1.4.0. Games played before
48
+ # that patch will be marked as either +skirmish+ (for local AI games) or
49
+ # +multiplayer+ (for networked custom or automatch games). Games recorded
50
+ # on or after patch 1.4.0 will properly differentiate between +custom+
51
+ # and +automatch+ games.
52
+ #
53
+ # @return [GameType::SKIRMISH|GameType::MULTIPLAYER|GameType::AUTOMATCH|GameType::CUSTOM]
54
+ def game_type; end
55
+
43
56
  # The ID used by Relic to track this match on their internal servers.
44
57
  # This ID can be matched with an ID of the same name returned by
45
58
  # Relic’s CoH3 stats API, enabling linkage between replay files and
46
- # statistical information for a match.
59
+ # statistical information for a match. When the game type is +skirmish+,
60
+ # there is no ID assigned by Relic, so this will be +nil+.
47
61
  #
48
- # @return [Integer] unsigned, 64 bits
62
+ # @return [Integer|NilClass] unsigned, 64 bits
49
63
  def matchhistory_id; end
50
64
 
65
+ # The UUID of the base game mod this replay ran on. If no mod was used,
66
+ # this will be a nil UUID (all zeroes).
67
+ #
68
+ # @return [String]
69
+ def mod_uuid; end
70
+
51
71
  # Map information for this match.
52
72
  #
53
73
  # @return [Map]
@@ -5,12 +5,5 @@ module VaultCoh
5
5
  class Team
6
6
  FIRST = 0
7
7
  SECOND = 1
8
-
9
- # Integer representation of the assigned team.
10
- #
11
- # @see https://docs.rs/vault/3.0.0/vault/enum.Team.html
12
- #
13
- # @return [FIRST|SECOND]
14
- def value; end
15
8
  end
16
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VaultCoh
4
- VERSION = '3.0.0'
4
+ VERSION = '5.0.0'
5
5
  end
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: 3.0.0
4
+ version: 5.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-23 00:00:00.000000000 Z
11
+ date: 2024-02-12 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.
@@ -21,6 +21,7 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - ".rspec"
23
23
  - ".rubocop.yml"
24
+ - ".ruby-version"
24
25
  - CHANGELOG.md
25
26
  - Cargo.lock
26
27
  - Cargo.toml
@@ -36,6 +37,8 @@ files:
36
37
  - lib/vault_coh.rb
37
38
  - lib/vault_coh/command.rb
38
39
  - lib/vault_coh/commands.rb
40
+ - lib/vault_coh/commands/build_global_upgrade.rb
41
+ - lib/vault_coh/commands/build_global_upgrade_command.rb
39
42
  - lib/vault_coh/commands/build_squad.rb
40
43
  - lib/vault_coh/commands/build_squad_command.rb
41
44
  - lib/vault_coh/commands/select_battlegroup.rb
@@ -47,6 +50,7 @@ files:
47
50
  - lib/vault_coh/commands/use_battlegroup_ability.rb
48
51
  - lib/vault_coh/commands/use_battlegroup_ability_command.rb
49
52
  - lib/vault_coh/faction.rb
53
+ - lib/vault_coh/game_type.rb
50
54
  - lib/vault_coh/map.rb
51
55
  - lib/vault_coh/message.rb
52
56
  - lib/vault_coh/player.rb