openra 2.0.0 → 2.1.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 -1
- data/lib/openra/cli/commands/replay_data.rb +9 -4
- data/lib/openra/cli/utils.rb +10 -0
- data/lib/openra/constants.rb +2 -0
- data/lib/openra/replays/order.rb +2 -2
- data/lib/openra/replays/replay.rb +1 -1
- data/lib/openra/struct/client.rb +1 -0
- data/lib/openra/struct/player.rb +4 -1
- data/lib/openra/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e488c6ceb71360aa93bfcb831c16754fbe2ba4faf55608a7572b8b302e1820bb
|
4
|
+
data.tar.gz: a78247905a1918531599f321bfa3b1c31d4b2520e3f955b55dc15e44c4db3fc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e69e8ceeeabbd611d12f54850ffbd89fee488637d895d783c13582d1747426cad2659248d9c38332576125d5c5d0854a6ff82d384f52bfa05ba81dcb9792e9d5
|
7
|
+
data.tar.gz: 4926b3ce501e4c138239bd3660b45baa3199484b8c33ec8bf7fe8ecb0922673c9f1d841e07195fe2db38202217a2e55fbb471faffc31ba4fee6ca1b3a57d001b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
## Unreleased
|
2
2
|
|
3
|
-
[Compare v2.
|
3
|
+
[Compare v2.1.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v2.1.0...HEAD)
|
4
|
+
|
5
|
+
## v2.1.0
|
6
|
+
|
7
|
+
### Added
|
8
|
+
|
9
|
+
* [replay-data] Add client fingerprint to output ([AMHOL](https://github.com/AMHOL))
|
10
|
+
* [replay-data] Restored placement outputs to x, y, layers hash
|
11
|
+
* [replay-data] Added support for bot replays
|
12
|
+
|
13
|
+
[Compare v2.0.0...v2.1.0](https://github.com/AMHOL/openra-ruby/compare/v2.0.0...v2.1.0)
|
4
14
|
|
5
15
|
## v2.0.0
|
6
16
|
|
@@ -55,10 +55,13 @@ module Openra
|
|
55
55
|
|
56
56
|
data[:clients] = sync_info.clients.map do |client|
|
57
57
|
player = replay.player(client.index)
|
58
|
+
player_index = replay.players.index(player) + FIRST_PLAYER_INDEX if player
|
58
59
|
|
59
60
|
{
|
60
61
|
index: client.index,
|
62
|
+
player_index: player_index,
|
61
63
|
name: utf8(client.name),
|
64
|
+
fingerprint: client.fingerprint,
|
62
65
|
preferred_color: client.preferred_color,
|
63
66
|
color: client.color,
|
64
67
|
spawn: {
|
@@ -112,18 +115,20 @@ module Openra
|
|
112
115
|
client_hash[:support_powers] << {
|
113
116
|
type: key,
|
114
117
|
game_time: time(order.frame * sync_info.global_settings.frametime_multiplier),
|
115
|
-
placement: order.
|
116
|
-
extra_placement: order.
|
118
|
+
placement: cell(order.target_cell.to_i),
|
119
|
+
extra_placement: cell(order.extra_cell.to_i),
|
117
120
|
}
|
118
121
|
when 'PlaceBuilding'
|
122
|
+
# subject_id stores the player index here
|
123
|
+
# as bot commands are issued by the host client
|
119
124
|
client_hash = data[:clients].find do |candidate|
|
120
|
-
candidate[:
|
125
|
+
candidate[:player_index] == order.subject_id
|
121
126
|
end
|
122
127
|
|
123
128
|
client_hash[:build] << {
|
124
129
|
structure: utf8(order.target),
|
125
130
|
game_time: time(order.frame * sync_info.global_settings.frametime_multiplier),
|
126
|
-
placement: order.
|
131
|
+
placement: cell(order.target_cell.to_i)
|
127
132
|
}
|
128
133
|
when 'Message'
|
129
134
|
data[:chat] << {
|
data/lib/openra/cli/utils.rb
CHANGED
@@ -7,6 +7,16 @@ module Openra
|
|
7
7
|
string.force_encoding('UTF-8')
|
8
8
|
end
|
9
9
|
|
10
|
+
def cell(pos)
|
11
|
+
return if pos.zero?
|
12
|
+
|
13
|
+
{
|
14
|
+
x: pos >> 20,
|
15
|
+
y: ((pos >> 4) & 0xFFF0) >> 4,
|
16
|
+
layer: pos & 0xFF
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
10
20
|
def time(msec)
|
11
21
|
sec = msec / 1000
|
12
22
|
mm, ss = sec.divmod(60)
|
data/lib/openra/constants.rb
CHANGED
data/lib/openra/replays/order.rb
CHANGED
@@ -32,13 +32,13 @@ module Openra
|
|
32
32
|
uint32 :actor_id, onlyif: TARGET_IS_ACTOR
|
33
33
|
uint32 :player_actor_id, onlyif: TARGET_IS_FROZEN_ACTOR
|
34
34
|
uint32 :frozen_actor_id, onlyif: TARGET_IS_FROZEN_ACTOR
|
35
|
-
int32 :
|
35
|
+
int32 :target_cell, onlyif: TARGET_IS_CELL
|
36
36
|
uint8 :target_sub_cell, onlyif: TARGET_IS_CELL
|
37
37
|
int32 :pos_x, onlyif: TARGET_NOT_CELL
|
38
38
|
int32 :pos_y, onlyif: TARGET_NOT_CELL
|
39
39
|
int32 :pos_z, onlyif: TARGET_NOT_CELL
|
40
40
|
pascal_string :standard_order_target, onlyif: HAS_TARGET_STRING
|
41
|
-
int32 :
|
41
|
+
int32 :extra_cell, onlyif: HAS_EXTRA_LOCATION
|
42
42
|
uint32 :extra_data, onlyif: HAS_EXTRA_DATA
|
43
43
|
|
44
44
|
def target
|
data/lib/openra/struct/client.rb
CHANGED
@@ -12,6 +12,7 @@ module Openra
|
|
12
12
|
attribute :faction_name, Types::Strict::String.meta(from: 'Faction')
|
13
13
|
attribute :spawn_point, Types::Strict::String.meta(from: 'SpawnPoint')
|
14
14
|
attribute :name, Types::Strict::String.meta(from: 'Name')
|
15
|
+
attribute :fingerprint, Types::Strict::String.meta(from: 'Fingerprint')
|
15
16
|
attribute :ip, Types::Strict::String.meta(from: 'IpAddress')
|
16
17
|
attribute :state, Types::Strict::String.meta(from: 'State')
|
17
18
|
attribute :team, Types::Strict::String.meta(from: 'Team')
|
data/lib/openra/struct/player.rb
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
module Openra
|
4
4
|
class Struct < Dry::Struct
|
5
5
|
class Player < Openra::Struct
|
6
|
+
transform_types(&:omittable)
|
7
|
+
|
6
8
|
define do
|
7
|
-
attribute :
|
9
|
+
attribute :client_index, Types::Strict::String.meta(from: 'ClientIndex')
|
8
10
|
attribute :name, Types::Strict::String.meta(from: 'Name')
|
11
|
+
attribute :fingerprint, Types::Strict::String.meta(from: 'Fingerprint')
|
9
12
|
attribute :is_human, Types::Params::Bool.meta(from: 'IsHuman')
|
10
13
|
attribute :is_bot, Types::Params::Bool.meta(from: 'IsBot')
|
11
14
|
attribute :faction_name, Types::Strict::String.meta(from: 'FactionName')
|
data/lib/openra/version.rb
CHANGED