// Code generated by protocol buffer compiler. Do not edit!
package emu.nebula.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.RepeatedByte;
import us.hebi.quickbuf.RepeatedLong;
import us.hebi.quickbuf.RepeatedMessage;

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

    /**
     * <code>optional uint32 NpcInteraction = 4;</code>
     */
    private int npcInteraction;

    /**
     * <code>optional uint32 Floor = 12;</code>
     */
    private int floor;

    /**
     * <code>optional uint32 PotentialCnt = 13;</code>
     */
    private int potentialCnt;

    /**
     * <code>optional uint32 TotalTime = 14;</code>
     */
    private int totalTime;

    /**
     * <code>optional .ChangeInfo Change = 1;</code>
     */
    private final Public.ChangeInfo change = Public.ChangeInfo.newInstance();

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</code>
     */
    private final PublicStarTower.StarTowerBuildInfo build = PublicStarTower.StarTowerBuildInfo.newInstance();

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     */
    private final RepeatedByte nextPackage = RepeatedByte.newEmptyInstance();

    /**
     * <code>repeated uint64 TotalDamages = 15;</code>
     */
    private final RepeatedLong totalDamages = RepeatedLong.newEmptyInstance();

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</code>
     */
    private final RepeatedMessage<PublicStarTower.NPCAffinityLevelReward> reward = RepeatedMessage.newEmptyInstance(PublicStarTower.NPCAffinityLevelReward.getFactory());

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</code>
     */
    private final RepeatedMessage<Public.ItemTpl> towerRewards = RepeatedMessage.newEmptyInstance(Public.ItemTpl.getFactory());

    private StarTowerGiveUpResp() {
    }

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

    /**
     * <code>optional uint32 NpcInteraction = 4;</code>
     * @return whether the npcInteraction field is set
     */
    public boolean hasNpcInteraction() {
      return (bitField0_ & 0x00000001) != 0;
    }

    /**
     * <code>optional uint32 NpcInteraction = 4;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearNpcInteraction() {
      bitField0_ &= ~0x00000001;
      npcInteraction = 0;
      return this;
    }

    /**
     * <code>optional uint32 NpcInteraction = 4;</code>
     * @return the npcInteraction
     */
    public int getNpcInteraction() {
      return npcInteraction;
    }

    /**
     * <code>optional uint32 NpcInteraction = 4;</code>
     * @param value the npcInteraction to set
     * @return this
     */
    public StarTowerGiveUpResp setNpcInteraction(final int value) {
      bitField0_ |= 0x00000001;
      npcInteraction = value;
      return this;
    }

    /**
     * <code>optional uint32 Floor = 12;</code>
     * @return whether the floor field is set
     */
    public boolean hasFloor() {
      return (bitField0_ & 0x00000002) != 0;
    }

    /**
     * <code>optional uint32 Floor = 12;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearFloor() {
      bitField0_ &= ~0x00000002;
      floor = 0;
      return this;
    }

    /**
     * <code>optional uint32 Floor = 12;</code>
     * @return the floor
     */
    public int getFloor() {
      return floor;
    }

    /**
     * <code>optional uint32 Floor = 12;</code>
     * @param value the floor to set
     * @return this
     */
    public StarTowerGiveUpResp setFloor(final int value) {
      bitField0_ |= 0x00000002;
      floor = value;
      return this;
    }

    /**
     * <code>optional uint32 PotentialCnt = 13;</code>
     * @return whether the potentialCnt field is set
     */
    public boolean hasPotentialCnt() {
      return (bitField0_ & 0x00000004) != 0;
    }

    /**
     * <code>optional uint32 PotentialCnt = 13;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearPotentialCnt() {
      bitField0_ &= ~0x00000004;
      potentialCnt = 0;
      return this;
    }

    /**
     * <code>optional uint32 PotentialCnt = 13;</code>
     * @return the potentialCnt
     */
    public int getPotentialCnt() {
      return potentialCnt;
    }

    /**
     * <code>optional uint32 PotentialCnt = 13;</code>
     * @param value the potentialCnt to set
     * @return this
     */
    public StarTowerGiveUpResp setPotentialCnt(final int value) {
      bitField0_ |= 0x00000004;
      potentialCnt = value;
      return this;
    }

    /**
     * <code>optional uint32 TotalTime = 14;</code>
     * @return whether the totalTime field is set
     */
    public boolean hasTotalTime() {
      return (bitField0_ & 0x00000008) != 0;
    }

    /**
     * <code>optional uint32 TotalTime = 14;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearTotalTime() {
      bitField0_ &= ~0x00000008;
      totalTime = 0;
      return this;
    }

    /**
     * <code>optional uint32 TotalTime = 14;</code>
     * @return the totalTime
     */
    public int getTotalTime() {
      return totalTime;
    }

    /**
     * <code>optional uint32 TotalTime = 14;</code>
     * @param value the totalTime to set
     * @return this
     */
    public StarTowerGiveUpResp setTotalTime(final int value) {
      bitField0_ |= 0x00000008;
      totalTime = value;
      return this;
    }

    /**
     * <code>optional .ChangeInfo Change = 1;</code>
     * @return whether the change field is set
     */
    public boolean hasChange() {
      return (bitField0_ & 0x00000010) != 0;
    }

    /**
     * <code>optional .ChangeInfo Change = 1;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearChange() {
      bitField0_ &= ~0x00000010;
      change.clear();
      return this;
    }

    /**
     * <code>optional .ChangeInfo Change = 1;</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 #getMutableChange()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public Public.ChangeInfo getChange() {
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 1;</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 Public.ChangeInfo getMutableChange() {
      bitField0_ |= 0x00000010;
      return change;
    }

    /**
     * <code>optional .ChangeInfo Change = 1;</code>
     * @param value the change to set
     * @return this
     */
    public StarTowerGiveUpResp setChange(final Public.ChangeInfo value) {
      bitField0_ |= 0x00000010;
      change.copyFrom(value);
      return this;
    }

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</code>
     * @return whether the build field is set
     */
    public boolean hasBuild() {
      return (bitField0_ & 0x00000020) != 0;
    }

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearBuild() {
      bitField0_ &= ~0x00000020;
      build.clear();
      return this;
    }

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</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 #getMutableBuild()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public PublicStarTower.StarTowerBuildInfo getBuild() {
      return build;
    }

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</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 PublicStarTower.StarTowerBuildInfo getMutableBuild() {
      bitField0_ |= 0x00000020;
      return build;
    }

    /**
     * <code>optional .StarTowerBuildInfo Build = 2;</code>
     * @param value the build to set
     * @return this
     */
    public StarTowerGiveUpResp setBuild(final PublicStarTower.StarTowerBuildInfo value) {
      bitField0_ |= 0x00000020;
      build.copyFrom(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return whether the nextPackage field is set
     */
    public boolean hasNextPackage() {
      return (bitField0_ & 0x00000040) != 0;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearNextPackage() {
      bitField0_ &= ~0x00000040;
      nextPackage.clear();
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 #getMutableNextPackage()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedByte getNextPackage() {
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</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 RepeatedByte getMutableNextPackage() {
      bitField0_ |= 0x00000040;
      return nextPackage;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param value the nextPackage to add
     * @return this
     */
    public StarTowerGiveUpResp addNextPackage(final byte value) {
      bitField0_ |= 0x00000040;
      nextPackage.add(value);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to add
     * @return this
     */
    public StarTowerGiveUpResp addAllNextPackage(final byte... values) {
      bitField0_ |= 0x00000040;
      nextPackage.addAll(values);
      return this;
    }

    /**
     * <code>optional bytes NextPackage = 2047;</code>
     * @param values the nextPackage to set
     * @return this
     */
    public StarTowerGiveUpResp setNextPackage(final byte... values) {
      bitField0_ |= 0x00000040;
      nextPackage.copyFrom(values);
      return this;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</code>
     * @return whether the totalDamages field is set
     */
    public boolean hasTotalDamages() {
      return (bitField0_ & 0x00000080) != 0;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearTotalDamages() {
      bitField0_ &= ~0x00000080;
      totalDamages.clear();
      return this;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</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 #getMutableTotalDamages()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedLong getTotalDamages() {
      return totalDamages;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</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 RepeatedLong getMutableTotalDamages() {
      bitField0_ |= 0x00000080;
      return totalDamages;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</code>
     * @param value the totalDamages to add
     * @return this
     */
    public StarTowerGiveUpResp addTotalDamages(final long value) {
      bitField0_ |= 0x00000080;
      totalDamages.add(value);
      return this;
    }

    /**
     * <code>repeated uint64 TotalDamages = 15;</code>
     * @param values the totalDamages to add
     * @return this
     */
    public StarTowerGiveUpResp addAllTotalDamages(final long... values) {
      bitField0_ |= 0x00000080;
      totalDamages.addAll(values);
      return this;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</code>
     * @return whether the reward field is set
     */
    public boolean hasReward() {
      return (bitField0_ & 0x00000100) != 0;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearReward() {
      bitField0_ &= ~0x00000100;
      reward.clear();
      return this;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</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 #getMutableReward()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<PublicStarTower.NPCAffinityLevelReward> getReward() {
      return reward;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</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<PublicStarTower.NPCAffinityLevelReward> getMutableReward() {
      bitField0_ |= 0x00000100;
      return reward;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</code>
     * @param value the reward to add
     * @return this
     */
    public StarTowerGiveUpResp addReward(final PublicStarTower.NPCAffinityLevelReward value) {
      bitField0_ |= 0x00000100;
      reward.add(value);
      return this;
    }

    /**
     * <code>repeated .NPCAffinityLevelReward Reward = 3;</code>
     * @param values the reward to add
     * @return this
     */
    public StarTowerGiveUpResp addAllReward(
        final PublicStarTower.NPCAffinityLevelReward... values) {
      bitField0_ |= 0x00000100;
      reward.addAll(values);
      return this;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</code>
     * @return whether the towerRewards field is set
     */
    public boolean hasTowerRewards() {
      return (bitField0_ & 0x00000200) != 0;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</code>
     * @return this
     */
    public StarTowerGiveUpResp clearTowerRewards() {
      bitField0_ &= ~0x00000200;
      towerRewards.clear();
      return this;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</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 #getMutableTowerRewards()} if you want to modify it.
     *
     * @return internal storage object for reading
     */
    public RepeatedMessage<Public.ItemTpl> getTowerRewards() {
      return towerRewards;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</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<Public.ItemTpl> getMutableTowerRewards() {
      bitField0_ |= 0x00000200;
      return towerRewards;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</code>
     * @param value the towerRewards to add
     * @return this
     */
    public StarTowerGiveUpResp addTowerRewards(final Public.ItemTpl value) {
      bitField0_ |= 0x00000200;
      towerRewards.add(value);
      return this;
    }

    /**
     * <code>repeated .ItemTpl TowerRewards = 5;</code>
     * @param values the towerRewards to add
     * @return this
     */
    public StarTowerGiveUpResp addAllTowerRewards(final Public.ItemTpl... values) {
      bitField0_ |= 0x00000200;
      towerRewards.addAll(values);
      return this;
    }

    @Override
    public StarTowerGiveUpResp copyFrom(final StarTowerGiveUpResp other) {
      cachedSize = other.cachedSize;
      if ((bitField0_ | other.bitField0_) != 0) {
        bitField0_ = other.bitField0_;
        npcInteraction = other.npcInteraction;
        floor = other.floor;
        potentialCnt = other.potentialCnt;
        totalTime = other.totalTime;
        change.copyFrom(other.change);
        build.copyFrom(other.build);
        nextPackage.copyFrom(other.nextPackage);
        totalDamages.copyFrom(other.totalDamages);
        reward.copyFrom(other.reward);
        towerRewards.copyFrom(other.towerRewards);
      }
      return this;
    }

    @Override
    public StarTowerGiveUpResp mergeFrom(final StarTowerGiveUpResp other) {
      if (other.isEmpty()) {
        return this;
      }
      cachedSize = -1;
      if (other.hasNpcInteraction()) {
        setNpcInteraction(other.npcInteraction);
      }
      if (other.hasFloor()) {
        setFloor(other.floor);
      }
      if (other.hasPotentialCnt()) {
        setPotentialCnt(other.potentialCnt);
      }
      if (other.hasTotalTime()) {
        setTotalTime(other.totalTime);
      }
      if (other.hasChange()) {
        getMutableChange().mergeFrom(other.change);
      }
      if (other.hasBuild()) {
        getMutableBuild().mergeFrom(other.build);
      }
      if (other.hasNextPackage()) {
        getMutableNextPackage().copyFrom(other.nextPackage);
      }
      if (other.hasTotalDamages()) {
        getMutableTotalDamages().addAll(other.totalDamages);
      }
      if (other.hasReward()) {
        getMutableReward().addAll(other.reward);
      }
      if (other.hasTowerRewards()) {
        getMutableTowerRewards().addAll(other.towerRewards);
      }
      return this;
    }

    @Override
    public StarTowerGiveUpResp clear() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      npcInteraction = 0;
      floor = 0;
      potentialCnt = 0;
      totalTime = 0;
      change.clear();
      build.clear();
      nextPackage.clear();
      totalDamages.clear();
      reward.clear();
      towerRewards.clear();
      return this;
    }

    @Override
    public StarTowerGiveUpResp clearQuick() {
      if (isEmpty()) {
        return this;
      }
      cachedSize = -1;
      bitField0_ = 0;
      change.clearQuick();
      build.clearQuick();
      nextPackage.clear();
      totalDamages.clear();
      reward.clearQuick();
      towerRewards.clearQuick();
      return this;
    }

    @Override
    public boolean equals(Object o) {
      if (o == this) {
        return true;
      }
      if (!(o instanceof StarTowerGiveUpResp)) {
        return false;
      }
      StarTowerGiveUpResp other = (StarTowerGiveUpResp) o;
      return bitField0_ == other.bitField0_
        && (!hasNpcInteraction() || npcInteraction == other.npcInteraction)
        && (!hasFloor() || floor == other.floor)
        && (!hasPotentialCnt() || potentialCnt == other.potentialCnt)
        && (!hasTotalTime() || totalTime == other.totalTime)
        && (!hasChange() || change.equals(other.change))
        && (!hasBuild() || build.equals(other.build))
        && (!hasNextPackage() || nextPackage.equals(other.nextPackage))
        && (!hasTotalDamages() || totalDamages.equals(other.totalDamages))
        && (!hasReward() || reward.equals(other.reward))
        && (!hasTowerRewards() || towerRewards.equals(other.towerRewards));
    }

    @Override
    public void writeTo(final ProtoSink output) throws IOException {
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeRawByte((byte) 32);
        output.writeUInt32NoTag(npcInteraction);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeRawByte((byte) 96);
        output.writeUInt32NoTag(floor);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeRawByte((byte) 104);
        output.writeUInt32NoTag(potentialCnt);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeRawByte((byte) 112);
        output.writeUInt32NoTag(totalTime);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeRawByte((byte) 10);
        output.writeMessageNoTag(change);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeRawByte((byte) 18);
        output.writeMessageNoTag(build);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeRawLittleEndian16((short) 32762);
        output.writeBytesNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        for (int i = 0; i < totalDamages.length(); i++) {
          output.writeRawByte((byte) 120);
          output.writeUInt64NoTag(totalDamages.array()[i]);
        }
      }
      if ((bitField0_ & 0x00000100) != 0) {
        for (int i = 0; i < reward.length(); i++) {
          output.writeRawByte((byte) 26);
          output.writeMessageNoTag(reward.get(i));
        }
      }
      if ((bitField0_ & 0x00000200) != 0) {
        for (int i = 0; i < towerRewards.length(); i++) {
          output.writeRawByte((byte) 42);
          output.writeMessageNoTag(towerRewards.get(i));
        }
      }
    }

    @Override
    protected int computeSerializedSize() {
      int size = 0;
      if ((bitField0_ & 0x00000001) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(npcInteraction);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(floor);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(potentialCnt);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        size += 1 + ProtoSink.computeUInt32SizeNoTag(totalTime);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(change);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        size += 1 + ProtoSink.computeMessageSizeNoTag(build);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        size += 2 + ProtoSink.computeBytesSizeNoTag(nextPackage);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        size += (1 * totalDamages.length()) + ProtoSink.computeRepeatedUInt64SizeNoTag(totalDamages);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        size += (1 * reward.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(reward);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        size += (1 * towerRewards.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(towerRewards);
      }
      return size;
    }

    @Override
    @SuppressWarnings("fallthrough")
    public StarTowerGiveUpResp mergeFrom(final ProtoSource input) throws IOException {
      // Enabled Fall-Through Optimization (QuickBuffers)
      int tag = input.readTag();
      while (true) {
        switch (tag) {
          case 32: {
            // npcInteraction
            npcInteraction = input.readUInt32();
            bitField0_ |= 0x00000001;
            tag = input.readTag();
            if (tag != 96) {
              break;
            }
          }
          case 96: {
            // floor
            floor = input.readUInt32();
            bitField0_ |= 0x00000002;
            tag = input.readTag();
            if (tag != 104) {
              break;
            }
          }
          case 104: {
            // potentialCnt
            potentialCnt = input.readUInt32();
            bitField0_ |= 0x00000004;
            tag = input.readTag();
            if (tag != 112) {
              break;
            }
          }
          case 112: {
            // totalTime
            totalTime = input.readUInt32();
            bitField0_ |= 0x00000008;
            tag = input.readTag();
            if (tag != 10) {
              break;
            }
          }
          case 10: {
            // change
            input.readMessage(change);
            bitField0_ |= 0x00000010;
            tag = input.readTag();
            if (tag != 18) {
              break;
            }
          }
          case 18: {
            // build
            input.readMessage(build);
            bitField0_ |= 0x00000020;
            tag = input.readTag();
            if (tag != 16378) {
              break;
            }
          }
          case 16378: {
            // nextPackage
            input.readBytes(nextPackage);
            bitField0_ |= 0x00000040;
            tag = input.readTag();
            if (tag != 122) {
              break;
            }
          }
          case 122: {
            // totalDamages [packed=true]
            input.readPackedUInt64(totalDamages, tag);
            bitField0_ |= 0x00000080;
            tag = input.readTag();
            if (tag != 26) {
              break;
            }
          }
          case 26: {
            // reward
            tag = input.readRepeatedMessage(reward, tag);
            bitField0_ |= 0x00000100;
            if (tag != 42) {
              break;
            }
          }
          case 42: {
            // towerRewards
            tag = input.readRepeatedMessage(towerRewards, tag);
            bitField0_ |= 0x00000200;
            if (tag != 0) {
              break;
            }
          }
          case 0: {
            return this;
          }
          default: {
            if (!input.skipField(tag)) {
              return this;
            }
            tag = input.readTag();
            break;
          }
          case 120: {
            // totalDamages [packed=false]
            tag = input.readRepeatedUInt64(totalDamages, tag);
            bitField0_ |= 0x00000080;
            break;
          }
        }
      }
    }

    @Override
    public void writeTo(final JsonSink output) throws IOException {
      output.beginObject();
      if ((bitField0_ & 0x00000001) != 0) {
        output.writeUInt32(FieldNames.npcInteraction, npcInteraction);
      }
      if ((bitField0_ & 0x00000002) != 0) {
        output.writeUInt32(FieldNames.floor, floor);
      }
      if ((bitField0_ & 0x00000004) != 0) {
        output.writeUInt32(FieldNames.potentialCnt, potentialCnt);
      }
      if ((bitField0_ & 0x00000008) != 0) {
        output.writeUInt32(FieldNames.totalTime, totalTime);
      }
      if ((bitField0_ & 0x00000010) != 0) {
        output.writeMessage(FieldNames.change, change);
      }
      if ((bitField0_ & 0x00000020) != 0) {
        output.writeMessage(FieldNames.build, build);
      }
      if ((bitField0_ & 0x00000040) != 0) {
        output.writeBytes(FieldNames.nextPackage, nextPackage);
      }
      if ((bitField0_ & 0x00000080) != 0) {
        output.writeRepeatedUInt64(FieldNames.totalDamages, totalDamages);
      }
      if ((bitField0_ & 0x00000100) != 0) {
        output.writeRepeatedMessage(FieldNames.reward, reward);
      }
      if ((bitField0_ & 0x00000200) != 0) {
        output.writeRepeatedMessage(FieldNames.towerRewards, towerRewards);
      }
      output.endObject();
    }

    @Override
    public StarTowerGiveUpResp mergeFrom(final JsonSource input) throws IOException {
      if (!input.beginObject()) {
        return this;
      }
      while (!input.isAtEnd()) {
        switch (input.readFieldHash()) {
          case -168972143: {
            if (input.isAtField(FieldNames.npcInteraction)) {
              if (!input.trySkipNullValue()) {
                npcInteraction = input.readUInt32();
                bitField0_ |= 0x00000001;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 67974124: {
            if (input.isAtField(FieldNames.floor)) {
              if (!input.trySkipNullValue()) {
                floor = input.readUInt32();
                bitField0_ |= 0x00000002;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2059288715: {
            if (input.isAtField(FieldNames.potentialCnt)) {
              if (!input.trySkipNullValue()) {
                potentialCnt = input.readUInt32();
                bitField0_ |= 0x00000004;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 1426685969: {
            if (input.isAtField(FieldNames.totalTime)) {
              if (!input.trySkipNullValue()) {
                totalTime = input.readUInt32();
                bitField0_ |= 0x00000008;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 2017198032: {
            if (input.isAtField(FieldNames.change)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(change);
                bitField0_ |= 0x00000010;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 64542286: {
            if (input.isAtField(FieldNames.build)) {
              if (!input.trySkipNullValue()) {
                input.readMessage(build);
                bitField0_ |= 0x00000020;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2082324045: {
            if (input.isAtField(FieldNames.nextPackage)) {
              if (!input.trySkipNullValue()) {
                input.readBytes(nextPackage);
                bitField0_ |= 0x00000040;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -2138865888: {
            if (input.isAtField(FieldNames.totalDamages)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedUInt64(totalDamages);
                bitField0_ |= 0x00000080;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case -1850459313: {
            if (input.isAtField(FieldNames.reward)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(reward);
                bitField0_ |= 0x00000100;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          case 162549755: {
            if (input.isAtField(FieldNames.towerRewards)) {
              if (!input.trySkipNullValue()) {
                input.readRepeatedMessage(towerRewards);
                bitField0_ |= 0x00000200;
              }
            } else {
              input.skipUnknownField();
            }
            break;
          }
          default: {
            input.skipUnknownField();
            break;
          }
        }
      }
      input.endObject();
      return this;
    }

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

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

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

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

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

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

    private enum StarTowerGiveUpRespFactory implements MessageFactory<StarTowerGiveUpResp> {
      INSTANCE;

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

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

      static final FieldName floor = FieldName.forField("Floor");

      static final FieldName potentialCnt = FieldName.forField("PotentialCnt");

      static final FieldName totalTime = FieldName.forField("TotalTime");

      static final FieldName change = FieldName.forField("Change");

      static final FieldName build = FieldName.forField("Build");

      static final FieldName nextPackage = FieldName.forField("NextPackage");

      static final FieldName totalDamages = FieldName.forField("TotalDamages");

      static final FieldName reward = FieldName.forField("Reward");

      static final FieldName towerRewards = FieldName.forField("TowerRewards");
    }
  }
}
