openra 1.8.1 → 1.8.2
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/cli.rb +1 -0
- data/lib/openra/cli/commands/detect_production_macros.rb +2 -2
- data/lib/openra/cli/commands/replay_data.rb +12 -23
- data/lib/openra/cli/utils.rb +22 -0
- data/lib/openra/replays/order.rb +1 -3
- data/lib/openra/struct/client.rb +1 -1
- data/lib/openra/struct/global_settings.rb +1 -1
- data/lib/openra/struct/metadata.rb +1 -1
- data/lib/openra/struct/player.rb +1 -1
- data/lib/openra/types.rb +0 -4
- data/lib/openra/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3636042a779c88135640420729bddffea4af5f7be68ce85f215a01c09b42c24
|
4
|
+
data.tar.gz: 5762e992a1d242bc8b02ae1f07bc4a6628f28f9cb77d30001aa5b39fd645c0c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47d3f9b58ce7c8132ef1c25f053a30cd016dfa4c7adc13fba47647996b491050ebf73a3b7836378f9c42d93fb797a08acb09b626f3f85507f018b8e50e2d857d
|
7
|
+
data.tar.gz: c9b9bf3d3782942c5348eb4ef347de4f65d5ecb9183217b4015692eec02905183e17ee416f6496e103c99fed61a59a8ff44143e57ef2f715aa51ae21cdbb0465
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
-
[Compare v1.8.
|
3
|
+
[Compare v1.8.2...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.8.2...HEAD)
|
4
|
+
|
5
|
+
## v1.8.2
|
6
|
+
|
7
|
+
### Fixes
|
8
|
+
|
9
|
+
* [core] Fix encoding issues again ([AMHOL](https://github.com/AMHOL))
|
10
|
+
|
11
|
+
[Compare v1.8.1...v1.8.2](https://github.com/AMHOL/openra-ruby/compare/v1.8.1...v1.8.2)
|
4
12
|
|
5
13
|
## v1.8.1
|
6
14
|
|
7
15
|
### Updates
|
8
16
|
|
9
|
-
* [replay-data] Update support powers to include game time and target positions
|
17
|
+
* [replay-data] Update support powers to include game time and target positions ([AMHOL](https://github.com/AMHOL))
|
10
18
|
|
11
19
|
[Compare v1.8.0...v1.8.1](https://github.com/AMHOL/openra-ruby/compare/v1.8.0...v1.8.1)
|
12
20
|
|
@@ -14,7 +22,7 @@
|
|
14
22
|
|
15
23
|
### Added
|
16
24
|
|
17
|
-
* [replay-data] Add support_powers with usage counts to output
|
25
|
+
* [replay-data] Add support_powers with usage counts to output ([AMHOL](https://github.com/AMHOL))
|
18
26
|
|
19
27
|
[Compare v1.7.0...v1.8.0](https://github.com/AMHOL/openra-ruby/compare/v1.7.0...v1.8.0)
|
20
28
|
|
data/lib/openra/cli.rb
CHANGED
@@ -7,6 +7,7 @@ require 'dry/cli'
|
|
7
7
|
require 'openra/version'
|
8
8
|
require 'openra/constants'
|
9
9
|
require 'openra/replays'
|
10
|
+
require 'openra/cli/utils'
|
10
11
|
require 'openra/cli/commands/formatters'
|
11
12
|
require 'openra/cli/commands/detect_production_macros'
|
12
13
|
require 'openra/cli/commands/replay_data'
|
@@ -26,7 +26,7 @@ module Openra
|
|
26
26
|
) unless game_started
|
27
27
|
when 'StartProduction'
|
28
28
|
commands[order.client_index.to_s] << {
|
29
|
-
target: order.target,
|
29
|
+
target: utf8(order.target),
|
30
30
|
msec: order.frame * sync_info.global_settings.frametime_multiplier
|
31
31
|
}
|
32
32
|
end
|
@@ -40,7 +40,7 @@ module Openra
|
|
40
40
|
|
41
41
|
{
|
42
42
|
index: player.index,
|
43
|
-
name: player.name,
|
43
|
+
name: utf8(player.name),
|
44
44
|
team: player.team,
|
45
45
|
outcome: player.outcome,
|
46
46
|
production_stats: production_stats,
|
@@ -4,6 +4,8 @@ module Openra
|
|
4
4
|
class CLI
|
5
5
|
module Commands
|
6
6
|
class ReplayData < Dry::CLI::Command
|
7
|
+
include CLI::Utils
|
8
|
+
|
7
9
|
desc 'Output replay data to stdout'
|
8
10
|
|
9
11
|
argument :replay, required: true, desc: 'Path of the replay file to read data from'
|
@@ -18,7 +20,7 @@ module Openra
|
|
18
20
|
version: replay.metadata.version,
|
19
21
|
server_name: nil,
|
20
22
|
map: {
|
21
|
-
name: replay.metadata.map_name,
|
23
|
+
name: utf8(replay.metadata.map_name),
|
22
24
|
hash: replay.metadata.map_hash
|
23
25
|
},
|
24
26
|
game: {
|
@@ -56,7 +58,7 @@ module Openra
|
|
56
58
|
|
57
59
|
{
|
58
60
|
index: client.index,
|
59
|
-
name: client.name,
|
61
|
+
name: utf8(client.name),
|
60
62
|
preferred_color: client.preferred_color,
|
61
63
|
color: client.color,
|
62
64
|
spawn: {
|
@@ -102,7 +104,7 @@ module Openra
|
|
102
104
|
Openra::YAML.load(order.target)
|
103
105
|
).clients
|
104
106
|
when *support_powers.keys
|
105
|
-
key = support_powers.fetch(order.command
|
107
|
+
key = support_powers.fetch(utf8(order.command))
|
106
108
|
client_hash = data[:clients].find do |candidate|
|
107
109
|
candidate[:index] == order.client_index.to_s
|
108
110
|
end
|
@@ -119,7 +121,7 @@ module Openra
|
|
119
121
|
end
|
120
122
|
|
121
123
|
client_hash[:build] << {
|
122
|
-
structure: order.target,
|
124
|
+
structure: utf8(order.target),
|
123
125
|
game_time: time(order.frame * sync_info.global_settings.frametime_multiplier),
|
124
126
|
placement: order.target_pos.to_i
|
125
127
|
}
|
@@ -127,40 +129,27 @@ module Openra
|
|
127
129
|
data[:chat] << {
|
128
130
|
channel: 'server',
|
129
131
|
name: nil,
|
130
|
-
message: order.target
|
132
|
+
message: utf8(order.target)
|
131
133
|
}
|
132
134
|
when 'Chat'
|
133
135
|
data[:chat] << {
|
134
136
|
channel: 'global',
|
135
|
-
name: client.name,
|
136
|
-
message: order.target
|
137
|
+
name: utf8(client.name),
|
138
|
+
message: utf8(order.target)
|
137
139
|
}
|
138
140
|
when 'TeamChat'
|
139
141
|
data[:chat] << {
|
140
142
|
channel: client.team,
|
141
|
-
name: client.name,
|
142
|
-
message: order.target
|
143
|
+
name: utf8(client.name),
|
144
|
+
message: utf8(order.target)
|
143
145
|
}
|
144
146
|
end
|
145
147
|
end
|
146
148
|
|
147
|
-
data[:server_name] = sync_info.global_settings.server_name
|
149
|
+
data[:server_name] = utf8(sync_info.global_settings.server_name)
|
148
150
|
|
149
151
|
puts FORMATTERS.fetch(options[:format]).call(data)
|
150
152
|
end
|
151
|
-
|
152
|
-
private
|
153
|
-
|
154
|
-
def time(msec)
|
155
|
-
sec = msec / 1000
|
156
|
-
mm, ss = sec.divmod(60)
|
157
|
-
hh, mm = mm.divmod(60)
|
158
|
-
|
159
|
-
{
|
160
|
-
formatted: '%02d:%02d:%02d' % [hh, mm, ss],
|
161
|
-
msec: msec.to_i
|
162
|
-
}
|
163
|
-
end
|
164
153
|
end
|
165
154
|
end
|
166
155
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Openra
|
4
|
+
class CLI
|
5
|
+
module Utils
|
6
|
+
def utf8(string)
|
7
|
+
string.force_encoding('UTF-8').to_s
|
8
|
+
end
|
9
|
+
|
10
|
+
def time(msec)
|
11
|
+
sec = msec / 1000
|
12
|
+
mm, ss = sec.divmod(60)
|
13
|
+
hh, mm = mm.divmod(60)
|
14
|
+
|
15
|
+
{
|
16
|
+
formatted: '%02d:%02d:%02d' % [hh, mm, ss],
|
17
|
+
msec: msec.to_i
|
18
|
+
}
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/openra/replays/order.rb
CHANGED
@@ -42,9 +42,7 @@ module Openra
|
|
42
42
|
uint32 :extra_data, onlyif: HAS_EXTRA_DATA
|
43
43
|
|
44
44
|
def target
|
45
|
-
|
46
|
-
|
47
|
-
Types::UTF8String.(target)
|
45
|
+
standard? ? standard_order_target : immediate_order_target
|
48
46
|
end
|
49
47
|
|
50
48
|
def type
|
data/lib/openra/struct/client.rb
CHANGED
@@ -11,7 +11,7 @@ module Openra
|
|
11
11
|
attribute :color, Types::Strict::String.meta(from: 'Color')
|
12
12
|
attribute :faction_name, Types::Strict::String.meta(from: 'Faction')
|
13
13
|
attribute :spawn_point, Types::Strict::String.meta(from: 'SpawnPoint')
|
14
|
-
attribute :name, Types::
|
14
|
+
attribute :name, Types::Strict::String.meta(from: 'Name')
|
15
15
|
attribute :ip, Types::Strict::String.meta(from: 'IpAddress')
|
16
16
|
attribute :state, Types::Strict::String.meta(from: 'State')
|
17
17
|
attribute :team, Types::Strict::String.meta(from: 'Team')
|
@@ -6,7 +6,7 @@ module Openra
|
|
6
6
|
transform_types(&:omittable)
|
7
7
|
|
8
8
|
define do
|
9
|
-
attribute :server_name, Types::
|
9
|
+
attribute :server_name, Types::Strict::String.meta(from: 'ServerName')
|
10
10
|
attribute :map_hash, Types::Strict::String.meta(from: 'Map')
|
11
11
|
attribute :timestep, Types::Params::Integer.meta(from: 'Timestep')
|
12
12
|
attribute :order_latency, Types::Params::Integer.meta(
|
@@ -9,7 +9,7 @@ module Openra
|
|
9
9
|
attribute :mod, Types::Strict::String.meta(from: 'Mod')
|
10
10
|
attribute :version, Types::Strict::String.meta(from: 'Version')
|
11
11
|
attribute :map_hash, Types::Strict::String.meta(from: 'MapUid')
|
12
|
-
attribute :map_name, Types::
|
12
|
+
attribute :map_name, Types::Strict::String.meta(from: 'MapTitle')
|
13
13
|
attribute :start_time, Types::Timestamp.meta(from: 'StartTimeUtc')
|
14
14
|
attribute :end_time, Types::Timestamp.meta(from: 'EndTimeUtc')
|
15
15
|
attribute :players, Types::Strict::Array.of(Player).meta(sequence: 'Player')
|
data/lib/openra/struct/player.rb
CHANGED
@@ -5,7 +5,7 @@ module Openra
|
|
5
5
|
class Player < Openra::Struct
|
6
6
|
define do
|
7
7
|
attribute :index, Types::Strict::String.meta(from: 'ClientIndex')
|
8
|
-
attribute :name, Types::
|
8
|
+
attribute :name, Types::Strict::String.meta(from: 'Name')
|
9
9
|
attribute :is_human, Types::Params::Bool.meta(from: 'IsHuman')
|
10
10
|
attribute :is_bot, Types::Params::Bool.meta(from: 'IsBot')
|
11
11
|
attribute :faction_name, Types::Strict::String.meta(from: 'FactionName')
|
data/lib/openra/types.rb
CHANGED
data/lib/openra/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Holland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -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/cli/utils.rb
|
182
183
|
- lib/openra/constants.rb
|
183
184
|
- lib/openra/replays.rb
|
184
185
|
- lib/openra/replays/file.rb
|