diff --git a/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataNotifyOuterClass.java b/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataNotifyOuterClass.java new file mode 100644 index 000000000..573bec68c --- /dev/null +++ b/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataNotifyOuterClass.java @@ -0,0 +1,865 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: AvatarSatiationDataNotify.proto + +package emu.grasscutter.net.proto; + +public final class AvatarSatiationDataNotifyOuterClass { + private AvatarSatiationDataNotifyOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface AvatarSatiationDataNotifyOrBuilder extends + // @@protoc_insertion_point(interface_extends:AvatarSatiationDataNotify) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + java.util.List + getSatiationDataListList(); + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getSatiationDataList(int index); + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + int getSatiationDataListCount(); + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + java.util.List + getSatiationDataListOrBuilderList(); + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder getSatiationDataListOrBuilder( + int index); + } + /** + *
+   * enum CmdId {
+   *   option allow_alias = true;
+   *   NONE = 0;
+   *   CMD_ID = 1766;
+   *   ENET_CHANNEL_ID = 0;
+   *   ENET_IS_RELIABLE = 1;
+   * }
+   * 
+ * + * Protobuf type {@code AvatarSatiationDataNotify} + */ + public static final class AvatarSatiationDataNotify extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:AvatarSatiationDataNotify) + AvatarSatiationDataNotifyOrBuilder { + private static final long serialVersionUID = 0L; + // Use AvatarSatiationDataNotify.newBuilder() to construct. + private AvatarSatiationDataNotify(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AvatarSatiationDataNotify() { + satiationDataList_ = java.util.Collections.emptyList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AvatarSatiationDataNotify(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AvatarSatiationDataNotify( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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; + case 106: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + satiationDataList_ = new java.util.ArrayList(); + mutable_bitField0_ |= 0x00000001; + } + satiationDataList_.add( + input.readMessage(emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.parser(), extensionRegistry)); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + satiationDataList_ = java.util.Collections.unmodifiableList(satiationDataList_); + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.internal_static_AvatarSatiationDataNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.internal_static_AvatarSatiationDataNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.class, emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.Builder.class); + } + + public static final int SATIATION_DATA_LIST_FIELD_NUMBER = 13; + private java.util.List satiationDataList_; + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + @java.lang.Override + public java.util.List getSatiationDataListList() { + return satiationDataList_; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + @java.lang.Override + public java.util.List + getSatiationDataListOrBuilderList() { + return satiationDataList_; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + @java.lang.Override + public int getSatiationDataListCount() { + return satiationDataList_.size(); + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getSatiationDataList(int index) { + return satiationDataList_.get(index); + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder getSatiationDataListOrBuilder( + int index) { + return satiationDataList_.get(index); + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + for (int i = 0; i < satiationDataList_.size(); i++) { + output.writeMessage(13, satiationDataList_.get(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + for (int i = 0; i < satiationDataList_.size(); i++) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(13, satiationDataList_.get(i)); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify other = (emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify) obj; + + if (!getSatiationDataListList() + .equals(other.getSatiationDataListList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getSatiationDataListCount() > 0) { + hash = (37 * hash) + SATIATION_DATA_LIST_FIELD_NUMBER; + hash = (53 * hash) + getSatiationDataListList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + *
+     * enum CmdId {
+     *   option allow_alias = true;
+     *   NONE = 0;
+     *   CMD_ID = 1766;
+     *   ENET_CHANNEL_ID = 0;
+     *   ENET_IS_RELIABLE = 1;
+     * }
+     * 
+ * + * Protobuf type {@code AvatarSatiationDataNotify} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:AvatarSatiationDataNotify) + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotifyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.internal_static_AvatarSatiationDataNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.internal_static_AvatarSatiationDataNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.class, emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + getSatiationDataListFieldBuilder(); + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + if (satiationDataListBuilder_ == null) { + satiationDataList_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + } else { + satiationDataListBuilder_.clear(); + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.internal_static_AvatarSatiationDataNotify_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify getDefaultInstanceForType() { + return emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify build() { + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify buildPartial() { + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify result = new emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify(this); + int from_bitField0_ = bitField0_; + if (satiationDataListBuilder_ == null) { + if (((bitField0_ & 0x00000001) != 0)) { + satiationDataList_ = java.util.Collections.unmodifiableList(satiationDataList_); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.satiationDataList_ = satiationDataList_; + } else { + result.satiationDataList_ = satiationDataListBuilder_.build(); + } + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify) { + return mergeFrom((emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify other) { + if (other == emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify.getDefaultInstance()) return this; + if (satiationDataListBuilder_ == null) { + if (!other.satiationDataList_.isEmpty()) { + if (satiationDataList_.isEmpty()) { + satiationDataList_ = other.satiationDataList_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureSatiationDataListIsMutable(); + satiationDataList_.addAll(other.satiationDataList_); + } + onChanged(); + } + } else { + if (!other.satiationDataList_.isEmpty()) { + if (satiationDataListBuilder_.isEmpty()) { + satiationDataListBuilder_.dispose(); + satiationDataListBuilder_ = null; + satiationDataList_ = other.satiationDataList_; + bitField0_ = (bitField0_ & ~0x00000001); + satiationDataListBuilder_ = + com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ? + getSatiationDataListFieldBuilder() : null; + } else { + satiationDataListBuilder_.addAllMessages(other.satiationDataList_); + } + } + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private java.util.List satiationDataList_ = + java.util.Collections.emptyList(); + private void ensureSatiationDataListIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + satiationDataList_ = new java.util.ArrayList(satiationDataList_); + bitField0_ |= 0x00000001; + } + } + + private com.google.protobuf.RepeatedFieldBuilderV3< + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder> satiationDataListBuilder_; + + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public java.util.List getSatiationDataListList() { + if (satiationDataListBuilder_ == null) { + return java.util.Collections.unmodifiableList(satiationDataList_); + } else { + return satiationDataListBuilder_.getMessageList(); + } + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public int getSatiationDataListCount() { + if (satiationDataListBuilder_ == null) { + return satiationDataList_.size(); + } else { + return satiationDataListBuilder_.getCount(); + } + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getSatiationDataList(int index) { + if (satiationDataListBuilder_ == null) { + return satiationDataList_.get(index); + } else { + return satiationDataListBuilder_.getMessage(index); + } + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder setSatiationDataList( + int index, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData value) { + if (satiationDataListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSatiationDataListIsMutable(); + satiationDataList_.set(index, value); + onChanged(); + } else { + satiationDataListBuilder_.setMessage(index, value); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder setSatiationDataList( + int index, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder builderForValue) { + if (satiationDataListBuilder_ == null) { + ensureSatiationDataListIsMutable(); + satiationDataList_.set(index, builderForValue.build()); + onChanged(); + } else { + satiationDataListBuilder_.setMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder addSatiationDataList(emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData value) { + if (satiationDataListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSatiationDataListIsMutable(); + satiationDataList_.add(value); + onChanged(); + } else { + satiationDataListBuilder_.addMessage(value); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder addSatiationDataList( + int index, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData value) { + if (satiationDataListBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + ensureSatiationDataListIsMutable(); + satiationDataList_.add(index, value); + onChanged(); + } else { + satiationDataListBuilder_.addMessage(index, value); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder addSatiationDataList( + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder builderForValue) { + if (satiationDataListBuilder_ == null) { + ensureSatiationDataListIsMutable(); + satiationDataList_.add(builderForValue.build()); + onChanged(); + } else { + satiationDataListBuilder_.addMessage(builderForValue.build()); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder addSatiationDataList( + int index, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder builderForValue) { + if (satiationDataListBuilder_ == null) { + ensureSatiationDataListIsMutable(); + satiationDataList_.add(index, builderForValue.build()); + onChanged(); + } else { + satiationDataListBuilder_.addMessage(index, builderForValue.build()); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder addAllSatiationDataList( + java.lang.Iterable values) { + if (satiationDataListBuilder_ == null) { + ensureSatiationDataListIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, satiationDataList_); + onChanged(); + } else { + satiationDataListBuilder_.addAllMessages(values); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder clearSatiationDataList() { + if (satiationDataListBuilder_ == null) { + satiationDataList_ = java.util.Collections.emptyList(); + bitField0_ = (bitField0_ & ~0x00000001); + onChanged(); + } else { + satiationDataListBuilder_.clear(); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public Builder removeSatiationDataList(int index) { + if (satiationDataListBuilder_ == null) { + ensureSatiationDataListIsMutable(); + satiationDataList_.remove(index); + onChanged(); + } else { + satiationDataListBuilder_.remove(index); + } + return this; + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder getSatiationDataListBuilder( + int index) { + return getSatiationDataListFieldBuilder().getBuilder(index); + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder getSatiationDataListOrBuilder( + int index) { + if (satiationDataListBuilder_ == null) { + return satiationDataList_.get(index); } else { + return satiationDataListBuilder_.getMessageOrBuilder(index); + } + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public java.util.List + getSatiationDataListOrBuilderList() { + if (satiationDataListBuilder_ != null) { + return satiationDataListBuilder_.getMessageOrBuilderList(); + } else { + return java.util.Collections.unmodifiableList(satiationDataList_); + } + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder addSatiationDataListBuilder() { + return getSatiationDataListFieldBuilder().addBuilder( + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.getDefaultInstance()); + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder addSatiationDataListBuilder( + int index) { + return getSatiationDataListFieldBuilder().addBuilder( + index, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.getDefaultInstance()); + } + /** + * repeated .AvatarSatiationData satiation_data_list = 13; + */ + public java.util.List + getSatiationDataListBuilderList() { + return getSatiationDataListFieldBuilder().getBuilderList(); + } + private com.google.protobuf.RepeatedFieldBuilderV3< + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder> + getSatiationDataListFieldBuilder() { + if (satiationDataListBuilder_ == null) { + satiationDataListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3< + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder>( + satiationDataList_, + ((bitField0_ & 0x00000001) != 0), + getParentForChildren(), + isClean()); + satiationDataList_ = null; + } + return satiationDataListBuilder_; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:AvatarSatiationDataNotify) + } + + // @@protoc_insertion_point(class_scope:AvatarSatiationDataNotify) + private static final emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify(); + } + + public static emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvatarSatiationDataNotify parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AvatarSatiationDataNotify(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_AvatarSatiationDataNotify_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_AvatarSatiationDataNotify_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\037AvatarSatiationDataNotify.proto\032\031Avata" + + "rSatiationData.proto\"N\n\031AvatarSatiationD" + + "ataNotify\0221\n\023satiation_data_list\030\r \003(\0132\024" + + ".AvatarSatiationDataB\033\n\031emu.grasscutter." + + "net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.getDescriptor(), + }); + internal_static_AvatarSatiationDataNotify_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_AvatarSatiationDataNotify_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_AvatarSatiationDataNotify_descriptor, + new java.lang.String[] { "SatiationDataList", }); + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataOuterClass.java b/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataOuterClass.java new file mode 100644 index 000000000..df17a0a65 --- /dev/null +++ b/src/generated/main/java/emu/grasscutter/net/proto/AvatarSatiationDataOuterClass.java @@ -0,0 +1,682 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: AvatarSatiationData.proto + +package emu.grasscutter.net.proto; + +public final class AvatarSatiationDataOuterClass { + private AvatarSatiationDataOuterClass() {} + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistryLite registry) { + } + + public static void registerAllExtensions( + com.google.protobuf.ExtensionRegistry registry) { + registerAllExtensions( + (com.google.protobuf.ExtensionRegistryLite) registry); + } + public interface AvatarSatiationDataOrBuilder extends + // @@protoc_insertion_point(interface_extends:AvatarSatiationData) + com.google.protobuf.MessageOrBuilder { + + /** + * uint64 avatar_guid = 15; + * @return The avatarGuid. + */ + long getAvatarGuid(); + + /** + * float penalty_finish_time = 6; + * @return The penaltyFinishTime. + */ + float getPenaltyFinishTime(); + + /** + * float finish_time = 7; + * @return The finishTime. + */ + float getFinishTime(); + } + /** + * Protobuf type {@code AvatarSatiationData} + */ + public static final class AvatarSatiationData extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:AvatarSatiationData) + AvatarSatiationDataOrBuilder { + private static final long serialVersionUID = 0L; + // Use AvatarSatiationData.newBuilder() to construct. + private AvatarSatiationData(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AvatarSatiationData() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AvatarSatiationData(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AvatarSatiationData( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + 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; + case 53: { + + penaltyFinishTime_ = input.readFloat(); + break; + } + case 61: { + + finishTime_ = input.readFloat(); + break; + } + case 120: { + + avatarGuid_ = input.readUInt64(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new com.google.protobuf.InvalidProtocolBufferException( + e).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.internal_static_AvatarSatiationData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.internal_static_AvatarSatiationData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.class, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder.class); + } + + public static final int AVATAR_GUID_FIELD_NUMBER = 15; + private long avatarGuid_; + /** + * uint64 avatar_guid = 15; + * @return The avatarGuid. + */ + @java.lang.Override + public long getAvatarGuid() { + return avatarGuid_; + } + + public static final int PENALTY_FINISH_TIME_FIELD_NUMBER = 6; + private float penaltyFinishTime_; + /** + * float penalty_finish_time = 6; + * @return The penaltyFinishTime. + */ + @java.lang.Override + public float getPenaltyFinishTime() { + return penaltyFinishTime_; + } + + public static final int FINISH_TIME_FIELD_NUMBER = 7; + private float finishTime_; + /** + * float finish_time = 7; + * @return The finishTime. + */ + @java.lang.Override + public float getFinishTime() { + return finishTime_; + } + + private byte memoizedIsInitialized = -1; + @java.lang.Override + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized == 1) return true; + if (isInitialized == 0) return false; + + memoizedIsInitialized = 1; + return true; + } + + @java.lang.Override + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + if (penaltyFinishTime_ != 0F) { + output.writeFloat(6, penaltyFinishTime_); + } + if (finishTime_ != 0F) { + output.writeFloat(7, finishTime_); + } + if (avatarGuid_ != 0L) { + output.writeUInt64(15, avatarGuid_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (penaltyFinishTime_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(6, penaltyFinishTime_); + } + if (finishTime_ != 0F) { + size += com.google.protobuf.CodedOutputStream + .computeFloatSize(7, finishTime_); + } + if (avatarGuid_ != 0L) { + size += com.google.protobuf.CodedOutputStream + .computeUInt64Size(15, avatarGuid_); + } + size += unknownFields.getSerializedSize(); + memoizedSize = size; + return size; + } + + @java.lang.Override + public boolean equals(final java.lang.Object obj) { + if (obj == this) { + return true; + } + if (!(obj instanceof emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData other = (emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData) obj; + + if (getAvatarGuid() + != other.getAvatarGuid()) return false; + if (java.lang.Float.floatToIntBits(getPenaltyFinishTime()) + != java.lang.Float.floatToIntBits( + other.getPenaltyFinishTime())) return false; + if (java.lang.Float.floatToIntBits(getFinishTime()) + != java.lang.Float.floatToIntBits( + other.getFinishTime())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + hash = (37 * hash) + AVATAR_GUID_FIELD_NUMBER; + hash = (53 * hash) + com.google.protobuf.Internal.hashLong( + getAvatarGuid()); + hash = (37 * hash) + PENALTY_FINISH_TIME_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits( + getPenaltyFinishTime()); + hash = (37 * hash) + FINISH_TIME_FIELD_NUMBER; + hash = (53 * hash) + java.lang.Float.floatToIntBits( + getFinishTime()); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input, extensionRegistry); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input, extensionRegistry); + } + + @java.lang.Override + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + public static Builder newBuilder(emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + @java.lang.Override + public Builder toBuilder() { + return this == DEFAULT_INSTANCE + ? new Builder() : new Builder().mergeFrom(this); + } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + /** + * Protobuf type {@code AvatarSatiationData} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:AvatarSatiationData) + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationDataOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.internal_static_AvatarSatiationData_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.internal_static_AvatarSatiationData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.class, emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder( + com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessageV3 + .alwaysUseFieldBuilders) { + } + } + @java.lang.Override + public Builder clear() { + super.clear(); + avatarGuid_ = 0L; + + penaltyFinishTime_ = 0F; + + finishTime_ = 0F; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.internal_static_AvatarSatiationData_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getDefaultInstanceForType() { + return emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData build() { + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData buildPartial() { + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData result = new emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData(this); + result.avatarGuid_ = avatarGuid_; + result.penaltyFinishTime_ = penaltyFinishTime_; + result.finishTime_ = finishTime_; + onBuilt(); + return result; + } + + @java.lang.Override + public Builder clone() { + return super.clone(); + } + @java.lang.Override + public Builder setField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.setField(field, value); + } + @java.lang.Override + public Builder clearField( + com.google.protobuf.Descriptors.FieldDescriptor field) { + return super.clearField(field); + } + @java.lang.Override + public Builder clearOneof( + com.google.protobuf.Descriptors.OneofDescriptor oneof) { + return super.clearOneof(oneof); + } + @java.lang.Override + public Builder setRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + int index, java.lang.Object value) { + return super.setRepeatedField(field, index, value); + } + @java.lang.Override + public Builder addRepeatedField( + com.google.protobuf.Descriptors.FieldDescriptor field, + java.lang.Object value) { + return super.addRepeatedField(field, value); + } + @java.lang.Override + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData) { + return mergeFrom((emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData other) { + if (other == emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData.getDefaultInstance()) return this; + if (other.getAvatarGuid() != 0L) { + setAvatarGuid(other.getAvatarGuid()); + } + if (other.getPenaltyFinishTime() != 0F) { + setPenaltyFinishTime(other.getPenaltyFinishTime()); + } + if (other.getFinishTime() != 0F) { + setFinishTime(other.getFinishTime()); + } + this.mergeUnknownFields(other.unknownFields); + onChanged(); + return this; + } + + @java.lang.Override + public final boolean isInitialized() { + return true; + } + + @java.lang.Override + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private long avatarGuid_ ; + /** + * uint64 avatar_guid = 15; + * @return The avatarGuid. + */ + @java.lang.Override + public long getAvatarGuid() { + return avatarGuid_; + } + /** + * uint64 avatar_guid = 15; + * @param value The avatarGuid to set. + * @return This builder for chaining. + */ + public Builder setAvatarGuid(long value) { + + avatarGuid_ = value; + onChanged(); + return this; + } + /** + * uint64 avatar_guid = 15; + * @return This builder for chaining. + */ + public Builder clearAvatarGuid() { + + avatarGuid_ = 0L; + onChanged(); + return this; + } + + private float penaltyFinishTime_ ; + /** + * float penalty_finish_time = 6; + * @return The penaltyFinishTime. + */ + @java.lang.Override + public float getPenaltyFinishTime() { + return penaltyFinishTime_; + } + /** + * float penalty_finish_time = 6; + * @param value The penaltyFinishTime to set. + * @return This builder for chaining. + */ + public Builder setPenaltyFinishTime(float value) { + + penaltyFinishTime_ = value; + onChanged(); + return this; + } + /** + * float penalty_finish_time = 6; + * @return This builder for chaining. + */ + public Builder clearPenaltyFinishTime() { + + penaltyFinishTime_ = 0F; + onChanged(); + return this; + } + + private float finishTime_ ; + /** + * float finish_time = 7; + * @return The finishTime. + */ + @java.lang.Override + public float getFinishTime() { + return finishTime_; + } + /** + * float finish_time = 7; + * @param value The finishTime to set. + * @return This builder for chaining. + */ + public Builder setFinishTime(float value) { + + finishTime_ = value; + onChanged(); + return this; + } + /** + * float finish_time = 7; + * @return This builder for chaining. + */ + public Builder clearFinishTime() { + + finishTime_ = 0F; + onChanged(); + return this; + } + @java.lang.Override + public final Builder setUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.setUnknownFields(unknownFields); + } + + @java.lang.Override + public final Builder mergeUnknownFields( + final com.google.protobuf.UnknownFieldSet unknownFields) { + return super.mergeUnknownFields(unknownFields); + } + + + // @@protoc_insertion_point(builder_scope:AvatarSatiationData) + } + + // @@protoc_insertion_point(class_scope:AvatarSatiationData) + private static final emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData(); + } + + public static emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvatarSatiationData parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AvatarSatiationData(input, extensionRegistry); + } + }; + + public static com.google.protobuf.Parser parser() { + return PARSER; + } + + @java.lang.Override + public com.google.protobuf.Parser getParserForType() { + return PARSER; + } + + @java.lang.Override + public emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_AvatarSatiationData_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_AvatarSatiationData_fieldAccessorTable; + + public static com.google.protobuf.Descriptors.FileDescriptor + getDescriptor() { + return descriptor; + } + private static com.google.protobuf.Descriptors.FileDescriptor + descriptor; + static { + java.lang.String[] descriptorData = { + "\n\031AvatarSatiationData.proto\"\\\n\023AvatarSat" + + "iationData\022\023\n\013avatar_guid\030\017 \001(\004\022\033\n\023penal" + + "ty_finish_time\030\006 \001(\002\022\023\n\013finish_time\030\007 \001(" + + "\002B\033\n\031emu.grasscutter.net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_AvatarSatiationData_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_AvatarSatiationData_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_AvatarSatiationData_descriptor, + new java.lang.String[] { "AvatarGuid", "PenaltyFinishTime", "FinishTime", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index adb3dc759..0d878e8ac 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -84,8 +84,8 @@ public class Avatar { @Getter @Setter private int level = 1; @Getter @Setter private int exp; @Getter @Setter private int promoteLevel; - @Getter @Setter private int satiation; // ? - @Getter @Setter private int satiationPenalty; // ? + @Getter @Setter private int satiation; // Fullness + @Getter @Setter private int satiationPenalty; // When eating too much @Getter @Setter private float currentHp; private float currentEnergy; @@ -204,12 +204,30 @@ public class Avatar { return 0; } - public boolean addSatiation(float value) { - if (this.satiation >= 100) return false; + public boolean addSatiation(int value) { + if (this.satiation >= 10000) return false; this.satiation += value; return true; } + public float reduceSatiation(int value) { + if (this.satiation == 0) return 0; + this.satiation -= value; + if(this.satiation < 0) { + this.satiation = 0; + } + return this.satiation; + } + + public float reduceSatiationPenalty(int value) { + if (this.satiationPenalty == 0) return 0; + this.satiationPenalty -= value; + if(this.satiationPenalty < 0) { + this.satiationPenalty = 0; + } + return this.satiationPenalty; + } + public GameItem getEquipBySlot(EquipType slot) { return this.getEquips().get(slot.getValue()); } @@ -879,8 +897,8 @@ public class Avatar { avatarInfo.putPropMap(PlayerProperty.PROP_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_LEVEL, this.getLevel())); avatarInfo.putPropMap(PlayerProperty.PROP_EXP.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_EXP, this.getExp())); avatarInfo.putPropMap(PlayerProperty.PROP_BREAK_LEVEL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_BREAK_LEVEL, this.getPromoteLevel())); - avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, 0)); - avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_PENALTY_TIME, 0)); + avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, this.getSatiation())); + avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_PENALTY_TIME, this.getSatiationPenalty())); return avatarInfo.build(); } diff --git a/src/main/java/emu/grasscutter/game/managers/SatiationManager.java b/src/main/java/emu/grasscutter/game/managers/SatiationManager.java new file mode 100644 index 000000000..22c011a5f --- /dev/null +++ b/src/main/java/emu/grasscutter/game/managers/SatiationManager.java @@ -0,0 +1,115 @@ +package emu.grasscutter.game.managers; + +import java.util.HashMap; +import java.util.Map; + +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.game.player.BasePlayerManager; +import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.props.PlayerProperty; +import emu.grasscutter.server.packet.send.PacketAvatarSatiationDataNotify; +import emu.grasscutter.server.packet.send.PacketPlayerGameTimeNotify; +import emu.grasscutter.server.packet.send.PacketPlayerTimeNotify; +import emu.grasscutter.server.packet.send.PacketAvatarPropNotify; + +public class SatiationManager extends BasePlayerManager { + + public SatiationManager(Player player) { + super(player); + } + + /******************** + * Change satiation + ********************/ + public synchronized boolean addSatiation(Avatar avatar, float satiationIncrease, int itemId) { + + // Satiation is max 10000 but can go over in the case of overeating + Map propMap = new HashMap<>(); + int satiation = Math.round(satiationIncrease * 100); + float totalSatiation = ((satiationIncrease * 100) + avatar.getSatiation()); + + // Update client time + updateTime(); + + // Calculate times + var playerTime = (player.getClientTime() / 1000); + float finishTime = playerTime + (totalSatiation / 30); + + // Penalty + long penaltyTime = playerTime; + long penaltyValue = avatar.getSatiationPenalty(); + if(totalSatiation + avatar.getSatiation() > 10000 && penaltyValue == 0) { + // Penalty is always 30sec + penaltyTime += 30; + penaltyValue = 3000; + } + + // Add satiation + if (!addSatiationDirectly(avatar, satiation)) return false; + propMap.put(PlayerProperty.PROP_SATIATION_VAL.getId(), Long.valueOf(satiation)); + propMap.put(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), penaltyValue); + + // Send packets + player.getSession().send(new PacketAvatarPropNotify(avatar, propMap)); + player.getSession().send(new PacketAvatarSatiationDataNotify(avatar, finishTime, penaltyTime)); + return true; + } + + public synchronized boolean addSatiationDirectly(Avatar avatar, int value) { + if (!avatar.addSatiation(value)) + return false; + // Update avatar + avatar.save(); + return true; + } + + public synchronized void removeSatiationDirectly(Avatar avatar, int value) { + avatar.reduceSatiation(value); + avatar.reduceSatiationPenalty(3000); + avatar.save(); + // Update avatar to no satiation + updateSingleAvatar(avatar, 0); + } + + public synchronized void reduceSatiation() { + /* Satiation may not reduce while paused on official but it will here */ + // Get all avatars with satiation + player.getAvatars().forEach(avatar -> { + // Ensure avatar isn't stuck in penalty + if (avatar.getSatiationPenalty() > 0 && avatar.getSatiation() == 0) { + avatar.reduceSatiationPenalty(3000); + } + + // Reduce satiation + if (avatar.getSatiation() > 0) { + // Reduce penalty first + if (avatar.getSatiationPenalty() > 0) { + // Penalty reduction rate is 1/s + avatar.reduceSatiationPenalty(100); + } else { + // Satiation reduction rate is 0.3/s + avatar.reduceSatiation(30); + + // Update all packets every tick else it won't work + // Surely there is a better way to handle this + addSatiation(avatar, 0, 0); + } + } + }); + } + + /******************** + * Player Updates + ********************/ + public synchronized void updateSingleAvatar(Avatar avatar, float givenTime) { + float time = (player.getClientTime() / 1000) + givenTime; + player.getSession().send(new PacketAvatarPropNotify(avatar)); + player.getSession().send(new PacketAvatarSatiationDataNotify(time, avatar)); + } + + private void updateTime() { + player.getSession().send(new PacketPlayerGameTimeNotify(player)); + player.getSession().send(new PacketPlayerTimeNotify(player)); + } + +} diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index ab0c6aaae..df0c60fd4 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -29,6 +29,7 @@ import emu.grasscutter.game.managers.cooking.CookingCompoundManager; import emu.grasscutter.game.managers.cooking.CookingManager; import emu.grasscutter.game.managers.FurnitureManager; import emu.grasscutter.game.managers.ResinManager; +import emu.grasscutter.game.managers.SatiationManager; import emu.grasscutter.game.managers.deforestation.DeforestationManager; import emu.grasscutter.game.managers.energy.EnergyManager; import emu.grasscutter.game.managers.forging.ActiveForgeData; @@ -164,6 +165,7 @@ public class Player { @Getter private transient ActivityManager activityManager; @Getter private transient PlayerBuffManager buffManager; @Getter private transient PlayerProgressManager progressManager; + @Getter private transient SatiationManager satiationManager; // Manager data (Save-able to the database) private PlayerProfile playerProfile; // Getter has null-check @@ -268,6 +270,7 @@ public class Player { this.furnitureManager = new FurnitureManager(this); this.cookingManager = new CookingManager(this); this.cookingCompoundManager=new CookingCompoundManager(this); + this.satiationManager = new SatiationManager(this); } // On player creation @@ -303,6 +306,7 @@ public class Player { this.furnitureManager = new FurnitureManager(this); this.cookingManager = new CookingManager(this); this.cookingCompoundManager=new CookingCompoundManager(this); + this.satiationManager = new SatiationManager(this); } public int getUid() { @@ -1100,6 +1104,9 @@ public class Player { // Recharge resin. this.getResinManager().rechargeResin(); + + // Satiation + this.getSatiationManager().reduceSatiation(); } private synchronized void doDailyReset() { diff --git a/src/main/java/emu/grasscutter/game/player/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java index f06fd9b2d..6d65217a5 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -26,6 +26,7 @@ import emu.grasscutter.server.packet.send.PacketAddBackupAvatarTeamRsp; import emu.grasscutter.server.packet.send.PacketAvatarDieAnimationEndRsp; import emu.grasscutter.server.packet.send.PacketAvatarFightPropUpdateNotify; import emu.grasscutter.server.packet.send.PacketAvatarLifeStateChangeNotify; +import emu.grasscutter.server.packet.send.PacketAvatarSatiationDataNotify; import emu.grasscutter.server.packet.send.PacketAvatarTeamAllDataNotify; import emu.grasscutter.server.packet.send.PacketAvatarTeamUpdateNotify; import emu.grasscutter.server.packet.send.PacketChangeAvatarRsp; @@ -569,6 +570,8 @@ public class TeamManager extends BasePlayerDataManager { } entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, 1f); + // Satiation is reset when reviving an avatar + player.getSatiationManager().removeSatiationDirectly(entity.getAvatar(), 15000); this.getPlayer().sendPacket(new PacketAvatarFightPropUpdateNotify(entity.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP)); this.getPlayer().sendPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar())); return true; @@ -618,6 +621,7 @@ public class TeamManager extends BasePlayerDataManager { FightProperty.FIGHT_PROP_CUR_HP, entity.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP) * .4f ); + player.getSatiationManager().removeSatiationDirectly(entity.getAvatar(), 15000); this.getPlayer().sendPacket(new PacketAvatarFightPropUpdateNotify(entity.getAvatar(), FightProperty.FIGHT_PROP_CUR_HP)); this.getPlayer().sendPacket(new PacketAvatarLifeStateChangeNotify(entity.getAvatar())); } diff --git a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java index 745697428..d4537716d 100644 --- a/src/main/java/emu/grasscutter/game/systems/InventorySystem.java +++ b/src/main/java/emu/grasscutter/game/systems/InventorySystem.java @@ -785,7 +785,7 @@ public class InventorySystem extends BaseGameSystem { if (event.isCanceled()) return false; float satiationIncrease = satiationParams[0] + ((float)satiationParams[1])/params.targetAvatar.getFightProperty(FightProperty.FIGHT_PROP_MAX_HP); - if (!params.targetAvatar.addSatiation(satiationIncrease)) { // Make sure avatar can eat + if (!params.player.getSatiationManager().addSatiation(params.targetAvatar, satiationIncrease, itemData.getId())) { // Make sure avatar can eat return false; } } diff --git a/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtils.java b/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtils.java index 73feb807e..177778394 100644 --- a/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtils.java +++ b/src/main/java/emu/grasscutter/net/packet/PacketOpcodesUtils.java @@ -28,7 +28,13 @@ public class PacketOpcodesUtils { PacketOpcodes.WorldPlayerRTTNotify, PacketOpcodes.UnionCmdNotify, PacketOpcodes.QueryPathReq, - PacketOpcodes.QueryPathRsp + PacketOpcodes.QueryPathRsp, + + // Satiation sends these every tick + PacketOpcodes.PlayerTimeNotify, + PacketOpcodes.PlayerGameTimeNotify, + PacketOpcodes.AvatarPropNotify, + PacketOpcodes.AvatarSatiationDataNotify ); static { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java index 21d373838..3b51c5f03 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarPropNotify.java @@ -1,5 +1,7 @@ package emu.grasscutter.server.packet.send; +import java.util.Map; + import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.net.packet.BasePacket; @@ -9,19 +11,19 @@ import emu.grasscutter.net.proto.AvatarPropNotifyOuterClass.AvatarPropNotify; public class PacketAvatarPropNotify extends BasePacket { public PacketAvatarPropNotify(Avatar avatar) { super(PacketOpcodes.AvatarPropNotify); - + AvatarPropNotify proto = AvatarPropNotify.newBuilder() .setAvatarGuid(avatar.getGuid()) .putPropMap(PlayerProperty.PROP_LEVEL.getId(), avatar.getLevel()) .putPropMap(PlayerProperty.PROP_EXP.getId(), avatar.getExp()) .putPropMap(PlayerProperty.PROP_BREAK_LEVEL.getId(), avatar.getPromoteLevel()) - .putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), 0) - .putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), 0) + .putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), avatar.getSatiation()) + .putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), avatar.getSatiationPenalty()) .build(); - + this.setData(proto); } - + public PacketAvatarPropNotify(Avatar avatar, PlayerProperty prop, int value) { super(PacketOpcodes.AvatarPropNotify); @@ -29,7 +31,18 @@ public class PacketAvatarPropNotify extends BasePacket { .setAvatarGuid(avatar.getGuid()) .putPropMap(prop.getId(), value) .build(); - + + this.setData(proto); + } + + public PacketAvatarPropNotify(Avatar avatar, Map propMap) { + super(PacketOpcodes.AvatarPropNotify); + + AvatarPropNotify proto = AvatarPropNotify.newBuilder() + .setAvatarGuid(avatar.getGuid()) + .putAllPropMap(propMap) + .build(); + this.setData(proto); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSatiationDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSatiationDataNotify.java new file mode 100644 index 000000000..0d2261d51 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarSatiationDataNotify.java @@ -0,0 +1,48 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.game.avatar.Avatar; +import emu.grasscutter.net.proto.AvatarSatiationDataNotifyOuterClass.AvatarSatiationDataNotify; +import emu.grasscutter.net.proto.AvatarSatiationDataOuterClass.AvatarSatiationData; + +public class PacketAvatarSatiationDataNotify extends BasePacket { + + public PacketAvatarSatiationDataNotify(Avatar avatar, float finishTime, long penaltyTime) { + super(PacketOpcodes.AvatarSatiationDataNotify); + + AvatarSatiationData.Builder avatarSatiation = AvatarSatiationData.newBuilder() + .setAvatarGuid(avatar.getGuid()) + .setFinishTime(finishTime); + + // Penalty for overeating + if (penaltyTime > 0) { + avatarSatiation.setPenaltyFinishTime(penaltyTime); + } + + avatarSatiation.build(); + + AvatarSatiationDataNotify notify = AvatarSatiationDataNotify.newBuilder() + .addSatiationDataList(0, avatarSatiation) + .build(); + + this.setData(notify); + } + + public PacketAvatarSatiationDataNotify(float time, Avatar avatar) { + super(PacketOpcodes.AvatarSatiationDataNotify); + + var avatarSatiation = AvatarSatiationData.newBuilder() + .setAvatarGuid(avatar.getGuid()) + .setFinishTime(time + (avatar.getSatiation() / 30f)) + // Penalty time always ends before finish time + .setPenaltyFinishTime(time + (avatar.getSatiationPenalty() / 100f)) + .build(); + + AvatarSatiationDataNotify notify = AvatarSatiationDataNotify.newBuilder() + .addSatiationDataList(0, avatarSatiation) + .build(); + + this.setData(notify); + } +}