openra 0.0.4 → 0.0.5
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/lib/openra/cli/commands/replay_data.rb +17 -6
- data/lib/openra/replays/order_list.rb +1 -1
- data/lib/openra/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0eaccca1c06eba0b65dde2f17a0981cf1e516d75
|
4
|
+
data.tar.gz: 34e76e8c18ff3aba1573818d0372128ab84a87f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02d718a012a934b2fc8bbd1ce39ac1977a4f3596c484c20947357af400f22caa6760ebc9f8722d03b5952c7f9d9832f04bba67393c5e613977ee73ffdc9ea3a3
|
7
|
+
data.tar.gz: 15e6a0cda86840e392d49603b7c26f1dc43b9f84bdc0d4ceb4a60079513f552c11eb7323037e38bdc13586802d9d87a0899fead8f925d3a8131bd73324a52cb1
|
@@ -4,6 +4,15 @@ module Openra
|
|
4
4
|
class CLI
|
5
5
|
module Commands
|
6
6
|
class ReplayData < Hanami::CLI::Command
|
7
|
+
ORDER_LATENCY_MAPPING = {
|
8
|
+
'slowest' => 2,
|
9
|
+
'slower' => 3,
|
10
|
+
'default' => 3,
|
11
|
+
'fast' => 4,
|
12
|
+
'faster' => 4,
|
13
|
+
'fastest' => 6
|
14
|
+
}.freeze
|
15
|
+
|
7
16
|
desc 'Output replay data to stdout'
|
8
17
|
|
9
18
|
argument :replay, required: true, desc: 'Path of the replay file to read data from'
|
@@ -50,9 +59,8 @@ module Openra
|
|
50
59
|
sync_info_orders = replay.orders.select do |order|
|
51
60
|
order.command == 'SyncInfo'
|
52
61
|
end
|
53
|
-
num_sync_info_orders = sync_info_orders.length
|
54
62
|
|
55
|
-
sync_info_orders.each.with_index do |sync_info_order, index|
|
63
|
+
sync_info_orders.reverse.each.with_index do |sync_info_order, index|
|
56
64
|
sync_info = Openra::YAML.load(sync_info_order.target)
|
57
65
|
|
58
66
|
# Get all clients
|
@@ -71,11 +79,14 @@ module Openra
|
|
71
79
|
is_admin: data['IsAdmin'] == 'True',
|
72
80
|
is_player: player_indices.include?(data['Index']),
|
73
81
|
build: []
|
74
|
-
}
|
82
|
+
} unless replay_data[:clients].any? { |client| client[:index] == data['Index'] }
|
75
83
|
when 'GlobalSettings'
|
76
|
-
next unless index.
|
84
|
+
next unless index.zero?
|
77
85
|
|
78
|
-
timestep = Integer(data['Timestep'])
|
86
|
+
timestep = Integer(data['Timestep']) * ORDER_LATENCY_MAPPING.fetch(
|
87
|
+
data['Options']['gamespeed']['Value'],
|
88
|
+
ORDER_LATENCY_MAPPING['default']
|
89
|
+
)
|
79
90
|
|
80
91
|
replay_data[:server_name] = data['ServerName']
|
81
92
|
replay_data[:game][:options] = {
|
@@ -87,7 +98,7 @@ module Openra
|
|
87
98
|
cheats_enabled: data['Options']['cheats']['Value'] == 'True',
|
88
99
|
kill_bounty_enabled: data['Options']['bounty']['Value'] == 'True',
|
89
100
|
allow_undeploy: data['Options']['factundeploy']['Value'] == 'True',
|
90
|
-
|
101
|
+
crates_enabled: data['Options']['crates']['Value'] == 'True',
|
91
102
|
build_off_allies: data['Options']['allybuild']['Value'] == 'True',
|
92
103
|
restrict_build_radius: data['Options']['buildradius']['Value'] == 'True',
|
93
104
|
short_game: data['Options']['shortgame']['Value'] == 'True',
|
data/lib/openra/version.rb
CHANGED