Method: Api::BuildItem#_encode

Defined in:
lib/sc2ai/protocol/ui_pb.rb

#_encode(buff) ⇒ Object



6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
# File 'lib/sc2ai/protocol/ui_pb.rb', line 6984

def _encode(buff)
  val = @ability_id
  if has_ability_id?
    buff << 0x08

    loop do
      byte = val & 0x7F
      val >>= 7
      byte |= 0x80 if val > 0
      buff << byte
      break if val == 0
    end
  end

  val = @build_progress
  if has_build_progress?
    buff << 0x15

    [val].pack("e", buffer: buff)
  end
  buff << @_unknown_fields if @_unknown_fields
  buff
end