sc2ai 0.4.3 → 0.5.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/lib/sc2ai/local_play/client.rb +1 -1
- data/lib/sc2ai/local_play/match.rb +1 -0
- data/lib/sc2ai/overrides/async/process/child.rb +2 -1
- data/lib/sc2ai/paths.rb +0 -1
- data/lib/sc2ai/player.rb +9 -0
- data/lib/sc2ai/protocol/common_pb.rb +208 -77
- data/lib/sc2ai/protocol/data_pb.rb +514 -304
- data/lib/sc2ai/protocol/debug_pb.rb +544 -198
- data/lib/sc2ai/protocol/error_pb.rb +430 -862
- data/lib/sc2ai/protocol/extensions/action.rb +1 -1
- data/lib/sc2ai/protocol/extensions/color.rb +1 -1
- data/lib/sc2ai/protocol/extensions/point.rb +1 -1
- data/lib/sc2ai/protocol/extensions/point_2_d.rb +1 -1
- data/lib/sc2ai/protocol/extensions/point_distance.rb +4 -4
- data/lib/sc2ai/protocol/extensions/position.rb +20 -0
- data/lib/sc2ai/protocol/extensions/power_source.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit.rb +1 -1
- data/lib/sc2ai/protocol/extensions/unit_type_data.rb +1 -1
- data/lib/sc2ai/protocol/query_pb.rb +270 -56
- data/lib/sc2ai/protocol/raw_pb.rb +917 -341
- data/lib/sc2ai/protocol/sc2api_pb.rb +2901 -1079
- data/lib/sc2ai/protocol/score_pb.rb +300 -87
- data/lib/sc2ai/protocol/spatial_pb.rb +611 -109
- data/lib/sc2ai/protocol/ui_pb.rb +717 -214
- data/lib/sc2ai/version.rb +1 -1
- data/sig/sc2ai.rbs +1361 -23
- metadata +2 -2
|
@@ -17,23 +17,15 @@ module Api
|
|
|
17
17
|
MELEE = 2
|
|
18
18
|
|
|
19
19
|
def self.lookup(val)
|
|
20
|
-
if val == 0
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
:CURRICULUM
|
|
24
|
-
elsif val == 2
|
|
25
|
-
:MELEE
|
|
26
|
-
end
|
|
20
|
+
return :ENUM_SCORE_TYPE_UNSET if val == 0
|
|
21
|
+
return :CURRICULUM if val == 1
|
|
22
|
+
return :MELEE if val == 2
|
|
27
23
|
end
|
|
28
24
|
|
|
29
25
|
def self.resolve(val)
|
|
30
|
-
if val == :ENUM_SCORE_TYPE_UNSET
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
1
|
|
34
|
-
elsif val == :MELEE
|
|
35
|
-
2
|
|
36
|
-
end
|
|
26
|
+
return 0 if val == :ENUM_SCORE_TYPE_UNSET
|
|
27
|
+
return 1 if val == :CURRICULUM
|
|
28
|
+
return 2 if val == :MELEE
|
|
37
29
|
end
|
|
38
30
|
end
|
|
39
31
|
# required field readers
|
|
@@ -51,6 +43,7 @@ module Api
|
|
|
51
43
|
# enum writers
|
|
52
44
|
def score_type=(v)
|
|
53
45
|
@score_type = Api::Score::ScoreType.resolve(v) || v
|
|
46
|
+
@_bitmask |= 0x0000000000000001
|
|
54
47
|
end
|
|
55
48
|
|
|
56
49
|
# BEGIN writers for optional fields
|
|
@@ -104,6 +97,10 @@ module Api
|
|
|
104
97
|
self.class.encode(self)
|
|
105
98
|
end
|
|
106
99
|
|
|
100
|
+
def has_score_type?
|
|
101
|
+
(@_bitmask & 0x0000000000000001) == 0x0000000000000001
|
|
102
|
+
end
|
|
103
|
+
|
|
107
104
|
def has_score?
|
|
108
105
|
(@_bitmask & 0x0000000000000002) == 0x0000000000000002
|
|
109
106
|
end
|
|
@@ -181,7 +178,7 @@ module Api
|
|
|
181
178
|
|
|
182
179
|
unknown_bytes = +"".b
|
|
183
180
|
val = tag
|
|
184
|
-
|
|
181
|
+
loop do
|
|
185
182
|
byte = val & 0x7F
|
|
186
183
|
|
|
187
184
|
val >>= 7
|
|
@@ -192,6 +189,7 @@ module Api
|
|
|
192
189
|
|
|
193
190
|
byte |= 0x80 if val != 0
|
|
194
191
|
unknown_bytes << byte
|
|
192
|
+
break if val == 0
|
|
195
193
|
end
|
|
196
194
|
|
|
197
195
|
case wire_type
|
|
@@ -266,7 +264,7 @@ module Api
|
|
|
266
264
|
end
|
|
267
265
|
|
|
268
266
|
val = value
|
|
269
|
-
|
|
267
|
+
loop do
|
|
270
268
|
byte = val & 0x7F
|
|
271
269
|
|
|
272
270
|
val >>= 7
|
|
@@ -277,6 +275,7 @@ module Api
|
|
|
277
275
|
|
|
278
276
|
byte |= 0x80 if val != 0
|
|
279
277
|
unknown_bytes << byte
|
|
278
|
+
break if val == 0
|
|
280
279
|
end
|
|
281
280
|
|
|
282
281
|
unknown_bytes << buff.byteslice(index, value)
|
|
@@ -706,10 +705,10 @@ module Api
|
|
|
706
705
|
end
|
|
707
706
|
def _encode(buff)
|
|
708
707
|
val = @score_type
|
|
709
|
-
if
|
|
708
|
+
if has_score_type?
|
|
710
709
|
buff << 0x30
|
|
711
710
|
|
|
712
|
-
|
|
711
|
+
loop do
|
|
713
712
|
byte = val & 0x7F
|
|
714
713
|
|
|
715
714
|
val >>= 7
|
|
@@ -720,14 +719,15 @@ module Api
|
|
|
720
719
|
|
|
721
720
|
byte |= 0x80 if val != 0
|
|
722
721
|
buff << byte
|
|
722
|
+
break if val == 0
|
|
723
723
|
end
|
|
724
724
|
end
|
|
725
725
|
|
|
726
726
|
val = @score
|
|
727
|
-
if
|
|
727
|
+
if has_score?
|
|
728
728
|
buff << 0x38
|
|
729
729
|
|
|
730
|
-
|
|
730
|
+
loop do
|
|
731
731
|
byte = val & 0x7F
|
|
732
732
|
|
|
733
733
|
val >>= 7
|
|
@@ -738,6 +738,7 @@ module Api
|
|
|
738
738
|
|
|
739
739
|
byte |= 0x80 if val != 0
|
|
740
740
|
buff << byte
|
|
741
|
+
break if val == 0
|
|
741
742
|
end
|
|
742
743
|
end
|
|
743
744
|
|
|
@@ -794,11 +795,34 @@ module Api
|
|
|
794
795
|
|
|
795
796
|
def to_h
|
|
796
797
|
result = {}
|
|
797
|
-
|
|
798
|
-
result["
|
|
799
|
-
result["
|
|
798
|
+
|
|
799
|
+
result[:"score_type"] = @score_type
|
|
800
|
+
result[:"score"] = @score
|
|
801
|
+
result[:"score_details"] = @score_details.to_h
|
|
802
|
+
|
|
800
803
|
result
|
|
801
804
|
end
|
|
805
|
+
|
|
806
|
+
def as_json(options = {})
|
|
807
|
+
result = {}
|
|
808
|
+
|
|
809
|
+
result["scoreType"] = @score_type if !options[:compact] || has_score_type?
|
|
810
|
+
result["score"] = @score if !options[:compact] || has_score?
|
|
811
|
+
result["scoreDetails"] = (
|
|
812
|
+
if @score_details.nil?
|
|
813
|
+
{}
|
|
814
|
+
else
|
|
815
|
+
@score_details.as_json(options)
|
|
816
|
+
end
|
|
817
|
+
) if !options[:compact] || has_score_details?
|
|
818
|
+
|
|
819
|
+
result
|
|
820
|
+
end
|
|
821
|
+
|
|
822
|
+
def to_json(as_json_options = {})
|
|
823
|
+
require "json"
|
|
824
|
+
JSON.dump(as_json(as_json_options))
|
|
825
|
+
end
|
|
802
826
|
end
|
|
803
827
|
class CategoryScoreDetails
|
|
804
828
|
def self.decode(buff)
|
|
@@ -990,7 +1014,7 @@ module Api
|
|
|
990
1014
|
|
|
991
1015
|
unknown_bytes = +"".b
|
|
992
1016
|
val = tag
|
|
993
|
-
|
|
1017
|
+
loop do
|
|
994
1018
|
byte = val & 0x7F
|
|
995
1019
|
|
|
996
1020
|
val >>= 7
|
|
@@ -1001,6 +1025,7 @@ module Api
|
|
|
1001
1025
|
|
|
1002
1026
|
byte |= 0x80 if val != 0
|
|
1003
1027
|
unknown_bytes << byte
|
|
1028
|
+
break if val == 0
|
|
1004
1029
|
end
|
|
1005
1030
|
|
|
1006
1031
|
case wire_type
|
|
@@ -1075,7 +1100,7 @@ module Api
|
|
|
1075
1100
|
end
|
|
1076
1101
|
|
|
1077
1102
|
val = value
|
|
1078
|
-
|
|
1103
|
+
loop do
|
|
1079
1104
|
byte = val & 0x7F
|
|
1080
1105
|
|
|
1081
1106
|
val >>= 7
|
|
@@ -1086,6 +1111,7 @@ module Api
|
|
|
1086
1111
|
|
|
1087
1112
|
byte |= 0x80 if val != 0
|
|
1088
1113
|
unknown_bytes << byte
|
|
1114
|
+
break if val == 0
|
|
1089
1115
|
end
|
|
1090
1116
|
|
|
1091
1117
|
unknown_bytes << buff.byteslice(index, value)
|
|
@@ -1448,35 +1474,35 @@ module Api
|
|
|
1448
1474
|
end
|
|
1449
1475
|
def _encode(buff)
|
|
1450
1476
|
val = @none
|
|
1451
|
-
if
|
|
1477
|
+
if has_none?
|
|
1452
1478
|
buff << 0x0d
|
|
1453
1479
|
|
|
1454
1480
|
[val].pack("e", buffer: buff)
|
|
1455
1481
|
end
|
|
1456
1482
|
|
|
1457
1483
|
val = @army
|
|
1458
|
-
if
|
|
1484
|
+
if has_army?
|
|
1459
1485
|
buff << 0x15
|
|
1460
1486
|
|
|
1461
1487
|
[val].pack("e", buffer: buff)
|
|
1462
1488
|
end
|
|
1463
1489
|
|
|
1464
1490
|
val = @economy
|
|
1465
|
-
if
|
|
1491
|
+
if has_economy?
|
|
1466
1492
|
buff << 0x1d
|
|
1467
1493
|
|
|
1468
1494
|
[val].pack("e", buffer: buff)
|
|
1469
1495
|
end
|
|
1470
1496
|
|
|
1471
1497
|
val = @technology
|
|
1472
|
-
if
|
|
1498
|
+
if has_technology?
|
|
1473
1499
|
buff << 0x25
|
|
1474
1500
|
|
|
1475
1501
|
[val].pack("e", buffer: buff)
|
|
1476
1502
|
end
|
|
1477
1503
|
|
|
1478
1504
|
val = @upgrade
|
|
1479
|
-
if
|
|
1505
|
+
if has_upgrade?
|
|
1480
1506
|
buff << 0x2d
|
|
1481
1507
|
|
|
1482
1508
|
[val].pack("e", buffer: buff)
|
|
@@ -1487,13 +1513,33 @@ module Api
|
|
|
1487
1513
|
|
|
1488
1514
|
def to_h
|
|
1489
1515
|
result = {}
|
|
1490
|
-
|
|
1491
|
-
result["
|
|
1492
|
-
result["
|
|
1493
|
-
result["
|
|
1494
|
-
result["
|
|
1516
|
+
|
|
1517
|
+
result[:"none"] = @none
|
|
1518
|
+
result[:"army"] = @army
|
|
1519
|
+
result[:"economy"] = @economy
|
|
1520
|
+
result[:"technology"] = @technology
|
|
1521
|
+
result[:"upgrade"] = @upgrade
|
|
1522
|
+
|
|
1523
|
+
result
|
|
1524
|
+
end
|
|
1525
|
+
|
|
1526
|
+
def as_json(options = {})
|
|
1527
|
+
result = {}
|
|
1528
|
+
|
|
1529
|
+
result["none"] = @none if !options[:compact] || has_none?
|
|
1530
|
+
result["army"] = @army if !options[:compact] || has_army?
|
|
1531
|
+
result["economy"] = @economy if !options[:compact] || has_economy?
|
|
1532
|
+
result["technology"] = @technology if !options[:compact] ||
|
|
1533
|
+
has_technology?
|
|
1534
|
+
result["upgrade"] = @upgrade if !options[:compact] || has_upgrade?
|
|
1535
|
+
|
|
1495
1536
|
result
|
|
1496
1537
|
end
|
|
1538
|
+
|
|
1539
|
+
def to_json(as_json_options = {})
|
|
1540
|
+
require "json"
|
|
1541
|
+
JSON.dump(as_json(as_json_options))
|
|
1542
|
+
end
|
|
1497
1543
|
end
|
|
1498
1544
|
class VitalScoreDetails
|
|
1499
1545
|
def self.decode(buff)
|
|
@@ -1641,7 +1687,7 @@ module Api
|
|
|
1641
1687
|
|
|
1642
1688
|
unknown_bytes = +"".b
|
|
1643
1689
|
val = tag
|
|
1644
|
-
|
|
1690
|
+
loop do
|
|
1645
1691
|
byte = val & 0x7F
|
|
1646
1692
|
|
|
1647
1693
|
val >>= 7
|
|
@@ -1652,6 +1698,7 @@ module Api
|
|
|
1652
1698
|
|
|
1653
1699
|
byte |= 0x80 if val != 0
|
|
1654
1700
|
unknown_bytes << byte
|
|
1701
|
+
break if val == 0
|
|
1655
1702
|
end
|
|
1656
1703
|
|
|
1657
1704
|
case wire_type
|
|
@@ -1726,7 +1773,7 @@ module Api
|
|
|
1726
1773
|
end
|
|
1727
1774
|
|
|
1728
1775
|
val = value
|
|
1729
|
-
|
|
1776
|
+
loop do
|
|
1730
1777
|
byte = val & 0x7F
|
|
1731
1778
|
|
|
1732
1779
|
val >>= 7
|
|
@@ -1737,6 +1784,7 @@ module Api
|
|
|
1737
1784
|
|
|
1738
1785
|
byte |= 0x80 if val != 0
|
|
1739
1786
|
unknown_bytes << byte
|
|
1787
|
+
break if val == 0
|
|
1740
1788
|
end
|
|
1741
1789
|
|
|
1742
1790
|
unknown_bytes << buff.byteslice(index, value)
|
|
@@ -1983,21 +2031,21 @@ module Api
|
|
|
1983
2031
|
end
|
|
1984
2032
|
def _encode(buff)
|
|
1985
2033
|
val = @life
|
|
1986
|
-
if
|
|
2034
|
+
if has_life?
|
|
1987
2035
|
buff << 0x0d
|
|
1988
2036
|
|
|
1989
2037
|
[val].pack("e", buffer: buff)
|
|
1990
2038
|
end
|
|
1991
2039
|
|
|
1992
2040
|
val = @shields
|
|
1993
|
-
if
|
|
2041
|
+
if has_shields?
|
|
1994
2042
|
buff << 0x15
|
|
1995
2043
|
|
|
1996
2044
|
[val].pack("e", buffer: buff)
|
|
1997
2045
|
end
|
|
1998
2046
|
|
|
1999
2047
|
val = @energy
|
|
2000
|
-
if
|
|
2048
|
+
if has_energy?
|
|
2001
2049
|
buff << 0x1d
|
|
2002
2050
|
|
|
2003
2051
|
[val].pack("e", buffer: buff)
|
|
@@ -2008,11 +2056,28 @@ module Api
|
|
|
2008
2056
|
|
|
2009
2057
|
def to_h
|
|
2010
2058
|
result = {}
|
|
2011
|
-
|
|
2012
|
-
result["
|
|
2013
|
-
result["
|
|
2059
|
+
|
|
2060
|
+
result[:"life"] = @life
|
|
2061
|
+
result[:"shields"] = @shields
|
|
2062
|
+
result[:"energy"] = @energy
|
|
2063
|
+
|
|
2014
2064
|
result
|
|
2015
2065
|
end
|
|
2066
|
+
|
|
2067
|
+
def as_json(options = {})
|
|
2068
|
+
result = {}
|
|
2069
|
+
|
|
2070
|
+
result["life"] = @life if !options[:compact] || has_life?
|
|
2071
|
+
result["shields"] = @shields if !options[:compact] || has_shields?
|
|
2072
|
+
result["energy"] = @energy if !options[:compact] || has_energy?
|
|
2073
|
+
|
|
2074
|
+
result
|
|
2075
|
+
end
|
|
2076
|
+
|
|
2077
|
+
def to_json(as_json_options = {})
|
|
2078
|
+
require "json"
|
|
2079
|
+
JSON.dump(as_json(as_json_options))
|
|
2080
|
+
end
|
|
2016
2081
|
end
|
|
2017
2082
|
class ScoreDetails
|
|
2018
2083
|
def self.decode(buff)
|
|
@@ -2664,7 +2729,7 @@ module Api
|
|
|
2664
2729
|
|
|
2665
2730
|
unknown_bytes = +"".b
|
|
2666
2731
|
val = tag
|
|
2667
|
-
|
|
2732
|
+
loop do
|
|
2668
2733
|
byte = val & 0x7F
|
|
2669
2734
|
|
|
2670
2735
|
val >>= 7
|
|
@@ -2675,6 +2740,7 @@ module Api
|
|
|
2675
2740
|
|
|
2676
2741
|
byte |= 0x80 if val != 0
|
|
2677
2742
|
unknown_bytes << byte
|
|
2743
|
+
break if val == 0
|
|
2678
2744
|
end
|
|
2679
2745
|
|
|
2680
2746
|
case wire_type
|
|
@@ -2749,7 +2815,7 @@ module Api
|
|
|
2749
2815
|
end
|
|
2750
2816
|
|
|
2751
2817
|
val = value
|
|
2752
|
-
|
|
2818
|
+
loop do
|
|
2753
2819
|
byte = val & 0x7F
|
|
2754
2820
|
|
|
2755
2821
|
val >>= 7
|
|
@@ -2760,6 +2826,7 @@ module Api
|
|
|
2760
2826
|
|
|
2761
2827
|
byte |= 0x80 if val != 0
|
|
2762
2828
|
unknown_bytes << byte
|
|
2829
|
+
break if val == 0
|
|
2763
2830
|
end
|
|
2764
2831
|
|
|
2765
2832
|
unknown_bytes << buff.byteslice(index, value)
|
|
@@ -5282,84 +5349,84 @@ module Api
|
|
|
5282
5349
|
end
|
|
5283
5350
|
def _encode(buff)
|
|
5284
5351
|
val = @idle_production_time
|
|
5285
|
-
if
|
|
5352
|
+
if has_idle_production_time?
|
|
5286
5353
|
buff << 0x0d
|
|
5287
5354
|
|
|
5288
5355
|
[val].pack("e", buffer: buff)
|
|
5289
5356
|
end
|
|
5290
5357
|
|
|
5291
5358
|
val = @idle_worker_time
|
|
5292
|
-
if
|
|
5359
|
+
if has_idle_worker_time?
|
|
5293
5360
|
buff << 0x15
|
|
5294
5361
|
|
|
5295
5362
|
[val].pack("e", buffer: buff)
|
|
5296
5363
|
end
|
|
5297
5364
|
|
|
5298
5365
|
val = @total_value_units
|
|
5299
|
-
if
|
|
5366
|
+
if has_total_value_units?
|
|
5300
5367
|
buff << 0x1d
|
|
5301
5368
|
|
|
5302
5369
|
[val].pack("e", buffer: buff)
|
|
5303
5370
|
end
|
|
5304
5371
|
|
|
5305
5372
|
val = @total_value_structures
|
|
5306
|
-
if
|
|
5373
|
+
if has_total_value_structures?
|
|
5307
5374
|
buff << 0x25
|
|
5308
5375
|
|
|
5309
5376
|
[val].pack("e", buffer: buff)
|
|
5310
5377
|
end
|
|
5311
5378
|
|
|
5312
5379
|
val = @killed_value_units
|
|
5313
|
-
if
|
|
5380
|
+
if has_killed_value_units?
|
|
5314
5381
|
buff << 0x2d
|
|
5315
5382
|
|
|
5316
5383
|
[val].pack("e", buffer: buff)
|
|
5317
5384
|
end
|
|
5318
5385
|
|
|
5319
5386
|
val = @killed_value_structures
|
|
5320
|
-
if
|
|
5387
|
+
if has_killed_value_structures?
|
|
5321
5388
|
buff << 0x35
|
|
5322
5389
|
|
|
5323
5390
|
[val].pack("e", buffer: buff)
|
|
5324
5391
|
end
|
|
5325
5392
|
|
|
5326
5393
|
val = @collected_minerals
|
|
5327
|
-
if
|
|
5394
|
+
if has_collected_minerals?
|
|
5328
5395
|
buff << 0x3d
|
|
5329
5396
|
|
|
5330
5397
|
[val].pack("e", buffer: buff)
|
|
5331
5398
|
end
|
|
5332
5399
|
|
|
5333
5400
|
val = @collected_vespene
|
|
5334
|
-
if
|
|
5401
|
+
if has_collected_vespene?
|
|
5335
5402
|
buff << 0x45
|
|
5336
5403
|
|
|
5337
5404
|
[val].pack("e", buffer: buff)
|
|
5338
5405
|
end
|
|
5339
5406
|
|
|
5340
5407
|
val = @collection_rate_minerals
|
|
5341
|
-
if
|
|
5408
|
+
if has_collection_rate_minerals?
|
|
5342
5409
|
buff << 0x4d
|
|
5343
5410
|
|
|
5344
5411
|
[val].pack("e", buffer: buff)
|
|
5345
5412
|
end
|
|
5346
5413
|
|
|
5347
5414
|
val = @collection_rate_vespene
|
|
5348
|
-
if
|
|
5415
|
+
if has_collection_rate_vespene?
|
|
5349
5416
|
buff << 0x55
|
|
5350
5417
|
|
|
5351
5418
|
[val].pack("e", buffer: buff)
|
|
5352
5419
|
end
|
|
5353
5420
|
|
|
5354
5421
|
val = @spent_minerals
|
|
5355
|
-
if
|
|
5422
|
+
if has_spent_minerals?
|
|
5356
5423
|
buff << 0x5d
|
|
5357
5424
|
|
|
5358
5425
|
[val].pack("e", buffer: buff)
|
|
5359
5426
|
end
|
|
5360
5427
|
|
|
5361
5428
|
val = @spent_vespene
|
|
5362
|
-
if
|
|
5429
|
+
if has_spent_vespene?
|
|
5363
5430
|
buff << 0x65
|
|
5364
5431
|
|
|
5365
5432
|
[val].pack("e", buffer: buff)
|
|
@@ -6049,7 +6116,7 @@ module Api
|
|
|
6049
6116
|
end
|
|
6050
6117
|
|
|
6051
6118
|
val = @current_apm
|
|
6052
|
-
if
|
|
6119
|
+
if has_current_apm?
|
|
6053
6120
|
buff << 0xdd
|
|
6054
6121
|
buff << 0x01
|
|
6055
6122
|
|
|
@@ -6057,7 +6124,7 @@ module Api
|
|
|
6057
6124
|
end
|
|
6058
6125
|
|
|
6059
6126
|
val = @current_effective_apm
|
|
6060
|
-
if
|
|
6127
|
+
if has_current_effective_apm?
|
|
6061
6128
|
buff << 0xe5
|
|
6062
6129
|
buff << 0x01
|
|
6063
6130
|
|
|
@@ -6069,35 +6136,181 @@ module Api
|
|
|
6069
6136
|
|
|
6070
6137
|
def to_h
|
|
6071
6138
|
result = {}
|
|
6072
|
-
|
|
6073
|
-
result["
|
|
6074
|
-
result["
|
|
6075
|
-
result["
|
|
6076
|
-
result["
|
|
6077
|
-
result["
|
|
6078
|
-
result["
|
|
6079
|
-
result["
|
|
6080
|
-
result["
|
|
6081
|
-
result["
|
|
6082
|
-
result["
|
|
6083
|
-
result["
|
|
6084
|
-
result["
|
|
6085
|
-
result["
|
|
6086
|
-
result["
|
|
6087
|
-
result["
|
|
6088
|
-
result["
|
|
6089
|
-
result["
|
|
6090
|
-
result["
|
|
6091
|
-
result["
|
|
6092
|
-
result["
|
|
6093
|
-
result["
|
|
6094
|
-
result["
|
|
6095
|
-
result["
|
|
6096
|
-
result["
|
|
6097
|
-
result["
|
|
6098
|
-
result["
|
|
6099
|
-
result["
|
|
6139
|
+
|
|
6140
|
+
result[:"idle_production_time"] = @idle_production_time
|
|
6141
|
+
result[:"idle_worker_time"] = @idle_worker_time
|
|
6142
|
+
result[:"total_value_units"] = @total_value_units
|
|
6143
|
+
result[:"total_value_structures"] = @total_value_structures
|
|
6144
|
+
result[:"killed_value_units"] = @killed_value_units
|
|
6145
|
+
result[:"killed_value_structures"] = @killed_value_structures
|
|
6146
|
+
result[:"collected_minerals"] = @collected_minerals
|
|
6147
|
+
result[:"collected_vespene"] = @collected_vespene
|
|
6148
|
+
result[:"collection_rate_minerals"] = @collection_rate_minerals
|
|
6149
|
+
result[:"collection_rate_vespene"] = @collection_rate_vespene
|
|
6150
|
+
result[:"spent_minerals"] = @spent_minerals
|
|
6151
|
+
result[:"spent_vespene"] = @spent_vespene
|
|
6152
|
+
result[:"food_used"] = @food_used.to_h
|
|
6153
|
+
result[:"killed_minerals"] = @killed_minerals.to_h
|
|
6154
|
+
result[:"killed_vespene"] = @killed_vespene.to_h
|
|
6155
|
+
result[:"lost_minerals"] = @lost_minerals.to_h
|
|
6156
|
+
result[:"lost_vespene"] = @lost_vespene.to_h
|
|
6157
|
+
result[:"friendly_fire_minerals"] = @friendly_fire_minerals.to_h
|
|
6158
|
+
result[:"friendly_fire_vespene"] = @friendly_fire_vespene.to_h
|
|
6159
|
+
result[:"used_minerals"] = @used_minerals.to_h
|
|
6160
|
+
result[:"used_vespene"] = @used_vespene.to_h
|
|
6161
|
+
result[:"total_used_minerals"] = @total_used_minerals.to_h
|
|
6162
|
+
result[:"total_used_vespene"] = @total_used_vespene.to_h
|
|
6163
|
+
result[:"total_damage_dealt"] = @total_damage_dealt.to_h
|
|
6164
|
+
result[:"total_damage_taken"] = @total_damage_taken.to_h
|
|
6165
|
+
result[:"total_healed"] = @total_healed.to_h
|
|
6166
|
+
result[:"current_apm"] = @current_apm
|
|
6167
|
+
result[:"current_effective_apm"] = @current_effective_apm
|
|
6168
|
+
|
|
6169
|
+
result
|
|
6170
|
+
end
|
|
6171
|
+
|
|
6172
|
+
def as_json(options = {})
|
|
6173
|
+
result = {}
|
|
6174
|
+
|
|
6175
|
+
result["idleProductionTime"] = @idle_production_time if !options[
|
|
6176
|
+
:compact
|
|
6177
|
+
] || has_idle_production_time?
|
|
6178
|
+
result["idleWorkerTime"] = @idle_worker_time if !options[:compact] ||
|
|
6179
|
+
has_idle_worker_time?
|
|
6180
|
+
result["totalValueUnits"] = @total_value_units if !options[:compact] ||
|
|
6181
|
+
has_total_value_units?
|
|
6182
|
+
result["totalValueStructures"] = @total_value_structures if !options[
|
|
6183
|
+
:compact
|
|
6184
|
+
] || has_total_value_structures?
|
|
6185
|
+
result["killedValueUnits"] = @killed_value_units if !options[:compact] ||
|
|
6186
|
+
has_killed_value_units?
|
|
6187
|
+
result["killedValueStructures"] = @killed_value_structures if !options[
|
|
6188
|
+
:compact
|
|
6189
|
+
] || has_killed_value_structures?
|
|
6190
|
+
result["collectedMinerals"] = @collected_minerals if !options[:compact] ||
|
|
6191
|
+
has_collected_minerals?
|
|
6192
|
+
result["collectedVespene"] = @collected_vespene if !options[:compact] ||
|
|
6193
|
+
has_collected_vespene?
|
|
6194
|
+
result["collectionRateMinerals"] = @collection_rate_minerals if !options[
|
|
6195
|
+
:compact
|
|
6196
|
+
] || has_collection_rate_minerals?
|
|
6197
|
+
result["collectionRateVespene"] = @collection_rate_vespene if !options[
|
|
6198
|
+
:compact
|
|
6199
|
+
] || has_collection_rate_vespene?
|
|
6200
|
+
result["spentMinerals"] = @spent_minerals if !options[:compact] ||
|
|
6201
|
+
has_spent_minerals?
|
|
6202
|
+
result["spentVespene"] = @spent_vespene if !options[:compact] ||
|
|
6203
|
+
has_spent_vespene?
|
|
6204
|
+
result["foodUsed"] = (
|
|
6205
|
+
if @food_used.nil?
|
|
6206
|
+
{}
|
|
6207
|
+
else
|
|
6208
|
+
@food_used.as_json(options)
|
|
6209
|
+
end
|
|
6210
|
+
) if !options[:compact] || has_food_used?
|
|
6211
|
+
result["killedMinerals"] = (
|
|
6212
|
+
if @killed_minerals.nil?
|
|
6213
|
+
{}
|
|
6214
|
+
else
|
|
6215
|
+
@killed_minerals.as_json(options)
|
|
6216
|
+
end
|
|
6217
|
+
) if !options[:compact] || has_killed_minerals?
|
|
6218
|
+
result["killedVespene"] = (
|
|
6219
|
+
if @killed_vespene.nil?
|
|
6220
|
+
{}
|
|
6221
|
+
else
|
|
6222
|
+
@killed_vespene.as_json(options)
|
|
6223
|
+
end
|
|
6224
|
+
) if !options[:compact] || has_killed_vespene?
|
|
6225
|
+
result["lostMinerals"] = (
|
|
6226
|
+
if @lost_minerals.nil?
|
|
6227
|
+
{}
|
|
6228
|
+
else
|
|
6229
|
+
@lost_minerals.as_json(options)
|
|
6230
|
+
end
|
|
6231
|
+
) if !options[:compact] || has_lost_minerals?
|
|
6232
|
+
result["lostVespene"] = (
|
|
6233
|
+
if @lost_vespene.nil?
|
|
6234
|
+
{}
|
|
6235
|
+
else
|
|
6236
|
+
@lost_vespene.as_json(options)
|
|
6237
|
+
end
|
|
6238
|
+
) if !options[:compact] || has_lost_vespene?
|
|
6239
|
+
result["friendlyFireMinerals"] = (
|
|
6240
|
+
if @friendly_fire_minerals.nil?
|
|
6241
|
+
{}
|
|
6242
|
+
else
|
|
6243
|
+
@friendly_fire_minerals.as_json(options)
|
|
6244
|
+
end
|
|
6245
|
+
) if !options[:compact] || has_friendly_fire_minerals?
|
|
6246
|
+
result["friendlyFireVespene"] = (
|
|
6247
|
+
if @friendly_fire_vespene.nil?
|
|
6248
|
+
{}
|
|
6249
|
+
else
|
|
6250
|
+
@friendly_fire_vespene.as_json(options)
|
|
6251
|
+
end
|
|
6252
|
+
) if !options[:compact] || has_friendly_fire_vespene?
|
|
6253
|
+
result["usedMinerals"] = (
|
|
6254
|
+
if @used_minerals.nil?
|
|
6255
|
+
{}
|
|
6256
|
+
else
|
|
6257
|
+
@used_minerals.as_json(options)
|
|
6258
|
+
end
|
|
6259
|
+
) if !options[:compact] || has_used_minerals?
|
|
6260
|
+
result["usedVespene"] = (
|
|
6261
|
+
if @used_vespene.nil?
|
|
6262
|
+
{}
|
|
6263
|
+
else
|
|
6264
|
+
@used_vespene.as_json(options)
|
|
6265
|
+
end
|
|
6266
|
+
) if !options[:compact] || has_used_vespene?
|
|
6267
|
+
result["totalUsedMinerals"] = (
|
|
6268
|
+
if @total_used_minerals.nil?
|
|
6269
|
+
{}
|
|
6270
|
+
else
|
|
6271
|
+
@total_used_minerals.as_json(options)
|
|
6272
|
+
end
|
|
6273
|
+
) if !options[:compact] || has_total_used_minerals?
|
|
6274
|
+
result["totalUsedVespene"] = (
|
|
6275
|
+
if @total_used_vespene.nil?
|
|
6276
|
+
{}
|
|
6277
|
+
else
|
|
6278
|
+
@total_used_vespene.as_json(options)
|
|
6279
|
+
end
|
|
6280
|
+
) if !options[:compact] || has_total_used_vespene?
|
|
6281
|
+
result["totalDamageDealt"] = (
|
|
6282
|
+
if @total_damage_dealt.nil?
|
|
6283
|
+
{}
|
|
6284
|
+
else
|
|
6285
|
+
@total_damage_dealt.as_json(options)
|
|
6286
|
+
end
|
|
6287
|
+
) if !options[:compact] || has_total_damage_dealt?
|
|
6288
|
+
result["totalDamageTaken"] = (
|
|
6289
|
+
if @total_damage_taken.nil?
|
|
6290
|
+
{}
|
|
6291
|
+
else
|
|
6292
|
+
@total_damage_taken.as_json(options)
|
|
6293
|
+
end
|
|
6294
|
+
) if !options[:compact] || has_total_damage_taken?
|
|
6295
|
+
result["totalHealed"] = (
|
|
6296
|
+
if @total_healed.nil?
|
|
6297
|
+
{}
|
|
6298
|
+
else
|
|
6299
|
+
@total_healed.as_json(options)
|
|
6300
|
+
end
|
|
6301
|
+
) if !options[:compact] || has_total_healed?
|
|
6302
|
+
result["currentApm"] = @current_apm if !options[:compact] ||
|
|
6303
|
+
has_current_apm?
|
|
6304
|
+
result["currentEffectiveApm"] = @current_effective_apm if !options[
|
|
6305
|
+
:compact
|
|
6306
|
+
] || has_current_effective_apm?
|
|
6307
|
+
|
|
6100
6308
|
result
|
|
6101
6309
|
end
|
|
6310
|
+
|
|
6311
|
+
def to_json(as_json_options = {})
|
|
6312
|
+
require "json"
|
|
6313
|
+
JSON.dump(as_json(as_json_options))
|
|
6314
|
+
end
|
|
6102
6315
|
end
|
|
6103
6316
|
end
|