sc2ai 0.0.8 → 0.2.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/data/sc2ai/protocol/common.proto +1 -1
- data/data/sc2ai/protocol/data.proto +4 -1
- data/data/sc2ai/protocol/debug.proto +5 -1
- data/data/sc2ai/protocol/error.proto +2 -1
- data/data/sc2ai/protocol/query.proto +1 -1
- data/data/sc2ai/protocol/raw.proto +9 -7
- data/data/sc2ai/protocol/sc2api.proto +21 -7
- data/data/sc2ai/protocol/score.proto +2 -1
- data/data/sc2ai/protocol/spatial.proto +2 -1
- data/data/sc2ai/protocol/ui.proto +5 -2
- data/lib/docker_build/Dockerfile.ruby +5 -3
- data/lib/sc2ai/api/ability_id.rb +6 -1
- data/lib/sc2ai/api/data.rb +15 -0
- data/lib/sc2ai/api/tech_tree.rb +1 -1
- data/lib/sc2ai/api/tech_tree_data.rb +54 -3
- data/lib/sc2ai/cli/cli.rb +1 -1
- data/lib/sc2ai/connection.rb +1 -1
- data/lib/sc2ai/local_play/client_manager.rb +2 -0
- data/lib/sc2ai/local_play/match.rb +0 -11
- data/lib/sc2ai/overrides/async/process/child.rb +1 -1
- data/lib/sc2ai/paths.rb +1 -1
- data/lib/sc2ai/player/debug.rb +36 -2
- data/lib/sc2ai/player/{geometry.rb → geo.rb} +41 -5
- data/lib/sc2ai/player/units.rb +32 -2
- data/lib/sc2ai/player.rb +8 -48
- data/lib/sc2ai/ports.rb +0 -1
- data/lib/sc2ai/protocol/_meta_documentation.rb +249 -4
- data/lib/sc2ai/protocol/common_pb.rb +2 -23
- data/lib/sc2ai/protocol/data_pb.rb +2 -23
- data/lib/sc2ai/protocol/debug_pb.rb +2 -24
- data/lib/sc2ai/protocol/error_pb.rb +2 -23
- data/lib/sc2ai/protocol/extensions/color.rb +1 -1
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +4 -0
- data/lib/sc2ai/protocol/extensions/position.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit.rb +45 -4
- data/lib/sc2ai/protocol/extensions/unit_type_data.rb +8 -0
- data/lib/sc2ai/protocol/query_pb.rb +2 -24
- data/lib/sc2ai/protocol/raw_pb.rb +2 -24
- data/lib/sc2ai/protocol/sc2api_pb.rb +2 -31
- data/lib/sc2ai/protocol/score_pb.rb +2 -23
- data/lib/sc2ai/protocol/spatial_pb.rb +2 -24
- data/lib/sc2ai/protocol/ui_pb.rb +2 -23
- data/lib/sc2ai/unit_group/action_ext.rb +2 -2
- data/lib/sc2ai/unit_group/filter_ext.rb +36 -1
- data/lib/sc2ai/version.rb +1 -1
- data/lib/sc2ai.rb +0 -7
- data/lib/templates/new/.ladderignore +15 -5
- data/lib/templates/new/api/raw.proto +1 -1
- data/lib/templates/new/api/ui.proto +1 -1
- data/lib/templates/new/my_bot.rb.tt +1 -1
- data/sig/minaswan.rbs +10323 -0
- data/sig/sc2ai.rbs +1170 -980
- metadata +52 -25
- data/lib/sc2ai/data.rb +0 -101
- data/lib/sc2ai/protocol/extensions/unit_type.rb +0 -9
data/lib/sc2ai/player/debug.rb
CHANGED
@@ -121,8 +121,8 @@ module Sc2
|
|
121
121
|
draw: Api::DebugDraw.new(
|
122
122
|
boxes: [
|
123
123
|
Api::DebugBox.new(
|
124
|
-
min: Api::Point.new(x: point.x - radius, y: point.y - radius, z: point.z + 0.
|
125
|
-
max: Api::Point.new(x: point.x + radius, y: point.y + radius, z: point.z + (radius * 2) + 0.
|
124
|
+
min: Api::Point.new(x: point.x - radius, y: point.y - radius, z: point.z + 0.03),
|
125
|
+
max: Api::Point.new(x: point.x + radius, y: point.y + radius, z: point.z + (radius * 2) + 0.03),
|
126
126
|
color:
|
127
127
|
)
|
128
128
|
]
|
@@ -149,6 +149,40 @@ module Sc2
|
|
149
149
|
)
|
150
150
|
end
|
151
151
|
|
152
|
+
# Renders a block on the floor, drawn by 4 lines
|
153
|
+
# Pass in either a pos (Position/Unit) or exact x * y coordinates
|
154
|
+
# Optional indentation adds padding on borders inward
|
155
|
+
# @param pos [Api::Unit, Api::Position]
|
156
|
+
# @param x [Float, Integer]
|
157
|
+
# @param y [Float, Integer]
|
158
|
+
# @param color [Api::Color]
|
159
|
+
# @param indent [Float] default 0.05. should be lower than < 1.0
|
160
|
+
# @example
|
161
|
+
# debug_tile(x: 12.3, y: 4.56, color: Api::Color.new(r: 255, g: 0, b: 0))
|
162
|
+
# debug_tile(some_unit)
|
163
|
+
# debug_tile(some_unit.pos)
|
164
|
+
def debug_tile(pos = nil, x: nil, y: nil, color: nil, indent: 0.05)
|
165
|
+
if pos.is_a?(Api::Unit)
|
166
|
+
x = pos.pos.x.floor
|
167
|
+
y = pos.pos.y.floor
|
168
|
+
elsif pos.is_a?(Sc2::Position)
|
169
|
+
x = pos.pos.x.floor
|
170
|
+
y = pos.pos.y.floor
|
171
|
+
end
|
172
|
+
|
173
|
+
# Raise above floor to prevent texture clipping
|
174
|
+
z = geo.terrain_height(x:, y:).to_f + 0.1
|
175
|
+
tl = Api::Point[x + indent, y + 1.0 - indent, z]
|
176
|
+
bl = Api::Point[x + indent, y + indent, z]
|
177
|
+
br = Api::Point[x + 1.0 - indent, y + indent, z]
|
178
|
+
tr = Api::Point[x + 1.0 - indent, y + 1.0 - indent, z]
|
179
|
+
|
180
|
+
debug_draw_line(p0: tl, p1: bl, color:)
|
181
|
+
debug_draw_line(p0: bl, p1: br, color:)
|
182
|
+
debug_draw_line(p0: br, p1: tr, color:)
|
183
|
+
debug_draw_line(p0: tr, p1: tl, color:)
|
184
|
+
end
|
185
|
+
|
152
186
|
# Other Commands ---
|
153
187
|
|
154
188
|
# @param command [Integer] one of Api::DebugGameState::*
|
@@ -6,7 +6,7 @@ require "rumale/pairwise_metric"
|
|
6
6
|
module Sc2
|
7
7
|
class Player
|
8
8
|
# Holds map and geography helper functions
|
9
|
-
class
|
9
|
+
class Geo
|
10
10
|
# @!attribute bot
|
11
11
|
# @return [Sc2::Player] player with active connection
|
12
12
|
attr_accessor :bot
|
@@ -98,7 +98,7 @@ module Sc2
|
|
98
98
|
expo_placement_grid[y.to_i, x.to_i] == 1
|
99
99
|
end
|
100
100
|
|
101
|
-
# Returns a grid where
|
101
|
+
# Returns a grid where only the expo locations are marked
|
102
102
|
# @return [Numo::Bit]
|
103
103
|
def expo_placement_grid
|
104
104
|
if @expo_placement_grid.nil?
|
@@ -111,16 +111,52 @@ module Sc2
|
|
111
111
|
if bot.race == Api::Race::Zerg
|
112
112
|
# Reserve one row lower, meaning (y-3) instead of (y-2)
|
113
113
|
@expo_placement_grid[(y - 3).clamp(map_tile_range_y)..(y + 2).clamp(map_tile_range_y),
|
114
|
-
(x - 2).clamp(
|
114
|
+
(x - 2).clamp(map_tile_range_x)..(x + 2).clamp(map_tile_range_x)] = 1
|
115
115
|
else
|
116
116
|
@expo_placement_grid[(y - 2).clamp(map_tile_range_y)..(y + 2).clamp(map_tile_range_y),
|
117
|
-
(x - 2).clamp(
|
117
|
+
(x - 2).clamp(map_tile_range_x)..(x + 2).clamp(map_tile_range_x)] = 1
|
118
118
|
end
|
119
119
|
end
|
120
120
|
end
|
121
121
|
@expo_placement_grid
|
122
122
|
end
|
123
123
|
|
124
|
+
# Returns a grid where only placement obstructions are marked
|
125
|
+
# includes Tumors and lowered Supply Depots
|
126
|
+
# @return [Numo::Bit]
|
127
|
+
private def placement_obstruction_grid
|
128
|
+
# Get obstructing structures
|
129
|
+
obstructure_types = [Api::UnitTypeId::SUPPLYDEPOTLOWERED, Api::UnitTypeId::CREEPTUMORQUEEN, Api::UnitTypeId::CREEPTUMOR, Api::UnitTypeId::CREEPTUMORBURROWED]
|
130
|
+
obstructures = bot.structures.select_type(obstructure_types) + bot.enemy.structures.select_type(obstructure_types)
|
131
|
+
cache_key = obstructures.tags.sort.hash
|
132
|
+
|
133
|
+
# Return cache if obstructing structures haven't changed
|
134
|
+
if !@placement_obstruction_grid.nil? && @placement_obstruction_grid[1] == cache_key
|
135
|
+
return @placement_obstruction_grid[0]
|
136
|
+
end
|
137
|
+
map = Numo::Bit.zeros(map_height, map_width)
|
138
|
+
|
139
|
+
# Cache empty, if no obstructing structures
|
140
|
+
if obstructures.size.zero?
|
141
|
+
@placement_obstruction_grid = [map, cache_key]
|
142
|
+
return map
|
143
|
+
end
|
144
|
+
|
145
|
+
# For each obstructing structure, mark it's tiles with 1's
|
146
|
+
obstructures.each do |structure|
|
147
|
+
x = structure.pos.x.floor
|
148
|
+
y = structure.pos.y.floor
|
149
|
+
|
150
|
+
if structure.unit_type == Api::UnitTypeId::SUPPLYDEPOTLOWERED
|
151
|
+
map[(y - 1)..(y), (x - 1)..(x)] = 1
|
152
|
+
else
|
153
|
+
map[y, x] = 1
|
154
|
+
end
|
155
|
+
end
|
156
|
+
@placement_obstruction_grid = [map, cache_key]
|
157
|
+
map
|
158
|
+
end
|
159
|
+
|
124
160
|
# Returns a grid where powered locations are marked true
|
125
161
|
# @return [Numo::Bit]
|
126
162
|
def parsed_power_grid
|
@@ -680,7 +716,7 @@ module Sc2
|
|
680
716
|
return @_build_coordinates[cache_key] if !@_build_coordinates[cache_key].nil? && !bot.game_info_stale?
|
681
717
|
|
682
718
|
result = []
|
683
|
-
input_grid = parsed_pathing_grid & parsed_placement_grid & ~expo_placement_grid
|
719
|
+
input_grid = parsed_pathing_grid & parsed_placement_grid & ~expo_placement_grid & ~placement_obstruction_grid
|
684
720
|
input_grid = if on_creep
|
685
721
|
parsed_creep & input_grid
|
686
722
|
else
|
data/lib/sc2ai/player/units.rb
CHANGED
@@ -41,6 +41,12 @@ module Sc2
|
|
41
41
|
# @return [Array<Integer>] a group of neutral units
|
42
42
|
def upgrades_completed = observation&.raw_data&.player&.upgrade_ids.to_a || [] # not a unit
|
43
43
|
|
44
|
+
# Returns true if this upgrade has finished researching
|
45
|
+
# @return [Boolean]
|
46
|
+
def upgrade_completed?(upgrade_id)
|
47
|
+
upgrades_completed.include?(upgrade_id)
|
48
|
+
end
|
49
|
+
|
44
50
|
# Returns the upgrade ids which are researching or queued
|
45
51
|
# Not set for enemy.
|
46
52
|
# @return [Array<Integer>]
|
@@ -69,7 +75,7 @@ module Sc2
|
|
69
75
|
result - upgrades_completed
|
70
76
|
end
|
71
77
|
|
72
|
-
# Returns the upgrade
|
78
|
+
# Returns true if the upgrade is busy researching
|
73
79
|
# @return [Boolean]
|
74
80
|
def upgrade_in_progress?(upgrade_id)
|
75
81
|
structure_unit_type_id = Api::TechTree.upgrade_researched_from(upgrade_id: upgrade_id)
|
@@ -85,6 +91,17 @@ module Sc2
|
|
85
91
|
# For this unit type, tells you how many are in progress by checking orders for all it's sources.
|
86
92
|
# @return [Integer]
|
87
93
|
def units_in_progress(unit_type_id)
|
94
|
+
if unit_type_id == Api::UnitTypeId::REACTOR
|
95
|
+
return units_in_progress(Api::UnitTypeId::BARRACKSREACTOR) +
|
96
|
+
units_in_progress(Api::UnitTypeId::FACTORYREACTOR) +
|
97
|
+
units_in_progress(Api::UnitTypeId::STARPORTREACTOR)
|
98
|
+
elsif unit_type_id == Api::UnitTypeId::TECHLAB
|
99
|
+
return units_in_progress(Api::UnitTypeId::BARRACKSTECHLAB) +
|
100
|
+
units_in_progress(Api::UnitTypeId::FACTORYTECHLAB) +
|
101
|
+
units_in_progress(Api::UnitTypeId::STARPORTTECHLAB)
|
102
|
+
end
|
103
|
+
|
104
|
+
# Get source unit
|
88
105
|
source_unit_types = Api::TechTree.unit_created_from(unit_type_id: unit_type_id)
|
89
106
|
|
90
107
|
# When building from LARVA, check the intermediate models
|
@@ -113,9 +130,22 @@ module Sc2
|
|
113
130
|
else
|
114
131
|
units
|
115
132
|
end
|
133
|
+
# For SCV, the structure might be completed but dangling order for a few frames.
|
134
|
+
source_is_scv = source_unit_types.include?(Api::UnitTypeId::SCV)
|
135
|
+
|
136
|
+
# Let's count orders matching the ability
|
116
137
|
total_in_progress = origin.select_type(source_unit_types).sum do |source|
|
117
138
|
source.orders.count do |order|
|
118
|
-
|
139
|
+
if order.ability_id == unit_create_ability
|
140
|
+
if source_is_scv
|
141
|
+
# If we are a SCV, do not count our order if the target is a completed structure pos
|
142
|
+
structures.select_type(unit_type_id).completed.none? do |structure|
|
143
|
+
structure.pos == order.target_world_space_pos
|
144
|
+
end
|
145
|
+
else
|
146
|
+
true
|
147
|
+
end
|
148
|
+
end
|
119
149
|
end
|
120
150
|
end
|
121
151
|
total_in_progress *= 2 if unit_type_id == Api::UnitTypeId::ZERGLING
|
data/lib/sc2ai/player.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "forwardable"
|
4
|
+
require "numo/narray"
|
3
5
|
require_relative "api/data"
|
4
6
|
require_relative "connection/connection_listener"
|
5
7
|
require_relative "connection/status_listener"
|
6
8
|
require_relative "player/game_state"
|
7
9
|
require_relative "player/units"
|
8
10
|
require_relative "player/previous_state"
|
9
|
-
require_relative "player/
|
11
|
+
require_relative "player/geo"
|
10
12
|
require_relative "player/actions"
|
11
13
|
require_relative "player/debug"
|
12
|
-
require "numo/narray"
|
13
14
|
|
14
15
|
module Sc2
|
15
16
|
# Allows defining Ai, Bot, BotProcess (external), Human or Observer for a Match
|
@@ -50,12 +51,7 @@ module Sc2
|
|
50
51
|
# @return [Hash]
|
51
52
|
attr_accessor :interface_options
|
52
53
|
|
53
|
-
# @return [Api::Race
|
54
|
-
# @return [Api::Race::Terran] if is_a? Bot, Human, BotProcess
|
55
|
-
# @return [Api::Race::Zerg] if is_a? Bot, Human, BotProcess
|
56
|
-
# @return [Api::Race::Protoss] if is_a? Bot, Human, BotProcess
|
57
|
-
# @return [Api::Race::Random] if specified random and in-game race hasn't been scouted yet
|
58
|
-
# @return [nil] if is_a? forgetful person
|
54
|
+
# @return [Integer] Api::Race enum
|
59
55
|
attr_accessor :race
|
60
56
|
|
61
57
|
# @return [String] in-game name
|
@@ -152,7 +148,7 @@ module Sc2
|
|
152
148
|
def join_game(server_host:, port_config:)
|
153
149
|
Sc2.logger.debug { "Player \"#{@name}\" joining game..." }
|
154
150
|
response = @api.join_game(name: @name, race: @race, server_host:, port_config:, enable_feature_layer: @enable_feature_layer, interface_options: @interface_options)
|
155
|
-
if
|
151
|
+
if response.error != :EnumResponseJoinGameErrorUnset && response.error != :MissingParticipation
|
156
152
|
raise Sc2::Error, "Player \"#{@name}\" join_game failed: #{response.error}"
|
157
153
|
end
|
158
154
|
add_listener(self, klass: Connection::StatusListener)
|
@@ -188,13 +184,13 @@ module Sc2
|
|
188
184
|
attr_accessor :previous
|
189
185
|
|
190
186
|
# @!attribute geo
|
191
|
-
# @return [Sc2::Player::
|
187
|
+
# @return [Sc2::Player::Geo] geo and map helper functions
|
192
188
|
attr_accessor :geo
|
193
189
|
|
194
190
|
def initialize(race:, name:)
|
195
191
|
super(race:, name:, type: Api::PlayerType::Participant, difficulty: nil, ai_build: nil)
|
196
192
|
@previous = Sc2::Player::PreviousState.new
|
197
|
-
@geo = Sc2::Player::
|
193
|
+
@geo = Sc2::Player::Geo.new(self)
|
198
194
|
|
199
195
|
configure
|
200
196
|
end
|
@@ -231,7 +227,7 @@ module Sc2
|
|
231
227
|
loop do
|
232
228
|
r = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
|
233
229
|
perform_actions
|
234
|
-
perform_debug_commands
|
230
|
+
perform_debug_commands unless Sc2.ladder?
|
235
231
|
step_forward
|
236
232
|
print "\e[2K#{game_loop - @previous.game_loop} Steps Took (ms): #{(::Process.clock_gettime(::Process::CLOCK_MONOTONIC) - r) * 1000}\n\e[1A\r"
|
237
233
|
return @result unless @result.nil?
|
@@ -551,7 +547,6 @@ module Sc2
|
|
551
547
|
# This is better than having a bunch of random zero and nil values
|
552
548
|
@previous.reset(self) if @previous.all_units.nil?
|
553
549
|
|
554
|
-
# TODO: remove @events attributes if we don't use them for performance gains
|
555
550
|
# Actions performed and errors (only if implemented)
|
556
551
|
on_actions_performed(response_observation.actions) unless response_observation.actions.empty?
|
557
552
|
on_action_errors(response_observation.action_errors) unless response_observation.action_errors.empty?
|
@@ -608,41 +603,6 @@ module Sc2
|
|
608
603
|
end
|
609
604
|
end
|
610
605
|
|
611
|
-
# Misc -------------------------------
|
612
|
-
# ##TODO: perfect loop implementation
|
613
|
-
# observation has an optional param game_loop and will only return once that step is reached (blocking).
|
614
|
-
# without it, it returns things as they are.
|
615
|
-
# broadly, i think this is what it should be doing, with step_count being minimum of 1, so no zero-steps occur.
|
616
|
-
# @example
|
617
|
-
# desired_game_loop = current_game_loop + step_count
|
618
|
-
# response = client.observation(game_loop: desired_game_loop)
|
619
|
-
#
|
620
|
-
# if response.game_loop > desired_game_loop {
|
621
|
-
#
|
622
|
-
# # our requested point-in-time has passed. bot too slow or unlucky timing.
|
623
|
-
# # so, just re-query things as they stand right now:
|
624
|
-
# missed_response = response
|
625
|
-
# # note no game_loop argument supplied this time
|
626
|
-
# response = client.observation()
|
627
|
-
#
|
628
|
-
# # Combine observations so you didn't miss anything
|
629
|
-
# # Merges
|
630
|
-
# response.actions.merge(missed_response.actions)
|
631
|
-
# response.action_errors.merge(missed_response.action_errors)
|
632
|
-
# response.chat.merge(missed_response.chat)
|
633
|
-
#
|
634
|
-
# # Overrides
|
635
|
-
# if missed_response.player_result && response.player_result.empty?
|
636
|
-
# response.player_result = player_result
|
637
|
-
# end
|
638
|
-
#
|
639
|
-
# # Note we don't touch reponse.observation and keep the latest
|
640
|
-
# end
|
641
|
-
# current_game_loop = response.game_loop
|
642
|
-
# return response # or dispatch events with it
|
643
|
-
# def perfect_loop
|
644
|
-
# end
|
645
|
-
|
646
606
|
private
|
647
607
|
|
648
608
|
# @private
|
data/lib/sc2ai/ports.rb
CHANGED
@@ -48,12 +48,257 @@
|
|
48
48
|
# @!parse
|
49
49
|
# module Api;
|
50
50
|
# # Protobuf virtual enum.
|
51
|
-
#
|
51
|
+
# module Race
|
52
|
+
# NoRace = 0
|
53
|
+
# Terran = 1
|
54
|
+
# Zerg = 2
|
55
|
+
# Protoss = 3
|
56
|
+
# Random = 4
|
57
|
+
# end
|
52
58
|
# # Protobuf virtual enum.
|
53
|
-
#
|
59
|
+
# module PlayerType
|
60
|
+
# Participant = 1
|
61
|
+
# Computer = 2
|
62
|
+
# Observer = 3
|
63
|
+
# end
|
54
64
|
# # Protobuf virtual enum.
|
55
|
-
#
|
65
|
+
# module Difficulty
|
66
|
+
# VeryEasy = 1
|
67
|
+
# Easy = 2
|
68
|
+
# Medium = 3
|
69
|
+
# MediumHard = 4
|
70
|
+
# Hard = 5
|
71
|
+
# Harder = 6
|
72
|
+
# VeryHard = 7
|
73
|
+
# CheatVision = 8
|
74
|
+
# CheatMoney = 9
|
75
|
+
# CheatInsane = 10
|
76
|
+
# end
|
56
77
|
# # Protobuf virtual enum.
|
57
|
-
#
|
78
|
+
# module AIBuild
|
79
|
+
# RandomBuild = 1
|
80
|
+
# Rush = 2
|
81
|
+
# Timing = 3
|
82
|
+
# Power = 4
|
83
|
+
# Macro = 5
|
84
|
+
# Air = 6
|
85
|
+
# end
|
86
|
+
# # Protobuf virtual enum.
|
87
|
+
# module ActionResult
|
88
|
+
# Success = 1;
|
89
|
+
# NotSupported = 2;
|
90
|
+
# Error = 3;
|
91
|
+
# CantQueueThatOrder = 4;
|
92
|
+
# Retry = 5;
|
93
|
+
# Cooldown = 6;
|
94
|
+
# QueueIsFull = 7;
|
95
|
+
# RallyQueueIsFull = 8;
|
96
|
+
# NotEnoughMinerals = 9;
|
97
|
+
# NotEnoughVespene = 10;
|
98
|
+
# NotEnoughTerrazine = 11;
|
99
|
+
# NotEnoughCustom = 12;
|
100
|
+
# NotEnoughFood = 13;
|
101
|
+
# FoodUsageImpossible = 14;
|
102
|
+
# NotEnoughLife = 15;
|
103
|
+
# NotEnoughShields = 16;
|
104
|
+
# NotEnoughEnergy = 17;
|
105
|
+
# LifeSuppressed = 18;
|
106
|
+
# ShieldsSuppressed = 19;
|
107
|
+
# EnergySuppressed = 20;
|
108
|
+
# NotEnoughCharges = 21;
|
109
|
+
# CantAddMoreCharges = 22;
|
110
|
+
# TooMuchMinerals = 23;
|
111
|
+
# TooMuchVespene = 24;
|
112
|
+
# TooMuchTerrazine = 25;
|
113
|
+
# TooMuchCustom = 26;
|
114
|
+
# TooMuchFood = 27;
|
115
|
+
# TooMuchLife = 28;
|
116
|
+
# TooMuchShields = 29;
|
117
|
+
# TooMuchEnergy = 30;
|
118
|
+
# MustTargetUnitWithLife = 31;
|
119
|
+
# MustTargetUnitWithShields = 32;
|
120
|
+
# MustTargetUnitWithEnergy = 33;
|
121
|
+
# CantTrade = 34;
|
122
|
+
# CantSpend = 35;
|
123
|
+
# CantTargetThatUnit = 36;
|
124
|
+
# CouldntAllocateUnit = 37;
|
125
|
+
# UnitCantMove = 38;
|
126
|
+
# TransportIsHoldingPosition = 39;
|
127
|
+
# BuildTechRequirementsNotMet = 40;
|
128
|
+
# CantFindPlacementLocation = 41;
|
129
|
+
# CantBuildOnThat = 42;
|
130
|
+
# CantBuildTooCloseToDropOff = 43;
|
131
|
+
# CantBuildLocationInvalid = 44;
|
132
|
+
# CantSeeBuildLocation = 45;
|
133
|
+
# CantBuildTooCloseToCreepSource = 46;
|
134
|
+
# CantBuildTooCloseToResources = 47;
|
135
|
+
# CantBuildTooFarFromWater = 48;
|
136
|
+
# CantBuildTooFarFromCreepSource = 49;
|
137
|
+
# CantBuildTooFarFromBuildPowerSource = 50;
|
138
|
+
# CantBuildOnDenseTerrain = 51;
|
139
|
+
# CantTrainTooFarFromTrainPowerSource = 52;
|
140
|
+
# CantLandLocationInvalid = 53;
|
141
|
+
# CantSeeLandLocation = 54;
|
142
|
+
# CantLandTooCloseToCreepSource = 55;
|
143
|
+
# CantLandTooCloseToResources = 56;
|
144
|
+
# CantLandTooFarFromWater = 57;
|
145
|
+
# CantLandTooFarFromCreepSource = 58;
|
146
|
+
# CantLandTooFarFromBuildPowerSource = 59;
|
147
|
+
# CantLandTooFarFromTrainPowerSource = 60;
|
148
|
+
# CantLandOnDenseTerrain = 61;
|
149
|
+
# AddOnTooFarFromBuilding = 62;
|
150
|
+
# MustBuildRefineryFirst = 63;
|
151
|
+
# BuildingIsUnderConstruction = 64;
|
152
|
+
# CantFindDropOff = 65;
|
153
|
+
# CantLoadOtherPlayersUnits = 66;
|
154
|
+
# NotEnoughRoomToLoadUnit = 67;
|
155
|
+
# CantUnloadUnitsThere = 68;
|
156
|
+
# CantWarpInUnitsThere = 69;
|
157
|
+
# CantLoadImmobileUnits = 70;
|
158
|
+
# CantRechargeImmobileUnits = 71;
|
159
|
+
# CantRechargeUnderConstructionUnits = 72;
|
160
|
+
# CantLoadThatUnit = 73;
|
161
|
+
# NoCargoToUnload = 74;
|
162
|
+
# LoadAllNoTargetsFound = 75;
|
163
|
+
# NotWhileOccupied = 76;
|
164
|
+
# CantAttackWithoutAmmo = 77;
|
165
|
+
# CantHoldAnyMoreAmmo = 78;
|
166
|
+
# TechRequirementsNotMet = 79;
|
167
|
+
# MustLockdownUnitFirst = 80;
|
168
|
+
# MustTargetUnit = 81;
|
169
|
+
# MustTargetInventory = 82;
|
170
|
+
# MustTargetVisibleUnit = 83;
|
171
|
+
# MustTargetVisibleLocation = 84;
|
172
|
+
# MustTargetWalkableLocation = 85;
|
173
|
+
# MustTargetPawnableUnit = 86;
|
174
|
+
# YouCantControlThatUnit = 87;
|
175
|
+
# YouCantIssueCommandsToThatUnit = 88;
|
176
|
+
# MustTargetResources = 89;
|
177
|
+
# RequiresHealTarget = 90;
|
178
|
+
# RequiresRepairTarget = 91;
|
179
|
+
# NoItemsToDrop = 92;
|
180
|
+
# CantHoldAnyMoreItems = 93;
|
181
|
+
# CantHoldThat = 94;
|
182
|
+
# TargetHasNoInventory = 95;
|
183
|
+
# CantDropThisItem = 96;
|
184
|
+
# CantMoveThisItem = 97;
|
185
|
+
# CantPawnThisUnit = 98;
|
186
|
+
# MustTargetCaster = 99;
|
187
|
+
# CantTargetCaster = 100;
|
188
|
+
# MustTargetOuter = 101;
|
189
|
+
# CantTargetOuter = 102;
|
190
|
+
# MustTargetYourOwnUnits = 103;
|
191
|
+
# CantTargetYourOwnUnits = 104;
|
192
|
+
# MustTargetFriendlyUnits = 105;
|
193
|
+
# CantTargetFriendlyUnits = 106;
|
194
|
+
# MustTargetNeutralUnits = 107;
|
195
|
+
# CantTargetNeutralUnits = 108;
|
196
|
+
# MustTargetEnemyUnits = 109;
|
197
|
+
# CantTargetEnemyUnits = 110;
|
198
|
+
# MustTargetAirUnits = 111;
|
199
|
+
# CantTargetAirUnits = 112;
|
200
|
+
# MustTargetGroundUnits = 113;
|
201
|
+
# CantTargetGroundUnits = 114;
|
202
|
+
# MustTargetStructures = 115;
|
203
|
+
# CantTargetStructures = 116;
|
204
|
+
# MustTargetLightUnits = 117;
|
205
|
+
# CantTargetLightUnits = 118;
|
206
|
+
# MustTargetArmoredUnits = 119;
|
207
|
+
# CantTargetArmoredUnits = 120;
|
208
|
+
# MustTargetBiologicalUnits = 121;
|
209
|
+
# CantTargetBiologicalUnits = 122;
|
210
|
+
# MustTargetHeroicUnits = 123;
|
211
|
+
# CantTargetHeroicUnits = 124;
|
212
|
+
# MustTargetRoboticUnits = 125;
|
213
|
+
# CantTargetRoboticUnits = 126;
|
214
|
+
# MustTargetMechanicalUnits = 127;
|
215
|
+
# CantTargetMechanicalUnits = 128;
|
216
|
+
# MustTargetPsionicUnits = 129;
|
217
|
+
# CantTargetPsionicUnits = 130;
|
218
|
+
# MustTargetMassiveUnits = 131;
|
219
|
+
# CantTargetMassiveUnits = 132;
|
220
|
+
# MustTargetMissile = 133;
|
221
|
+
# CantTargetMissile = 134;
|
222
|
+
# MustTargetWorkerUnits = 135;
|
223
|
+
# CantTargetWorkerUnits = 136;
|
224
|
+
# MustTargetEnergyCapableUnits = 137;
|
225
|
+
# CantTargetEnergyCapableUnits = 138;
|
226
|
+
# MustTargetShieldCapableUnits = 139;
|
227
|
+
# CantTargetShieldCapableUnits = 140;
|
228
|
+
# MustTargetFlyers = 141;
|
229
|
+
# CantTargetFlyers = 142;
|
230
|
+
# MustTargetBuriedUnits = 143;
|
231
|
+
# CantTargetBuriedUnits = 144;
|
232
|
+
# MustTargetCloakedUnits = 145;
|
233
|
+
# CantTargetCloakedUnits = 146;
|
234
|
+
# MustTargetUnitsInAStasisField = 147;
|
235
|
+
# CantTargetUnitsInAStasisField = 148;
|
236
|
+
# MustTargetUnderConstructionUnits = 149;
|
237
|
+
# CantTargetUnderConstructionUnits = 150;
|
238
|
+
# MustTargetDeadUnits = 151;
|
239
|
+
# CantTargetDeadUnits = 152;
|
240
|
+
# MustTargetRevivableUnits = 153;
|
241
|
+
# CantTargetRevivableUnits = 154;
|
242
|
+
# MustTargetHiddenUnits = 155;
|
243
|
+
# CantTargetHiddenUnits = 156;
|
244
|
+
# CantRechargeOtherPlayersUnits = 157;
|
245
|
+
# MustTargetHallucinations = 158;
|
246
|
+
# CantTargetHallucinations = 159;
|
247
|
+
# MustTargetInvulnerableUnits = 160;
|
248
|
+
# CantTargetInvulnerableUnits = 161;
|
249
|
+
# MustTargetDetectedUnits = 162;
|
250
|
+
# CantTargetDetectedUnits = 163;
|
251
|
+
# CantTargetUnitWithEnergy = 164;
|
252
|
+
# CantTargetUnitWithShields = 165;
|
253
|
+
# MustTargetUncommandableUnits = 166;
|
254
|
+
# CantTargetUncommandableUnits = 167;
|
255
|
+
# MustTargetPreventDefeatUnits = 168;
|
256
|
+
# CantTargetPreventDefeatUnits = 169;
|
257
|
+
# MustTargetPreventRevealUnits = 170;
|
258
|
+
# CantTargetPreventRevealUnits = 171;
|
259
|
+
# MustTargetPassiveUnits = 172;
|
260
|
+
# CantTargetPassiveUnits = 173;
|
261
|
+
# MustTargetStunnedUnits = 174;
|
262
|
+
# CantTargetStunnedUnits = 175;
|
263
|
+
# MustTargetSummonedUnits = 176;
|
264
|
+
# CantTargetSummonedUnits = 177;
|
265
|
+
# MustTargetUser1 = 178;
|
266
|
+
# CantTargetUser1 = 179;
|
267
|
+
# MustTargetUnstoppableUnits = 180;
|
268
|
+
# CantTargetUnstoppableUnits = 181;
|
269
|
+
# MustTargetResistantUnits = 182;
|
270
|
+
# CantTargetResistantUnits = 183;
|
271
|
+
# MustTargetDazedUnits = 184;
|
272
|
+
# CantTargetDazedUnits = 185;
|
273
|
+
# CantLockdown = 186;
|
274
|
+
# CantMindControl = 187;
|
275
|
+
# MustTargetDestructibles = 188;
|
276
|
+
# CantTargetDestructibles = 189;
|
277
|
+
# MustTargetItems = 190;
|
278
|
+
# CantTargetItems = 191;
|
279
|
+
# NoCalldownAvailable = 192;
|
280
|
+
# WaypointListFull = 193;
|
281
|
+
# MustTargetRace = 194;
|
282
|
+
# CantTargetRace = 195;
|
283
|
+
# MustTargetSimilarUnits = 196;
|
284
|
+
# CantTargetSimilarUnits = 197;
|
285
|
+
# CantFindEnoughTargets = 198;
|
286
|
+
# AlreadySpawningLarva = 199;
|
287
|
+
# CantTargetExhaustedResources = 200;
|
288
|
+
# CantUseMinimap = 201;
|
289
|
+
# CantUseInfoPanel = 202;
|
290
|
+
# OrderQueueIsFull = 203;
|
291
|
+
# CantHarvestThatResource = 204;
|
292
|
+
# HarvestersNotRequired = 205;
|
293
|
+
# AlreadyTargeted = 206;
|
294
|
+
# CantAttackWeaponsDisabled = 207;
|
295
|
+
# CouldntReachTarget = 208;
|
296
|
+
# TargetIsOutOfRange = 209;
|
297
|
+
# TargetIsTooClose = 210;
|
298
|
+
# TargetIsOutOfArc = 211;
|
299
|
+
# CantFindTeleportLocation = 212;
|
300
|
+
# InvalidItemClass = 213;
|
301
|
+
# CantFindCancelOrder = 214;
|
302
|
+
# end
|
58
303
|
# end
|
59
304
|
# @!parse
|
@@ -5,31 +5,10 @@
|
|
5
5
|
require 'google/protobuf'
|
6
6
|
|
7
7
|
|
8
|
-
descriptor_data = "\n\x1bsc2ai/protocol/common.proto\x12\x03\x41pi\"
|
8
|
+
descriptor_data = "\n\x1bsc2ai/protocol/common.proto\x12\x03\x41pi\"j\n\x10\x41vailableAbility\x12\x17\n\nability_id\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1b\n\x0erequires_point\x18\x02 \x01(\x08H\x01\x88\x01\x01\x42\r\n\x0b_ability_idB\x11\n\x0f_requires_point\"\x81\x01\n\tImageData\x12\x1b\n\x0e\x62its_per_pixel\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x1f\n\x04size\x18\x02 \x01(\x0b\x32\x0c.Api.Size2DIH\x01\x88\x01\x01\x12\x11\n\x04\x64\x61ta\x18\x03 \x01(\x0cH\x02\x88\x01\x01\x42\x11\n\x0f_bits_per_pixelB\x07\n\x05_sizeB\x07\n\x05_data\"4\n\x06PointI\x12\x0e\n\x01x\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y\"V\n\nRectangleI\x12\x1c\n\x02p0\x18\x01 \x01(\x0b\x32\x0b.Api.PointIH\x00\x88\x01\x01\x12\x1c\n\x02p1\x18\x02 \x01(\x0b\x32\x0b.Api.PointIH\x01\x88\x01\x01\x42\x05\n\x03_p0B\x05\n\x03_p1\"5\n\x07Point2D\x12\x0e\n\x01x\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y\"I\n\x05Point\x12\x0e\n\x01x\x18\x01 \x01(\x02H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12\x0e\n\x01z\x18\x03 \x01(\x02H\x02\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_yB\x04\n\x02_z\"5\n\x07Size2DI\x12\x0e\n\x01x\x18\x01 \x01(\x05H\x00\x88\x01\x01\x12\x0e\n\x01y\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x04\n\x02_xB\x04\n\x02_y*A\n\x04Race\x12\n\n\x06NoRace\x10\x00\x12\n\n\x06Terran\x10\x01\x12\x08\n\x04Zerg\x10\x02\x12\x0b\n\x07Protoss\x10\x03\x12\n\n\x06Random\x10\x04\x62\x06proto3"
|
9
9
|
|
10
10
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
11
|
-
|
12
|
-
begin
|
13
|
-
pool.add_serialized_file(descriptor_data)
|
14
|
-
rescue TypeError
|
15
|
-
# Compatibility code: will be removed in the next major version.
|
16
|
-
require 'google/protobuf/descriptor_pb'
|
17
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
18
|
-
parsed.clear_dependency
|
19
|
-
serialized = parsed.class.encode(parsed)
|
20
|
-
file = pool.add_serialized_file(serialized)
|
21
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
22
|
-
imports = [
|
23
|
-
]
|
24
|
-
imports.each do |type_name, expected_filename|
|
25
|
-
import_file = pool.lookup(type_name).file_descriptor
|
26
|
-
if import_file.name != expected_filename
|
27
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
28
|
-
end
|
29
|
-
end
|
30
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
31
|
-
warn "This will become an error in the next major version."
|
32
|
-
end
|
11
|
+
pool.add_serialized_file(descriptor_data)
|
33
12
|
|
34
13
|
module Api
|
35
14
|
AvailableAbility = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AvailableAbility").msgclass
|
@@ -7,31 +7,10 @@ require 'google/protobuf'
|
|
7
7
|
require 'sc2ai/protocol/common_pb'
|
8
8
|
|
9
9
|
|
10
|
-
descriptor_data = "\n\x19sc2ai/protocol/data.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\
|
10
|
+
descriptor_data = "\n\x19sc2ai/protocol/data.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\x96\x06\n\x0b\x41\x62ilityData\x12\x17\n\nability_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x16\n\tlink_name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x17\n\nlink_index\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x18\n\x0b\x62utton_name\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x1a\n\rfriendly_name\x18\x05 \x01(\tH\x04\x88\x01\x01\x12\x13\n\x06hotkey\x18\x06 \x01(\tH\x05\x88\x01\x01\x12!\n\x14remaps_to_ability_id\x18\x07 \x01(\rH\x06\x88\x01\x01\x12\x16\n\tavailable\x18\x08 \x01(\x08H\x07\x88\x01\x01\x12,\n\x06target\x18\t \x01(\x0e\x32\x17.Api.AbilityData.TargetH\x08\x88\x01\x01\x12\x1a\n\rallow_minimap\x18\n \x01(\x08H\t\x88\x01\x01\x12\x1b\n\x0e\x61llow_autocast\x18\x0b \x01(\x08H\n\x88\x01\x01\x12\x18\n\x0bis_building\x18\x0c \x01(\x08H\x0b\x88\x01\x01\x12\x1d\n\x10\x66ootprint_radius\x18\r \x01(\x02H\x0c\x88\x01\x01\x12!\n\x14is_instant_placement\x18\x0e \x01(\x08H\r\x88\x01\x01\x12\x17\n\ncast_range\x18\x0f \x01(\x02H\x0e\x88\x01\x01\"^\n\x06Target\x12\x13\n\x0f\x45numTargetUnset\x10\x00\x12\x08\n\x04None\x10\x01\x12\t\n\x05Point\x10\x02\x12\x08\n\x04Unit\x10\x03\x12\x0f\n\x0bPointOrUnit\x10\x04\x12\x0f\n\x0bPointOrNone\x10\x05\x42\r\n\x0b_ability_idB\x0c\n\n_link_nameB\r\n\x0b_link_indexB\x0e\n\x0c_button_nameB\x10\n\x0e_friendly_nameB\t\n\x07_hotkeyB\x17\n\x15_remaps_to_ability_idB\x0c\n\n_availableB\t\n\x07_targetB\x10\n\x0e_allow_minimapB\x11\n\x0f_allow_autocastB\x0e\n\x0c_is_buildingB\x13\n\x11_footprint_radiusB\x17\n\x15_is_instant_placementB\r\n\x0b_cast_range\"a\n\x0b\x44\x61mageBonus\x12&\n\tattribute\x18\x01 \x01(\x0e\x32\x0e.Api.AttributeH\x00\x88\x01\x01\x12\x12\n\x05\x62onus\x18\x02 \x01(\x02H\x01\x88\x01\x01\x42\x0c\n\n_attributeB\x08\n\x06_bonus\"\xa7\x02\n\x06Weapon\x12)\n\x04type\x18\x01 \x01(\x0e\x32\x16.Api.Weapon.TargetTypeH\x00\x88\x01\x01\x12\x13\n\x06\x64\x61mage\x18\x02 \x01(\x02H\x01\x88\x01\x01\x12&\n\x0c\x64\x61mage_bonus\x18\x03 \x03(\x0b\x32\x10.Api.DamageBonus\x12\x14\n\x07\x61ttacks\x18\x04 \x01(\rH\x02\x88\x01\x01\x12\x12\n\x05range\x18\x05 \x01(\x02H\x03\x88\x01\x01\x12\x12\n\x05speed\x18\x06 \x01(\x02H\x04\x88\x01\x01\"C\n\nTargetType\x12\x17\n\x13\x45numTargetTypeUnset\x10\x00\x12\n\n\x06Ground\x10\x01\x12\x07\n\x03\x41ir\x10\x02\x12\x07\n\x03\x41ny\x10\x03\x42\x07\n\x05_typeB\t\n\x07_damageB\n\n\x08_attacksB\x08\n\x06_rangeB\x08\n\x06_speed\"\xf9\x06\n\x0cUnitTypeData\x12\x14\n\x07unit_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x16\n\tavailable\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x17\n\ncargo_size\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x19\n\x0cmineral_cost\x18\x0c \x01(\rH\x04\x88\x01\x01\x12\x19\n\x0cvespene_cost\x18\r \x01(\rH\x05\x88\x01\x01\x12\x1a\n\rfood_required\x18\x0e \x01(\x02H\x06\x88\x01\x01\x12\x1a\n\rfood_provided\x18\x12 \x01(\x02H\x07\x88\x01\x01\x12\x17\n\nability_id\x18\x0f \x01(\rH\x08\x88\x01\x01\x12\x1c\n\x04race\x18\x10 \x01(\x0e\x32\t.Api.RaceH\t\x88\x01\x01\x12\x17\n\nbuild_time\x18\x11 \x01(\x02H\n\x88\x01\x01\x12\x18\n\x0bhas_vespene\x18\x13 \x01(\x08H\x0b\x88\x01\x01\x12\x19\n\x0chas_minerals\x18\x14 \x01(\x08H\x0c\x88\x01\x01\x12\x18\n\x0bsight_range\x18\x19 \x01(\x02H\r\x88\x01\x01\x12\x12\n\ntech_alias\x18\x15 \x03(\r\x12\x17\n\nunit_alias\x18\x16 \x01(\rH\x0e\x88\x01\x01\x12\x1d\n\x10tech_requirement\x18\x17 \x01(\rH\x0f\x88\x01\x01\x12\x1d\n\x10require_attached\x18\x18 \x01(\x08H\x10\x88\x01\x01\x12\"\n\nattributes\x18\x08 \x03(\x0e\x32\x0e.Api.Attribute\x12\x1b\n\x0emovement_speed\x18\t \x01(\x02H\x11\x88\x01\x01\x12\x12\n\x05\x61rmor\x18\n \x01(\x02H\x12\x88\x01\x01\x12\x1c\n\x07weapons\x18\x0b \x03(\x0b\x32\x0b.Api.WeaponB\n\n\x08_unit_idB\x07\n\x05_nameB\x0c\n\n_availableB\r\n\x0b_cargo_sizeB\x0f\n\r_mineral_costB\x0f\n\r_vespene_costB\x10\n\x0e_food_requiredB\x10\n\x0e_food_providedB\r\n\x0b_ability_idB\x07\n\x05_raceB\r\n\x0b_build_timeB\x0e\n\x0c_has_vespeneB\x0f\n\r_has_mineralsB\x0e\n\x0c_sight_rangeB\r\n\x0b_unit_aliasB\x13\n\x11_tech_requirementB\x13\n\x11_require_attachedB\x11\n\x0f_movement_speedB\x08\n\x06_armor\"\xff\x01\n\x0bUpgradeData\x12\x17\n\nupgrade_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x19\n\x0cmineral_cost\x18\x03 \x01(\rH\x02\x88\x01\x01\x12\x19\n\x0cvespene_cost\x18\x04 \x01(\rH\x03\x88\x01\x01\x12\x1a\n\rresearch_time\x18\x05 \x01(\x02H\x04\x88\x01\x01\x12\x17\n\nability_id\x18\x06 \x01(\rH\x05\x88\x01\x01\x42\r\n\x0b_upgrade_idB\x07\n\x05_nameB\x0f\n\r_mineral_costB\x0f\n\r_vespene_costB\x10\n\x0e_research_timeB\r\n\x0b_ability_id\"H\n\x08\x42uffData\x12\x14\n\x07\x62uff_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x42\n\n\x08_buff_idB\x07\n\x05_name\"\x9c\x01\n\nEffectData\x12\x16\n\teffect_id\x18\x01 \x01(\rH\x00\x88\x01\x01\x12\x11\n\x04name\x18\x02 \x01(\tH\x01\x88\x01\x01\x12\x1a\n\rfriendly_name\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x13\n\x06radius\x18\x04 \x01(\x02H\x03\x88\x01\x01\x42\x0c\n\n_effect_idB\x07\n\x05_nameB\x10\n\x0e_friendly_nameB\t\n\x07_radius*\xb6\x01\n\tAttribute\x12\x16\n\x12\x45numAttributeUnset\x10\x00\x12\t\n\x05Light\x10\x01\x12\x0b\n\x07\x41rmored\x10\x02\x12\x0e\n\nBiological\x10\x03\x12\x0e\n\nMechanical\x10\x04\x12\x0b\n\x07Robotic\x10\x05\x12\x0b\n\x07Psionic\x10\x06\x12\x0b\n\x07Massive\x10\x07\x12\r\n\tStructure\x10\x08\x12\t\n\x05Hover\x10\t\x12\n\n\x06Heroic\x10\n\x12\x0c\n\x08Summoned\x10\x0b\x62\x06proto3"
|
11
11
|
|
12
12
|
pool = Google::Protobuf::DescriptorPool.generated_pool
|
13
|
-
|
14
|
-
begin
|
15
|
-
pool.add_serialized_file(descriptor_data)
|
16
|
-
rescue TypeError
|
17
|
-
# Compatibility code: will be removed in the next major version.
|
18
|
-
require 'google/protobuf/descriptor_pb'
|
19
|
-
parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
|
20
|
-
parsed.clear_dependency
|
21
|
-
serialized = parsed.class.encode(parsed)
|
22
|
-
file = pool.add_serialized_file(serialized)
|
23
|
-
warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
|
24
|
-
imports = [
|
25
|
-
]
|
26
|
-
imports.each do |type_name, expected_filename|
|
27
|
-
import_file = pool.lookup(type_name).file_descriptor
|
28
|
-
if import_file.name != expected_filename
|
29
|
-
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
30
|
-
end
|
31
|
-
end
|
32
|
-
warn "Each proto file must use a consistent fully-qualified name."
|
33
|
-
warn "This will become an error in the next major version."
|
34
|
-
end
|
13
|
+
pool.add_serialized_file(descriptor_data)
|
35
14
|
|
36
15
|
module Api
|
37
16
|
AbilityData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AbilityData").msgclass
|