sc2ai 0.0.0.pre → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/data.json +1 -0
- data/data/data_readable.json +22842 -0
- data/data/sc2ai/protocol/common.proto +59 -0
- data/data/sc2ai/protocol/data.proto +120 -0
- data/data/sc2ai/protocol/debug.proto +127 -0
- data/data/sc2ai/protocol/error.proto +221 -0
- data/data/sc2ai/protocol/query.proto +55 -0
- data/data/sc2ai/protocol/raw.proto +202 -0
- data/data/sc2ai/protocol/sc2api.proto +718 -0
- data/data/sc2ai/protocol/score.proto +108 -0
- data/data/sc2ai/protocol/spatial.proto +115 -0
- data/data/sc2ai/protocol/ui.proto +145 -0
- data/data/setup/setup.SC2Map +0 -0
- data/data/setup/setup.SC2Replay +0 -0
- data/data/stableid.json +35730 -0
- data/data/versions.json +554 -0
- data/exe/sc2ai +35 -0
- data/lib/docker_build/Dockerfile.ruby +74 -0
- data/lib/docker_build/docker-compose-base-image.yml +10 -0
- data/lib/docker_build/docker-compose-ladderzip.yml +9 -0
- data/lib/sc2ai/api/ability_id.rb +1644 -0
- data/lib/sc2ai/api/buff_id.rb +306 -0
- data/lib/sc2ai/api/data.rb +101 -0
- data/lib/sc2ai/api/effect_id.rb +20 -0
- data/lib/sc2ai/api/tech_tree.rb +83 -0
- data/lib/sc2ai/api/tech_tree_data.rb +2338 -0
- data/lib/sc2ai/api/unit_type_id.rb +2022 -0
- data/lib/sc2ai/api/upgrade_id.rb +310 -0
- data/lib/sc2ai/cli/cli.rb +175 -0
- data/lib/sc2ai/cli/ladderzip.rb +154 -0
- data/lib/sc2ai/cli/new.rb +88 -0
- data/lib/sc2ai/configuration.rb +145 -0
- data/lib/sc2ai/connection/connection_listener.rb +30 -0
- data/lib/sc2ai/connection/requests.rb +417 -0
- data/lib/sc2ai/connection/status_listener.rb +15 -0
- data/lib/sc2ai/connection.rb +146 -0
- data/lib/sc2ai/local_play/client/configurable_options.rb +115 -0
- data/lib/sc2ai/local_play/client.rb +159 -0
- data/lib/sc2ai/local_play/client_manager.rb +70 -0
- data/lib/sc2ai/local_play/map_file.rb +48 -0
- data/lib/sc2ai/local_play/match.rb +184 -0
- data/lib/sc2ai/overrides/array.rb +14 -0
- data/lib/sc2ai/overrides/async/process/child.rb +31 -0
- data/lib/sc2ai/overrides/kernel.rb +33 -0
- data/lib/sc2ai/paths.rb +294 -0
- data/lib/sc2ai/player/actions.rb +386 -0
- data/lib/sc2ai/player/debug.rb +224 -0
- data/lib/sc2ai/player/game_state.rb +131 -0
- data/lib/sc2ai/player/geometry.rb +766 -0
- data/lib/sc2ai/player/previous_state.rb +49 -0
- data/lib/sc2ai/player/units.rb +337 -0
- data/lib/sc2ai/player.rb +661 -0
- data/lib/sc2ai/ports.rb +152 -0
- data/lib/sc2ai/protocol/_meta_documentation.rb +39 -0
- data/lib/sc2ai/protocol/common_pb.rb +43 -0
- data/lib/sc2ai/protocol/data_pb.rb +47 -0
- data/lib/sc2ai/protocol/debug_pb.rb +56 -0
- data/lib/sc2ai/protocol/error_pb.rb +36 -0
- data/lib/sc2ai/protocol/extensions/color.rb +20 -0
- data/lib/sc2ai/protocol/extensions/point.rb +23 -0
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +26 -0
- data/lib/sc2ai/protocol/extensions/position.rb +202 -0
- data/lib/sc2ai/protocol/extensions/power_source.rb +19 -0
- data/lib/sc2ai/protocol/extensions/unit.rb +489 -0
- data/lib/sc2ai/protocol/query_pb.rb +47 -0
- data/lib/sc2ai/protocol/raw_pb.rb +57 -0
- data/lib/sc2ai/protocol/sc2api_pb.rb +130 -0
- data/lib/sc2ai/protocol/score_pb.rb +40 -0
- data/lib/sc2ai/protocol/spatial_pb.rb +48 -0
- data/lib/sc2ai/protocol/ui_pb.rb +56 -0
- data/lib/sc2ai/unit_group/action_ext.rb +74 -0
- data/lib/sc2ai/unit_group/filter_ext.rb +379 -0
- data/lib/sc2ai/unit_group.rb +277 -0
- data/lib/sc2ai/version.rb +2 -1
- data/lib/sc2ai.rb +93 -2
- data/lib/templates/ladderzip/bin/ladder.tt +23 -0
- data/lib/templates/new/.ladderignore +20 -0
- data/lib/templates/new/Gemfile.tt +7 -0
- data/lib/templates/new/api/common.proto +59 -0
- data/lib/templates/new/api/data.proto +120 -0
- data/lib/templates/new/api/debug.proto +127 -0
- data/lib/templates/new/api/error.proto +221 -0
- data/lib/templates/new/api/query.proto +55 -0
- data/lib/templates/new/api/raw.proto +202 -0
- data/lib/templates/new/api/sc2api.proto +718 -0
- data/lib/templates/new/api/score.proto +108 -0
- data/lib/templates/new/api/spatial.proto +115 -0
- data/lib/templates/new/api/ui.proto +145 -0
- data/lib/templates/new/boot.rb.tt +6 -0
- data/lib/templates/new/my_bot.rb.tt +23 -0
- data/lib/templates/new/run_example_match.rb.tt +14 -0
- data/sc2ai.gemspec +80 -0
- metadata +344 -13
data/lib/sc2ai/ports.rb
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "socket"
|
4
|
+
|
5
|
+
module Sc2
|
6
|
+
# Produces suitable PortConfig based on start_port and num_players.
|
7
|
+
# Community-consensus on port usage: where start_port is x
|
8
|
+
# term "start_port" only used for calculation: x
|
9
|
+
# legacy, ignored port: x+1
|
10
|
+
# @server.game_port: x+2, @server.base_port: x+3
|
11
|
+
# below is meant to be repeated, but client only allows 1 additional client. player 2:
|
12
|
+
# @client_ports.game_port: x+4, @client_ports.base_port: x+5
|
13
|
+
class Ports
|
14
|
+
# @private
|
15
|
+
# Random ports previously used
|
16
|
+
@used_random_ports = []
|
17
|
+
|
18
|
+
# @private
|
19
|
+
# A valid auto-generated port config is only ever used once
|
20
|
+
@auto_port_config = nil
|
21
|
+
|
22
|
+
class << self
|
23
|
+
# Basic port config using the magic of incrementation on start_port
|
24
|
+
# @param start_port [Integer]
|
25
|
+
# @param num_players [Integer] Player count which require clients
|
26
|
+
# @return [PortConfig] basic port config
|
27
|
+
def port_config_basic(start_port:, num_players:)
|
28
|
+
PortConfig.new(start_port:,
|
29
|
+
num_players:,
|
30
|
+
ports: port_range(start_port.to_i + 2, num_players).to_a)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Checks system for open ports to get a list of ports for num_players
|
34
|
+
# since start_port is purely cosmetic, it's set to the first port, minus two
|
35
|
+
# @param num_players [Integer] Player count which require clients
|
36
|
+
# @return [PortConfig] new portconfig
|
37
|
+
def port_config_auto(num_players:)
|
38
|
+
return @auto_port_config unless @auto_port_config.nil?
|
39
|
+
|
40
|
+
if num_players <= 1
|
41
|
+
@auto_port_config = PortConfig.new(start_port: 0,
|
42
|
+
num_players:,
|
43
|
+
ports: [])
|
44
|
+
return @auto_port_config
|
45
|
+
end
|
46
|
+
|
47
|
+
max_retry = 10
|
48
|
+
try = 0
|
49
|
+
|
50
|
+
# First, attempt to grab a random open port and test sequentially ahead
|
51
|
+
while try < max_retry
|
52
|
+
try += 1
|
53
|
+
|
54
|
+
random_port = random_available_port
|
55
|
+
next unless random_port
|
56
|
+
|
57
|
+
random_port_range = port_range(random_port, num_players)
|
58
|
+
# Ensure all are available
|
59
|
+
next unless random_port_range.detect { |p| !port_available?(p) }.nil?
|
60
|
+
|
61
|
+
start_port = random_port_range.first - 2
|
62
|
+
# If so, store and return a port config
|
63
|
+
@auto_port_config = PortConfig.new(start_port:,
|
64
|
+
num_players:,
|
65
|
+
ports: random_port_range.to_a)
|
66
|
+
|
67
|
+
# And memorise our random ports used, for good measure
|
68
|
+
@used_random_ports << random_port_range.to_a
|
69
|
+
@used_random_ports.uniq!
|
70
|
+
return @auto_port_config
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
# Checks if port is open
|
75
|
+
# @param port [String,Integer] check if open
|
76
|
+
def port_available?(port)
|
77
|
+
!!bind(port)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Checks system for a random available port which we haven't used yet
|
81
|
+
# @return [Integer] port
|
82
|
+
# @raise [Sc2::Error] error if no free port is found
|
83
|
+
def random_available_port
|
84
|
+
10.times do
|
85
|
+
port = bind(0)
|
86
|
+
unless @used_random_ports.include?(port)
|
87
|
+
@used_random_ports << port
|
88
|
+
return port
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Alternatively, grab some random ports and check if they are open
|
93
|
+
# Try random ports as a last resort.
|
94
|
+
10.times do
|
95
|
+
port = rand(15_000..25_000)
|
96
|
+
if port_available?(port) && !@used_random_ports.include?(port)
|
97
|
+
@used_random_ports << port
|
98
|
+
return port
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
raise Error, "no free ports found"
|
103
|
+
end
|
104
|
+
|
105
|
+
private
|
106
|
+
|
107
|
+
# Gets range of ports based on offset and number of players
|
108
|
+
# @param from [Integer] (inclusive)
|
109
|
+
# @param num_players [Integer]
|
110
|
+
# @return [Range] range of ports
|
111
|
+
def port_range(from, num_players)
|
112
|
+
(from...(from + (num_players * 2)))
|
113
|
+
end
|
114
|
+
|
115
|
+
# Will bind tcp port and return port if successful
|
116
|
+
# if port is zero, it will return random port bound to
|
117
|
+
# @return [Integer, Boolean] port if bind succeeds, false on failure
|
118
|
+
def bind(port)
|
119
|
+
socket = ::Socket.new(:AF_INET, :SOCK_STREAM, 0)
|
120
|
+
socket.bind(Addrinfo.tcp("", port))
|
121
|
+
socket.local_address.ip_port
|
122
|
+
rescue
|
123
|
+
false
|
124
|
+
ensure
|
125
|
+
# noinspection RubyScope
|
126
|
+
socket&.close
|
127
|
+
false
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# A port configuration for a Match which allows generating Api::PortSet
|
133
|
+
class PortConfig
|
134
|
+
attr_reader :start_port, :server_port_set, :client_port_sets
|
135
|
+
|
136
|
+
def initialize(start_port:, num_players:, ports: [])
|
137
|
+
@start_port = start_port
|
138
|
+
@server_port_set = nil
|
139
|
+
@client_port_sets = nil
|
140
|
+
return if num_players <= 1
|
141
|
+
|
142
|
+
return if ports.empty?
|
143
|
+
|
144
|
+
@server_port_set = Api::PortSet.new(game_port: ports.shift, base_port: ports.shift)
|
145
|
+
|
146
|
+
@client_port_sets = []
|
147
|
+
(num_players - 1).times do
|
148
|
+
@client_port_sets << Api::PortSet.new(game_port: ports.shift, base_port: ports.shift)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
end
|
152
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# This file defines meta documentation for Protobuf objects
|
2
|
+
# Review data/sc2ai/protocol
|
3
|
+
# Do not add functionality.
|
4
|
+
|
5
|
+
# Protobuf classes
|
6
|
+
# @!parse
|
7
|
+
# module Api;
|
8
|
+
# # Protobuf virtual class.
|
9
|
+
# class Color < Google::Protobuf::AbstractMessage; end;
|
10
|
+
# # Protobuf virtual class.
|
11
|
+
# class Point < Google::Protobuf::AbstractMessage; end;
|
12
|
+
# # Protobuf virtual class.
|
13
|
+
# class Point2D < Google::Protobuf::AbstractMessage; end;
|
14
|
+
# # Protobuf virtual class.
|
15
|
+
# class PointI < Google::Protobuf::AbstractMessage; end;
|
16
|
+
# # Protobuf virtual class.
|
17
|
+
# class PowerSource < Google::Protobuf::AbstractMessage; end;
|
18
|
+
# # Protobuf virtual class.
|
19
|
+
# class Size2DI < Google::Protobuf::AbstractMessage; end;
|
20
|
+
# # Protobuf virtual class.
|
21
|
+
# class Point < Google::Protobuf::AbstractMessage; end;
|
22
|
+
# # Protobuf virtual class.
|
23
|
+
# class Unit < Google::Protobuf::AbstractMessage; end;
|
24
|
+
# end
|
25
|
+
|
26
|
+
# Protobuf enums ---
|
27
|
+
# Protobuf classes
|
28
|
+
# @!parse
|
29
|
+
# module Api;
|
30
|
+
# # Protobuf virtual enum.
|
31
|
+
# class Race < Google::Protobuf::AbstractMessage; end;
|
32
|
+
# # Protobuf virtual enum.
|
33
|
+
# class PlayerType < Google::Protobuf::AbstractMessage; end;
|
34
|
+
# # Protobuf virtual enum.
|
35
|
+
# class Difficulty < Google::Protobuf::AbstractMessage; end;
|
36
|
+
# # Protobuf virtual enum.
|
37
|
+
# class AIBuild < Google::Protobuf::AbstractMessage; end;
|
38
|
+
# end
|
39
|
+
# @!parse
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: sc2ai/protocol/common.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
|
8
|
+
descriptor_data = "\n\x1bsc2ai/protocol/common.proto\x12\x03\x41pi\">\n\x10\x41vailableAbility\x12\x12\n\nability_id\x18\x01 \x01(\x05\x12\x16\n\x0erequires_point\x18\x02 \x01(\x08\"M\n\tImageData\x12\x16\n\x0e\x62its_per_pixel\x18\x01 \x01(\x05\x12\x1a\n\x04size\x18\x02 \x01(\x0b\x32\x0c.Api.Size2DI\x12\x0c\n\x04\x64\x61ta\x18\x03 \x01(\x0c\"\x1e\n\x06PointI\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05\">\n\nRectangleI\x12\x17\n\x02p0\x18\x01 \x01(\x0b\x32\x0b.Api.PointI\x12\x17\n\x02p1\x18\x02 \x01(\x0b\x32\x0b.Api.PointI\"\x1f\n\x07Point2D\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\"(\n\x05Point\x12\t\n\x01x\x18\x01 \x01(\x02\x12\t\n\x01y\x18\x02 \x01(\x02\x12\t\n\x01z\x18\x03 \x01(\x02\"\x1f\n\x07Size2DI\x12\t\n\x01x\x18\x01 \x01(\x05\x12\t\n\x01y\x18\x02 \x01(\x05*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"
|
9
|
+
|
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
|
33
|
+
|
34
|
+
module Api
|
35
|
+
AvailableAbility = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AvailableAbility").msgclass
|
36
|
+
ImageData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.ImageData").msgclass
|
37
|
+
PointI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.PointI").msgclass
|
38
|
+
RectangleI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.RectangleI").msgclass
|
39
|
+
Point2D = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Point2D").msgclass
|
40
|
+
Point = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Point").msgclass
|
41
|
+
Size2DI = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Size2DI").msgclass
|
42
|
+
Race = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Race").enummodule
|
43
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: sc2ai/protocol/data.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'sc2ai/protocol/common_pb'
|
8
|
+
|
9
|
+
|
10
|
+
descriptor_data = "\n\x19sc2ai/protocol/data.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\xb9\x03\n\x0b\x41\x62ilityData\x12\x12\n\nability_id\x18\x01 \x01(\r\x12\x11\n\tlink_name\x18\x02 \x01(\t\x12\x12\n\nlink_index\x18\x03 \x01(\r\x12\x13\n\x0b\x62utton_name\x18\x04 \x01(\t\x12\x15\n\rfriendly_name\x18\x05 \x01(\t\x12\x0e\n\x06hotkey\x18\x06 \x01(\t\x12\x1c\n\x14remaps_to_ability_id\x18\x07 \x01(\r\x12\x11\n\tavailable\x18\x08 \x01(\x08\x12\'\n\x06target\x18\t \x01(\x0e\x32\x17.Api.AbilityData.Target\x12\x15\n\rallow_minimap\x18\n \x01(\x08\x12\x16\n\x0e\x61llow_autocast\x18\x0b \x01(\x08\x12\x13\n\x0bis_building\x18\x0c \x01(\x08\x12\x18\n\x10\x66ootprint_radius\x18\r \x01(\x02\x12\x1c\n\x14is_instant_placement\x18\x0e \x01(\x08\x12\x12\n\ncast_range\x18\x0f \x01(\x02\"I\n\x06Target\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\"?\n\x0b\x44\x61mageBonus\x12!\n\tattribute\x18\x01 \x01(\x0e\x32\x0e.Api.Attribute\x12\r\n\x05\x62onus\x18\x02 \x01(\x02\"\xc1\x01\n\x06Weapon\x12$\n\x04type\x18\x01 \x01(\x0e\x32\x16.Api.Weapon.TargetType\x12\x0e\n\x06\x64\x61mage\x18\x02 \x01(\x02\x12&\n\x0c\x64\x61mage_bonus\x18\x03 \x03(\x0b\x32\x10.Api.DamageBonus\x12\x0f\n\x07\x61ttacks\x18\x04 \x01(\r\x12\r\n\x05range\x18\x05 \x01(\x02\x12\r\n\x05speed\x18\x06 \x01(\x02\"*\n\nTargetType\x12\n\n\x06Ground\x10\x01\x12\x07\n\x03\x41ir\x10\x02\x12\x07\n\x03\x41ny\x10\x03\"\xf4\x03\n\x0cUnitTypeData\x12\x0f\n\x07unit_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x11\n\tavailable\x18\x03 \x01(\x08\x12\x12\n\ncargo_size\x18\x04 \x01(\r\x12\x14\n\x0cmineral_cost\x18\x0c \x01(\r\x12\x14\n\x0cvespene_cost\x18\r \x01(\r\x12\x15\n\rfood_required\x18\x0e \x01(\x02\x12\x15\n\rfood_provided\x18\x12 \x01(\x02\x12\x12\n\nability_id\x18\x0f \x01(\r\x12\x17\n\x04race\x18\x10 \x01(\x0e\x32\t.Api.Race\x12\x12\n\nbuild_time\x18\x11 \x01(\x02\x12\x13\n\x0bhas_vespene\x18\x13 \x01(\x08\x12\x14\n\x0chas_minerals\x18\x14 \x01(\x08\x12\x13\n\x0bsight_range\x18\x19 \x01(\x02\x12\x12\n\ntech_alias\x18\x15 \x03(\r\x12\x12\n\nunit_alias\x18\x16 \x01(\r\x12\x18\n\x10tech_requirement\x18\x17 \x01(\r\x12\x18\n\x10require_attached\x18\x18 \x01(\x08\x12\"\n\nattributes\x18\x08 \x03(\x0e\x32\x0e.Api.Attribute\x12\x16\n\x0emovement_speed\x18\t \x01(\x02\x12\r\n\x05\x61rmor\x18\n \x01(\x02\x12\x1c\n\x07weapons\x18\x0b \x03(\x0b\x32\x0b.Api.Weapon\"\x86\x01\n\x0bUpgradeData\x12\x12\n\nupgrade_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x14\n\x0cmineral_cost\x18\x03 \x01(\r\x12\x14\n\x0cvespene_cost\x18\x04 \x01(\r\x12\x15\n\rresearch_time\x18\x05 \x01(\x02\x12\x12\n\nability_id\x18\x06 \x01(\r\")\n\x08\x42uffData\x12\x0f\n\x07\x62uff_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\"T\n\nEffectData\x12\x11\n\teffect_id\x18\x01 \x01(\r\x12\x0c\n\x04name\x18\x02 \x01(\t\x12\x15\n\rfriendly_name\x18\x03 \x01(\t\x12\x0e\n\x06radius\x18\x04 \x01(\x02*\x9e\x01\n\tAttribute\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"
|
11
|
+
|
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
|
35
|
+
|
36
|
+
module Api
|
37
|
+
AbilityData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AbilityData").msgclass
|
38
|
+
AbilityData::Target = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.AbilityData.Target").enummodule
|
39
|
+
DamageBonus = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DamageBonus").msgclass
|
40
|
+
Weapon = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Weapon").msgclass
|
41
|
+
Weapon::TargetType = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Weapon.TargetType").enummodule
|
42
|
+
UnitTypeData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.UnitTypeData").msgclass
|
43
|
+
UpgradeData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.UpgradeData").msgclass
|
44
|
+
BuffData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.BuffData").msgclass
|
45
|
+
EffectData = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.EffectData").msgclass
|
46
|
+
Attribute = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Attribute").enummodule
|
47
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: sc2ai/protocol/debug.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
require 'sc2ai/protocol/common_pb'
|
8
|
+
|
9
|
+
|
10
|
+
descriptor_data = "\n\x1asc2ai/protocol/debug.proto\x12\x03\x41pi\x1a\x1bsc2ai/protocol/common.proto\"\xe3\x02\n\x0c\x44\x65\x62ugCommand\x12\x1e\n\x04\x64raw\x18\x01 \x01(\x0b\x32\x0e.Api.DebugDrawH\x00\x12)\n\ngame_state\x18\x02 \x01(\x0e\x32\x13.Api.DebugGameStateH\x00\x12+\n\x0b\x63reate_unit\x18\x03 \x01(\x0b\x32\x14.Api.DebugCreateUnitH\x00\x12\'\n\tkill_unit\x18\x04 \x01(\x0b\x32\x12.Api.DebugKillUnitH\x00\x12-\n\x0ctest_process\x18\x05 \x01(\x0b\x32\x15.Api.DebugTestProcessH\x00\x12#\n\x05score\x18\x06 \x01(\x0b\x32\x12.Api.DebugSetScoreH\x00\x12%\n\x08\x65nd_game\x18\x07 \x01(\x0b\x32\x11.Api.DebugEndGameH\x00\x12,\n\nunit_value\x18\x08 \x01(\x0b\x32\x16.Api.DebugSetUnitValueH\x00\x42\t\n\x07\x63ommand\"\x89\x01\n\tDebugDraw\x12\x1c\n\x04text\x18\x01 \x03(\x0b\x32\x0e.Api.DebugText\x12\x1d\n\x05lines\x18\x02 \x03(\x0b\x32\x0e.Api.DebugLine\x12\x1c\n\x05\x62oxes\x18\x03 \x03(\x0b\x32\r.Api.DebugBox\x12!\n\x07spheres\x18\x04 \x03(\x0b\x32\x10.Api.DebugSphere\"6\n\x04Line\x12\x16\n\x02p0\x18\x01 \x01(\x0b\x32\n.Api.Point\x12\x16\n\x02p1\x18\x02 \x01(\x0b\x32\n.Api.Point\"(\n\x05\x43olor\x12\t\n\x01r\x18\x01 \x01(\r\x12\t\n\x01g\x18\x02 \x01(\r\x12\t\n\x01\x62\x18\x03 \x01(\r\"\x82\x01\n\tDebugText\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x0c\n\x04text\x18\x02 \x01(\t\x12\x1f\n\x0bvirtual_pos\x18\x03 \x01(\x0b\x32\n.Api.Point\x12\x1d\n\tworld_pos\x18\x04 \x01(\x0b\x32\n.Api.Point\x12\x0c\n\x04size\x18\x05 \x01(\r\"?\n\tDebugLine\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x17\n\x04line\x18\x02 \x01(\x0b\x32\t.Api.Line\"W\n\x08\x44\x65\x62ugBox\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x17\n\x03min\x18\x02 \x01(\x0b\x32\n.Api.Point\x12\x17\n\x03max\x18\x03 \x01(\x0b\x32\n.Api.Point\"J\n\x0b\x44\x65\x62ugSphere\x12\x19\n\x05\x63olor\x18\x01 \x01(\x0b\x32\n.Api.Color\x12\x15\n\x01p\x18\x02 \x01(\x0b\x32\n.Api.Point\x12\t\n\x01r\x18\x03 \x01(\x02\"`\n\x0f\x44\x65\x62ugCreateUnit\x12\x11\n\tunit_type\x18\x01 \x01(\r\x12\r\n\x05owner\x18\x02 \x01(\x05\x12\x19\n\x03pos\x18\x03 \x01(\x0b\x32\x0c.Api.Point2D\x12\x10\n\x08quantity\x18\x04 \x01(\r\"\x1c\n\rDebugKillUnit\x12\x0b\n\x03tag\x18\x01 \x03(\x04\"u\n\x10\x44\x65\x62ugTestProcess\x12(\n\x04test\x18\x01 \x01(\x0e\x32\x1a.Api.DebugTestProcess.Test\x12\x10\n\x08\x64\x65lay_ms\x18\x02 \x01(\x05\"%\n\x04Test\x12\x08\n\x04hang\x10\x01\x12\t\n\x05\x63rash\x10\x02\x12\x08\n\x04\x65xit\x10\x03\"\x1e\n\rDebugSetScore\x12\r\n\x05score\x18\x01 \x01(\x02\"o\n\x0c\x44\x65\x62ugEndGame\x12/\n\nend_result\x18\x01 \x01(\x0e\x32\x1b.Api.DebugEndGame.EndResult\".\n\tEndResult\x12\r\n\tSurrender\x10\x01\x12\x12\n\x0e\x44\x65\x63lareVictory\x10\x02\"\x9a\x01\n\x11\x44\x65\x62ugSetUnitValue\x12\x34\n\nunit_value\x18\x01 \x01(\x0e\x32 .Api.DebugSetUnitValue.UnitValue\x12\r\n\x05value\x18\x02 \x01(\x02\x12\x10\n\x08unit_tag\x18\x03 \x01(\x04\".\n\tUnitValue\x12\n\n\x06\x45nergy\x10\x01\x12\x08\n\x04Life\x10\x02\x12\x0b\n\x07Shields\x10\x03*\xb2\x01\n\x0e\x44\x65\x62ugGameState\x12\x0c\n\x08show_map\x10\x01\x12\x11\n\rcontrol_enemy\x10\x02\x12\x08\n\x04\x66ood\x10\x03\x12\x08\n\x04\x66ree\x10\x04\x12\x11\n\rall_resources\x10\x05\x12\x07\n\x03god\x10\x06\x12\x0c\n\x08minerals\x10\x07\x12\x07\n\x03gas\x10\x08\x12\x0c\n\x08\x63ooldown\x10\t\x12\r\n\ttech_tree\x10\n\x12\x0b\n\x07upgrade\x10\x0b\x12\x0e\n\nfast_build\x10\x0c"
|
11
|
+
|
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
|
+
["Api.Point", "sc2ai/protocol/common.proto"],
|
26
|
+
]
|
27
|
+
imports.each do |type_name, expected_filename|
|
28
|
+
import_file = pool.lookup(type_name).file_descriptor
|
29
|
+
if import_file.name != expected_filename
|
30
|
+
warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
warn "Each proto file must use a consistent fully-qualified name."
|
34
|
+
warn "This will become an error in the next major version."
|
35
|
+
end
|
36
|
+
|
37
|
+
module Api
|
38
|
+
DebugCommand = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugCommand").msgclass
|
39
|
+
DebugDraw = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugDraw").msgclass
|
40
|
+
Line = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Line").msgclass
|
41
|
+
Color = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.Color").msgclass
|
42
|
+
DebugText = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugText").msgclass
|
43
|
+
DebugLine = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugLine").msgclass
|
44
|
+
DebugBox = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugBox").msgclass
|
45
|
+
DebugSphere = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugSphere").msgclass
|
46
|
+
DebugCreateUnit = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugCreateUnit").msgclass
|
47
|
+
DebugKillUnit = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugKillUnit").msgclass
|
48
|
+
DebugTestProcess = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugTestProcess").msgclass
|
49
|
+
DebugTestProcess::Test = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugTestProcess.Test").enummodule
|
50
|
+
DebugSetScore = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugSetScore").msgclass
|
51
|
+
DebugEndGame = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugEndGame").msgclass
|
52
|
+
DebugEndGame::EndResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugEndGame.EndResult").enummodule
|
53
|
+
DebugSetUnitValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugSetUnitValue").msgclass
|
54
|
+
DebugSetUnitValue::UnitValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugSetUnitValue.UnitValue").enummodule
|
55
|
+
DebugGameState = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.DebugGameState").enummodule
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
3
|
+
# source: sc2ai/protocol/error.proto
|
4
|
+
|
5
|
+
require 'google/protobuf'
|
6
|
+
|
7
|
+
|
8
|
+
descriptor_data = "\n\x1asc2ai/protocol/error.proto\x12\x03\x41pi*\xa8-\n\x0c\x41\x63tionResult\x12\x0b\n\x07Success\x10\x01\x12\x10\n\x0cNotSupported\x10\x02\x12\t\n\x05\x45rror\x10\x03\x12\x16\n\x12\x43\x61ntQueueThatOrder\x10\x04\x12\t\n\x05Retry\x10\x05\x12\x0c\n\x08\x43ooldown\x10\x06\x12\x0f\n\x0bQueueIsFull\x10\x07\x12\x14\n\x10RallyQueueIsFull\x10\x08\x12\x15\n\x11NotEnoughMinerals\x10\t\x12\x14\n\x10NotEnoughVespene\x10\n\x12\x16\n\x12NotEnoughTerrazine\x10\x0b\x12\x13\n\x0fNotEnoughCustom\x10\x0c\x12\x11\n\rNotEnoughFood\x10\r\x12\x17\n\x13\x46oodUsageImpossible\x10\x0e\x12\x11\n\rNotEnoughLife\x10\x0f\x12\x14\n\x10NotEnoughShields\x10\x10\x12\x13\n\x0fNotEnoughEnergy\x10\x11\x12\x12\n\x0eLifeSuppressed\x10\x12\x12\x15\n\x11ShieldsSuppressed\x10\x13\x12\x14\n\x10\x45nergySuppressed\x10\x14\x12\x14\n\x10NotEnoughCharges\x10\x15\x12\x16\n\x12\x43\x61ntAddMoreCharges\x10\x16\x12\x13\n\x0fTooMuchMinerals\x10\x17\x12\x12\n\x0eTooMuchVespene\x10\x18\x12\x14\n\x10TooMuchTerrazine\x10\x19\x12\x11\n\rTooMuchCustom\x10\x1a\x12\x0f\n\x0bTooMuchFood\x10\x1b\x12\x0f\n\x0bTooMuchLife\x10\x1c\x12\x12\n\x0eTooMuchShields\x10\x1d\x12\x11\n\rTooMuchEnergy\x10\x1e\x12\x1a\n\x16MustTargetUnitWithLife\x10\x1f\x12\x1d\n\x19MustTargetUnitWithShields\x10 \x12\x1c\n\x18MustTargetUnitWithEnergy\x10!\x12\r\n\tCantTrade\x10\"\x12\r\n\tCantSpend\x10#\x12\x16\n\x12\x43\x61ntTargetThatUnit\x10$\x12\x17\n\x13\x43ouldntAllocateUnit\x10%\x12\x10\n\x0cUnitCantMove\x10&\x12\x1e\n\x1aTransportIsHoldingPosition\x10\'\x12\x1f\n\x1b\x42uildTechRequirementsNotMet\x10(\x12\x1d\n\x19\x43\x61ntFindPlacementLocation\x10)\x12\x13\n\x0f\x43\x61ntBuildOnThat\x10*\x12\x1e\n\x1a\x43\x61ntBuildTooCloseToDropOff\x10+\x12\x1c\n\x18\x43\x61ntBuildLocationInvalid\x10,\x12\x18\n\x14\x43\x61ntSeeBuildLocation\x10-\x12\"\n\x1e\x43\x61ntBuildTooCloseToCreepSource\x10.\x12 \n\x1c\x43\x61ntBuildTooCloseToResources\x10/\x12\x1c\n\x18\x43\x61ntBuildTooFarFromWater\x10\x30\x12\"\n\x1e\x43\x61ntBuildTooFarFromCreepSource\x10\x31\x12\'\n#CantBuildTooFarFromBuildPowerSource\x10\x32\x12\x1b\n\x17\x43\x61ntBuildOnDenseTerrain\x10\x33\x12\'\n#CantTrainTooFarFromTrainPowerSource\x10\x34\x12\x1b\n\x17\x43\x61ntLandLocationInvalid\x10\x35\x12\x17\n\x13\x43\x61ntSeeLandLocation\x10\x36\x12!\n\x1d\x43\x61ntLandTooCloseToCreepSource\x10\x37\x12\x1f\n\x1b\x43\x61ntLandTooCloseToResources\x10\x38\x12\x1b\n\x17\x43\x61ntLandTooFarFromWater\x10\x39\x12!\n\x1d\x43\x61ntLandTooFarFromCreepSource\x10:\x12&\n\"CantLandTooFarFromBuildPowerSource\x10;\x12&\n\"CantLandTooFarFromTrainPowerSource\x10<\x12\x1a\n\x16\x43\x61ntLandOnDenseTerrain\x10=\x12\x1b\n\x17\x41\x64\x64OnTooFarFromBuilding\x10>\x12\x1a\n\x16MustBuildRefineryFirst\x10?\x12\x1f\n\x1b\x42uildingIsUnderConstruction\x10@\x12\x13\n\x0f\x43\x61ntFindDropOff\x10\x41\x12\x1d\n\x19\x43\x61ntLoadOtherPlayersUnits\x10\x42\x12\x1b\n\x17NotEnoughRoomToLoadUnit\x10\x43\x12\x18\n\x14\x43\x61ntUnloadUnitsThere\x10\x44\x12\x18\n\x14\x43\x61ntWarpInUnitsThere\x10\x45\x12\x19\n\x15\x43\x61ntLoadImmobileUnits\x10\x46\x12\x1d\n\x19\x43\x61ntRechargeImmobileUnits\x10G\x12&\n\"CantRechargeUnderConstructionUnits\x10H\x12\x14\n\x10\x43\x61ntLoadThatUnit\x10I\x12\x13\n\x0fNoCargoToUnload\x10J\x12\x19\n\x15LoadAllNoTargetsFound\x10K\x12\x14\n\x10NotWhileOccupied\x10L\x12\x19\n\x15\x43\x61ntAttackWithoutAmmo\x10M\x12\x17\n\x13\x43\x61ntHoldAnyMoreAmmo\x10N\x12\x1a\n\x16TechRequirementsNotMet\x10O\x12\x19\n\x15MustLockdownUnitFirst\x10P\x12\x12\n\x0eMustTargetUnit\x10Q\x12\x17\n\x13MustTargetInventory\x10R\x12\x19\n\x15MustTargetVisibleUnit\x10S\x12\x1d\n\x19MustTargetVisibleLocation\x10T\x12\x1e\n\x1aMustTargetWalkableLocation\x10U\x12\x1a\n\x16MustTargetPawnableUnit\x10V\x12\x1a\n\x16YouCantControlThatUnit\x10W\x12\"\n\x1eYouCantIssueCommandsToThatUnit\x10X\x12\x17\n\x13MustTargetResources\x10Y\x12\x16\n\x12RequiresHealTarget\x10Z\x12\x18\n\x14RequiresRepairTarget\x10[\x12\x11\n\rNoItemsToDrop\x10\\\x12\x18\n\x14\x43\x61ntHoldAnyMoreItems\x10]\x12\x10\n\x0c\x43\x61ntHoldThat\x10^\x12\x18\n\x14TargetHasNoInventory\x10_\x12\x14\n\x10\x43\x61ntDropThisItem\x10`\x12\x14\n\x10\x43\x61ntMoveThisItem\x10\x61\x12\x14\n\x10\x43\x61ntPawnThisUnit\x10\x62\x12\x14\n\x10MustTargetCaster\x10\x63\x12\x14\n\x10\x43\x61ntTargetCaster\x10\x64\x12\x13\n\x0fMustTargetOuter\x10\x65\x12\x13\n\x0f\x43\x61ntTargetOuter\x10\x66\x12\x1a\n\x16MustTargetYourOwnUnits\x10g\x12\x1a\n\x16\x43\x61ntTargetYourOwnUnits\x10h\x12\x1b\n\x17MustTargetFriendlyUnits\x10i\x12\x1b\n\x17\x43\x61ntTargetFriendlyUnits\x10j\x12\x1a\n\x16MustTargetNeutralUnits\x10k\x12\x1a\n\x16\x43\x61ntTargetNeutralUnits\x10l\x12\x18\n\x14MustTargetEnemyUnits\x10m\x12\x18\n\x14\x43\x61ntTargetEnemyUnits\x10n\x12\x16\n\x12MustTargetAirUnits\x10o\x12\x16\n\x12\x43\x61ntTargetAirUnits\x10p\x12\x19\n\x15MustTargetGroundUnits\x10q\x12\x19\n\x15\x43\x61ntTargetGroundUnits\x10r\x12\x18\n\x14MustTargetStructures\x10s\x12\x18\n\x14\x43\x61ntTargetStructures\x10t\x12\x18\n\x14MustTargetLightUnits\x10u\x12\x18\n\x14\x43\x61ntTargetLightUnits\x10v\x12\x1a\n\x16MustTargetArmoredUnits\x10w\x12\x1a\n\x16\x43\x61ntTargetArmoredUnits\x10x\x12\x1d\n\x19MustTargetBiologicalUnits\x10y\x12\x1d\n\x19\x43\x61ntTargetBiologicalUnits\x10z\x12\x19\n\x15MustTargetHeroicUnits\x10{\x12\x19\n\x15\x43\x61ntTargetHeroicUnits\x10|\x12\x1a\n\x16MustTargetRoboticUnits\x10}\x12\x1a\n\x16\x43\x61ntTargetRoboticUnits\x10~\x12\x1d\n\x19MustTargetMechanicalUnits\x10\x7f\x12\x1e\n\x19\x43\x61ntTargetMechanicalUnits\x10\x80\x01\x12\x1b\n\x16MustTargetPsionicUnits\x10\x81\x01\x12\x1b\n\x16\x43\x61ntTargetPsionicUnits\x10\x82\x01\x12\x1b\n\x16MustTargetMassiveUnits\x10\x83\x01\x12\x1b\n\x16\x43\x61ntTargetMassiveUnits\x10\x84\x01\x12\x16\n\x11MustTargetMissile\x10\x85\x01\x12\x16\n\x11\x43\x61ntTargetMissile\x10\x86\x01\x12\x1a\n\x15MustTargetWorkerUnits\x10\x87\x01\x12\x1a\n\x15\x43\x61ntTargetWorkerUnits\x10\x88\x01\x12!\n\x1cMustTargetEnergyCapableUnits\x10\x89\x01\x12!\n\x1c\x43\x61ntTargetEnergyCapableUnits\x10\x8a\x01\x12!\n\x1cMustTargetShieldCapableUnits\x10\x8b\x01\x12!\n\x1c\x43\x61ntTargetShieldCapableUnits\x10\x8c\x01\x12\x15\n\x10MustTargetFlyers\x10\x8d\x01\x12\x15\n\x10\x43\x61ntTargetFlyers\x10\x8e\x01\x12\x1a\n\x15MustTargetBuriedUnits\x10\x8f\x01\x12\x1a\n\x15\x43\x61ntTargetBuriedUnits\x10\x90\x01\x12\x1b\n\x16MustTargetCloakedUnits\x10\x91\x01\x12\x1b\n\x16\x43\x61ntTargetCloakedUnits\x10\x92\x01\x12\"\n\x1dMustTargetUnitsInAStasisField\x10\x93\x01\x12\"\n\x1d\x43\x61ntTargetUnitsInAStasisField\x10\x94\x01\x12%\n MustTargetUnderConstructionUnits\x10\x95\x01\x12%\n CantTargetUnderConstructionUnits\x10\x96\x01\x12\x18\n\x13MustTargetDeadUnits\x10\x97\x01\x12\x18\n\x13\x43\x61ntTargetDeadUnits\x10\x98\x01\x12\x1d\n\x18MustTargetRevivableUnits\x10\x99\x01\x12\x1d\n\x18\x43\x61ntTargetRevivableUnits\x10\x9a\x01\x12\x1a\n\x15MustTargetHiddenUnits\x10\x9b\x01\x12\x1a\n\x15\x43\x61ntTargetHiddenUnits\x10\x9c\x01\x12\"\n\x1d\x43\x61ntRechargeOtherPlayersUnits\x10\x9d\x01\x12\x1d\n\x18MustTargetHallucinations\x10\x9e\x01\x12\x1d\n\x18\x43\x61ntTargetHallucinations\x10\x9f\x01\x12 \n\x1bMustTargetInvulnerableUnits\x10\xa0\x01\x12 \n\x1b\x43\x61ntTargetInvulnerableUnits\x10\xa1\x01\x12\x1c\n\x17MustTargetDetectedUnits\x10\xa2\x01\x12\x1c\n\x17\x43\x61ntTargetDetectedUnits\x10\xa3\x01\x12\x1d\n\x18\x43\x61ntTargetUnitWithEnergy\x10\xa4\x01\x12\x1e\n\x19\x43\x61ntTargetUnitWithShields\x10\xa5\x01\x12!\n\x1cMustTargetUncommandableUnits\x10\xa6\x01\x12!\n\x1c\x43\x61ntTargetUncommandableUnits\x10\xa7\x01\x12!\n\x1cMustTargetPreventDefeatUnits\x10\xa8\x01\x12!\n\x1c\x43\x61ntTargetPreventDefeatUnits\x10\xa9\x01\x12!\n\x1cMustTargetPreventRevealUnits\x10\xaa\x01\x12!\n\x1c\x43\x61ntTargetPreventRevealUnits\x10\xab\x01\x12\x1b\n\x16MustTargetPassiveUnits\x10\xac\x01\x12\x1b\n\x16\x43\x61ntTargetPassiveUnits\x10\xad\x01\x12\x1b\n\x16MustTargetStunnedUnits\x10\xae\x01\x12\x1b\n\x16\x43\x61ntTargetStunnedUnits\x10\xaf\x01\x12\x1c\n\x17MustTargetSummonedUnits\x10\xb0\x01\x12\x1c\n\x17\x43\x61ntTargetSummonedUnits\x10\xb1\x01\x12\x14\n\x0fMustTargetUser1\x10\xb2\x01\x12\x14\n\x0f\x43\x61ntTargetUser1\x10\xb3\x01\x12\x1f\n\x1aMustTargetUnstoppableUnits\x10\xb4\x01\x12\x1f\n\x1a\x43\x61ntTargetUnstoppableUnits\x10\xb5\x01\x12\x1d\n\x18MustTargetResistantUnits\x10\xb6\x01\x12\x1d\n\x18\x43\x61ntTargetResistantUnits\x10\xb7\x01\x12\x19\n\x14MustTargetDazedUnits\x10\xb8\x01\x12\x19\n\x14\x43\x61ntTargetDazedUnits\x10\xb9\x01\x12\x11\n\x0c\x43\x61ntLockdown\x10\xba\x01\x12\x14\n\x0f\x43\x61ntMindControl\x10\xbb\x01\x12\x1c\n\x17MustTargetDestructibles\x10\xbc\x01\x12\x1c\n\x17\x43\x61ntTargetDestructibles\x10\xbd\x01\x12\x14\n\x0fMustTargetItems\x10\xbe\x01\x12\x14\n\x0f\x43\x61ntTargetItems\x10\xbf\x01\x12\x18\n\x13NoCalldownAvailable\x10\xc0\x01\x12\x15\n\x10WaypointListFull\x10\xc1\x01\x12\x13\n\x0eMustTargetRace\x10\xc2\x01\x12\x13\n\x0e\x43\x61ntTargetRace\x10\xc3\x01\x12\x1b\n\x16MustTargetSimilarUnits\x10\xc4\x01\x12\x1b\n\x16\x43\x61ntTargetSimilarUnits\x10\xc5\x01\x12\x1a\n\x15\x43\x61ntFindEnoughTargets\x10\xc6\x01\x12\x19\n\x14\x41lreadySpawningLarva\x10\xc7\x01\x12!\n\x1c\x43\x61ntTargetExhaustedResources\x10\xc8\x01\x12\x13\n\x0e\x43\x61ntUseMinimap\x10\xc9\x01\x12\x15\n\x10\x43\x61ntUseInfoPanel\x10\xca\x01\x12\x15\n\x10OrderQueueIsFull\x10\xcb\x01\x12\x1c\n\x17\x43\x61ntHarvestThatResource\x10\xcc\x01\x12\x1a\n\x15HarvestersNotRequired\x10\xcd\x01\x12\x14\n\x0f\x41lreadyTargeted\x10\xce\x01\x12\x1e\n\x19\x43\x61ntAttackWeaponsDisabled\x10\xcf\x01\x12\x17\n\x12\x43ouldntReachTarget\x10\xd0\x01\x12\x17\n\x12TargetIsOutOfRange\x10\xd1\x01\x12\x15\n\x10TargetIsTooClose\x10\xd2\x01\x12\x15\n\x10TargetIsOutOfArc\x10\xd3\x01\x12\x1d\n\x18\x43\x61ntFindTeleportLocation\x10\xd4\x01\x12\x15\n\x10InvalidItemClass\x10\xd5\x01\x12\x18\n\x13\x43\x61ntFindCancelOrder\x10\xd6\x01"
|
9
|
+
|
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
|
33
|
+
|
34
|
+
module Api
|
35
|
+
ActionResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("Api.ActionResult").enummodule
|
36
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Api
|
2
|
+
# Adds additional functionality and fixes quirks with color specifically pertaining to debug commands
|
3
|
+
module ColorExtension
|
4
|
+
# For lines: r & b are swapped.
|
5
|
+
def initialize(r:, g:, b:)
|
6
|
+
super(r: b, g: g, b: r)
|
7
|
+
end
|
8
|
+
|
9
|
+
# Adds additional functionality to message class Api::Color
|
10
|
+
module ClassMethods
|
11
|
+
# Creates a new Api::Color object with random rgb values
|
12
|
+
# @return [Api::Color] random color
|
13
|
+
def random
|
14
|
+
Api::Color.new(r: rand(0..255), g: rand(0..255), b: rand(0..255))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
Api::Color.include Api::ColorExtension
|
20
|
+
Api::Color.extend Api::ColorExtension::ClassMethods
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Api
|
2
|
+
# Adds additional functionality to message object Api::Point
|
3
|
+
module PointExtension
|
4
|
+
# Creates a Point2D using x and y
|
5
|
+
# @return [Api::Point2D]
|
6
|
+
def to_p2d
|
7
|
+
Api::Point2D.new(x: x, y: y)
|
8
|
+
end
|
9
|
+
|
10
|
+
# Adds additional functionality to message class Api::Point
|
11
|
+
module ClassMethods
|
12
|
+
# Shorthand for creating an instance for [x, y, z]
|
13
|
+
# @example
|
14
|
+
# Api::Point[1,2,3] # Where x is 1.0, y is 2.0 and z is 3.0
|
15
|
+
# @return [Api::Point]
|
16
|
+
def [](x, y, z)
|
17
|
+
Api::Point.new(x: x, y: y, z: z)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
Api::Point.include Api::PointExtension
|
23
|
+
Api::Point.include Api::PointExtension::ClassMethods
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Api
|
2
|
+
# Adds additional functionality to message object Api::Point2D
|
3
|
+
module Point2DExtension
|
4
|
+
# @private
|
5
|
+
def hash
|
6
|
+
[x, y].hash
|
7
|
+
end
|
8
|
+
|
9
|
+
def eql?(other)
|
10
|
+
self.class == other.class && hash == other.hash
|
11
|
+
end
|
12
|
+
|
13
|
+
# Adds additional functionality to message class Api::Point2D
|
14
|
+
module ClassMethods
|
15
|
+
# Shorthand for creating an instance for [x, y]
|
16
|
+
# @example
|
17
|
+
# Api::Point2D[2,4] # Where x is 2.0 and y is 4.0
|
18
|
+
# @return [Api::Point2D]
|
19
|
+
def [](x, y)
|
20
|
+
Api::Point2D.new(x: x, y: y)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
Api::Point2D.include Api::Point2DExtension
|
26
|
+
Api::Point2D.extend Api::Point2DExtension::ClassMethods
|