sc2ai 0.0.8 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/sc2ai/protocol/raw.proto +1 -1
- data/data/sc2ai/protocol/ui.proto +1 -1
- data/lib/docker_build/Dockerfile.ruby +1 -1
- data/lib/sc2ai/cli/cli.rb +1 -1
- data/lib/sc2ai/connection.rb +1 -0
- data/lib/sc2ai/local_play/client_manager.rb +2 -0
- data/lib/sc2ai/local_play/match.rb +0 -11
- data/lib/sc2ai/paths.rb +1 -1
- data/lib/sc2ai/player/{geometry.rb → geo.rb} +39 -3
- data/lib/sc2ai/player/units.rb +7 -1
- data/lib/sc2ai/player.rb +6 -41
- data/lib/sc2ai/protocol/extensions/color.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit_type.rb +3 -3
- data/lib/sc2ai/unit_group/action_ext.rb +2 -2
- data/lib/sc2ai/unit_group/filter_ext.rb +20 -0
- data/lib/sc2ai/version.rb +1 -1
- data/lib/sc2ai.rb +0 -7
- data/lib/templates/new/api/raw.proto +1 -1
- data/lib/templates/new/api/ui.proto +1 -1
- data/sig/sc2ai.rbs +798 -950
- metadata +46 -19
- data/lib/sc2ai/data.rb +0 -101
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sc2ai
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dyson Returns
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.17.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.17.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: async-websocket
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: '0.30'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: '0.30'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: google-protobuf
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.
|
47
|
+
version: '4.28'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.
|
54
|
+
version: '4.28'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: async-process
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.3
|
61
|
+
version: '1.3'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.3
|
68
|
+
version: '1.3'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: thor
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3
|
75
|
+
version: '1.3'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3
|
82
|
+
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: numo-narray
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.29
|
117
|
+
version: '0.29'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.29
|
124
|
+
version: '0.29'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: sc2ai-kdtree
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,6 +164,34 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.9.36
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: abbrev
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 0.1.2
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 0.1.2
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: ostruct
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - "~>"
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 0.6.0
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - "~>"
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 0.6.0
|
167
195
|
- !ruby/object:Gem::Dependency
|
168
196
|
name: webrick
|
169
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,14 +226,14 @@ dependencies:
|
|
198
226
|
requirements:
|
199
227
|
- - "~>"
|
200
228
|
- !ruby/object:Gem::Version
|
201
|
-
version: '1.
|
229
|
+
version: '1.40'
|
202
230
|
type: :development
|
203
231
|
prerelease: false
|
204
232
|
version_requirements: !ruby/object:Gem::Requirement
|
205
233
|
requirements:
|
206
234
|
- - "~>"
|
207
235
|
- !ruby/object:Gem::Version
|
208
|
-
version: '1.
|
236
|
+
version: '1.40'
|
209
237
|
- !ruby/object:Gem::Dependency
|
210
238
|
name: factory_bot
|
211
239
|
requirement: !ruby/object:Gem::Requirement
|
@@ -321,7 +349,6 @@ files:
|
|
321
349
|
- lib/sc2ai/connection/connection_listener.rb
|
322
350
|
- lib/sc2ai/connection/requests.rb
|
323
351
|
- lib/sc2ai/connection/status_listener.rb
|
324
|
-
- lib/sc2ai/data.rb
|
325
352
|
- lib/sc2ai/local_play/client.rb
|
326
353
|
- lib/sc2ai/local_play/client/configurable_options.rb
|
327
354
|
- lib/sc2ai/local_play/client_manager.rb
|
@@ -335,7 +362,7 @@ files:
|
|
335
362
|
- lib/sc2ai/player/actions.rb
|
336
363
|
- lib/sc2ai/player/debug.rb
|
337
364
|
- lib/sc2ai/player/game_state.rb
|
338
|
-
- lib/sc2ai/player/
|
365
|
+
- lib/sc2ai/player/geo.rb
|
339
366
|
- lib/sc2ai/player/previous_state.rb
|
340
367
|
- lib/sc2ai/player/units.rb
|
341
368
|
- lib/sc2ai/ports.rb
|
@@ -405,7 +432,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
405
432
|
- !ruby/object:Gem::Version
|
406
433
|
version: '0'
|
407
434
|
requirements: []
|
408
|
-
rubygems_version: 3.5.
|
435
|
+
rubygems_version: 3.5.18
|
409
436
|
signing_key:
|
410
437
|
specification_version: 4
|
411
438
|
summary: STARCRAFT® II AI API
|
data/lib/sc2ai/data.rb
DELETED
@@ -1,101 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require_relative "api/ability_id"
|
4
|
-
require_relative "api/unit_type_id"
|
5
|
-
require_relative "api/upgrade_id"
|
6
|
-
require_relative "api/buff_id"
|
7
|
-
require_relative "api/effect_id"
|
8
|
-
require_relative "api/tech_tree"
|
9
|
-
|
10
|
-
module Sc2
|
11
|
-
# Holds game data from tech tree and Api::ResponseData
|
12
|
-
# Called once on game start
|
13
|
-
class Data
|
14
|
-
# @!attribute abilities
|
15
|
-
# @return [Hash<Integer, Api::AbilityData]>] AbilitId => AbilityData
|
16
|
-
attr_accessor :abilities
|
17
|
-
# @!attribute units
|
18
|
-
# @return [Hash<Integer, Api::UnitTypeData>] UnitId => UnitData
|
19
|
-
attr_accessor :units
|
20
|
-
# @!attribute upgrades
|
21
|
-
# @return [Hash<Integer, Api::UpgradeData>] UpgradeId => UpgradeData
|
22
|
-
attr_accessor :upgrades
|
23
|
-
# @!attribute buffs
|
24
|
-
# Not particularly useful data. Just use BuffId directly
|
25
|
-
# @return [Hash<Integer, Api::UpgradeData>] BuffId => BuffData
|
26
|
-
attr_accessor :buffs
|
27
|
-
# @!attribute effects
|
28
|
-
# Not particularly useful data. Just use EffectId directly
|
29
|
-
# @return [Hash<Integer, Api::UpgradeData>] EffectId => EffectData
|
30
|
-
attr_accessor :effects
|
31
|
-
|
32
|
-
# @param data [Api::ResponseData]
|
33
|
-
def initialize(data)
|
34
|
-
return unless data
|
35
|
-
|
36
|
-
@abilities = abilities_from_proto(data.abilities)
|
37
|
-
@units = units_from_proto(data.units)
|
38
|
-
@upgrades = upgrades_from_proto(data.upgrades)
|
39
|
-
@buffs = buffs_from_proto(data.buffs)
|
40
|
-
@effects = effects_from_proto(data.effects)
|
41
|
-
end
|
42
|
-
|
43
|
-
private
|
44
|
-
|
45
|
-
# Indexes ability data by ability id
|
46
|
-
# @param abilities [Array<Api::AbilityData>]
|
47
|
-
# @return [Hash<Integer, Api::AbilityData] indexed data
|
48
|
-
def abilities_from_proto(abilities)
|
49
|
-
result = {}
|
50
|
-
|
51
|
-
ability_ids = Api::AbilityId.constants.map { |c| Api::AbilityId.const_get(c) }
|
52
|
-
abilities.each do |a|
|
53
|
-
next if a.ability_id.zero?
|
54
|
-
next if ability_ids.delete(a.ability_id).nil?
|
55
|
-
|
56
|
-
result[a.ability_id] = a
|
57
|
-
end
|
58
|
-
result
|
59
|
-
end
|
60
|
-
|
61
|
-
# Indexes unit data by id
|
62
|
-
# @param units [Array<Api::UnitTypeData>]
|
63
|
-
# @return [Hash<Integer, Api::UnitTypeData>] indexed data
|
64
|
-
def units_from_proto(units)
|
65
|
-
result = {}
|
66
|
-
units.each do |u|
|
67
|
-
next unless u.available
|
68
|
-
|
69
|
-
result[u.unit_id] = u
|
70
|
-
end
|
71
|
-
result
|
72
|
-
end
|
73
|
-
|
74
|
-
# Indexes upgrades data by id
|
75
|
-
# @param upgrades [Array<Api::UpgradeData>]
|
76
|
-
# @return [Hash<Integer, Api::UpgradeData] indexed data
|
77
|
-
def upgrades_from_proto(upgrades)
|
78
|
-
result = {}
|
79
|
-
upgrades.each do |u|
|
80
|
-
result[u.upgrade_id] = u
|
81
|
-
end
|
82
|
-
result
|
83
|
-
end
|
84
|
-
|
85
|
-
def effects_from_proto(effects)
|
86
|
-
result = {}
|
87
|
-
effects.each do |e|
|
88
|
-
result[e.effect_id] = e
|
89
|
-
end
|
90
|
-
result
|
91
|
-
end
|
92
|
-
|
93
|
-
def buffs_from_proto(buffs)
|
94
|
-
result = {}
|
95
|
-
buffs.each do |b|
|
96
|
-
result[b.buff_id] = b
|
97
|
-
end
|
98
|
-
result
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|