openra 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: e029e23b233d065443fef36c02df47517ab18155
4
- data.tar.gz: c73247c0487c8316dee554b8d9b17feec9920102
3
+ metadata.gz: 0eaccca1c06eba0b65dde2f17a0981cf1e516d75
4
+ data.tar.gz: 34e76e8c18ff3aba1573818d0372128ab84a87f4
5
5
  SHA512:
6
- metadata.gz: fc2a499388e8e4c19dc8affb7783cdb3dfc85de7591e6b760ccecd8921b3cf42b0ece3b2206da6e901659ba1dcffc795f7dfc22d50fa192b6145c81bd6652572
7
- data.tar.gz: ddbd900f7f584d34fa8b5076013f6ec98479d63808a6ed3d2b6b1a88b22f74ed3e1c55127683a53906cc6e5bbd6e32ae34d2e30d10dbc9f5dff3dec68117d2fd
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.next == num_sync_info_orders
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
- crated_enabled: data['Options']['crates']['Value'] == 'True',
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',
@@ -2,7 +2,7 @@ module Openra
2
2
  module Replays
3
3
  class OrderList < BinData::Record
4
4
  endian :little
5
- int32 :frame
5
+ uint32 :frame
6
6
  array :orders, type: :order, read_until: :eof
7
7
  end
8
8
  end
@@ -1,3 +1,3 @@
1
1
  module Openra
2
- VERSION = '0.0.4'.freeze
2
+ VERSION = '0.0.5'.freeze
3
3
  end
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: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland