public static final class CDemoSendTables extends
    com.google.protobuf.GeneratedMessage
    implements CDemoSendTablesOrBuilder {
  // Use CDemoSendTables.newBuilder() to construct.
  private CDemoSendTables(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
    this.unknownFields = builder.getUnknownFields();
  }
  private CDemoSendTables(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

  private static final CDemoSendTables defaultInstance;
  public static CDemoSendTables getDefaultInstance() {
    return defaultInstance;
  }

  public CDemoSendTables getDefaultInstanceForType() {
    return defaultInstance;
  }

  private final com.google.protobuf.UnknownFieldSet unknownFields;
  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
      getUnknownFields() {
    return this.unknownFields;
  }
  private CDemoSendTables(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    initFields();
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!parseUnknownField(input, unknownFields,
                                   extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            bitField0_ |= 0x00000001;
            data_ = input.readBytes();
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e.getMessage()).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.valve.dota2.Demo.internal_static_CDemoSendTables_descriptor;
  }

  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.valve.dota2.Demo.internal_static_CDemoSendTables_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.valve.dota2.Demo.CDemoSendTables.class, com.valve.dota2.Demo.CDemoSendTables.Builder.class);
  }

  public static com.google.protobuf.Parser<CDemoSendTables> PARSER =
      new com.google.protobuf.AbstractParser<CDemoSendTables>() {
    public CDemoSendTables parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new CDemoSendTables(input, extensionRegistry);
    }
  };

  @java.lang.Override
  public com.google.protobuf.Parser<CDemoSendTables> getParserForType() {
    return PARSER;
  }

  private int bitField0_;
  // optional bytes data = 1;
  public static final int DATA_FIELD_NUMBER = 1;
  private com.google.protobuf.ByteString data_;
  /**
   * <code>optional bytes data = 1;</code>
   */
  public boolean hasData() {
    return ((bitField0_ & 0x00000001) == 0x00000001);
  }
  /**
   * <code>optional bytes data = 1;</code>
   */
  public com.google.protobuf.ByteString getData() {
    return data_;
  }

  private void initFields() {
    data_ = com.google.protobuf.ByteString.EMPTY;
  }
  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized != -1) return isInitialized == 1;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    getSerializedSize();
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      output.writeBytes(1, data_);
    }
    getUnknownFields().writeTo(output);
  }

  private int memoizedSerializedSize = -1;
  public int getSerializedSize() {
    int size = memoizedSerializedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(1, data_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSerializedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  protected java.lang.Object writeReplace()
      throws java.io.ObjectStreamException {
    return super.writeReplace();
  }

  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Demo.CDemoSendTables parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }

  public static Builder newBuilder() { return Builder.create(); }
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder(com.valve.dota2.Demo.CDemoSendTables prototype) {
    return newBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() { return newBuilder(this); }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code CDemoSendTables}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder>
     implements com.valve.dota2.Demo.CDemoSendTablesOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.valve.dota2.Demo.internal_static_CDemoSendTables_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.valve.dota2.Demo.internal_static_CDemoSendTables_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.valve.dota2.Demo.CDemoSendTables.class, com.valve.dota2.Demo.CDemoSendTables.Builder.class);
    }

    // Construct using com.valve.dota2.Demo.CDemoSendTables.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
      }
    }
    private static Builder create() {
      return new Builder();
    }

    public Builder clear() {
      super.clear();
      data_ = com.google.protobuf.ByteString.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000001);
      return this;
    }

    public Builder clone() {
      return create().mergeFrom(buildPartial());
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.valve.dota2.Demo.internal_static_CDemoSendTables_descriptor;
    }

    public com.valve.dota2.Demo.CDemoSendTables getDefaultInstanceForType() {
      return com.valve.dota2.Demo.CDemoSendTables.getDefaultInstance();
    }

    public com.valve.dota2.Demo.CDemoSendTables build() {
      com.valve.dota2.Demo.CDemoSendTables result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.valve.dota2.Demo.CDemoSendTables buildPartial() {
      com.valve.dota2.Demo.CDemoSendTables result = new com.valve.dota2.Demo.CDemoSendTables(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
        to_bitField0_ |= 0x00000001;
      }
      result.data_ = data_;
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.valve.dota2.Demo.CDemoSendTables) {
        return mergeFrom((com.valve.dota2.Demo.CDemoSendTables)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.valve.dota2.Demo.CDemoSendTables other) {
      if (other == com.valve.dota2.Demo.CDemoSendTables.getDefaultInstance()) return this;
      if (other.hasData()) {
        setData(other.getData());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.valve.dota2.Demo.CDemoSendTables parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.valve.dota2.Demo.CDemoSendTables) e.getUnfinishedMessage();
        throw e;
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    // optional bytes data = 1;
    private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <code>optional bytes data = 1;</code>
     */
    public boolean hasData() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional bytes data = 1;</code>
     */
    public com.google.protobuf.ByteString getData() {
      return data_;
    }
    /**
     * <code>optional bytes data = 1;</code>
     */
    public Builder setData(com.google.protobuf.ByteString value) {
      if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000001;
      data_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>optional bytes data = 1;</code>
     */
    public Builder clearData() {
      bitField0_ = (bitField0_ & ~0x00000001);
      data_ = getDefaultInstance().getData();
      onChanged();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:CDemoSendTables)
  }

  static {
    defaultInstance = new CDemoSendTables(true);
    defaultInstance.initFields();
  }

  // @@protoc_insertion_point(class_scope:CDemoSendTables)
} public static final class CSVCMsg_GameEvent extends
    com.google.protobuf.GeneratedMessage
    implements CSVCMsg_GameEventOrBuilder {
  // Use CSVCMsg_GameEvent.newBuilder() to construct.
  private CSVCMsg_GameEvent(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
    this.unknownFields = builder.getUnknownFields();
  }
  private CSVCMsg_GameEvent(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

  private static final CSVCMsg_GameEvent defaultInstance;
  public static CSVCMsg_GameEvent getDefaultInstance() {
    return defaultInstance;
  }

  public CSVCMsg_GameEvent getDefaultInstanceForType() {
    return defaultInstance;
  }

  private final com.google.protobuf.UnknownFieldSet unknownFields;
  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
      getUnknownFields() {
    return this.unknownFields;
  }
  private CSVCMsg_GameEvent(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    initFields();
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!parseUnknownField(input, unknownFields,
                                   extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 10: {
            bitField0_ |= 0x00000001;
            eventName_ = input.readBytes();
            break;
          }
          case 16: {
            bitField0_ |= 0x00000002;
            eventid_ = input.readInt32();
            break;
          }
          case 26: {
            if (!((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
              keys_ = new java.util.ArrayList<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t>();
              mutable_bitField0_ |= 0x00000004;
            }
            keys_.add(input.readMessage(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.PARSER, extensionRegistry));
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e.getMessage()).setUnfinishedMessage(this);
    } finally {
      if (((mutable_bitField0_ & 0x00000004) == 0x00000004)) {
        keys_ = java.util.Collections.unmodifiableList(keys_);
      }
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_descriptor;
  }

  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.class, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.Builder.class);
  }

  public static com.google.protobuf.Parser<CSVCMsg_GameEvent> PARSER =
      new com.google.protobuf.AbstractParser<CSVCMsg_GameEvent>() {
    public CSVCMsg_GameEvent parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new CSVCMsg_GameEvent(input, extensionRegistry);
    }
  };

  @java.lang.Override
  public com.google.protobuf.Parser<CSVCMsg_GameEvent> getParserForType() {
    return PARSER;
  }

  public interface key_tOrBuilder
      extends com.google.protobuf.MessageOrBuilder {

    // optional int32 type = 1;
    /**
     * <code>optional int32 type = 1;</code>
     */
    boolean hasType();
    /**
     * <code>optional int32 type = 1;</code>
     */
    int getType();

    // optional string val_string = 2;
    /**
     * <code>optional string val_string = 2;</code>
     */
    boolean hasValString();
    /**
     * <code>optional string val_string = 2;</code>
     */
    java.lang.String getValString();
    /**
     * <code>optional string val_string = 2;</code>
     */
    com.google.protobuf.ByteString
        getValStringBytes();

    // optional float val_float = 3;
    /**
     * <code>optional float val_float = 3;</code>
     */
    boolean hasValFloat();
    /**
     * <code>optional float val_float = 3;</code>
     */
    float getValFloat();

    // optional int32 val_long = 4;
    /**
     * <code>optional int32 val_long = 4;</code>
     */
    boolean hasValLong();
    /**
     * <code>optional int32 val_long = 4;</code>
     */
    int getValLong();

    // optional int32 val_short = 5;
    /**
     * <code>optional int32 val_short = 5;</code>
     */
    boolean hasValShort();
    /**
     * <code>optional int32 val_short = 5;</code>
     */
    int getValShort();

    // optional int32 val_byte = 6;
    /**
     * <code>optional int32 val_byte = 6;</code>
     */
    boolean hasValByte();
    /**
     * <code>optional int32 val_byte = 6;</code>
     */
    int getValByte();

    // optional bool val_bool = 7;
    /**
     * <code>optional bool val_bool = 7;</code>
     */
    boolean hasValBool();
    /**
     * <code>optional bool val_bool = 7;</code>
     */
    boolean getValBool();

    // optional uint64 val_uint64 = 8;
    /**
     * <code>optional uint64 val_uint64 = 8;</code>
     */
    boolean hasValUint64();
    /**
     * <code>optional uint64 val_uint64 = 8;</code>
     */
    long getValUint64();
  }
  /**
   * Protobuf type {@code CSVCMsg_GameEvent.key_t}
   */
  public static final class key_t extends
      com.google.protobuf.GeneratedMessage
      implements key_tOrBuilder {
    // Use key_t.newBuilder() to construct.
    private key_t(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
      super(builder);
      this.unknownFields = builder.getUnknownFields();
    }
    private key_t(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

    private static final key_t defaultInstance;
    public static key_t getDefaultInstance() {
      return defaultInstance;
    }

    public key_t getDefaultInstanceForType() {
      return defaultInstance;
    }

    private final com.google.protobuf.UnknownFieldSet unknownFields;
    @java.lang.Override
    public final com.google.protobuf.UnknownFieldSet
        getUnknownFields() {
      return this.unknownFields;
    }
    private key_t(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      initFields();
      int mutable_bitField0_ = 0;
      com.google.protobuf.UnknownFieldSet.Builder unknownFields =
          com.google.protobuf.UnknownFieldSet.newBuilder();
      try {
        boolean done = false;
        while (!done) {
          int tag = input.readTag();
          switch (tag) {
            case 0:
              done = true;
              break;
            default: {
              if (!parseUnknownField(input, unknownFields,
                                     extensionRegistry, tag)) {
                done = true;
              }
              break;
            }
            case 8: {
              bitField0_ |= 0x00000001;
              type_ = input.readInt32();
              break;
            }
            case 18: {
              bitField0_ |= 0x00000002;
              valString_ = input.readBytes();
              break;
            }
            case 29: {
              bitField0_ |= 0x00000004;
              valFloat_ = input.readFloat();
              break;
            }
            case 32: {
              bitField0_ |= 0x00000008;
              valLong_ = input.readInt32();
              break;
            }
            case 40: {
              bitField0_ |= 0x00000010;
              valShort_ = input.readInt32();
              break;
            }
            case 48: {
              bitField0_ |= 0x00000020;
              valByte_ = input.readInt32();
              break;
            }
            case 56: {
              bitField0_ |= 0x00000040;
              valBool_ = input.readBool();
              break;
            }
            case 64: {
              bitField0_ |= 0x00000080;
              valUint64_ = input.readUInt64();
              break;
            }
          }
        }
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        throw e.setUnfinishedMessage(this);
      } catch (java.io.IOException e) {
        throw new com.google.protobuf.InvalidProtocolBufferException(
            e.getMessage()).setUnfinishedMessage(this);
      } finally {
        this.unknownFields = unknownFields.build();
        makeExtensionsImmutable();
      }
    }
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_key_t_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_key_t_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.class, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder.class);
    }

    public static com.google.protobuf.Parser<key_t> PARSER =
        new com.google.protobuf.AbstractParser<key_t>() {
      public key_t parsePartialFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws com.google.protobuf.InvalidProtocolBufferException {
        return new key_t(input, extensionRegistry);
      }
    };

    @java.lang.Override
    public com.google.protobuf.Parser<key_t> getParserForType() {
      return PARSER;
    }

    private int bitField0_;
    // optional int32 type = 1;
    public static final int TYPE_FIELD_NUMBER = 1;
    private int type_;
    /**
     * <code>optional int32 type = 1;</code>
     */
    public boolean hasType() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional int32 type = 1;</code>
     */
    public int getType() {
      return type_;
    }

    // optional string val_string = 2;
    public static final int VAL_STRING_FIELD_NUMBER = 2;
    private java.lang.Object valString_;
    /**
     * <code>optional string val_string = 2;</code>
     */
    public boolean hasValString() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional string val_string = 2;</code>
     */
    public java.lang.String getValString() {
      java.lang.Object ref = valString_;
      if (ref instanceof java.lang.String) {
        return (java.lang.String) ref;
      } else {
        com.google.protobuf.ByteString bs = 
            (com.google.protobuf.ByteString) ref;
        java.lang.String s = bs.toStringUtf8();
        if (bs.isValidUtf8()) {
          valString_ = s;
        }
        return s;
      }
    }
    /**
     * <code>optional string val_string = 2;</code>
     */
    public com.google.protobuf.ByteString
        getValStringBytes() {
      java.lang.Object ref = valString_;
      if (ref instanceof java.lang.String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        valString_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }

    // optional float val_float = 3;
    public static final int VAL_FLOAT_FIELD_NUMBER = 3;
    private float valFloat_;
    /**
     * <code>optional float val_float = 3;</code>
     */
    public boolean hasValFloat() {
      return ((bitField0_ & 0x00000004) == 0x00000004);
    }
    /**
     * <code>optional float val_float = 3;</code>
     */
    public float getValFloat() {
      return valFloat_;
    }

    // optional int32 val_long = 4;
    public static final int VAL_LONG_FIELD_NUMBER = 4;
    private int valLong_;
    /**
     * <code>optional int32 val_long = 4;</code>
     */
    public boolean hasValLong() {
      return ((bitField0_ & 0x00000008) == 0x00000008);
    }
    /**
     * <code>optional int32 val_long = 4;</code>
     */
    public int getValLong() {
      return valLong_;
    }

    // optional int32 val_short = 5;
    public static final int VAL_SHORT_FIELD_NUMBER = 5;
    private int valShort_;
    /**
     * <code>optional int32 val_short = 5;</code>
     */
    public boolean hasValShort() {
      return ((bitField0_ & 0x00000010) == 0x00000010);
    }
    /**
     * <code>optional int32 val_short = 5;</code>
     */
    public int getValShort() {
      return valShort_;
    }

    // optional int32 val_byte = 6;
    public static final int VAL_BYTE_FIELD_NUMBER = 6;
    private int valByte_;
    /**
     * <code>optional int32 val_byte = 6;</code>
     */
    public boolean hasValByte() {
      return ((bitField0_ & 0x00000020) == 0x00000020);
    }
    /**
     * <code>optional int32 val_byte = 6;</code>
     */
    public int getValByte() {
      return valByte_;
    }

    // optional bool val_bool = 7;
    public static final int VAL_BOOL_FIELD_NUMBER = 7;
    private boolean valBool_;
    /**
     * <code>optional bool val_bool = 7;</code>
     */
    public boolean hasValBool() {
      return ((bitField0_ & 0x00000040) == 0x00000040);
    }
    /**
     * <code>optional bool val_bool = 7;</code>
     */
    public boolean getValBool() {
      return valBool_;
    }

    // optional uint64 val_uint64 = 8;
    public static final int VAL_UINT64_FIELD_NUMBER = 8;
    private long valUint64_;
    /**
     * <code>optional uint64 val_uint64 = 8;</code>
     */
    public boolean hasValUint64() {
      return ((bitField0_ & 0x00000080) == 0x00000080);
    }
    /**
     * <code>optional uint64 val_uint64 = 8;</code>
     */
    public long getValUint64() {
      return valUint64_;
    }

    private void initFields() {
      type_ = 0;
      valString_ = "";
      valFloat_ = 0F;
      valLong_ = 0;
      valShort_ = 0;
      valByte_ = 0;
      valBool_ = false;
      valUint64_ = 0L;
    }
    private byte memoizedIsInitialized = -1;
    public final boolean isInitialized() {
      byte isInitialized = memoizedIsInitialized;
      if (isInitialized != -1) return isInitialized == 1;

      memoizedIsInitialized = 1;
      return true;
    }

    public void writeTo(com.google.protobuf.CodedOutputStream output)
                        throws java.io.IOException {
      getSerializedSize();
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        output.writeInt32(1, type_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        output.writeBytes(2, getValStringBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        output.writeFloat(3, valFloat_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        output.writeInt32(4, valLong_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        output.writeInt32(5, valShort_);
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        output.writeInt32(6, valByte_);
      }
      if (((bitField0_ & 0x00000040) == 0x00000040)) {
        output.writeBool(7, valBool_);
      }
      if (((bitField0_ & 0x00000080) == 0x00000080)) {
        output.writeUInt64(8, valUint64_);
      }
      getUnknownFields().writeTo(output);
    }

    private int memoizedSerializedSize = -1;
    public int getSerializedSize() {
      int size = memoizedSerializedSize;
      if (size != -1) return size;

      size = 0;
      if (((bitField0_ & 0x00000001) == 0x00000001)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(1, type_);
      }
      if (((bitField0_ & 0x00000002) == 0x00000002)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBytesSize(2, getValStringBytes());
      }
      if (((bitField0_ & 0x00000004) == 0x00000004)) {
        size += com.google.protobuf.CodedOutputStream
          .computeFloatSize(3, valFloat_);
      }
      if (((bitField0_ & 0x00000008) == 0x00000008)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(4, valLong_);
      }
      if (((bitField0_ & 0x00000010) == 0x00000010)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(5, valShort_);
      }
      if (((bitField0_ & 0x00000020) == 0x00000020)) {
        size += com.google.protobuf.CodedOutputStream
          .computeInt32Size(6, valByte_);
      }
      if (((bitField0_ & 0x00000040) == 0x00000040)) {
        size += com.google.protobuf.CodedOutputStream
          .computeBoolSize(7, valBool_);
      }
      if (((bitField0_ & 0x00000080) == 0x00000080)) {
        size += com.google.protobuf.CodedOutputStream
          .computeUInt64Size(8, valUint64_);
      }
      size += getUnknownFields().getSerializedSize();
      memoizedSerializedSize = size;
      return size;
    }

    private static final long serialVersionUID = 0L;
    @java.lang.Override
    protected java.lang.Object writeReplace()
        throws java.io.ObjectStreamException {
      return super.writeReplace();
    }

    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        com.google.protobuf.ByteString data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        com.google.protobuf.ByteString data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(byte[] data)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        byte[] data,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return PARSER.parseFrom(data, extensionRegistry);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseDelimitedFrom(java.io.InputStream input)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseDelimitedFrom(
        java.io.InputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseDelimitedFrom(input, extensionRegistry);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        com.google.protobuf.CodedInputStream input)
        throws java.io.IOException {
      return PARSER.parseFrom(input);
    }
    public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parseFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      return PARSER.parseFrom(input, extensionRegistry);
    }

    public static Builder newBuilder() { return Builder.create(); }
    public Builder newBuilderForType() { return newBuilder(); }
    public static Builder newBuilder(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t prototype) {
      return newBuilder().mergeFrom(prototype);
    }
    public Builder toBuilder() { return newBuilder(this); }

    @java.lang.Override
    protected Builder newBuilderForType(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      Builder builder = new Builder(parent);
      return builder;
    }
    /**
     * Protobuf type {@code CSVCMsg_GameEvent.key_t}
     */
    public static final class Builder extends
        com.google.protobuf.GeneratedMessage.Builder<Builder>
       implements com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder {
      public static final com.google.protobuf.Descriptors.Descriptor
          getDescriptor() {
        return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_key_t_descriptor;
      }

      protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
          internalGetFieldAccessorTable() {
        return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_key_t_fieldAccessorTable
            .ensureFieldAccessorsInitialized(
                com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.class, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder.class);
      }

      // Construct using com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.newBuilder()
      private Builder() {
        maybeForceBuilderInitialization();
      }

      private Builder(
          com.google.protobuf.GeneratedMessage.BuilderParent parent) {
        super(parent);
        maybeForceBuilderInitialization();
      }
      private void maybeForceBuilderInitialization() {
        if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        }
      }
      private static Builder create() {
        return new Builder();
      }

      public Builder clear() {
        super.clear();
        type_ = 0;
        bitField0_ = (bitField0_ & ~0x00000001);
        valString_ = "";
        bitField0_ = (bitField0_ & ~0x00000002);
        valFloat_ = 0F;
        bitField0_ = (bitField0_ & ~0x00000004);
        valLong_ = 0;
        bitField0_ = (bitField0_ & ~0x00000008);
        valShort_ = 0;
        bitField0_ = (bitField0_ & ~0x00000010);
        valByte_ = 0;
        bitField0_ = (bitField0_ & ~0x00000020);
        valBool_ = false;
        bitField0_ = (bitField0_ & ~0x00000040);
        valUint64_ = 0L;
        bitField0_ = (bitField0_ & ~0x00000080);
        return this;
      }

      public Builder clone() {
        return create().mergeFrom(buildPartial());
      }

      public com.google.protobuf.Descriptors.Descriptor
          getDescriptorForType() {
        return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_key_t_descriptor;
      }

      public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t getDefaultInstanceForType() {
        return com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.getDefaultInstance();
      }

      public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t build() {
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t result = buildPartial();
        if (!result.isInitialized()) {
          throw newUninitializedMessageException(result);
        }
        return result;
      }

      public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t buildPartial() {
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t result = new com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t(this);
        int from_bitField0_ = bitField0_;
        int to_bitField0_ = 0;
        if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
          to_bitField0_ |= 0x00000001;
        }
        result.type_ = type_;
        if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
          to_bitField0_ |= 0x00000002;
        }
        result.valString_ = valString_;
        if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
          to_bitField0_ |= 0x00000004;
        }
        result.valFloat_ = valFloat_;
        if (((from_bitField0_ & 0x00000008) == 0x00000008)) {
          to_bitField0_ |= 0x00000008;
        }
        result.valLong_ = valLong_;
        if (((from_bitField0_ & 0x00000010) == 0x00000010)) {
          to_bitField0_ |= 0x00000010;
        }
        result.valShort_ = valShort_;
        if (((from_bitField0_ & 0x00000020) == 0x00000020)) {
          to_bitField0_ |= 0x00000020;
        }
        result.valByte_ = valByte_;
        if (((from_bitField0_ & 0x00000040) == 0x00000040)) {
          to_bitField0_ |= 0x00000040;
        }
        result.valBool_ = valBool_;
        if (((from_bitField0_ & 0x00000080) == 0x00000080)) {
          to_bitField0_ |= 0x00000080;
        }
        result.valUint64_ = valUint64_;
        result.bitField0_ = to_bitField0_;
        onBuilt();
        return result;
      }

      public Builder mergeFrom(com.google.protobuf.Message other) {
        if (other instanceof com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t) {
          return mergeFrom((com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t)other);
        } else {
          super.mergeFrom(other);
          return this;
        }
      }

      public Builder mergeFrom(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t other) {
        if (other == com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.getDefaultInstance()) return this;
        if (other.hasType()) {
          setType(other.getType());
        }
        if (other.hasValString()) {
          bitField0_ |= 0x00000002;
          valString_ = other.valString_;
          onChanged();
        }
        if (other.hasValFloat()) {
          setValFloat(other.getValFloat());
        }
        if (other.hasValLong()) {
          setValLong(other.getValLong());
        }
        if (other.hasValShort()) {
          setValShort(other.getValShort());
        }
        if (other.hasValByte()) {
          setValByte(other.getValByte());
        }
        if (other.hasValBool()) {
          setValBool(other.getValBool());
        }
        if (other.hasValUint64()) {
          setValUint64(other.getValUint64());
        }
        this.mergeUnknownFields(other.getUnknownFields());
        return this;
      }

      public final boolean isInitialized() {
        return true;
      }

      public Builder mergeFrom(
          com.google.protobuf.CodedInputStream input,
          com.google.protobuf.ExtensionRegistryLite extensionRegistry)
          throws java.io.IOException {
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t parsedMessage = null;
        try {
          parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
        } catch (com.google.protobuf.InvalidProtocolBufferException e) {
          parsedMessage = (com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t) e.getUnfinishedMessage();
          throw e;
        } finally {
          if (parsedMessage != null) {
            mergeFrom(parsedMessage);
          }
        }
        return this;
      }
      private int bitField0_;

      // optional int32 type = 1;
      private int type_ ;
      /**
       * <code>optional int32 type = 1;</code>
       */
      public boolean hasType() {
        return ((bitField0_ & 0x00000001) == 0x00000001);
      }
      /**
       * <code>optional int32 type = 1;</code>
       */
      public int getType() {
        return type_;
      }
      /**
       * <code>optional int32 type = 1;</code>
       */
      public Builder setType(int value) {
        bitField0_ |= 0x00000001;
        type_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional int32 type = 1;</code>
       */
      public Builder clearType() {
        bitField0_ = (bitField0_ & ~0x00000001);
        type_ = 0;
        onChanged();
        return this;
      }

      // optional string val_string = 2;
      private java.lang.Object valString_ = "";
      /**
       * <code>optional string val_string = 2;</code>
       */
      public boolean hasValString() {
        return ((bitField0_ & 0x00000002) == 0x00000002);
      }
      /**
       * <code>optional string val_string = 2;</code>
       */
      public java.lang.String getValString() {
        java.lang.Object ref = valString_;
        if (!(ref instanceof java.lang.String)) {
          java.lang.String s = ((com.google.protobuf.ByteString) ref)
              .toStringUtf8();
          valString_ = s;
          return s;
        } else {
          return (java.lang.String) ref;
        }
      }
      /**
       * <code>optional string val_string = 2;</code>
       */
      public com.google.protobuf.ByteString
          getValStringBytes() {
        java.lang.Object ref = valString_;
        if (ref instanceof String) {
          com.google.protobuf.ByteString b = 
              com.google.protobuf.ByteString.copyFromUtf8(
                  (java.lang.String) ref);
          valString_ = b;
          return b;
        } else {
          return (com.google.protobuf.ByteString) ref;
        }
      }
      /**
       * <code>optional string val_string = 2;</code>
       */
      public Builder setValString(
          java.lang.String value) {
        if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000002;
        valString_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional string val_string = 2;</code>
       */
      public Builder clearValString() {
        bitField0_ = (bitField0_ & ~0x00000002);
        valString_ = getDefaultInstance().getValString();
        onChanged();
        return this;
      }
      /**
       * <code>optional string val_string = 2;</code>
       */
      public Builder setValStringBytes(
          com.google.protobuf.ByteString value) {
        if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000002;
        valString_ = value;
        onChanged();
        return this;
      }

      // optional float val_float = 3;
      private float valFloat_ ;
      /**
       * <code>optional float val_float = 3;</code>
       */
      public boolean hasValFloat() {
        return ((bitField0_ & 0x00000004) == 0x00000004);
      }
      /**
       * <code>optional float val_float = 3;</code>
       */
      public float getValFloat() {
        return valFloat_;
      }
      /**
       * <code>optional float val_float = 3;</code>
       */
      public Builder setValFloat(float value) {
        bitField0_ |= 0x00000004;
        valFloat_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional float val_float = 3;</code>
       */
      public Builder clearValFloat() {
        bitField0_ = (bitField0_ & ~0x00000004);
        valFloat_ = 0F;
        onChanged();
        return this;
      }

      // optional int32 val_long = 4;
      private int valLong_ ;
      /**
       * <code>optional int32 val_long = 4;</code>
       */
      public boolean hasValLong() {
        return ((bitField0_ & 0x00000008) == 0x00000008);
      }
      /**
       * <code>optional int32 val_long = 4;</code>
       */
      public int getValLong() {
        return valLong_;
      }
      /**
       * <code>optional int32 val_long = 4;</code>
       */
      public Builder setValLong(int value) {
        bitField0_ |= 0x00000008;
        valLong_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional int32 val_long = 4;</code>
       */
      public Builder clearValLong() {
        bitField0_ = (bitField0_ & ~0x00000008);
        valLong_ = 0;
        onChanged();
        return this;
      }

      // optional int32 val_short = 5;
      private int valShort_ ;
      /**
       * <code>optional int32 val_short = 5;</code>
       */
      public boolean hasValShort() {
        return ((bitField0_ & 0x00000010) == 0x00000010);
      }
      /**
       * <code>optional int32 val_short = 5;</code>
       */
      public int getValShort() {
        return valShort_;
      }
      /**
       * <code>optional int32 val_short = 5;</code>
       */
      public Builder setValShort(int value) {
        bitField0_ |= 0x00000010;
        valShort_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional int32 val_short = 5;</code>
       */
      public Builder clearValShort() {
        bitField0_ = (bitField0_ & ~0x00000010);
        valShort_ = 0;
        onChanged();
        return this;
      }

      // optional int32 val_byte = 6;
      private int valByte_ ;
      /**
       * <code>optional int32 val_byte = 6;</code>
       */
      public boolean hasValByte() {
        return ((bitField0_ & 0x00000020) == 0x00000020);
      }
      /**
       * <code>optional int32 val_byte = 6;</code>
       */
      public int getValByte() {
        return valByte_;
      }
      /**
       * <code>optional int32 val_byte = 6;</code>
       */
      public Builder setValByte(int value) {
        bitField0_ |= 0x00000020;
        valByte_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional int32 val_byte = 6;</code>
       */
      public Builder clearValByte() {
        bitField0_ = (bitField0_ & ~0x00000020);
        valByte_ = 0;
        onChanged();
        return this;
      }

      // optional bool val_bool = 7;
      private boolean valBool_ ;
      /**
       * <code>optional bool val_bool = 7;</code>
       */
      public boolean hasValBool() {
        return ((bitField0_ & 0x00000040) == 0x00000040);
      }
      /**
       * <code>optional bool val_bool = 7;</code>
       */
      public boolean getValBool() {
        return valBool_;
      }
      /**
       * <code>optional bool val_bool = 7;</code>
       */
      public Builder setValBool(boolean value) {
        bitField0_ |= 0x00000040;
        valBool_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional bool val_bool = 7;</code>
       */
      public Builder clearValBool() {
        bitField0_ = (bitField0_ & ~0x00000040);
        valBool_ = false;
        onChanged();
        return this;
      }

      // optional uint64 val_uint64 = 8;
      private long valUint64_ ;
      /**
       * <code>optional uint64 val_uint64 = 8;</code>
       */
      public boolean hasValUint64() {
        return ((bitField0_ & 0x00000080) == 0x00000080);
      }
      /**
       * <code>optional uint64 val_uint64 = 8;</code>
       */
      public long getValUint64() {
        return valUint64_;
      }
      /**
       * <code>optional uint64 val_uint64 = 8;</code>
       */
      public Builder setValUint64(long value) {
        bitField0_ |= 0x00000080;
        valUint64_ = value;
        onChanged();
        return this;
      }
      /**
       * <code>optional uint64 val_uint64 = 8;</code>
       */
      public Builder clearValUint64() {
        bitField0_ = (bitField0_ & ~0x00000080);
        valUint64_ = 0L;
        onChanged();
        return this;
      }

      // @@protoc_insertion_point(builder_scope:CSVCMsg_GameEvent.key_t)
    }

    static {
      defaultInstance = new key_t(true);
      defaultInstance.initFields();
    }

    // @@protoc_insertion_point(class_scope:CSVCMsg_GameEvent.key_t)
  }

  private int bitField0_;
  // optional string event_name = 1;
  public static final int EVENT_NAME_FIELD_NUMBER = 1;
  private java.lang.Object eventName_;
  /**
   * <code>optional string event_name = 1;</code>
   */
  public boolean hasEventName() {
    return ((bitField0_ & 0x00000001) == 0x00000001);
  }
  /**
   * <code>optional string event_name = 1;</code>
   */
  public java.lang.String getEventName() {
    java.lang.Object ref = eventName_;
    if (ref instanceof java.lang.String) {
      return (java.lang.String) ref;
    } else {
      com.google.protobuf.ByteString bs = 
          (com.google.protobuf.ByteString) ref;
      java.lang.String s = bs.toStringUtf8();
      if (bs.isValidUtf8()) {
        eventName_ = s;
      }
      return s;
    }
  }
  /**
   * <code>optional string event_name = 1;</code>
   */
  public com.google.protobuf.ByteString
      getEventNameBytes() {
    java.lang.Object ref = eventName_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      eventName_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }

  // optional int32 eventid = 2;
  public static final int EVENTID_FIELD_NUMBER = 2;
  private int eventid_;
  /**
   * <code>optional int32 eventid = 2;</code>
   */
  public boolean hasEventid() {
    return ((bitField0_ & 0x00000002) == 0x00000002);
  }
  /**
   * <code>optional int32 eventid = 2;</code>
   */
  public int getEventid() {
    return eventid_;
  }

  // repeated .CSVCMsg_GameEvent.key_t keys = 3;
  public static final int KEYS_FIELD_NUMBER = 3;
  private java.util.List<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t> keys_;
  /**
   * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
   */
  public java.util.List<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t> getKeysList() {
    return keys_;
  }
  /**
   * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
   */
  public java.util.List<? extends com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder> 
      getKeysOrBuilderList() {
    return keys_;
  }
  /**
   * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
   */
  public int getKeysCount() {
    return keys_.size();
  }
  /**
   * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
   */
  public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t getKeys(int index) {
    return keys_.get(index);
  }
  /**
   * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
   */
  public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder getKeysOrBuilder(
      int index) {
    return keys_.get(index);
  }

  private void initFields() {
    eventName_ = "";
    eventid_ = 0;
    keys_ = java.util.Collections.emptyList();
  }
  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized != -1) return isInitialized == 1;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    getSerializedSize();
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      output.writeBytes(1, getEventNameBytes());
    }
    if (((bitField0_ & 0x00000002) == 0x00000002)) {
      output.writeInt32(2, eventid_);
    }
    for (int i = 0; i < keys_.size(); i++) {
      output.writeMessage(3, keys_.get(i));
    }
    getUnknownFields().writeTo(output);
  }

  private int memoizedSerializedSize = -1;
  public int getSerializedSize() {
    int size = memoizedSerializedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(1, getEventNameBytes());
    }
    if (((bitField0_ & 0x00000002) == 0x00000002)) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(2, eventid_);
    }
    for (int i = 0; i < keys_.size(); i++) {
      size += com.google.protobuf.CodedOutputStream
        .computeMessageSize(3, keys_.get(i));
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSerializedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  protected java.lang.Object writeReplace()
      throws java.io.ObjectStreamException {
    return super.writeReplace();
  }

  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }

  public static Builder newBuilder() { return Builder.create(); }
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent prototype) {
    return newBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() { return newBuilder(this); }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code CSVCMsg_GameEvent}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder>
     implements com.valve.dota2.Networkbasetypes.CSVCMsg_GameEventOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.class, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.Builder.class);
    }

    // Construct using com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
        getKeysFieldBuilder();
      }
    }
    private static Builder create() {
      return new Builder();
    }

    public Builder clear() {
      super.clear();
      eventName_ = "";
      bitField0_ = (bitField0_ & ~0x00000001);
      eventid_ = 0;
      bitField0_ = (bitField0_ & ~0x00000002);
      if (keysBuilder_ == null) {
        keys_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
      } else {
        keysBuilder_.clear();
      }
      return this;
    }

    public Builder clone() {
      return create().mergeFrom(buildPartial());
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_GameEvent_descriptor;
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent getDefaultInstanceForType() {
      return com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.getDefaultInstance();
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent build() {
      com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent buildPartial() {
      com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent result = new com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
        to_bitField0_ |= 0x00000001;
      }
      result.eventName_ = eventName_;
      if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
        to_bitField0_ |= 0x00000002;
      }
      result.eventid_ = eventid_;
      if (keysBuilder_ == null) {
        if (((bitField0_ & 0x00000004) == 0x00000004)) {
          keys_ = java.util.Collections.unmodifiableList(keys_);
          bitField0_ = (bitField0_ & ~0x00000004);
        }
        result.keys_ = keys_;
      } else {
        result.keys_ = keysBuilder_.build();
      }
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent) {
        return mergeFrom((com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent other) {
      if (other == com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.getDefaultInstance()) return this;
      if (other.hasEventName()) {
        bitField0_ |= 0x00000001;
        eventName_ = other.eventName_;
        onChanged();
      }
      if (other.hasEventid()) {
        setEventid(other.getEventid());
      }
      if (keysBuilder_ == null) {
        if (!other.keys_.isEmpty()) {
          if (keys_.isEmpty()) {
            keys_ = other.keys_;
            bitField0_ = (bitField0_ & ~0x00000004);
          } else {
            ensureKeysIsMutable();
            keys_.addAll(other.keys_);
          }
          onChanged();
        }
      } else {
        if (!other.keys_.isEmpty()) {
          if (keysBuilder_.isEmpty()) {
            keysBuilder_.dispose();
            keysBuilder_ = null;
            keys_ = other.keys_;
            bitField0_ = (bitField0_ & ~0x00000004);
            keysBuilder_ = 
              com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders ?
                 getKeysFieldBuilder() : null;
          } else {
            keysBuilder_.addAllMessages(other.keys_);
          }
        }
      }
      this.mergeUnknownFields(other.getUnknownFields());
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent) e.getUnfinishedMessage();
        throw e;
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    // optional string event_name = 1;
    private java.lang.Object eventName_ = "";
    /**
     * <code>optional string event_name = 1;</code>
     */
    public boolean hasEventName() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional string event_name = 1;</code>
     */
    public java.lang.String getEventName() {
      java.lang.Object ref = eventName_;
      if (!(ref instanceof java.lang.String)) {
        java.lang.String s = ((com.google.protobuf.ByteString) ref)
            .toStringUtf8();
        eventName_ = s;
        return s;
      } else {
        return (java.lang.String) ref;
      }
    }
    /**
     * <code>optional string event_name = 1;</code>
     */
    public com.google.protobuf.ByteString
        getEventNameBytes() {
      java.lang.Object ref = eventName_;
      if (ref instanceof String) {
        com.google.protobuf.ByteString b = 
            com.google.protobuf.ByteString.copyFromUtf8(
                (java.lang.String) ref);
        eventName_ = b;
        return b;
      } else {
        return (com.google.protobuf.ByteString) ref;
      }
    }
    /**
     * <code>optional string event_name = 1;</code>
     */
    public Builder setEventName(
        java.lang.String value) {
      if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000001;
      eventName_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>optional string event_name = 1;</code>
     */
    public Builder clearEventName() {
      bitField0_ = (bitField0_ & ~0x00000001);
      eventName_ = getDefaultInstance().getEventName();
      onChanged();
      return this;
    }
    /**
     * <code>optional string event_name = 1;</code>
     */
    public Builder setEventNameBytes(
        com.google.protobuf.ByteString value) {
      if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000001;
      eventName_ = value;
      onChanged();
      return this;
    }

    // optional int32 eventid = 2;
    private int eventid_ ;
    /**
     * <code>optional int32 eventid = 2;</code>
     */
    public boolean hasEventid() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional int32 eventid = 2;</code>
     */
    public int getEventid() {
      return eventid_;
    }
    /**
     * <code>optional int32 eventid = 2;</code>
     */
    public Builder setEventid(int value) {
      bitField0_ |= 0x00000002;
      eventid_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>optional int32 eventid = 2;</code>
     */
    public Builder clearEventid() {
      bitField0_ = (bitField0_ & ~0x00000002);
      eventid_ = 0;
      onChanged();
      return this;
    }

    // repeated .CSVCMsg_GameEvent.key_t keys = 3;
    private java.util.List<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t> keys_ =
      java.util.Collections.emptyList();
    private void ensureKeysIsMutable() {
      if (!((bitField0_ & 0x00000004) == 0x00000004)) {
        keys_ = new java.util.ArrayList<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t>(keys_);
        bitField0_ |= 0x00000004;
       }
    }

    private com.google.protobuf.RepeatedFieldBuilder<
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder> keysBuilder_;

    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public java.util.List<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t> getKeysList() {
      if (keysBuilder_ == null) {
        return java.util.Collections.unmodifiableList(keys_);
      } else {
        return keysBuilder_.getMessageList();
      }
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public int getKeysCount() {
      if (keysBuilder_ == null) {
        return keys_.size();
      } else {
        return keysBuilder_.getCount();
      }
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t getKeys(int index) {
      if (keysBuilder_ == null) {
        return keys_.get(index);
      } else {
        return keysBuilder_.getMessage(index);
      }
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder setKeys(
        int index, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t value) {
      if (keysBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureKeysIsMutable();
        keys_.set(index, value);
        onChanged();
      } else {
        keysBuilder_.setMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder setKeys(
        int index, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder builderForValue) {
      if (keysBuilder_ == null) {
        ensureKeysIsMutable();
        keys_.set(index, builderForValue.build());
        onChanged();
      } else {
        keysBuilder_.setMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder addKeys(com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t value) {
      if (keysBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureKeysIsMutable();
        keys_.add(value);
        onChanged();
      } else {
        keysBuilder_.addMessage(value);
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder addKeys(
        int index, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t value) {
      if (keysBuilder_ == null) {
        if (value == null) {
          throw new NullPointerException();
        }
        ensureKeysIsMutable();
        keys_.add(index, value);
        onChanged();
      } else {
        keysBuilder_.addMessage(index, value);
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder addKeys(
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder builderForValue) {
      if (keysBuilder_ == null) {
        ensureKeysIsMutable();
        keys_.add(builderForValue.build());
        onChanged();
      } else {
        keysBuilder_.addMessage(builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder addKeys(
        int index, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder builderForValue) {
      if (keysBuilder_ == null) {
        ensureKeysIsMutable();
        keys_.add(index, builderForValue.build());
        onChanged();
      } else {
        keysBuilder_.addMessage(index, builderForValue.build());
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder addAllKeys(
        java.lang.Iterable<? extends com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t> values) {
      if (keysBuilder_ == null) {
        ensureKeysIsMutable();
        super.addAll(values, keys_);
        onChanged();
      } else {
        keysBuilder_.addAllMessages(values);
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder clearKeys() {
      if (keysBuilder_ == null) {
        keys_ = java.util.Collections.emptyList();
        bitField0_ = (bitField0_ & ~0x00000004);
        onChanged();
      } else {
        keysBuilder_.clear();
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public Builder removeKeys(int index) {
      if (keysBuilder_ == null) {
        ensureKeysIsMutable();
        keys_.remove(index);
        onChanged();
      } else {
        keysBuilder_.remove(index);
      }
      return this;
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder getKeysBuilder(
        int index) {
      return getKeysFieldBuilder().getBuilder(index);
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder getKeysOrBuilder(
        int index) {
      if (keysBuilder_ == null) {
        return keys_.get(index);  } else {
        return keysBuilder_.getMessageOrBuilder(index);
      }
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public java.util.List<? extends com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder> 
         getKeysOrBuilderList() {
      if (keysBuilder_ != null) {
        return keysBuilder_.getMessageOrBuilderList();
      } else {
        return java.util.Collections.unmodifiableList(keys_);
      }
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder addKeysBuilder() {
      return getKeysFieldBuilder().addBuilder(
          com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.getDefaultInstance());
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder addKeysBuilder(
        int index) {
      return getKeysFieldBuilder().addBuilder(
          index, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.getDefaultInstance());
    }
    /**
     * <code>repeated .CSVCMsg_GameEvent.key_t keys = 3;</code>
     */
    public java.util.List<com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder> 
         getKeysBuilderList() {
      return getKeysFieldBuilder().getBuilderList();
    }
    private com.google.protobuf.RepeatedFieldBuilder<
        com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder> 
        getKeysFieldBuilder() {
      if (keysBuilder_ == null) {
        keysBuilder_ = new com.google.protobuf.RepeatedFieldBuilder<
            com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_t.Builder, com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent.key_tOrBuilder>(
                keys_,
                ((bitField0_ & 0x00000004) == 0x00000004),
                getParentForChildren(),
                isClean());
        keys_ = null;
      }
      return keysBuilder_;
    }

    // @@protoc_insertion_point(builder_scope:CSVCMsg_GameEvent)
  }

  static {
    defaultInstance = new CSVCMsg_GameEvent(true);
    defaultInstance.initFields();
  }

  // @@protoc_insertion_point(class_scope:CSVCMsg_GameEvent)
} public static final class CSVCMsg_UserMessage extends
    com.google.protobuf.GeneratedMessage
    implements CSVCMsg_UserMessageOrBuilder {
  // Use CSVCMsg_UserMessage.newBuilder() to construct.
  private CSVCMsg_UserMessage(com.google.protobuf.GeneratedMessage.Builder<?> builder) {
    super(builder);
    this.unknownFields = builder.getUnknownFields();
  }
  private CSVCMsg_UserMessage(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); }

  private static final CSVCMsg_UserMessage defaultInstance;
  public static CSVCMsg_UserMessage getDefaultInstance() {
    return defaultInstance;
  }

  public CSVCMsg_UserMessage getDefaultInstanceForType() {
    return defaultInstance;
  }

  private final com.google.protobuf.UnknownFieldSet unknownFields;
  @java.lang.Override
  public final com.google.protobuf.UnknownFieldSet
      getUnknownFields() {
    return this.unknownFields;
  }
  private CSVCMsg_UserMessage(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    initFields();
    int mutable_bitField0_ = 0;
    com.google.protobuf.UnknownFieldSet.Builder unknownFields =
        com.google.protobuf.UnknownFieldSet.newBuilder();
    try {
      boolean done = false;
      while (!done) {
        int tag = input.readTag();
        switch (tag) {
          case 0:
            done = true;
            break;
          default: {
            if (!parseUnknownField(input, unknownFields,
                                   extensionRegistry, tag)) {
              done = true;
            }
            break;
          }
          case 8: {
            bitField0_ |= 0x00000001;
            msgType_ = input.readInt32();
            break;
          }
          case 18: {
            bitField0_ |= 0x00000002;
            msgData_ = input.readBytes();
            break;
          }
        }
      }
    } catch (com.google.protobuf.InvalidProtocolBufferException e) {
      throw e.setUnfinishedMessage(this);
    } catch (java.io.IOException e) {
      throw new com.google.protobuf.InvalidProtocolBufferException(
          e.getMessage()).setUnfinishedMessage(this);
    } finally {
      this.unknownFields = unknownFields.build();
      makeExtensionsImmutable();
    }
  }
  public static final com.google.protobuf.Descriptors.Descriptor
      getDescriptor() {
    return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_UserMessage_descriptor;
  }

  protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
      internalGetFieldAccessorTable() {
    return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_UserMessage_fieldAccessorTable
        .ensureFieldAccessorsInitialized(
            com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.class, com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.Builder.class);
  }

  public static com.google.protobuf.Parser<CSVCMsg_UserMessage> PARSER =
      new com.google.protobuf.AbstractParser<CSVCMsg_UserMessage>() {
    public CSVCMsg_UserMessage parsePartialFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws com.google.protobuf.InvalidProtocolBufferException {
      return new CSVCMsg_UserMessage(input, extensionRegistry);
    }
  };

  @java.lang.Override
  public com.google.protobuf.Parser<CSVCMsg_UserMessage> getParserForType() {
    return PARSER;
  }

  private int bitField0_;
  // optional int32 msg_type = 1;
  public static final int MSG_TYPE_FIELD_NUMBER = 1;
  private int msgType_;
  /**
   * <code>optional int32 msg_type = 1;</code>
   */
  public boolean hasMsgType() {
    return ((bitField0_ & 0x00000001) == 0x00000001);
  }
  /**
   * <code>optional int32 msg_type = 1;</code>
   */
  public int getMsgType() {
    return msgType_;
  }

  // optional bytes msg_data = 2;
  public static final int MSG_DATA_FIELD_NUMBER = 2;
  private com.google.protobuf.ByteString msgData_;
  /**
   * <code>optional bytes msg_data = 2;</code>
   */
  public boolean hasMsgData() {
    return ((bitField0_ & 0x00000002) == 0x00000002);
  }
  /**
   * <code>optional bytes msg_data = 2;</code>
   */
  public com.google.protobuf.ByteString getMsgData() {
    return msgData_;
  }

  private void initFields() {
    msgType_ = 0;
    msgData_ = com.google.protobuf.ByteString.EMPTY;
  }
  private byte memoizedIsInitialized = -1;
  public final boolean isInitialized() {
    byte isInitialized = memoizedIsInitialized;
    if (isInitialized != -1) return isInitialized == 1;

    memoizedIsInitialized = 1;
    return true;
  }

  public void writeTo(com.google.protobuf.CodedOutputStream output)
                      throws java.io.IOException {
    getSerializedSize();
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      output.writeInt32(1, msgType_);
    }
    if (((bitField0_ & 0x00000002) == 0x00000002)) {
      output.writeBytes(2, msgData_);
    }
    getUnknownFields().writeTo(output);
  }

  private int memoizedSerializedSize = -1;
  public int getSerializedSize() {
    int size = memoizedSerializedSize;
    if (size != -1) return size;

    size = 0;
    if (((bitField0_ & 0x00000001) == 0x00000001)) {
      size += com.google.protobuf.CodedOutputStream
        .computeInt32Size(1, msgType_);
    }
    if (((bitField0_ & 0x00000002) == 0x00000002)) {
      size += com.google.protobuf.CodedOutputStream
        .computeBytesSize(2, msgData_);
    }
    size += getUnknownFields().getSerializedSize();
    memoizedSerializedSize = size;
    return size;
  }

  private static final long serialVersionUID = 0L;
  @java.lang.Override
  protected java.lang.Object writeReplace()
      throws java.io.ObjectStreamException {
    return super.writeReplace();
  }

  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      com.google.protobuf.ByteString data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      com.google.protobuf.ByteString data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(byte[] data)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      byte[] data,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws com.google.protobuf.InvalidProtocolBufferException {
    return PARSER.parseFrom(data, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseDelimitedFrom(java.io.InputStream input)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseDelimitedFrom(
      java.io.InputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseDelimitedFrom(input, extensionRegistry);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      com.google.protobuf.CodedInputStream input)
      throws java.io.IOException {
    return PARSER.parseFrom(input);
  }
  public static com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parseFrom(
      com.google.protobuf.CodedInputStream input,
      com.google.protobuf.ExtensionRegistryLite extensionRegistry)
      throws java.io.IOException {
    return PARSER.parseFrom(input, extensionRegistry);
  }

  public static Builder newBuilder() { return Builder.create(); }
  public Builder newBuilderForType() { return newBuilder(); }
  public static Builder newBuilder(com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage prototype) {
    return newBuilder().mergeFrom(prototype);
  }
  public Builder toBuilder() { return newBuilder(this); }

  @java.lang.Override
  protected Builder newBuilderForType(
      com.google.protobuf.GeneratedMessage.BuilderParent parent) {
    Builder builder = new Builder(parent);
    return builder;
  }
  /**
   * Protobuf type {@code CSVCMsg_UserMessage}
   */
  public static final class Builder extends
      com.google.protobuf.GeneratedMessage.Builder<Builder>
     implements com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessageOrBuilder {
    public static final com.google.protobuf.Descriptors.Descriptor
        getDescriptor() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_UserMessage_descriptor;
    }

    protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
        internalGetFieldAccessorTable() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_UserMessage_fieldAccessorTable
          .ensureFieldAccessorsInitialized(
              com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.class, com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.Builder.class);
    }

    // Construct using com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.newBuilder()
    private Builder() {
      maybeForceBuilderInitialization();
    }

    private Builder(
        com.google.protobuf.GeneratedMessage.BuilderParent parent) {
      super(parent);
      maybeForceBuilderInitialization();
    }
    private void maybeForceBuilderInitialization() {
      if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {
      }
    }
    private static Builder create() {
      return new Builder();
    }

    public Builder clear() {
      super.clear();
      msgType_ = 0;
      bitField0_ = (bitField0_ & ~0x00000001);
      msgData_ = com.google.protobuf.ByteString.EMPTY;
      bitField0_ = (bitField0_ & ~0x00000002);
      return this;
    }

    public Builder clone() {
      return create().mergeFrom(buildPartial());
    }

    public com.google.protobuf.Descriptors.Descriptor
        getDescriptorForType() {
      return com.valve.dota2.Networkbasetypes.internal_static_CSVCMsg_UserMessage_descriptor;
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage getDefaultInstanceForType() {
      return com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.getDefaultInstance();
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage build() {
      com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage result = buildPartial();
      if (!result.isInitialized()) {
        throw newUninitializedMessageException(result);
      }
      return result;
    }

    public com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage buildPartial() {
      com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage result = new com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage(this);
      int from_bitField0_ = bitField0_;
      int to_bitField0_ = 0;
      if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
        to_bitField0_ |= 0x00000001;
      }
      result.msgType_ = msgType_;
      if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
        to_bitField0_ |= 0x00000002;
      }
      result.msgData_ = msgData_;
      result.bitField0_ = to_bitField0_;
      onBuilt();
      return result;
    }

    public Builder mergeFrom(com.google.protobuf.Message other) {
      if (other instanceof com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage) {
        return mergeFrom((com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage)other);
      } else {
        super.mergeFrom(other);
        return this;
      }
    }

    public Builder mergeFrom(com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage other) {
      if (other == com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage.getDefaultInstance()) return this;
      if (other.hasMsgType()) {
        setMsgType(other.getMsgType());
      }
      if (other.hasMsgData()) {
        setMsgData(other.getMsgData());
      }
      this.mergeUnknownFields(other.getUnknownFields());
      return this;
    }

    public final boolean isInitialized() {
      return true;
    }

    public Builder mergeFrom(
        com.google.protobuf.CodedInputStream input,
        com.google.protobuf.ExtensionRegistryLite extensionRegistry)
        throws java.io.IOException {
      com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage parsedMessage = null;
      try {
        parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
      } catch (com.google.protobuf.InvalidProtocolBufferException e) {
        parsedMessage = (com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage) e.getUnfinishedMessage();
        throw e;
      } finally {
        if (parsedMessage != null) {
          mergeFrom(parsedMessage);
        }
      }
      return this;
    }
    private int bitField0_;

    // optional int32 msg_type = 1;
    private int msgType_ ;
    /**
     * <code>optional int32 msg_type = 1;</code>
     */
    public boolean hasMsgType() {
      return ((bitField0_ & 0x00000001) == 0x00000001);
    }
    /**
     * <code>optional int32 msg_type = 1;</code>
     */
    public int getMsgType() {
      return msgType_;
    }
    /**
     * <code>optional int32 msg_type = 1;</code>
     */
    public Builder setMsgType(int value) {
      bitField0_ |= 0x00000001;
      msgType_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>optional int32 msg_type = 1;</code>
     */
    public Builder clearMsgType() {
      bitField0_ = (bitField0_ & ~0x00000001);
      msgType_ = 0;
      onChanged();
      return this;
    }

    // optional bytes msg_data = 2;
    private com.google.protobuf.ByteString msgData_ = com.google.protobuf.ByteString.EMPTY;
    /**
     * <code>optional bytes msg_data = 2;</code>
     */
    public boolean hasMsgData() {
      return ((bitField0_ & 0x00000002) == 0x00000002);
    }
    /**
     * <code>optional bytes msg_data = 2;</code>
     */
    public com.google.protobuf.ByteString getMsgData() {
      return msgData_;
    }
    /**
     * <code>optional bytes msg_data = 2;</code>
     */
    public Builder setMsgData(com.google.protobuf.ByteString value) {
      if (value == null) {
  throw new NullPointerException();
}
bitField0_ |= 0x00000002;
      msgData_ = value;
      onChanged();
      return this;
    }
    /**
     * <code>optional bytes msg_data = 2;</code>
     */
    public Builder clearMsgData() {
      bitField0_ = (bitField0_ & ~0x00000002);
      msgData_ = getDefaultInstance().getMsgData();
      onChanged();
      return this;
    }

    // @@protoc_insertion_point(builder_scope:CSVCMsg_UserMessage)
  }

  static {
    defaultInstance = new CSVCMsg_UserMessage(true);
    defaultInstance.initFields();
  }

  // @@protoc_insertion_point(class_scope:CSVCMsg_UserMessage)
} public class DotaPlay {
    public interface ProgressListener {
        void bytesRemaining( int position );
    }

    /**
     * The current parsing state.
     */
    private static ParseState state;

    private static List<GameEventListener> listeners = new ArrayList<GameEventListener>();

    private static int tick;

    private final static Logger LOGGER = Logger.getLogger( DotaPlay.class.getName() );

    public static void addListener( GameEventListener l ) {
        listeners.add( l );
    }

    public static List<GameEventListener> getListeners() {
        return listeners;
    }

    public static ParseState getState() {
        return state;
    }

    public static int getTick() {
        return tick;
    }

    public static long getTickMs() {
        return state.getTickAsMs( tick );
    }

    private static void handleClassInfo( CDemoClassInfo info ) {
        if (state == null) {
            throw new IllegalStateException( "DEM_ClassInfo but no state." );
        }

        for (int i = 0; i < info.getClassesCount(); ++i) {
            final class_t clazz = info.getClasses( i );
            state.createClass( clazz.getClassId(), clazz.getTableName(), clazz.getNetworkName() );
        }

        for (final SendTable table : state.getSendTables()) {
            for (int i = 0; i < table.getProps().size(); ++i) {
                final SendProp prop = table.getProps().get( i );

                prop.setInTable( table );

                if (prop.getType() == SP_Type.SP_Array) {
                    if (i == 0) {
                        throw new IllegalStateException( "Array prop " + prop.getName() + " is at index zero." );
                    }
                    prop.setArrayProp( table.getProps().get( i - 1 ) );
                }
            }
        }
        LOGGER.info( "Received " + info.getClassesCount() + " classes." );

        state.compileSendTables();

    }

    private static void handleDemoCommand( EDemoCommands type, byte[] message, int tick ) throws IOException {
        switch (type) {
            case DEM_FileHeader:
                final CDemoFileHeader header = CDemoFileHeader.parseFrom( message );
                handleHeader( header );

                break;
            case DEM_Stop:
                handleStop();
                break;
            case DEM_FullPacket:
                final CDemoFullPacket full = CDemoFullPacket.parseFrom( message );
                state.clearEntities();

                handlePacket( full.getPacket() );
                break;
            case DEM_Packet:
            case DEM_SignonPacket:

                final CDemoPacket p = CDemoPacket.parseFrom( message );
                handlePacket( p );
                break;
            case DEM_ClassInfo:
                final CDemoClassInfo info = CDemoClassInfo.parseFrom( message );
                handleClassInfo( info );
                break;
            case DEM_SendTables:
                final CDemoSendTables tables = CDemoSendTables.parseFrom( message );
                SVCMessageHandler.handleSendTables( tables, state );
                break;
            case DEM_FileInfo:
                final CDemoFileInfo finfo = CDemoFileInfo.parseFrom( message );
                handleFileInfo( finfo );
                break;
            case DEM_StringTables:

            case DEM_ConsoleCmd:
            case DEM_CustomData:
            case DEM_CustomDataCallbacks:
            case DEM_Error:

            case DEM_IsCompressed:
            case DEM_Max:

            case DEM_SyncTick:
            case DEM_UserCmd:
            default:
                LOGGER.info( "Skipping paket of type " + type + " in tick " + tick );
                break;
        }

    }

    private static void handleFileInfo( CDemoFileInfo finfo ) {
        final CGameInfo info = finfo.getGameInfo();

        final CDotaGameInfo dInfo = info.getDota();
        for (final CPlayerInfo p : dInfo.getPlayerInfoList()) {
            state.setPlayerInfo( p.getPlayerName(), p.getHeroName() );
        }

    }

    private static void handleHeader( CDemoFileHeader header ) {
        LOGGER.info( "Server name: " + header.getServerName() );
        LOGGER.info( "Server client name: " + header.getClientName() );

    }

    private static void handleNetMessage( int cmd, int size, ByteBuffer buffer ) {
        final NET_Messages msg = NET_Messages.valueOf( cmd );
        Logger.getLogger( DotaPlay.class.getName() ).finest( msg.name() );
        final byte[] data = new byte[size];
        buffer.get( data );

        switch (msg) {
            case net_Disconnect:
            case net_File:
            case net_NOP:
            case net_SetConVar:
            case net_SignonState:
            case net_SplitScreenUser:
            case net_StringCmd:
            case net_Tick:
                break;

        }
    }

    private static void handlePacket( CDemoPacket p ) throws IOException {

        final ByteBuffer buffer = p.getData().asReadOnlyByteBuffer();

        while (buffer.hasRemaining()) {
            final int cmd = Utils.readVarInt( buffer );
            final int size = Utils.readVarInt( buffer );

            if (SVC_Messages.valueOf( cmd ) != null) {
                SVCMessageHandler.handleSVCMessage( cmd, size, buffer );
            }
            else if (NET_Messages.valueOf( cmd ) != null) {
                handleNetMessage( cmd, size, buffer );
            }
            else {
                throw new IllegalStateException( "CDemo Packet with unknown command " + cmd + " and size " + size );
            }

        }

    }

    private static void handleStop() {

        LOGGER.info( "Demo ended after " + getTickMs() + " ms" );

    }

    public static void loadFile( String path ) {
        loadFile( path, (ProgressListener[]) null );
    }

    public static void loadFile( String path, ProgressListener... pl ) {
        setState( null );
        final DemoFile file = new DemoFile();
        try {
            file.open( path );
            while (!file.isDone()) {
                final int[] pTick = new int[1];
                final boolean[] compressed = new boolean[1];
                final EDemoCommands type = file.readMessageType( pTick, compressed );
                setTick( pTick[0] );

                Logger.getLogger( DotaPlay.class.getName() ).fine( "Tick: " + pTick[0] );
                final byte[] message = file.readMessage( compressed[0] );
                handleDemoCommand( type, message, pTick[0] );
                if (pl != null) {
                    for (final ProgressListener p : pl) {
                        p.bytesRemaining( file.bytesRemaining() );
                    }
                }
            }

            file.close();
            for (final GameEventListener l : listeners) {
                l.parseComplete( getTickMs(), getState() );
            }
        }
        catch (final IOException e) {
            Logger.getLogger( DotaPlay.class.getName() ).severe( e.getLocalizedMessage() );
            e.printStackTrace();
        }

    }

    public static void removeListener( GameEventListener l ) {
        listeners.remove( l );
    }

    public static void setState( ParseState state ) {
        DotaPlay.state = state;
    }

    public static void setTick( int i ) {
        tick = i;

    }

}
 public class ParseState {
    private class CompileState {
        Set<String> excluding;
        Vector<SendProp> props;

        CompileState() {
            excluding = new HashSet<String>();
            props = new Vector<SendProp>();
            playedHeroes = new HashMap<String, String>();
        }
    }

    private final Map<Integer, Entity> entities;

    private final Map<Integer, EntityClass> entityClasses;

    private final int classBits;

    private final Map<String, SendTable> sendTables;

    private final LinkedHashMap<String, StringTable> stringTables;

    private final Map<String, FlatSendTable> flatSendTables;

    private Map<String, String> playedHeroes;

    private float tickInterval;

    private CSVCMsg_GameEventList gameEventList;

    private final int protocolVersion;

    public ParseState( int version, int maxClasses ) {
        protocolVersion = version;
        entities = new HashMap<Integer, Entity>();
        sendTables = new HashMap<String, SendTable>();
        flatSendTables = new HashMap<String, FlatSendTable>();
        entityClasses = new HashMap<Integer, EntityClass>();
        classBits = Utils.log2( maxClasses );
        stringTables = new LinkedHashMap<String, StringTable>();
    }

    private void buildHierarchy( SendTable sendTable, DTProp dtProp, CompileState state ) {
        dtProp.sendTable = sendTable;

        dtProp.propStart = state.props.size();
        gather( sendTable, dtProp, state );

        final Iterator<SendProp> iter = dtProp.nonDtProps.iterator();
        while (iter.hasNext()) {
            final SendProp p = iter.next();
            state.props.add( p );
        }

        dtProp.propCount = state.props.size() - dtProp.propStart;

    }

    public void clearEntities() {
        entities.clear();
    }

    private void compileSendTable( SendTable table ) {
        final CompileState state = new CompileState();
        gatherExcludes( table, state.excluding );

        final DTProp dtProp = new DTProp();
        buildHierarchy( table, dtProp, state );

        final Vector<Integer> priorities = new Vector();
        priorities.add( 64 );
        for (final SendProp prop : state.props) {
            final int priority = prop.getPriority();

            final Iterator<Integer> iter = priorities.iterator();
            int p = iter.next();
            while (iter.hasNext() && p != priority) {
                p = iter.next();
            }

            if (p == priorities.lastElement()) {
                priorities.add( priority );
            }
        }

        Collections.sort( priorities );

        int propOffset = 0;
        for (int priorityIndex = 0; priorityIndex < priorities.size(); ++priorityIndex) {
            final int priority = priorities.get( priorityIndex );

            int hole = propOffset;
            int cursor = hole;
            while (cursor < state.props.size()) {
                final SendProp prop = state.props.get( cursor );

                if (prop.getPriority() == priority || priority == 64 && (SP_Flags.SP_ChangesOften.getId() & prop.getFlags()) > 0) {
                    final SendProp temp = state.props.get( hole );
                    state.props.set( hole, state.props.get( cursor ) );
                    state.props.set( cursor, temp );

                    ++hole;
                    ++propOffset;
                }

                ++cursor;
            }
        }

        final FlatSendTable flatTable = new FlatSendTable( table.getName() );
        flatTable.setProps( state.props );
        flatTable.setDtProp( dtProp );

        flatSendTables.put( table.getName(), flatTable );

    }

    public void compileSendTables() {
        for (final SendTable t : sendTables.values()) {
            compileSendTable( t );
        }

    }

    public void createClass( int classId, String tableName, String networkName ) {
        if (entityClasses.containsKey( classId )) {
            throw new IllegalArgumentException( "Class with id " + classId + " already exists." );
        }

        final EntityClass ec = new EntityClass( classId, tableName, networkName );
        Logger.getLogger( ParseState.class.getName() ).fine( "Created class: " + ec );
        entityClasses.put( classId, ec );

    }

    public SendTable createSendTable( String netTableName, boolean needsDecoder ) {
        final SendTable table = new SendTable( netTableName, needsDecoder );
        sendTables.put( netTableName, table );
        return table;
    }

    public StringTable createStringTable( String name, int maxEntries, int flags, boolean userDataFixedSize, int userDataSize, int userDataSizeBits ) {
        if (stringTables.containsKey( name )) {
            throw new IllegalStateException( "StringTable " + name + " already exists." );
        }

        final StringTable table = new StringTable( name, maxEntries, userDataFixedSize, userDataSize, userDataSizeBits, flags );
        stringTables.put( name, table );

        return table;
    }

    public Entity deleteEntity( int entityId ) {
        if (!entities.containsKey( entityId )) {
            throw new IllegalArgumentException( "Entity " + entityId + " does not exist" );
        }
        return entities.remove( entityId );

    }

    private void gather( SendTable from, DTProp dt_prop, CompileState state ) {
        for (final SendProp prop : from.getProps()) {

            if (((SP_Flags.SP_Exclude.getId() | SP_Flags.SP_InsideArray.getId()) & prop.getFlags()) > 0) {
                continue;
            }
            else if (state.excluding.contains( from.getName() + prop.getName() )) {
                continue;
            }

            if (SP_Type.SP_DataTable == prop.getType()) {
                final SendTable dtTable = sendTables.get( prop.getDtName() );
                if (dtTable == from) {
                    throw new IllegalStateException();
                }
                if ((SP_Flags.SP_Collapsible.getId() & prop.getFlags()) > 0) {
                    gather( dtTable, dt_prop, state );
                }
                else {
                    final DTProp newDtProp = new DTProp();
                    dt_prop.dtProps.add( newDtProp );

                    buildHierarchy( dtTable, newDtProp, state );
                }
            }
            else {
                if (dt_prop.nonDtProps.contains( prop )) {
                    throw new IllegalStateException();
                }
                dt_prop.nonDtProps.add( prop );
            }
        }
    }

    private void gatherExcludes( SendTable table, Set<String> excluding ) {
        for (final SendProp prop : table.getProps()) {

            if ((SP_Flags.SP_Exclude.getId() & prop.getFlags()) > 0) {
                excluding.add( prop.getDtName() + prop.getName() );
            }
            else if (SP_Type.SP_DataTable == prop.getType()) {
                gatherExcludes( sendTables.get( prop.getDtName() ), excluding );
            }
        }
    }

    public int getClassBits() {
        return classBits;
    }

    public Entity getEntity( int id ) {
        return entities.get( id );
    }

    public EntityClass getEntityClass( int id ) {
        return entityClasses.get( id );
    }

    public FlatSendTable getFlatSendTable( String dtName ) {
        return flatSendTables.get( dtName );
    }

    public CSVCMsg_GameEventList getGameEventList() {
        return gameEventList;
    }

    public String getHeroForPlayer( String player ) {
        return playedHeroes.get( player );
    }

    public int getProtocolVersion() {
        return protocolVersion;
    }

    public Collection<SendTable> getSendTables() {
        return sendTables.values();
    }

    public StringTable getStringTable( int tableId ) {
        final Iterator<String> iter = stringTables.keySet().iterator();
        String key = iter.next();
        while (tableId > 0) {
            key = iter.next();
            tableId--;
        }
        return stringTables.get( key );
    }

    public StringTable getStringTable( String key ) {
        return stringTables.get( key );
    }

    public LinkedHashMap<String, StringTable> getStringTables() {
        return stringTables;
    }

    /**
     * Dota2 game time is counted in "ticks". A wallclock minute
     * has 30 ticks, therefore a tick occurs roughly every 33ms.
     * This method converts a tick number in the number of miliseconds
     * passed since game start time.
     * @param tick
     * @return
     */
    public long getTickAsMs( int tick ) {
        return (long) (tick * 1000 * tickInterval);
    }

    public float getTickInterval() {
        return tickInterval;
    }

    public boolean hasEntity( int id ) {
        return entities.containsKey( id );
    }

    public void setEntity( int id, Entity entity ) {
        entities.put( id, entity );

    }

    public void setGameEventList( CSVCMsg_GameEventList e ) {
        gameEventList = e;

    }

    public void setPlayerInfo( String playerName, String heroName ) {
        playedHeroes.put( playerName, heroName );

    }

    public void setTickInterval( float tickInterval ) {
        this.tickInterval = tickInterval;

    }

}
 public class StateUtils {
    static class DTProp {
        SendTable sendTable;
        Vector<DTProp> dtProps;
        Vector<SendProp> nonDtProps;

        int propStart;
        int propCount;

        public DTProp() {
            dtProps = new Vector<DTProp>();
            nonDtProps = new Vector<SendProp>();
        }
    };

    public static class FlatSendTable {

        private final String netTableName;
        private Vector<SendProp> props;

        private DTProp dtProp;

        FlatSendTable( String netTableName ) {
            this.netTableName = netTableName;
        }

        public DTProp getDtProp() {
            return dtProp;
        }

        public String getNetTableName() {
            return netTableName;
        }

        public Vector<SendProp> getProps() {
            return props;
        }

        public void setDtProp( DTProp dtProp ) {
            this.dtProp = dtProp;
        }

        public void setProps( Vector<SendProp> props ) {
            this.props = props;
        }
    };

    public static class SendProp {
        private final SP_Type type;

        private final String name;

        private final int flags;
        private final int priority;
        private final String dtName;
        private final int numElements;

        private final float lowValue;
        private final float highValue;

        private final int numBits;
        private SendTable inTable;
        private SendProp arrayProp;

        public SendProp( SP_Type type, String name, int flags, int priority, String dtName, int numElements, float lowValue, float highValue, int numBits ) {

            this.type = type;
            this.name = name;
            this.flags = flags;
            this.priority = priority;
            this.dtName = dtName;
            this.numElements = numElements;
            this.lowValue = lowValue;
            this.highValue = highValue;
            this.numBits = numBits;
        }

        public SendProp getArrayProp() {
            return arrayProp;
        }

        public String getDtName() {
            return dtName;
        }

        public int getFlags() {
            return flags;
        }

        public float getHighValue() {
            return highValue;
        }

        public SendTable getInTable() {
            return inTable;
        }

        public float getLowValue() {
            return lowValue;
        }

        public String getName() {
            return name;
        }

        public int getNumberOfElements() {
            return numElements;
        }

        public int getNumBits() {
            return numBits;
        }

        public int getPriority() {
            return priority;
        }

        public SP_Type getType() {

            return type;
        }

        public void setArrayProp( SendProp sendProp ) {
            arrayProp = sendProp;

        }

        public void setInTable( SendTable inTable ) {
            this.inTable = inTable;
        }

        @Override
        public String toString() {
            return "SendProp [type=" + type + ", name=" + name + ", lowValue=" + lowValue + ", highValue=" + highValue + "]";
        }

    };

    public static class SendTable {

        private String netTableName;

        private boolean needsDecoder;
        private final List<SendProp> props;

        public SendTable() {
            props = new ArrayList<SendProp>();
        }

        public SendTable( String netTableName, boolean needsDecoder ) {
            this();
            this.netTableName = netTableName;
            this.needsDecoder = needsDecoder;
        }

        public String getName() {
            return netTableName;
        }

        public List<SendProp> getProps() {
            return props;
        }
    };

    public enum SP_Flags {
        SP_Unsigned( 1 << 0 ), SP_Coord( 1 << 1 ), SP_NoScale( 1 << 2 ), SP_RoundDown( 1 << 3 ), SP_RoundUp( 1 << 4 ), SP_Normal( 1 << 5 ), SP_Exclude( 1 << 6 ), SP_Xyze(
                        1 << 7 ), SP_InsideArray( 1 << 8 ),

        SP_Collapsible( 1 << 11 ), SP_CoordMp( 1 << 12 ), SP_CoordMpLowPrecision( 1 << 13 ), SP_CoordMpIntegral( 1 << 14 ), SP_CellCoord( 1 << 15 ), SP_CellCoordLowPrecision(
                        1 << 16 ), SP_CellCoordIntegral( 1 << 17 ), SP_ChangesOften( 1 << 18 ), SP_EncodedAgainstTickcount( 1 << 19 );
        public static SP_Flags valueOf( int id ) {
            for (final SP_Flags f : SP_Flags.values()) {
                if (f.id == id) {
                    return f;
                }
            }

            return null;
        }

        private final int id;

        private SP_Flags( int id ) {
            this.id = id;
        }

        public int getId() {
            return id;
        }
    };

    public enum SP_Type {
        SP_Int( 0 ), SP_Float( 1 ), SP_Vector( 2 ), SP_VectorXY( 3 ), SP_String( 4 ), SP_Array( 5 ), SP_DataTable( 6 ), SP_Int64( 7 );
        public static SP_Type valueOf( int id ) {
            switch (id) {
                case 0:
                    return SP_Int;
                case 1:
                    return SP_Float;
                case 2:
                    return SP_Vector;
                case 3:
                    return SP_VectorXY;
                case 4:
                    return SP_String;
                case 5:
                    return SP_Array;
                case 6:
                    return SP_DataTable;
                case 7:
                    return SP_Int64;
                default:
                    return null;
            }
        }

        private final int id;

        private SP_Type( int id ) {
            this.id = id;
        }

        public int getId() {
            return id;
        }
    };

    public enum ST_Flags {
        ST_Something( 2 ), ST_FixedLength( 8 );

        public static ST_Flags valueOf( int id ) {
            switch (id) {
                case 2:
                    return ST_Something;
                case 8:
                    return ST_FixedLength;
                default:
                    return null;
            }
        }

        private final int id;

        private ST_Flags( int id ) {
            this.id = id;
        }

        public int getId() {
            return id;
        }

    };

    public static class StringTable extends LinkedHashMap<String, StringTableEntry> {

        /**
         * 
         */
        private static final long serialVersionUID = -3539920946466168199L;
        private final String name;
        private final int max_entries;

        private final boolean user_data_fixed_size;
        private final int userDataSize;
        private final int userDataSizeBits;
        private final int flags;
        private final int entry_bits;

        public StringTable( String name, int max_entries, boolean user_data_fixed_size, int user_data_size, int user_data_size_bits, int flags ) {
            super();
            this.name = name;
            this.max_entries = max_entries;
            this.user_data_fixed_size = user_data_fixed_size;
            userDataSize = user_data_size;
            userDataSizeBits = user_data_size_bits;
            this.flags = flags;
            entry_bits = Utils.log2( max_entries );

        }

        public StringTableEntry get( int id ) {
            final Iterator<String> iter = keySet().iterator();
            String key = iter.next();
            for (int i = 0; i < id; i++) {
                key = iter.next();
            }
            return get( key );
        }

        public int getEntryBits() {
            return entry_bits;
        }

        public int getFlags() {
            return flags;
        }

        public int getMaxEntries() {
            return max_entries;
        }

        public String getName() {
            return name;
        }

        public int getUserDataSize() {
            return userDataSize;
        }

        public int getUserDataSizeBits() {
            return userDataSizeBits;
        }

        public boolean isUser_data_fixed_size() {
            return user_data_fixed_size;
        }

        public StringTableEntry put( String key, byte[] value ) {
            if (containsKey( key )) {
                throw new IllegalArgumentException( "Entry " + key + " already exists." );
            }

            final StringTableEntry entry = new StringTableEntry( key, value );
            return put( key, entry );
        }

    };

    public static class StringTableEntry {
        public String key;
        public byte[] value;

        public StringTableEntry( String key, byte[] value ) {
            super();
            this.key = key;
            this.value = value;
        }
    };
}
 public enum ST_Flags {
    ST_Something( 2 ), ST_FixedLength( 8 );

    public static ST_Flags valueOf( int id ) {
        switch (id) {
            case 2:
                return ST_Something;
            case 8:
                return ST_FixedLength;
            default:
                return null;
        }
    }

    private final int id;

    private ST_Flags( int id ) {
        this.id = id;
    }

    public int getId() {
        return id;
    }

};
 public static class SendProp {
    private final SP_Type type;

    private final String name;

    private final int flags;
    private final int priority;
    private final String dtName;
    private final int numElements;

    private final float lowValue;
    private final float highValue;

    private final int numBits;
    private SendTable inTable;
    private SendProp arrayProp;

    public SendProp( SP_Type type, String name, int flags, int priority, String dtName, int numElements, float lowValue, float highValue, int numBits ) {

        this.type = type;
        this.name = name;
        this.flags = flags;
        this.priority = priority;
        this.dtName = dtName;
        this.numElements = numElements;
        this.lowValue = lowValue;
        this.highValue = highValue;
        this.numBits = numBits;
    }

    public SendProp getArrayProp() {
        return arrayProp;
    }

    public String getDtName() {
        return dtName;
    }

    public int getFlags() {
        return flags;
    }

    public float getHighValue() {
        return highValue;
    }

    public SendTable getInTable() {
        return inTable;
    }

    public float getLowValue() {
        return lowValue;
    }

    public String getName() {
        return name;
    }

    public int getNumberOfElements() {
        return numElements;
    }

    public int getNumBits() {
        return numBits;
    }

    public int getPriority() {
        return priority;
    }

    public SP_Type getType() {

        return type;
    }

    public void setArrayProp( SendProp sendProp ) {
        arrayProp = sendProp;

    }

    public void setInTable( SendTable inTable ) {
        this.inTable = inTable;
    }

    @Override
    public String toString() {
        return "SendProp [type=" + type + ", name=" + name + ", lowValue=" + lowValue + ", highValue=" + highValue + "]";
    }

};
 public static class SendTable {

    private String netTableName;

    private boolean needsDecoder;
    private final List<SendProp> props;

    public SendTable() {
        props = new ArrayList<SendProp>();
    }

    public SendTable( String netTableName, boolean needsDecoder ) {
        this();
        this.netTableName = netTableName;
        this.needsDecoder = needsDecoder;
    }

    public String getName() {
        return netTableName;
    }

    public List<SendProp> getProps() {
        return props;
    }
};
 public static class StringTable extends LinkedHashMap<String, StringTableEntry> {

    /**
     * 
     */
    private static final long serialVersionUID = -3539920946466168199L;
    private final String name;
    private final int max_entries;

    private final boolean user_data_fixed_size;
    private final int userDataSize;
    private final int userDataSizeBits;
    private final int flags;
    private final int entry_bits;

    public StringTable( String name, int max_entries, boolean user_data_fixed_size, int user_data_size, int user_data_size_bits, int flags ) {
        super();
        this.name = name;
        this.max_entries = max_entries;
        this.user_data_fixed_size = user_data_fixed_size;
        userDataSize = user_data_size;
        userDataSizeBits = user_data_size_bits;
        this.flags = flags;
        entry_bits = Utils.log2( max_entries );

    }

    public StringTableEntry get( int id ) {
        final Iterator<String> iter = keySet().iterator();
        String key = iter.next();
        for (int i = 0; i < id; i++) {
            key = iter.next();
        }
        return get( key );
    }

    public int getEntryBits() {
        return entry_bits;
    }

    public int getFlags() {
        return flags;
    }

    public int getMaxEntries() {
        return max_entries;
    }

    public String getName() {
        return name;
    }

    public int getUserDataSize() {
        return userDataSize;
    }

    public int getUserDataSizeBits() {
        return userDataSizeBits;
    }

    public boolean isUser_data_fixed_size() {
        return user_data_fixed_size;
    }

    public StringTableEntry put( String key, byte[] value ) {
        if (containsKey( key )) {
            throw new IllegalArgumentException( "Entry " + key + " already exists." );
        }

        final StringTableEntry entry = new StringTableEntry( key, value );
        return put( key, entry );
    }

};
 public static class StringTableEntry {
    public String key;
    public byte[] value;

    public StringTableEntry( String key, byte[] value ) {
        super();
        this.key = key;
        this.value = value;
    }
};
 public class BitInputBuffer {

    /**
     * Converts an array of bits into a (signed) integer.
     * @param a an array of bits. The first array element is treated as the highest bit.
     * @return the integer
     */
    private static int encodeBoolAsInt( boolean[] a ) {
        int result = 0;
        for (int i = 0; i < a.length; i++) {
            final int value = (a[i] ? 1 : 0) << i;
            result = result | value;
        }

        return result;
    }

    /**
     * back buffer.
     */
    private final BitSet data;

    /**
     * Current position in data.
     */
    private int position;

    public BitInputBuffer( byte[] bytes ) {
        data = BitSet.valueOf( bytes );
    }

    public BitInputBuffer( ByteBuffer data ) {
        final byte[] temp = new byte[data.capacity()];
        data.get( temp );
        this.data = BitSet.valueOf( temp );
    }

    public int getPosition() {
        return position;
    }

    public boolean hasNext() {

        return position < data.length();
    }

    public boolean readBit() {
        return readBits( 1 )[0];
    }

    public void readBits( byte[] data, int bit_length ) {

        int remaining = bit_length;

        int i = 0;

        while (remaining >= 8) {
            data[i++] = (byte) readBitsAsInt( 8 );
            remaining -= 8;
        }

        if (remaining > 0) {
            data[i++] = (byte) readBitsAsInt( remaining );
        }
    }

    public boolean[] readBits( int bit_length ) {
        final boolean[] ret = new boolean[bit_length];
        for (int i = 0; i < bit_length; i++) {
            ret[i] = data.get( position++ );
        }
        return ret;
    }

    public void readBits( int[] data, int bit_length ) {

        int remaining = bit_length;

        int i = 0;

        while (remaining >= 8) {
            data[i++] = (char) readBitsAsInt( 8 );
            remaining -= 8;
        }

        if (remaining > 0) {
            data[i++] = (char) readBitsAsInt( remaining );
        }
    }

    public float readBitsAsFloat( int entryBits ) {
        return Float.intBitsToFloat( readBitsAsInt( entryBits ) );
    }

    public int readBitsAsInt( int entryBits ) {
        return encodeBoolAsInt( readBits( entryBits ) );
    }

    public String readString( int maxSize ) {
        final StringBuilder builder = new StringBuilder();

        for (int i = 0; i < maxSize - 1; ++i) {
            final char c = (char) encodeBoolAsInt( readBits( 8 ) );

            if (c == '\0') {
                return builder.toString();
            }
            else {
                builder.append( c );
            }
        }

        //  builder.append( '\0' );
        return builder.toString();
    }

    public int readVar35() {
        int read = 0;

        int value = 0;
        int got;
        do {
            got = readBitsAsInt( 8 );

            final int lower = got & 0x7F;
//            final int upper = got >>> 7;

            value |= lower << read;
            read += 7;
        }
        while (got >>> 7 > 0 && read < 35);

        return value;
    }

} public final class Utils {

    /**
     * Calculates the logarithm dualis aka the number of bytes necessary
     * to represent n distinct values.
     * @param n the maximum number of values
     * @return the number of bits necessary to represent n different values
     */
    public static int log2( int n ) {
        if (n < 1) {
            throw new IllegalArgumentException( "Invalid number passed to log2 " + n + "." );
        }

        int r = 0;
        int acc = 1;

        while (acc < n) {
            ++r;
            acc *= 2;
        }

        return r;
    }

    public static int readVarInt( ByteBuffer stream ) throws IOException {
        final byte b[] = new byte[1];
        int count = 0;
        int result = 0;

        do {
            if (count == 5) {
                // If we get here it means that the fifth bit had its
                // high bit set, which implies corrupt data.
                throw new IOException( "stream corrupted" );
            }
            stream.get( b );

            result |= (b[0] & 0x7F) << (7 * count);
            ++count;
        }
        while ((b[0] & 0x80) > 0);

        return result;
    }

    public static int readVarInt( InputStream stream ) throws IOException {
        final byte b[] = new byte[1];
        int count = 0;
        int result = 0;

        do {
            if (count == 5) {
                // If we get here it means that the fifth bit had its
                // high bit set, which implies corrupt data.
                throw new IOException( "stream corrupted" );
            }
            if (stream.read( b ) == -1) {
                throw new IOException( "end of stream" );
            }
            result |= (b[0] & 0x7F) << (7 * count);
            ++count;
        }
        while ((b[0] & 0x80) > 0);

        return result;
    }

    public static int toInt( byte[] bytes, int offset ) {
        int ret = 0;
        for (int i = 0; (i < 4) && ((i + offset) < bytes.length); i++) {
            ret <<= 8;
            ret |= bytes[i] & 0xFF;
        }
        return ret;
    }

    /**
     * Private constructor for utility class.
     */
    private Utils() {

    }

}

import java.io.IOException;
import java.nio.ByteBuffer;
import java.util.logging.Logger;
import com.valve.dota2.Demo.CDemoSendTables;
import com.valve.dota2.Netmessages.CSVCMsg_CreateStringTable;
import com.valve.dota2.Netmessages.CSVCMsg_GameEventList;
import com.valve.dota2.Netmessages.CSVCMsg_PacketEntities;
import com.valve.dota2.Netmessages.CSVCMsg_SendTable;
import com.valve.dota2.Netmessages.CSVCMsg_SendTable.sendprop_t;
import com.valve.dota2.Netmessages.CSVCMsg_ServerInfo;
import com.valve.dota2.Netmessages.CSVCMsg_TempEntities;
import com.valve.dota2.Netmessages.CSVCMsg_UpdateStringTable;
import com.valve.dota2.Netmessages.SVC_Messages;
import com.valve.dota2.Networkbasetypes.CSVCMsg_GameEvent;
import com.valve.dota2.Networkbasetypes.CSVCMsg_UserMessage;
import de.lighti.DotaPlay;
import de.lighti.model.state.ParseState;
import de.lighti.model.state.StateUtils;
import de.lighti.model.state.StateUtils.ST_Flags;
import de.lighti.model.state.StateUtils.SendProp;
import de.lighti.model.state.StateUtils.SendTable;
import de.lighti.model.state.StateUtils.StringTable;
import de.lighti.model.state.StateUtils.StringTableEntry;
import de.lighti.util.BitInputBuffer;
import de.lighti.util.Utils;

                }
                final CSVCMsg_ServerInfo si = CSVCMsg_ServerInfo.parseFrom( bytes );
                DotaPlay.setState( new ParseState( si.getProtocol(), si.getMaxClasses() ) );
                DotaPlay.getState().setTickInterval( si.getTickInterval() );
                break;
            case svc_CreateStringTable:
                final CSVCMsg_CreateStringTable create = CSVCMsg_CreateStringTable.parseFrom( bytes );
                handleCreateTable( create, DotaPlay.getState() );
                break;
            case svc_UpdateStringTable:

                final CSVCMsg_UpdateStringTable update = CSVCMsg_UpdateStringTable.parseFrom( bytes );
                final StringTable table = DotaPlay.getState().getStringTable( update.getTableId() );
                if (table == null) {
                    throw new IllegalStateException( "Trying to update a non-existing table" );
                }
                if (table.getName().equals( INSTANCE_BASELINE_TABLE )) {
                    updateStringTable( table, update.getNumChangedEntries(), update.getStringData().asReadOnlyByteBuffer() );
                }
                else {
                    Logger.getLogger( SVCMessageHandler.class.getName() ).fine( "not updating " + table.getName() );
                }
                break;
            case svc_TempEntities:
                final CSVCMsg_TempEntities te = CSVCMsg_TempEntities.parseFrom( bytes );
                handleTempEntities( te );
                break;
            case svc_EntityMessage:
            case svc_BSPDecal:
            case svc_ClassInfo:

            case svc_CrosshairAngle:

            case svc_FixAngle:
            case svc_GetCvarValue:
            case svc_Menu:
            case svc_Prefetch:
            case svc_Print:
            case svc_SendTable:

            case svc_SetPause:
            case svc_SetView:
            case svc_Sounds:
            case svc_SplitScreen:

            case svc_VoiceData:
            case svc_VoiceInit:
            default:
//                System.out.println( msg.name() );
                break;

        }
    }

    private static void handleTempEntities( CSVCMsg_TempEntities te ) {
//        System.out.println( "TempEntities with " + te.getNumEntries() + " entries" );

        final BitInputBuffer buffer = new BitInputBuffer( te.getEntityData().asReadOnlyByteBuffer() );
//        System.out.println( buffer );
    }

    private static void updateStringTable( StringTable table, int numEntries, ByteBuffer stringData ) {
        final BitInputBuffer stream = new BitInputBuffer( stringData );

        Logger.getLogger( SVCMessageHandler.class.getName() ).finer( "Update package has " + stringData.capacity() + " bytes" );
        Logger.getLogger( SVCMessageHandler.class.getName() ).finer( "Expecting " + numEntries + " entires" );
        final boolean first = stream.readBit();

        int entryId = -1;
        int entriesRead = 0;
        final int oldSize = table.size();

        while (entriesRead < numEntries) {

            if (!stream.readBit()) {
                entryId = stream.readBitsAsInt( table.getEntryBits() );
            }
            else {
                entryId += 1;
            }
            if (entryId >= table.getMaxEntries()) {
                throw new IllegalStateException( "Entry id too large" );
            }

            String key = null;
            if (stream.readBit()) {
                if (first && stream.readBit()) {
                    throw new UnsupportedOperationException( "please no" );
                }
                else {
                    if (stream.readBit()) {
                        throw new UnsupportedOperationException( "no substring" );
                    }
                    else {
                        key = stream.readString( MAX_KEY_SIZE );
                    }
                }
            }

            byte[] valueBuffer = null;

            int length = 0;
            if (stream.readBit()) {
                if ((table.getFlags() & ST_Flags.ST_FixedLength.getId()) > 0) {
                    length = table.getUserDataSize();
                }
                else {
                    length = stream.readBitsAsInt( 14 );
                }
                if (length >= MAX_VALUE_SIZE) {
                    throw new IllegalStateException( "Message too long." );
                }
                valueBuffer = new byte[length];

                for (int i = 0; i < length; i++) {
                    valueBuffer[i] = (byte) stream.readBitsAsInt( 8 );
                }
            }

            if (entryId < table.size()) {

                final StringTableEntry item = table.get( entryId );
