openra 1.7.0 → 1.8.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/CHANGELOG.md +11 -3
- data/lib/openra.rb +1 -0
- data/lib/openra/cli.rb +1 -0
- data/lib/openra/cli/commands/replay_data.rb +10 -1
- data/lib/openra/constants.rb +19 -0
- data/lib/openra/types.rb +1 -1
- data/lib/openra/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdebe6f1d4e30d7cefc66638f4f88f853f31acd04b371e367af70b7e23ccc83b
|
4
|
+
data.tar.gz: c61ed7c050d13664ef650d4727c904ecd1814ce789534b93bec693a3863dec94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b70e814b16cf0d65bad4b6482388753f0f4104c03757589df219e739ef713c156ac306a3fe97a7e06662e19ac808c49c3eee7ad086210f386595fabdbe909bd
|
7
|
+
data.tar.gz: 6e80c9a0b8c1c486b6159ca6b58323ca4114ce8cebaca13cc66b6d73a168cfe8a8ff3296f49fe782ddd8055799cbf1d1dc0237bd1a9066320fa6b7ae22837283
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
-
[Compare v1.
|
3
|
+
[Compare v1.8.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.8.0...HEAD)
|
4
|
+
|
5
|
+
## v1.8.0
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* [replay-data] Add support_powers with usage counts to output
|
10
|
+
|
11
|
+
[Compare v1.7.0...v1.8.0](https://github.com/AMHOL/openra-ruby/compare/v1.7.0...v1.8.0)
|
4
12
|
|
5
13
|
## v1.7.0
|
6
14
|
|
7
15
|
### Improvements
|
8
16
|
|
9
|
-
* Decreased memory usage by streaming orders with iterator ([AMHOL](https://github.com/AMHOL))
|
17
|
+
* [core] Decreased memory usage by streaming orders with iterator ([AMHOL](https://github.com/AMHOL))
|
10
18
|
|
11
19
|
[Compare v1.6.0...v1.7.0](https://github.com/AMHOL/openra-ruby/compare/v1.6.0...v1.7.0)
|
12
20
|
|
@@ -14,7 +22,7 @@
|
|
14
22
|
|
15
23
|
### Fixed
|
16
24
|
|
17
|
-
* Updated to work with release-20200202 (current release) ([AMHOL](https://github.com/AMHOL))
|
25
|
+
* [core] Updated to work with release-20200202 (current release) ([AMHOL](https://github.com/AMHOL))
|
18
26
|
|
19
27
|
[Compare v1.5.0...v1.6.0](https://github.com/AMHOL/openra-ruby/compare/v1.5.0...v1.6.0)
|
20
28
|
|
data/lib/openra.rb
CHANGED
data/lib/openra/cli.rb
CHANGED
@@ -11,6 +11,7 @@ module Openra
|
|
11
11
|
|
12
12
|
def call(replay:, **options)
|
13
13
|
replay = Openra::Replays::Replay.new(replay)
|
14
|
+
support_powers = SUPPORT_POWERS.fetch(replay.metadata.mod, {})
|
14
15
|
|
15
16
|
data = {
|
16
17
|
mod: replay.metadata.mod,
|
@@ -72,7 +73,8 @@ module Openra
|
|
72
73
|
is_admin: client.is_admin,
|
73
74
|
is_player: !player.nil?,
|
74
75
|
is_winner: player&.outcome == 'Won',
|
75
|
-
build: []
|
76
|
+
build: [],
|
77
|
+
support_powers: support_powers.values.product([0]).to_h
|
76
78
|
}
|
77
79
|
end
|
78
80
|
|
@@ -99,6 +101,13 @@ module Openra
|
|
99
101
|
current_sync_clients = Openra::Struct::SyncLobbyClients.new(
|
100
102
|
Openra::YAML.load(order.target)
|
101
103
|
).clients
|
104
|
+
when *support_powers.keys
|
105
|
+
key = support_powers.fetch(order.command.force_encoding('UTF-8'))
|
106
|
+
client_hash = data[:clients].find do |candidate|
|
107
|
+
candidate[:index] == order.client_index.to_s
|
108
|
+
end
|
109
|
+
|
110
|
+
client_hash[:support_powers][key] += 1
|
102
111
|
when 'PlaceBuilding'
|
103
112
|
client_hash = data[:clients].find do |candidate|
|
104
113
|
candidate[:index] == order.client_index.to_s
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Openra
|
4
|
+
SUPPORT_POWERS = {
|
5
|
+
'ra' => {
|
6
|
+
'SovietSpyPlane' => :spy_plane,
|
7
|
+
'SovietParatroopers' => :paratroopers,
|
8
|
+
'UkraineParabombs' => :parabombs,
|
9
|
+
'Chronoshift' => :chronoshift,
|
10
|
+
'NukePowerInfoOrder' => :nuke,
|
11
|
+
'GrantExternalConditionPowerInfoOrder' => :iron_curtain
|
12
|
+
},
|
13
|
+
'cnc' => {
|
14
|
+
'AirstrikePowerInfoOrder' => :airstrike,
|
15
|
+
'IonCannonPowerInfoOrder' => :ion_cannon,
|
16
|
+
'NukePowerInfoOrder' => :nuke
|
17
|
+
}
|
18
|
+
}.freeze
|
19
|
+
end
|
data/lib/openra/types.rb
CHANGED
data/lib/openra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Holland
|
@@ -179,6 +179,7 @@ files:
|
|
179
179
|
- lib/openra/cli/commands/formatters.rb
|
180
180
|
- lib/openra/cli/commands/replay_data.rb
|
181
181
|
- lib/openra/cli/commands/version.rb
|
182
|
+
- lib/openra/constants.rb
|
182
183
|
- lib/openra/replays.rb
|
183
184
|
- lib/openra/replays/file.rb
|
184
185
|
- lib/openra/replays/metadata.rb
|