Class: Api::ActionRawToggleAutocast
- Inherits:
-
Object
- Object
- Api::ActionRawToggleAutocast
- Includes:
- AbilityRemapable
- Defined in:
- lib/sc2ai/protocol/_meta_documentation.rb,
lib/sc2ai/protocol/raw_pb.rb
Overview
Protobuf virtual class.
Instance Attribute Summary collapse
-
#ability_id ⇒ Object
optional field readers.
-
#unit_tags ⇒ Object
required field readers.
Class Method Summary collapse
Instance Method Summary collapse
- #_encode(buff) ⇒ Object
- #decode_from(buff, index, len) ⇒ Object
- #has_ability_id? ⇒ Boolean
-
#initialize(ability_id: nil, unit_tags: []) ⇒ ActionRawToggleAutocast
constructor
END writers for optional fields.
- #to_h ⇒ Object
- #to_proto(_options = {}) ⇒ Object
Constructor Details
#initialize(ability_id: nil, unit_tags: []) ⇒ ActionRawToggleAutocast
END writers for optional fields
17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17755 def initialize(ability_id: nil, unit_tags: []) @_bitmask = 0 if ability_id == nil @ability_id = 0 else unless -2_147_483_648 <= ability_id && ability_id <= 2_147_483_647 raise RangeError, "Value (#{ability_id}) for field ability_id is out of bounds (-2147483648..2147483647)" end @_bitmask |= 0x0000000000000001 @ability_id = ability_id end .each do |v| unless 0 <= v && v <= 18_446_744_073_709_551_615 raise RangeError, "Value (#{v}}) for field unit_tags is out of bounds (0..18446744073709551615)" end end @unit_tags = end |
Instance Attribute Details
#ability_id ⇒ Object
optional field readers
17729 17730 17731 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17729 def ability_id @ability_id end |
#unit_tags ⇒ Object
required field readers
17725 17726 17727 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17725 def @unit_tags end |
Class Method Details
.decode(buff) ⇒ Object
17716 17717 17718 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17716 def self.decode(buff) allocate.decode_from(buff.b, 0, buff.bytesize) end |
.encode(obj) ⇒ Object
17720 17721 17722 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17720 def self.encode(obj) obj._encode("".b) end |
Instance Method Details
#_encode(buff) ⇒ Object
18271 18272 18273 18274 18275 18276 18277 18278 18279 18280 18281 18282 18283 18284 18285 18286 18287 18288 18289 18290 18291 18292 18293 18294 18295 18296 18297 18298 18299 18300 18301 18302 18303 18304 18305 18306 18307 18308 18309 18310 18311 18312 18313 18314 18315 18316 18317 18318 18319 18320 18321 18322 18323 18324 18325 18326 18327 18328 18329 18330 18331 18332 18333 18334 18335 18336 18337 18338 18339 18340 18341 18342 18343 18344 18345 18346 18347 18348 18349 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 18271 def _encode(buff) val = @ability_id if val != 0 buff << 0x08 while val != 0 byte = val & 0x7F val >>= 7 # This drops the top bits, # Otherwise, with a signed right shift, # we get infinity one bits at the top val &= (1 << 57) - 1 byte |= 0x80 if val != 0 buff << byte end end list = @unit_tags if list.size > 0 buff << 0x12 # Save the buffer size before appending the repeated bytes current_len = buff.bytesize # Write a single dummy byte to later store encoded length buff << 42 # "*" # write each item list.each do |item| val = item if val != 0 while val != 0 byte = val & 0x7F val >>= 7 byte |= 0x80 if val > 0 buff << byte end end end # Calculate the submessage's size = buff.bytesize - current_len - 1 # Hope the size fits in one byte byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) # If the sub message was bigger if > 0 current_len += 1 # compute how much we need to shift encoded_int_len = 0 remaining_size = while remaining_size != 0 remaining_size >>= 7 encoded_int_len += 1 end # Make space in the string with dummy bytes buff.bytesplice(current_len, 0, "*********", 0, encoded_int_len) # Overwrite the dummy bytes with the encoded length while != 0 byte = & 0x7F >>= 7 byte |= 0x80 if > 0 buff.setbyte(current_len, byte) current_len += 1 end end end buff end |
#decode_from(buff, index, len) ⇒ Object
17786 17787 17788 17789 17790 17791 17792 17793 17794 17795 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 17855 17856 17857 17858 17859 17860 17861 17862 17863 17864 17865 17866 17867 17868 17869 17870 17871 17872 17873 17874 17875 17876 17877 17878 17879 17880 17881 17882 17883 17884 17885 17886 17887 17888 17889 17890 17891 17892 17893 17894 17895 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 17911 17912 17913 17914 17915 17916 17917 17918 17919 17920 17921 17922 17923 17924 17925 17926 17927 17928 17929 17930 17931 17932 17933 17934 17935 17936 17937 17938 17939 17940 17941 17942 17943 17944 17945 17946 17947 17948 17949 17950 17951 17952 17953 17954 17955 17956 17957 17958 17959 17960 17961 17962 17963 17964 17965 17966 17967 17968 17969 17970 17971 17972 17973 17974 17975 17976 17977 17978 17979 17980 17981 17982 17983 17984 17985 17986 17987 17988 17989 17990 17991 17992 17993 17994 17995 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 18024 18025 18026 18027 18028 18029 18030 18031 18032 18033 18034 18035 18036 18037 18038 18039 18040 18041 18042 18043 18044 18045 18046 18047 18048 18049 18050 18051 18052 18053 18054 18055 18056 18057 18058 18059 18060 18061 18062 18063 18064 18065 18066 18067 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 18101 18102 18103 18104 18105 18106 18107 18108 18109 18110 18111 18112 18113 18114 18115 18116 18117 18118 18119 18120 18121 18122 18123 18124 18125 18126 18127 18128 18129 18130 18131 18132 18133 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 18149 18150 18151 18152 18153 18154 18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 18169 18170 18171 18172 18173 18174 18175 18176 18177 18178 18179 18180 18181 18182 18183 18184 18185 18186 18187 18188 18189 18190 18191 18192 18193 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 18215 18216 18217 18218 18219 18220 18221 18222 18223 18224 18225 18226 18227 18228 18229 18230 18231 18232 18233 18234 18235 18236 18237 18238 18239 18240 18241 18242 18243 18244 18245 18246 18247 18248 18249 18250 18251 18252 18253 18254 18255 18256 18257 18258 18259 18260 18261 18262 18263 18264 18265 18266 18267 18268 18269 18270 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17786 def decode_from(buff, index, len) @_bitmask = 0 @ability_id = 0 @unit_tags = [] return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 found = true while true # If we have looped around since the last found tag this one is # unexpected, so discard it and continue. if !found wire_type = tag & 0x7 case wire_type when 0 i = 0 while true newbyte = buff.getbyte(index) index += 1 break if newbyte.nil? || newbyte < 0x80 i += 1 break if i > 9 end when 1 index += 8 when 2 ## PULL_BYTES value = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end buff.byteslice(index, value) index += value ## END PULL_BYTES when 5 index += 4 else raise "unknown wire type #{wire_type}" end return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end found = false if tag == 0x8 found = true ## PULL_INT32 @ability_id = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 # Negative 32 bit integers are still encoded with 10 bytes # handle 2's complement negative numbers # If the top bit is 1, then it must be negative. -( ( ( ~( (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) ) ) & 0xFFFF_FFFF ) + 1 ) else raise "integer decoding error" end ## END PULL_INT32 @_bitmask |= 0x0000000000000001 return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end if tag == 0x12 found = true ## PULL_UINT64 value = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 goal = index + value list = @unit_tags while true break if index >= goal ## PULL_UINT64 list << if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end return self if index >= len ## PULL_UINT64 tag = if (byte0 = buff.getbyte(index)) < 0x80 index += 1 byte0 elsif (byte1 = buff.getbyte(index + 1)) < 0x80 index += 2 (byte1 << 7) | (byte0 & 0x7F) elsif (byte2 = buff.getbyte(index + 2)) < 0x80 index += 3 (byte2 << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte3 = buff.getbyte(index + 3)) < 0x80 index += 4 (byte3 << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte4 = buff.getbyte(index + 4)) < 0x80 index += 5 (byte4 << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte5 = buff.getbyte(index + 5)) < 0x80 index += 6 (byte5 << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte6 = buff.getbyte(index + 6)) < 0x80 index += 7 (byte6 << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte7 = buff.getbyte(index + 7)) < 0x80 index += 8 (byte7 << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte8 = buff.getbyte(index + 8)) < 0x80 index += 9 (byte8 << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) elsif (byte9 = buff.getbyte(index + 9)) < 0x80 index += 10 (byte9 << 63) | ((byte8 & 0x7F) << 56) | ((byte7 & 0x7F) << 49) | ((byte6 & 0x7F) << 42) | ((byte5 & 0x7F) << 35) | ((byte4 & 0x7F) << 28) | ((byte3 & 0x7F) << 21) | ((byte2 & 0x7F) << 14) | ((byte1 & 0x7F) << 7) | (byte0 & 0x7F) else raise "integer decoding error" end ## END PULL_UINT64 end return self if index >= len end end |
#has_ability_id? ⇒ Boolean
17782 17783 17784 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17782 def has_ability_id? (@_bitmask & 0x0000000000000001) == 0x0000000000000001 end |
#to_h ⇒ Object
18351 18352 18353 18354 18355 18356 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 18351 def to_h result = {} result["ability_id".to_sym] = @ability_id result["unit_tags".to_sym] = @unit_tags result end |
#to_proto(_options = {}) ⇒ Object
17778 17779 17780 |
# File 'lib/sc2ai/protocol/raw_pb.rb', line 17778 def to_proto( = {}) self.class.encode(self) end |