// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;

import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedInt;
import us.hebi.quickbuf.RepeatedMessage;

public final class RogueBuffSelectInfoOuterClass {
  /**
   * Protobuf type {@code RogueBuffSelectInfo}
   */
  public static final class RogueBuffSelectInfo extends ProtoMessage<RogueBuffSelectInfo> implements Cloneable {
    private static final long serialVersionUID = 0L;

    /**
     * <code>optional uint32 roll_buff_times = 2;</code>
     */
    private int rollBuffTimes;

    /**
     * <code>optional uint32 select_buff_source_hint = 4;</code>
     */
    private int selectBuffSourceHint;

    /**
     * <code>optional uint32 select_buff_source_total_count = 5;</code>
     */
    private int selectBuffSourceTotalCount;

    /**
     * <code>optional uint32 select_buff_source_cur_count = 7;</code>
     */
    private int selectBuffSourceCurCount;

    /**
     * <code>optional uint32 roll_buff_max_times = 15;</code>
     */
    private int rollBuffMaxTimes;

    /**
     * <code>optional .RogueCommonBuffSelectSource source = 3;</code>
     */
    private int source;

    /**
     * <code>optional bool show_handbook_hint = 8;</code>
     */
    private boolean showHandbookHint;

    /**
     * <code>optional bool can_roll = 10;</code>
     */
    private boolean canRoll;

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     */
    private final ItemCostListOuterClass.ItemCostList rollBuffsCost = ItemCostListOuterClass.ItemCostList.newInstance();

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     */
    private final RepeatedInt selectFirstBuffList = RepeatedInt.newEmptyInstance();

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     */
    private final RepeatedMessage<RogueBuffOuterClass.RogueBuff> mazeBuffList = RepeatedMessage.newEmptyInstance(RogueBuffOuterClass.RogueBuff.getFactory());

    private RogueBuffSelectInfo() {
    }

    /**
     * @return a new empty instance of {@code RogueBuffSelectInfo}
     */
    public static RogueBuffSelectInfo newInstance() {
      return new RogueBuffSelectInfo();
    }

    /**
     * <code>optional uint32 roll_buff_times = 2;</code>
     * @return whether the rollBuffTimes field is set
     */
    public boolean hasRollBuffTimes() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 roll_buff_times = 2;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearRollBuffTimes() {
      bitField0_ &= ~0x00000001;
      rollBuffTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 roll_buff_times = 2;</code>
     * @return the rollBuffTimes
     */
    public int getRollBuffTimes() {
      return rollBuffTimes;
    }

    /**
     * <code>optional uint32 roll_buff_times = 2;</code>
     * @param value the rollBuffTimes to set
     * @return this
     */
    public RogueBuffSelectInfo setRollBuffTimes(final int value) {
      bitField0_ |= 0x00000001;
      rollBuffTimes = value;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_hint = 4;</code>
     * @return whether the selectBuffSourceHint field is set
     */
    public boolean hasSelectBuffSourceHint() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 select_buff_source_hint = 4;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearSelectBuffSourceHint() {
      bitField0_ &= ~0x00000002;
      selectBuffSourceHint = 0;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_hint = 4;</code>
     * @return the selectBuffSourceHint
     */
    public int getSelectBuffSourceHint() {
      return selectBuffSourceHint;
    }

    /**
     * <code>optional uint32 select_buff_source_hint = 4;</code>
     * @param value the selectBuffSourceHint to set
     * @return this
     */
    public RogueBuffSelectInfo setSelectBuffSourceHint(final int value) {
      bitField0_ |= 0x00000002;
      selectBuffSourceHint = value;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_total_count = 5;</code>
     * @return whether the selectBuffSourceTotalCount field is set
     */
    public boolean hasSelectBuffSourceTotalCount() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 select_buff_source_total_count = 5;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearSelectBuffSourceTotalCount() {
      bitField0_ &= ~0x00000004;
      selectBuffSourceTotalCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_total_count = 5;</code>
     * @return the selectBuffSourceTotalCount
     */
    public int getSelectBuffSourceTotalCount() {
      return selectBuffSourceTotalCount;
    }

    /**
     * <code>optional uint32 select_buff_source_total_count = 5;</code>
     * @param value the selectBuffSourceTotalCount to set
     * @return this
     */
    public RogueBuffSelectInfo setSelectBuffSourceTotalCount(final int value) {
      bitField0_ |= 0x00000004;
      selectBuffSourceTotalCount = value;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_cur_count = 7;</code>
     * @return whether the selectBuffSourceCurCount field is set
     */
    public boolean hasSelectBuffSourceCurCount() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 select_buff_source_cur_count = 7;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearSelectBuffSourceCurCount() {
      bitField0_ &= ~0x00000008;
      selectBuffSourceCurCount = 0;
      return this;
    }

    /**
     * <code>optional uint32 select_buff_source_cur_count = 7;</code>
     * @return the selectBuffSourceCurCount
     */
    public int getSelectBuffSourceCurCount() {
      return selectBuffSourceCurCount;
    }

    /**
     * <code>optional uint32 select_buff_source_cur_count = 7;</code>
     * @param value the selectBuffSourceCurCount to set
     * @return this
     */
    public RogueBuffSelectInfo setSelectBuffSourceCurCount(final int value) {
      bitField0_ |= 0x00000008;
      selectBuffSourceCurCount = value;
      return this;
    }

    /**
     * <code>optional uint32 roll_buff_max_times = 15;</code>
     * @return whether the rollBuffMaxTimes field is set
     */
    public boolean hasRollBuffMaxTimes() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional uint32 roll_buff_max_times = 15;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearRollBuffMaxTimes() {
      bitField0_ &= ~0x00000010;
      rollBuffMaxTimes = 0;
      return this;
    }

    /**
     * <code>optional uint32 roll_buff_max_times = 15;</code>
     * @return the rollBuffMaxTimes
     */
    public int getRollBuffMaxTimes() {
      return rollBuffMaxTimes;
    }

    /**
     * <code>optional uint32 roll_buff_max_times = 15;</code>
     * @param value the rollBuffMaxTimes to set
     * @return this
     */
    public RogueBuffSelectInfo setRollBuffMaxTimes(final int value) {
      bitField0_ |= 0x00000010;
      rollBuffMaxTimes = value;
      return this;
    }

    /**
     * <code>optional .RogueCommonBuffSelectSource source = 3;</code>
     * @return whether the source field is set
     */
    public boolean hasSource() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional .RogueCommonBuffSelectSource source = 3;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearSource() {
      bitField0_ &= ~0x00000020;
      source = 0;
      return this;
    }

    /**
     * <code>optional .RogueCommonBuffSelectSource source = 3;</code>
     * @return the source
     */
    public RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource getSource() {
      return RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource.forNumber(source);
    }

    /**
     * Gets the value of the internal enum store. The result is
     * equivalent to {@link RogueBuffSelectInfo#getSource()}.getNumber().
     *
     * @return numeric wire representation
     */
    public int getSourceValue() {
      return source;
    }

    /**
     * Sets the value of the internal enum store. This does not
     * do any validity checks, so be sure to use appropriate value
     * constants from {@link RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource}. Setting an invalid value
     * can cause {@link RogueBuffSelectInfo#getSource()} to return null
     *
     * @param value the numeric wire value to set
     * @return this
     */
    public RogueBuffSelectInfo setSourceValue(final int value) {
      bitField0_ |= 0x00000020;
      source = value;
      return this;
    }

    /**
     * <code>optional .RogueCommonBuffSelectSource source = 3;</code>
     * @param value the source to set
     * @return this
     */
    public RogueBuffSelectInfo setSource(
        final RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource value) {
      bitField0_ |= 0x00000020;
      source = value.getNumber();
      return this;
    }

    /**
     * <code>optional bool show_handbook_hint = 8;</code>
     * @return whether the showHandbookHint field is set
     */
    public boolean hasShowHandbookHint() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional bool show_handbook_hint = 8;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearShowHandbookHint() {
      bitField0_ &= ~0x00000040;
      showHandbookHint = false;
      return this;
    }

    /**
     * <code>optional bool show_handbook_hint = 8;</code>
     * @return the showHandbookHint
     */
    public boolean getShowHandbookHint() {
      return showHandbookHint;
    }

    /**
     * <code>optional bool show_handbook_hint = 8;</code>
     * @param value the showHandbookHint to set
     * @return this
     */
    public RogueBuffSelectInfo setShowHandbookHint(final boolean value) {
      bitField0_ |= 0x00000040;
      showHandbookHint = value;
      return this;
    }

    /**
     * <code>optional bool can_roll = 10;</code>
     * @return whether the canRoll field is set
     */
    public boolean hasCanRoll() {
      return (bitField0_ & 0x00000080) != 0;
    }

    /**
     * <code>optional bool can_roll = 10;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearCanRoll() {
      bitField0_ &= ~0x00000080;
      canRoll = false;
      return this;
    }

    /**
     * <code>optional bool can_roll = 10;</code>
     * @return the canRoll
     */
    public boolean getCanRoll() {
      return canRoll;
    }

    /**
     * <code>optional bool can_roll = 10;</code>
     * @param value the canRoll to set
     * @return this
     */
    public RogueBuffSelectInfo setCanRoll(final boolean value) {
      bitField0_ |= 0x00000080;
      canRoll = value;
      return this;
    }

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     * @return whether the rollBuffsCost field is set
     */
    public boolean hasRollBuffsCost() {
      return (bitField0_ & 0x00000100) != 0;
    }

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearRollBuffsCost() {
      bitField0_ &= ~0x00000100;
      rollBuffsCost.clear();
      return this;
    }

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableRollBuffsCost()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public ItemCostListOuterClass.ItemCostList getRollBuffsCost() {
      return rollBuffsCost;
    }

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public ItemCostListOuterClass.ItemCostList getMutableRollBuffsCost() {
      bitField0_ |= 0x00000100;
      return rollBuffsCost;
    }

    /**
     * <code>optional .ItemCostList roll_buffs_cost = 11;</code>
     * @param value the rollBuffsCost to set
     * @return this
     */
    public RogueBuffSelectInfo setRollBuffsCost(final ItemCostListOuterClass.ItemCostList value) {
      bitField0_ |= 0x00000100;
      rollBuffsCost.copyFrom(value);
      return this;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     * @return whether the selectFirstBuffList field is set
     */
    public boolean hasSelectFirstBuffList() {
      return (bitField0_ & 0x00000200) != 0;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearSelectFirstBuffList() {
      bitField0_ &= ~0x00000200;
      selectFirstBuffList.clear();
      return this;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableSelectFirstBuffList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedInt getSelectFirstBuffList() {
      return selectFirstBuffList;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedInt getMutableSelectFirstBuffList() {
      bitField0_ |= 0x00000200;
      return selectFirstBuffList;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     * @param value the selectFirstBuffList to add
     * @return this
     */
    public RogueBuffSelectInfo addSelectFirstBuffList(final int value) {
      bitField0_ |= 0x00000200;
      selectFirstBuffList.add(value);
      return this;
    }

    /**
     * <code>repeated uint32 select_first_buff_list = 12;</code>
     * @param values the selectFirstBuffList to add
     * @return this
     */
    public RogueBuffSelectInfo addAllSelectFirstBuffList(final int... values) {
      bitField0_ |= 0x00000200;
      selectFirstBuffList.addAll(values);
      return this;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     * @return whether the mazeBuffList field is set
     */
    public boolean hasMazeBuffList() {
      return (bitField0_ & 0x00000400) != 0;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     * @return this
     */
    public RogueBuffSelectInfo clearMazeBuffList() {
      bitField0_ &= ~0x00000400;
      mazeBuffList.clear();
      return this;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     *
     * This method returns the internal storage object without modifying any has state.
     * The returned object should not be modified and be treated as read-only.
     *
     * Use {@link #getMutableMazeBuffList()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<RogueBuffOuterClass.RogueBuff> getMazeBuffList() {
      return mazeBuffList;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     *
     * This method returns the internal storage object and sets the corresponding
     * has state. The returned object will become part of this message and its
     * contents may be modified as long as the has state is not cleared.
     *
     * @return internal storage object for modifications
     */
    public RepeatedMessage<RogueBuffOuterClass.RogueBuff> getMutableMazeBuffList() {
      bitField0_ |= 0x00000400;
      return mazeBuffList;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     * @param value the mazeBuffList to add
     * @return this
     */
    public RogueBuffSelectInfo addMazeBuffList(final RogueBuffOuterClass.RogueBuff value) {
      bitField0_ |= 0x00000400;
      mazeBuffList.add(value);
      return this;
    }

    /**
     * <code>repeated .RogueBuff maze_buff_list = 14;</code>
     * @param values the mazeBuffList to add
     * @return this
     */
    public RogueBuffSelectInfo addAllMazeBuffList(final RogueBuffOuterClass.RogueBuff... values) {
      bitField0_ |= 0x00000400;
      mazeBuffList.addAll(values);
      return this;
    }

    @Override
    public RogueBuffSelectInfo copyFrom(final RogueBuffSelectInfo other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        rollBuffTimes = other.rollBuffTimes;
        selectBuffSourceHint = other.selectBuffSourceHint;
        selectBuffSourceTotalCount = other.selectBuffSourceTotalCount;
        selectBuffSourceCurCount = other.selectBuffSourceCurCount;
        rollBuffMaxTimes = other.rollBuffMaxTimes;
        source = other.source;
        showHandbookHint = other.showHandbookHint;
        canRoll = other.canRoll;
        rollBuffsCost.copyFrom(other.rollBuffsCost);
        selectFirstBuffList.copyFrom(other.selectFirstBuffList);
        mazeBuffList.copyFrom(other.mazeBuffList);
      }
      return this;
    }

    @Override
    public RogueBuffSelectInfo mergeFrom(final RogueBuffSelectInfo other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasRollBuffTimes()) {
        setRollBuffTimes(other.rollBuffTimes);
      }
      if (other.hasSelectBuffSourceHint()) {
        setSelectBuffSourceHint(other.selectBuffSourceHint);
      }
      if (other.hasSelectBuffSourceTotalCount()) {
        setSelectBuffSourceTotalCount(other.selectBuffSourceTotalCount);
      }
      if (other.hasSelectBuffSourceCurCount()) {
        setSelectBuffSourceCurCount(other.selectBuffSourceCurCount);
      }
      if (other.hasRollBuffMaxTimes()) {
        setRollBuffMaxTimes(other.rollBuffMaxTimes);
      }
      if (other.hasSource()) {
        setSourceValue(other.source);
      }
      if (other.hasShowHandbookHint()) {
        setShowHandbookHint(other.showHandbookHint);
      }
      if (other.hasCanRoll()) {
        setCanRoll(other.canRoll);
      }
      if (other.hasRollBuffsCost()) {
        getMutableRollBuffsCost().mergeFrom(other.rollBuffsCost);
      }
      if (other.hasSelectFirstBuffList()) {
        getMutableSelectFirstBuffList().addAll(other.selectFirstBuffList);
      }
      if (other.hasMazeBuffList()) {
        getMutableMazeBuffList().addAll(other.mazeBuffList);
      }
      return this;
    }

    @Override
    public RogueBuffSelectInfo clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rollBuffTimes = 0;
      selectBuffSourceHint = 0;
      selectBuffSourceTotalCount = 0;
      selectBuffSourceCurCount = 0;
      rollBuffMaxTimes = 0;
      source = 0;
      showHandbookHint = false;
      canRoll = false;
      rollBuffsCost.clear();
      selectFirstBuffList.clear();
      mazeBuffList.clear();
      return this;
    }

    @Override
    public RogueBuffSelectInfo clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      rollBuffsCost.clearQuick();
      selectFirstBuffList.clear();
      mazeBuffList.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof RogueBuffSelectInfo)) {
        return false;
      }
      RogueBuffSelectInfo other = (RogueBuffSelectInfo) o;
      return bitField0_ == other.bitField0_
        && (!hasRollBuffTimes() || rollBuffTimes == other.rollBuffTimes)
        && (!hasSelectBuffSourceHint() || selectBuffSourceHint == other.selectBuffSourceHint)
        && (!hasSelectBuffSourceTotalCount() || selectBuffSourceTotalCount == other.selectBuffSourceTotalCount)
        && (!hasSelectBuffSourceCurCount() || selectBuffSourceCurCount == other.selectBuffSourceCurCount)
        && (!hasRollBuffMaxTimes() || rollBuffMaxTimes == other.rollBuffMaxTimes)
        && (!hasSource() || source == other.source)
        && (!hasShowHandbookHint() || showHandbookHint == other.showHandbookHint)
        && (!hasCanRoll() || canRoll == other.canRoll)
        && (!hasRollBuffsCost() || rollBuffsCost.equals(other.rollBuffsCost))
        && (!hasSelectFirstBuffList() || selectFirstBuffList.equals(other.selectFirstBuffList))
        && (!hasMazeBuffList() || mazeBuffList.equals(other.mazeBuffList));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 16);
        output.writeUInt32NoTag(rollBuffTimes);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(selectBuffSourceHint);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 40);
        output.writeUInt32NoTag(selectBuffSourceTotalCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 56);
        output.writeUInt32NoTag(selectBuffSourceCurCount);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 120);
        output.writeUInt32NoTag(rollBuffMaxTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 24);
        output.writeEnumNoTag(source);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawByte((byte) 64);
        output.writeBoolNoTag(showHandbookHint);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRawByte((byte) 80);
        output.writeBoolNoTag(canRoll);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeRawByte((byte) 90);
        output.writeMessageNoTag(rollBuffsCost);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        for (int i = 0; i < selectFirstBuffList.length(); i++) {
          output.writeRawByte((byte) 96);
          output.writeUInt32NoTag(selectFirstBuffList.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000400) != 0) {
        for (int i = 0; i < mazeBuffList.length(); i++) {
          output.writeRawByte((byte) 114);
          output.writeMessageNoTag(mazeBuffList.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(rollBuffTimes);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(selectBuffSourceHint);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(selectBuffSourceTotalCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(selectBuffSourceCurCount);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(rollBuffMaxTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeEnumSizeNoTag(source);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += 2;
      }
      if ((bitField0_ & 0x00000100) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(rollBuffsCost);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        size += (1 * selectFirstBuffList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(selectFirstBuffList);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        size += (1 * mazeBuffList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(mazeBuffList);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public RogueBuffSelectInfo mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 16: {
            // rollBuffTimes
            rollBuffTimes = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 32) {
              break;
            }
          }
          case 32: {
            // selectBuffSourceHint
            selectBuffSourceHint = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 40) {
              break;
            }
          }
          case 40: {
            // selectBuffSourceTotalCount
            selectBuffSourceTotalCount = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 56) {
              break;
            }
          }
          case 56: {
            // selectBuffSourceCurCount
            selectBuffSourceCurCount = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 120) {
              break;
            }
          }
          case 120: {
            // rollBuffMaxTimes
            rollBuffMaxTimes = input.readUInt32();
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 24) {
              break;
            }
          }
          case 24: {
            // source
            final int value = input.readInt32();
            if (RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource.forNumber(value) != null) {
              source = value;
              bitField0_ |= 0x00000020;
            }
            tag = input.readTag();
            if (tag != 64) {
              break;
            }
          }
          case 64: {
            // showHandbookHint
            showHandbookHint = input.readBool();
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 80) {
              break;
            }
          }
          case 80: {
            // canRoll
            canRoll = input.readBool();
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 90) {
              break;
            }
          }
          case 90: {
            // rollBuffsCost
            input.readMessage(rollBuffsCost);
            bitField0_ |= 0x00000100;
            tag = input.readTag();
            if (tag != 98) {
              break;
            }
          }
          case 98: {
            // selectFirstBuffList [packed=true]
            input.readPackedUInt32(selectFirstBuffList, tag);
            bitField0_ |= 0x00000200;
            tag = input.readTag();
            if (tag != 114) {
              break;
            }
          }
          case 114: {
            // mazeBuffList
            tag = input.readRepeatedMessage(mazeBuffList, tag);
            bitField0_ |= 0x00000400;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 96: {
            // selectFirstBuffList [packed=false]
            tag = input.readRepeatedUInt32(selectFirstBuffList, tag);
            bitField0_ |= 0x00000200;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.rollBuffTimes, rollBuffTimes);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.selectBuffSourceHint, selectBuffSourceHint);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.selectBuffSourceTotalCount, selectBuffSourceTotalCount);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.selectBuffSourceCurCount, selectBuffSourceCurCount);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeUInt32(FieldNames.rollBuffMaxTimes, rollBuffMaxTimes);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeEnum(FieldNames.source, source, RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource.converter());
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeBool(FieldNames.showHandbookHint, showHandbookHint);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeBool(FieldNames.canRoll, canRoll);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeMessage(FieldNames.rollBuffsCost, rollBuffsCost);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeRepeatedUInt32(FieldNames.selectFirstBuffList, selectFirstBuffList);
      }
      if ((bitField0_ & 0x00000400) != 0) {
        output.writeRepeatedMessage(FieldNames.mazeBuffList, mazeBuffList);
      }
      output.endObject();
    }

    @Override
    public RogueBuffSelectInfo mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -436216138:
          case 2038334812: {
            if (input.isAtField(FieldNames.rollBuffTimes)) {
              if (!input.trySkipNullValue()) {
                rollBuffTimes = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1160450543:
          case -335538398: {
            if (input.isAtField(FieldNames.selectBuffSourceHint)) {
              if (!input.trySkipNullValue()) {
                selectBuffSourceHint = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 94416949:
          case 204078937: {
            if (input.isAtField(FieldNames.selectBuffSourceTotalCount)) {
              if (!input.trySkipNullValue()) {
                selectBuffSourceTotalCount = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1017675463:
          case -1138919787: {
            if (input.isAtField(FieldNames.selectBuffSourceCurCount)) {
              if (!input.trySkipNullValue()) {
                selectBuffSourceCurCount = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -564731182:
          case -792528959: {
            if (input.isAtField(FieldNames.rollBuffMaxTimes)) {
              if (!input.trySkipNullValue()) {
                rollBuffMaxTimes = input.readUInt32();
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -896505829: {
            if (input.isAtField(FieldNames.source)) {
              if (!input.trySkipNullValue()) {
                final RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource value = input.readEnum(RogueCommonBuffSelectSourceOuterClass.RogueCommonBuffSelectSource.converter());
                if (value != null) {
                  source = value.getNumber();
                  bitField0_ |= 0x00000020;
                } else {
                  input.skipUnknownEnumValue();
                }
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1843696100:
          case 641745100: {
            if (input.isAtField(FieldNames.showHandbookHint)) {
              if (!input.trySkipNullValue()) {
                showHandbookHint = input.readBool();
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 549719149:
          case -126477428: {
            if (input.isAtField(FieldNames.canRoll)) {
              if (!input.trySkipNullValue()) {
                canRoll = input.readBool();
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -408716688:
          case -1703619794: {
            if (input.isAtField(FieldNames.rollBuffsCost)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(rollBuffsCost);
                bitField0_ |= 0x00000100;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1380355781:
          case -936470280: {
            if (input.isAtField(FieldNames.selectFirstBuffList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt32(selectFirstBuffList);
                bitField0_ |= 0x00000200;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1147228272:
          case -1634995062: {
            if (input.isAtField(FieldNames.mazeBuffList)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(mazeBuffList);
                bitField0_ |= 0x00000400;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

    @Override
    public RogueBuffSelectInfo clone() {
      return new RogueBuffSelectInfo().copyFrom(this);
    }

    @Override
    public boolean isEmpty() {
      return ((bitField0_) == 0);
    }

    public static RogueBuffSelectInfo parseFrom(final byte[] data) throws
        InvalidProtocolBufferException {
      return ProtoMessage.mergeFrom(new RogueBuffSelectInfo(), data).checkInitialized();
    }

    public static RogueBuffSelectInfo parseFrom(final ProtoSource input) throws IOException {
      return ProtoMessage.mergeFrom(new RogueBuffSelectInfo(), input).checkInitialized();
    }

    public static RogueBuffSelectInfo parseFrom(final JsonSource input) throws IOException {
      return ProtoMessage.mergeFrom(new RogueBuffSelectInfo(), input).checkInitialized();
    }

    /**
     * @return factory for creating RogueBuffSelectInfo messages
     */
    public static MessageFactory<RogueBuffSelectInfo> getFactory() {
      return RogueBuffSelectInfoFactory.INSTANCE;
    }

    private enum RogueBuffSelectInfoFactory implements MessageFactory<RogueBuffSelectInfo> {
      INSTANCE;

      @Override
      public RogueBuffSelectInfo create() {
        return RogueBuffSelectInfo.newInstance();
      }
    }

    /**
     * Contains name constants used for serializing JSON
     */
    static class FieldNames {
      static final FieldName rollBuffTimes = FieldName.forField("rollBuffTimes", "roll_buff_times");

      static final FieldName selectBuffSourceHint = FieldName.forField("selectBuffSourceHint", "select_buff_source_hint");

      static final FieldName selectBuffSourceTotalCount = FieldName.forField("selectBuffSourceTotalCount", "select_buff_source_total_count");

      static final FieldName selectBuffSourceCurCount = FieldName.forField("selectBuffSourceCurCount", "select_buff_source_cur_count");

      static final FieldName rollBuffMaxTimes = FieldName.forField("rollBuffMaxTimes", "roll_buff_max_times");

      static final FieldName source = FieldName.forField("source");

      static final FieldName showHandbookHint = FieldName.forField("showHandbookHint", "show_handbook_hint");

      static final FieldName canRoll = FieldName.forField("canRoll", "can_roll");

      static final FieldName rollBuffsCost = FieldName.forField("rollBuffsCost", "roll_buffs_cost");

      static final FieldName selectFirstBuffList = FieldName.forField("selectFirstBuffList", "select_first_buff_list");

      static final FieldName mazeBuffList = FieldName.forField("mazeBuffList", "maze_buff_list");
    }
  }
}
