From 10f98cf13c2d7dbd93ba9fa321907e192a9013ea Mon Sep 17 00:00:00 2001 From: w4123 <1840686745@qq.com> Date: Wed, 20 Apr 2022 12:25:38 +0800 Subject: [PATCH 1/8] Implement stub NpcTalk packets --- .../net/proto/NpcTalkReqOuterClass.java | 680 ++++++++++++++++ .../net/proto/NpcTalkRspOuterClass.java | 750 ++++++++++++++++++ .../server/packet/recv/HandlerNpcTalkReq.java | 21 + .../server/packet/send/PacketNpcTalkRsp.java | 19 + 4 files changed, 1470 insertions(+) create mode 100644 src/main/java/emu/grasscutter/net/proto/NpcTalkReqOuterClass.java create mode 100644 src/main/java/emu/grasscutter/net/proto/NpcTalkRspOuterClass.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java diff --git a/src/main/java/emu/grasscutter/net/proto/NpcTalkReqOuterClass.java b/src/main/java/emu/grasscutter/net/proto/NpcTalkReqOuterClass.java new file mode 100644 index 000000000..a974986b9 --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/NpcTalkReqOuterClass.java @@ -0,0 +1,680 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Grasscutter-Protos/proto/NpcTalkReq.proto + +package emu.grasscutter.net.proto; + +public final class NpcTalkReqOuterClass { + private NpcTalkReqOuterClass() {} + 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 NpcTalkReqOrBuilder extends + // @@protoc_insertion_point(interface_extends:NpcTalkReq) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 npc_entity_id = 1; + * @return The npcEntityId. + */ + int getNpcEntityId(); + + /** + * uint32 talk_id = 3; + * @return The talkId. + */ + int getTalkId(); + + /** + * uint32 entity_id = 4; + * @return The entityId. + */ + int getEntityId(); + } + /** + * Protobuf type {@code NpcTalkReq} + */ + public static final class NpcTalkReq extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:NpcTalkReq) + NpcTalkReqOrBuilder { + private static final long serialVersionUID = 0L; + // Use NpcTalkReq.newBuilder() to construct. + private NpcTalkReq(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private NpcTalkReq() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new NpcTalkReq(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private NpcTalkReq( + 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 8: { + + npcEntityId_ = input.readUInt32(); + break; + } + case 24: { + + talkId_ = input.readUInt32(); + break; + } + case 32: { + + entityId_ = input.readUInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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.NpcTalkReqOuterClass.internal_static_NpcTalkReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.NpcTalkReqOuterClass.internal_static_NpcTalkReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.class, emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.Builder.class); + } + + public static final int NPC_ENTITY_ID_FIELD_NUMBER = 1; + private int npcEntityId_; + /** + * uint32 npc_entity_id = 1; + * @return The npcEntityId. + */ + @java.lang.Override + public int getNpcEntityId() { + return npcEntityId_; + } + + public static final int TALK_ID_FIELD_NUMBER = 3; + private int talkId_; + /** + * uint32 talk_id = 3; + * @return The talkId. + */ + @java.lang.Override + public int getTalkId() { + return talkId_; + } + + public static final int ENTITY_ID_FIELD_NUMBER = 4; + private int entityId_; + /** + * uint32 entity_id = 4; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + + 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 (npcEntityId_ != 0) { + output.writeUInt32(1, npcEntityId_); + } + if (talkId_ != 0) { + output.writeUInt32(3, talkId_); + } + if (entityId_ != 0) { + output.writeUInt32(4, entityId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (npcEntityId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, npcEntityId_); + } + if (talkId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(3, talkId_); + } + if (entityId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, entityId_); + } + 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.NpcTalkReqOuterClass.NpcTalkReq)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq other = (emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq) obj; + + if (getNpcEntityId() + != other.getNpcEntityId()) return false; + if (getTalkId() + != other.getTalkId()) return false; + if (getEntityId() + != other.getEntityId()) 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) + NPC_ENTITY_ID_FIELD_NUMBER; + hash = (53 * hash) + getNpcEntityId(); + hash = (37 * hash) + TALK_ID_FIELD_NUMBER; + hash = (53 * hash) + getTalkId(); + hash = (37 * hash) + ENTITY_ID_FIELD_NUMBER; + hash = (53 * hash) + getEntityId(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq 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.NpcTalkReqOuterClass.NpcTalkReq parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq 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.NpcTalkReqOuterClass.NpcTalkReq parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq 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.NpcTalkReqOuterClass.NpcTalkReq parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq 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.NpcTalkReqOuterClass.NpcTalkReq parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq 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.NpcTalkReqOuterClass.NpcTalkReq 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 NpcTalkReq} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:NpcTalkReq) + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReqOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.NpcTalkReqOuterClass.internal_static_NpcTalkReq_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.NpcTalkReqOuterClass.internal_static_NpcTalkReq_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.class, emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.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(); + npcEntityId_ = 0; + + talkId_ = 0; + + entityId_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.NpcTalkReqOuterClass.internal_static_NpcTalkReq_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq getDefaultInstanceForType() { + return emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq build() { + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq buildPartial() { + emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq result = new emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq(this); + result.npcEntityId_ = npcEntityId_; + result.talkId_ = talkId_; + result.entityId_ = entityId_; + 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.NpcTalkReqOuterClass.NpcTalkReq) { + return mergeFrom((emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq other) { + if (other == emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq.getDefaultInstance()) return this; + if (other.getNpcEntityId() != 0) { + setNpcEntityId(other.getNpcEntityId()); + } + if (other.getTalkId() != 0) { + setTalkId(other.getTalkId()); + } + if (other.getEntityId() != 0) { + setEntityId(other.getEntityId()); + } + 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.NpcTalkReqOuterClass.NpcTalkReq parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int npcEntityId_ ; + /** + * uint32 npc_entity_id = 1; + * @return The npcEntityId. + */ + @java.lang.Override + public int getNpcEntityId() { + return npcEntityId_; + } + /** + * uint32 npc_entity_id = 1; + * @param value The npcEntityId to set. + * @return This builder for chaining. + */ + public Builder setNpcEntityId(int value) { + + npcEntityId_ = value; + onChanged(); + return this; + } + /** + * uint32 npc_entity_id = 1; + * @return This builder for chaining. + */ + public Builder clearNpcEntityId() { + + npcEntityId_ = 0; + onChanged(); + return this; + } + + private int talkId_ ; + /** + * uint32 talk_id = 3; + * @return The talkId. + */ + @java.lang.Override + public int getTalkId() { + return talkId_; + } + /** + * uint32 talk_id = 3; + * @param value The talkId to set. + * @return This builder for chaining. + */ + public Builder setTalkId(int value) { + + talkId_ = value; + onChanged(); + return this; + } + /** + * uint32 talk_id = 3; + * @return This builder for chaining. + */ + public Builder clearTalkId() { + + talkId_ = 0; + onChanged(); + return this; + } + + private int entityId_ ; + /** + * uint32 entity_id = 4; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + /** + * uint32 entity_id = 4; + * @param value The entityId to set. + * @return This builder for chaining. + */ + public Builder setEntityId(int value) { + + entityId_ = value; + onChanged(); + return this; + } + /** + * uint32 entity_id = 4; + * @return This builder for chaining. + */ + public Builder clearEntityId() { + + entityId_ = 0; + 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:NpcTalkReq) + } + + // @@protoc_insertion_point(class_scope:NpcTalkReq) + private static final emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq(); + } + + public static emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public NpcTalkReq parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new NpcTalkReq(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.NpcTalkReqOuterClass.NpcTalkReq getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_NpcTalkReq_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_NpcTalkReq_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)Grasscutter-Protos/proto/NpcTalkReq.pr" + + "oto\"G\n\nNpcTalkReq\022\025\n\rnpc_entity_id\030\001 \001(\r" + + "\022\017\n\007talk_id\030\003 \001(\r\022\021\n\tentity_id\030\004 \001(\rB1\n\031" + + "emu.grasscutter.net.protoB\024NpcTalkReqOut" + + "erClassb\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_NpcTalkReq_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_NpcTalkReq_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_NpcTalkReq_descriptor, + new java.lang.String[] { "NpcEntityId", "TalkId", "EntityId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/net/proto/NpcTalkRspOuterClass.java b/src/main/java/emu/grasscutter/net/proto/NpcTalkRspOuterClass.java new file mode 100644 index 000000000..80daa3154 --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/NpcTalkRspOuterClass.java @@ -0,0 +1,750 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: Grasscutter-Protos/proto/NpcTalkRsp.proto + +package emu.grasscutter.net.proto; + +public final class NpcTalkRspOuterClass { + private NpcTalkRspOuterClass() {} + 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 NpcTalkRspOrBuilder extends + // @@protoc_insertion_point(interface_extends:NpcTalkRsp) + com.google.protobuf.MessageOrBuilder { + + /** + * int32 retcode = 1; + * @return The retcode. + */ + int getRetcode(); + + /** + * uint32 npc_entity_id = 2; + * @return The npcEntityId. + */ + int getNpcEntityId(); + + /** + * uint32 cur_talk_id = 4; + * @return The curTalkId. + */ + int getCurTalkId(); + + /** + * uint32 entity_id = 5; + * @return The entityId. + */ + int getEntityId(); + } + /** + * Protobuf type {@code NpcTalkRsp} + */ + public static final class NpcTalkRsp extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:NpcTalkRsp) + NpcTalkRspOrBuilder { + private static final long serialVersionUID = 0L; + // Use NpcTalkRsp.newBuilder() to construct. + private NpcTalkRsp(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private NpcTalkRsp() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new NpcTalkRsp(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private NpcTalkRsp( + 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 8: { + + retcode_ = input.readInt32(); + break; + } + case 16: { + + npcEntityId_ = input.readUInt32(); + break; + } + case 32: { + + curTalkId_ = input.readUInt32(); + break; + } + case 40: { + + entityId_ = input.readUInt32(); + break; + } + default: { + if (!parseUnknownField( + input, unknownFields, extensionRegistry, tag)) { + done = true; + } + break; + } + } + } + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (com.google.protobuf.UninitializedMessageException e) { + throw e.asInvalidProtocolBufferException().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.NpcTalkRspOuterClass.internal_static_NpcTalkRsp_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.NpcTalkRspOuterClass.internal_static_NpcTalkRsp_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.class, emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.Builder.class); + } + + public static final int RETCODE_FIELD_NUMBER = 1; + private int retcode_; + /** + * int32 retcode = 1; + * @return The retcode. + */ + @java.lang.Override + public int getRetcode() { + return retcode_; + } + + public static final int NPC_ENTITY_ID_FIELD_NUMBER = 2; + private int npcEntityId_; + /** + * uint32 npc_entity_id = 2; + * @return The npcEntityId. + */ + @java.lang.Override + public int getNpcEntityId() { + return npcEntityId_; + } + + public static final int CUR_TALK_ID_FIELD_NUMBER = 4; + private int curTalkId_; + /** + * uint32 cur_talk_id = 4; + * @return The curTalkId. + */ + @java.lang.Override + public int getCurTalkId() { + return curTalkId_; + } + + public static final int ENTITY_ID_FIELD_NUMBER = 5; + private int entityId_; + /** + * uint32 entity_id = 5; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + + 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 (retcode_ != 0) { + output.writeInt32(1, retcode_); + } + if (npcEntityId_ != 0) { + output.writeUInt32(2, npcEntityId_); + } + if (curTalkId_ != 0) { + output.writeUInt32(4, curTalkId_); + } + if (entityId_ != 0) { + output.writeUInt32(5, entityId_); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (retcode_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeInt32Size(1, retcode_); + } + if (npcEntityId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, npcEntityId_); + } + if (curTalkId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(4, curTalkId_); + } + if (entityId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(5, entityId_); + } + 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.NpcTalkRspOuterClass.NpcTalkRsp)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp other = (emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp) obj; + + if (getRetcode() + != other.getRetcode()) return false; + if (getNpcEntityId() + != other.getNpcEntityId()) return false; + if (getCurTalkId() + != other.getCurTalkId()) return false; + if (getEntityId() + != other.getEntityId()) 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) + RETCODE_FIELD_NUMBER; + hash = (53 * hash) + getRetcode(); + hash = (37 * hash) + NPC_ENTITY_ID_FIELD_NUMBER; + hash = (53 * hash) + getNpcEntityId(); + hash = (37 * hash) + CUR_TALK_ID_FIELD_NUMBER; + hash = (53 * hash) + getCurTalkId(); + hash = (37 * hash) + ENTITY_ID_FIELD_NUMBER; + hash = (53 * hash) + getEntityId(); + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp 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.NpcTalkRspOuterClass.NpcTalkRsp parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp 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.NpcTalkRspOuterClass.NpcTalkRsp parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp 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.NpcTalkRspOuterClass.NpcTalkRsp parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp 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.NpcTalkRspOuterClass.NpcTalkRsp parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp 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.NpcTalkRspOuterClass.NpcTalkRsp 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 NpcTalkRsp} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:NpcTalkRsp) + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRspOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.NpcTalkRspOuterClass.internal_static_NpcTalkRsp_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.NpcTalkRspOuterClass.internal_static_NpcTalkRsp_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.class, emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.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(); + retcode_ = 0; + + npcEntityId_ = 0; + + curTalkId_ = 0; + + entityId_ = 0; + + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.NpcTalkRspOuterClass.internal_static_NpcTalkRsp_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp getDefaultInstanceForType() { + return emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp build() { + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp buildPartial() { + emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp result = new emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp(this); + result.retcode_ = retcode_; + result.npcEntityId_ = npcEntityId_; + result.curTalkId_ = curTalkId_; + result.entityId_ = entityId_; + 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.NpcTalkRspOuterClass.NpcTalkRsp) { + return mergeFrom((emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp other) { + if (other == emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp.getDefaultInstance()) return this; + if (other.getRetcode() != 0) { + setRetcode(other.getRetcode()); + } + if (other.getNpcEntityId() != 0) { + setNpcEntityId(other.getNpcEntityId()); + } + if (other.getCurTalkId() != 0) { + setCurTalkId(other.getCurTalkId()); + } + if (other.getEntityId() != 0) { + setEntityId(other.getEntityId()); + } + 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.NpcTalkRspOuterClass.NpcTalkRsp parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int retcode_ ; + /** + * int32 retcode = 1; + * @return The retcode. + */ + @java.lang.Override + public int getRetcode() { + return retcode_; + } + /** + * int32 retcode = 1; + * @param value The retcode to set. + * @return This builder for chaining. + */ + public Builder setRetcode(int value) { + + retcode_ = value; + onChanged(); + return this; + } + /** + * int32 retcode = 1; + * @return This builder for chaining. + */ + public Builder clearRetcode() { + + retcode_ = 0; + onChanged(); + return this; + } + + private int npcEntityId_ ; + /** + * uint32 npc_entity_id = 2; + * @return The npcEntityId. + */ + @java.lang.Override + public int getNpcEntityId() { + return npcEntityId_; + } + /** + * uint32 npc_entity_id = 2; + * @param value The npcEntityId to set. + * @return This builder for chaining. + */ + public Builder setNpcEntityId(int value) { + + npcEntityId_ = value; + onChanged(); + return this; + } + /** + * uint32 npc_entity_id = 2; + * @return This builder for chaining. + */ + public Builder clearNpcEntityId() { + + npcEntityId_ = 0; + onChanged(); + return this; + } + + private int curTalkId_ ; + /** + * uint32 cur_talk_id = 4; + * @return The curTalkId. + */ + @java.lang.Override + public int getCurTalkId() { + return curTalkId_; + } + /** + * uint32 cur_talk_id = 4; + * @param value The curTalkId to set. + * @return This builder for chaining. + */ + public Builder setCurTalkId(int value) { + + curTalkId_ = value; + onChanged(); + return this; + } + /** + * uint32 cur_talk_id = 4; + * @return This builder for chaining. + */ + public Builder clearCurTalkId() { + + curTalkId_ = 0; + onChanged(); + return this; + } + + private int entityId_ ; + /** + * uint32 entity_id = 5; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + /** + * uint32 entity_id = 5; + * @param value The entityId to set. + * @return This builder for chaining. + */ + public Builder setEntityId(int value) { + + entityId_ = value; + onChanged(); + return this; + } + /** + * uint32 entity_id = 5; + * @return This builder for chaining. + */ + public Builder clearEntityId() { + + entityId_ = 0; + 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:NpcTalkRsp) + } + + // @@protoc_insertion_point(class_scope:NpcTalkRsp) + private static final emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp(); + } + + public static emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public NpcTalkRsp parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new NpcTalkRsp(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.NpcTalkRspOuterClass.NpcTalkRsp getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_NpcTalkRsp_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_NpcTalkRsp_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)Grasscutter-Protos/proto/NpcTalkRsp.pr" + + "oto\"\\\n\nNpcTalkRsp\022\017\n\007retcode\030\001 \001(\005\022\025\n\rnp" + + "c_entity_id\030\002 \001(\r\022\023\n\013cur_talk_id\030\004 \001(\r\022\021" + + "\n\tentity_id\030\005 \001(\rB1\n\031emu.grasscutter.net" + + ".protoB\024NpcTalkRspOuterClassb\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_NpcTalkRsp_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_NpcTalkRsp_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_NpcTalkRsp_descriptor, + new java.lang.String[] { "Retcode", "NpcEntityId", "CurTalkId", "EntityId", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java new file mode 100644 index 000000000..588e1c4e1 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketNpcTalkRsp; + +@Opcodes(PacketOpcodes.NpcTalkReq) +public class HandlerNpcTalkReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + NpcTalkReq req = NpcTalkReq.parseFrom(payload); + + session.send(new PacketNpcTalkRsp(req.getNpcEntityId(), req.getTalkId(), req.getEntityId())); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java new file mode 100644 index 000000000..b447a19eb --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java @@ -0,0 +1,19 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp; + +public class PacketNpcTalkRsp extends GenshinPacket { + public PacketNpcTalkRsp(int npcEntityId, int curTalkId, int entityId) { + super(PacketOpcodes.NpcTalkRsp); + + NpcTalkRsp p = NpcTalkRsp.newBuilder() + .setNpcEntityId(npcEntityId) + .setCurTalkId(curTalkId) + .setEntityId(entityId) + .build(); + + this.setData(p); + } +} From 51e1afefba7dfe27d6f67f74f018c17b2a5ae0ca Mon Sep 17 00:00:00 2001 From: Yazawazi <47273265+Yazawazi@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:16:21 +0800 Subject: [PATCH 2/8] Add /weather Command --- .../grasscutter/commands/PlayerCommands.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index 779e91ef9..656f85a20 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -16,10 +16,12 @@ import emu.grasscutter.game.entity.EntityMonster; import emu.grasscutter.game.inventory.GenshinItem; import emu.grasscutter.game.inventory.Inventory; import emu.grasscutter.game.inventory.ItemType; +import emu.grasscutter.game.props.ClimateType; import emu.grasscutter.game.props.ActionReason; import emu.grasscutter.game.props.FightProperty; import emu.grasscutter.game.props.PlayerProperty; import emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify; +import emu.grasscutter.server.packet.send.PacketSceneAreaWeatherNotify; import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; import emu.grasscutter.utils.Position; @@ -536,4 +538,29 @@ public final class PlayerCommands { } } } + + @Command(label = "weather", aliases = {"weather", "w"}, + usage = "weather ", description = "Changes the weather.", + execution = Command.Execution.PLAYER, permission = "player.weather" + ) + public static class ChangeWeatherCommand implements CommandHandler { + @Override + public void execute(GenshinPlayer player, List args) { + if (args.size() < 1) { + CommandHandler.sendMessage(player, "Usage: weather "); + return; + } + + try { + int weatherId = Integer.parseInt(args.get(0)); + + ClimateType climate = ClimateType.getTypeByValue(weatherId); + + player.getScene().setClimate(climate); + player.getScene().broadcastPacket(new PacketSceneAreaWeatherNotify(player)); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(player, "Invalid weather ID."); + } + } + } } From bde8a2114083e3ff312ca09e8bd21d2c543d3ea3 Mon Sep 17 00:00:00 2001 From: Jaida Wu Date: Wed, 20 Apr 2022 18:13:26 +0800 Subject: [PATCH 3/8] Optimize proxy scripts Signed-off-by: Jaida Wu --- proxy.py | 68 +++++++++++++++++++++++++------------------------ proxy_config.py | 2 ++ 2 files changed, 37 insertions(+), 33 deletions(-) create mode 100644 proxy_config.py diff --git a/proxy.py b/proxy.py index b352af3ac..2d2282af9 100644 --- a/proxy.py +++ b/proxy.py @@ -21,43 +21,45 @@ ## from mitmproxy import http +from proxy_config import REMOTE_HOST class MlgmXyysd_Genshin_Impact_Proxy: + LIST_DOMAINS = [ + "api-os-takumi.mihoyo.com", + "hk4e-api-os-static.mihoyo.com", + "hk4e-sdk-os.mihoyo.com", + "dispatchosglobal.yuanshen.com", + "osusadispatch.yuanshen.com", + "account.mihoyo.com", + "log-upload-os.mihoyo.com", + "dispatchcntest.yuanshen.com", + "devlog-upload.mihoyo.com", + "webstatic.mihoyo.com", + "log-upload.mihoyo.com", + "hk4e-sdk.mihoyo.com", + "api-beta-sdk.mihoyo.com", + "api-beta-sdk-os.mihoyo.com", + "cnbeta01dispatch.yuanshen.com", + "dispatchcnglobal.yuanshen.com", + "cnbeta02dispatch.yuanshen.com", + "sdk-os-static.mihoyo.com", + "webstatic-sea.mihoyo.com", + "webstatic-sea.hoyoverse.com", + "hk4e-sdk-os-static.hoyoverse.com", + "sdk-os-static.hoyoverse.com", + "api-account-os.hoyoverse.com", + "hk4e-sdk-os.hoyoverse.com", + "overseauspider.yuanshen.com", + "gameapi-account.mihoyo.com", + "minor-api.mihoyo.com", + "public-data-api.mihoyo.com", + "uspider.yuanshen.com", + "sdk-static.mihoyo.com" + ] + def request(self, flow: http.HTTPFlow) -> None: - - # This can also be replaced with another IP address. - REMOTE_HOST = "localhost" - - LIST_DOMAINS = [ - "api-os-takumi.mihoyo.com", - "hk4e-api-os-static.mihoyo.com", - "hk4e-sdk-os.mihoyo.com", - "dispatchosglobal.yuanshen.com", - "osusadispatch.yuanshen.com", - "account.mihoyo.com", - "log-upload-os.mihoyo.com", - "dispatchcntest.yuanshen.com", - "devlog-upload.mihoyo.com", - "webstatic.mihoyo.com", - "log-upload.mihoyo.com", - "hk4e-sdk.mihoyo.com", - "api-beta-sdk.mihoyo.com", - "api-beta-sdk-os.mihoyo.com", - "cnbeta01dispatch.yuanshen.com", - "dispatchcnglobal.yuanshen.com", - "cnbeta02dispatch.yuanshen.com", - "sdk-os-static.mihoyo.com", - "webstatic-sea.mihoyo.com", - "webstatic-sea.hoyoverse.com", - "hk4e-sdk-os-static.hoyoverse.com", - "sdk-os-static.hoyoverse.com", - "api-account-os.hoyoverse.com", - "hk4e-sdk-os.hoyoverse.com", - "overseauspider.yuanshen.com" - ] - - if flow.request.host in LIST_DOMAINS: + if flow.request.host in self.LIST_DOMAINS: flow.request.host = REMOTE_HOST addons = [ diff --git a/proxy_config.py b/proxy_config.py new file mode 100644 index 000000000..f048ef88c --- /dev/null +++ b/proxy_config.py @@ -0,0 +1,2 @@ +# This can also be replaced with another IP address. +REMOTE_HOST = "localhost" \ No newline at end of file From 968693b84d02f4c882ca129e07298f9a7759d466 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Wed, 20 Apr 2022 03:28:54 -0700 Subject: [PATCH 4/8] Fix account not found issue when logging in --- .../server/dispatch/DispatchServer.java | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java index dab6ba0a4..f13b9dc2f 100644 --- a/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java +++ b/src/main/java/emu/grasscutter/server/dispatch/DispatchServer.java @@ -226,18 +226,22 @@ public final class DispatchServer { Account account = DatabaseHelper.getAccountByName(requestData.account); // Check if account exists, else create a new one. - if (account == null && Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) { - // This account has been created AUTOMATICALLY. There will be no permissions added. - account = DatabaseHelper.createAccountWithId(requestData.account, 0); - - responseData.message = "OK"; - responseData.data.account.uid = account.getId(); - responseData.data.account.token = account.generateSessionKey(); - responseData.data.account.email = account.getEmail(); - } else if (!Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) { - responseData.retcode = -201; - responseData.message = "Username not found."; + if (account == null) { + // Account doesnt exist, so we can either auto create it if the config value is set + if (Grasscutter.getConfig().ServerOptions.AutomaticallyCreateAccounts) { + // This account has been created AUTOMATICALLY. There will be no permissions added. + account = DatabaseHelper.createAccountWithId(requestData.account, 0); + + responseData.message = "OK"; + responseData.data.account.uid = account.getId(); + responseData.data.account.token = account.generateSessionKey(); + responseData.data.account.email = account.getEmail(); + } else { + responseData.retcode = -201; + responseData.message = "Username not found."; + } } else { + // Account was found, log the player in responseData.message = "OK"; responseData.data.account.uid = account.getId(); responseData.data.account.token = account.generateSessionKey(); From 1e7d537965811491d910330365d4846c6d00b725 Mon Sep 17 00:00:00 2001 From: alt3ri <95161279+alt3ri@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:40:26 +0700 Subject: [PATCH 5/8] Adding /pos Some people want to get the coordinate, here you go! --- .../java/emu/grasscutter/commands/PlayerCommands.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index 4b7a2b8e1..7426284da 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -573,6 +573,17 @@ public final class PlayerCommands { } } } + + @Command(label = "pos", + usage = "Usage: pos", description = "Get coordinates.", + execution = Command.Execution.PLAYER) + public static class CordCommand implements CommandHandler { + + @Override + public void execute(GenshinPlayer player, List args) { + player.dropMessage(String.format("Coord: %.3f, %.3f, %.3f", player.getPos().getX(), player.getPos().getY(), player.getPos().getZ())); + } + } @Command(label = "restart", usage = "Usage: restart", description = "Restarts the current session", execution = Command.Execution.PLAYER, permission = "player.restart") public static class RestartCommand implements CommandHandler { From cfb13acb7d98a50d01d2f0580c2ceb221273a489 Mon Sep 17 00:00:00 2001 From: Melledy <52122272+Melledy@users.noreply.github.com> Date: Wed, 20 Apr 2022 03:42:59 -0700 Subject: [PATCH 6/8] Fix character abilities not showing for others in co-op/lasting too long --- .../emu/grasscutter/game/GenshinPlayer.java | 7 + .../proto/EvtDoSkillSuccNotifyOuterClass.java | 923 ++++++++++++++++++ .../SetEntityClientDataNotifyOuterClass.java | 743 ++++++++++++++ .../HandlerClientAbilityInitFinishNotify.java | 26 + .../HandlerSetEntityClientDataNotify.java | 11 +- .../PacketClientAbilityInitFinishNotify.java | 29 + 6 files changed, 1738 insertions(+), 1 deletion(-) create mode 100644 src/main/java/emu/grasscutter/net/proto/EvtDoSkillSuccNotifyOuterClass.java create mode 100644 src/main/java/emu/grasscutter/net/proto/SetEntityClientDataNotifyOuterClass.java create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerClientAbilityInitFinishNotify.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java diff --git a/src/main/java/emu/grasscutter/game/GenshinPlayer.java b/src/main/java/emu/grasscutter/game/GenshinPlayer.java index 70fea04f0..1d8650e54 100644 --- a/src/main/java/emu/grasscutter/game/GenshinPlayer.java +++ b/src/main/java/emu/grasscutter/game/GenshinPlayer.java @@ -38,6 +38,7 @@ import emu.grasscutter.server.packet.send.PacketAvatarAddNotify; import emu.grasscutter.server.packet.send.PacketAvatarDataNotify; import emu.grasscutter.server.packet.send.PacketAvatarGainCostumeNotify; import emu.grasscutter.server.packet.send.PacketAvatarGainFlycloakNotify; +import emu.grasscutter.server.packet.send.PacketClientAbilityInitFinishNotify; import emu.grasscutter.server.packet.send.PacketCombatInvocationsNotify; import emu.grasscutter.server.packet.send.PacketGadgetInteractRsp; import emu.grasscutter.server.packet.send.PacketItemAddHintNotify; @@ -104,6 +105,7 @@ public class GenshinPlayer { @Transient private final Int2ObjectMap coopRequests; @Transient private final InvokeHandler combatInvokeHandler; @Transient private final InvokeHandler abilityInvokeHandler; + @Transient private final InvokeHandler clientAbilityInitFinishHandler; @Deprecated @SuppressWarnings({ "rawtypes", "unchecked" }) // Morphia only! public GenshinPlayer() { @@ -126,6 +128,7 @@ public class GenshinPlayer { this.coopRequests = new Int2ObjectOpenHashMap<>(); this.combatInvokeHandler = new InvokeHandler(PacketCombatInvocationsNotify.class); this.abilityInvokeHandler = new InvokeHandler(PacketAbilityInvocationsNotify.class); + this.clientAbilityInitFinishHandler = new InvokeHandler(PacketClientAbilityInitFinishNotify.class); } // On player creation @@ -389,6 +392,10 @@ public class GenshinPlayer { return this.abilityInvokeHandler; } + public InvokeHandler getClientAbilityInitFinishHandler() { + return clientAbilityInitFinishHandler; + } + public void setMpSetting(MpSettingType mpSetting) { this.mpSetting = mpSetting; } diff --git a/src/main/java/emu/grasscutter/net/proto/EvtDoSkillSuccNotifyOuterClass.java b/src/main/java/emu/grasscutter/net/proto/EvtDoSkillSuccNotifyOuterClass.java new file mode 100644 index 000000000..61edb141d --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/EvtDoSkillSuccNotifyOuterClass.java @@ -0,0 +1,923 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: EvtDoSkillSuccNotify.proto + +package emu.grasscutter.net.proto; + +public final class EvtDoSkillSuccNotifyOuterClass { + private EvtDoSkillSuccNotifyOuterClass() {} + 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 EvtDoSkillSuccNotifyOrBuilder extends + // @@protoc_insertion_point(interface_extends:EvtDoSkillSuccNotify) + com.google.protobuf.MessageOrBuilder { + + /** + * .ForwardType forwardType = 1; + * @return The enum numeric value on the wire for forwardType. + */ + int getForwardTypeValue(); + /** + * .ForwardType forwardType = 1; + * @return The forwardType. + */ + emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType getForwardType(); + + /** + * uint32 casterId = 2; + * @return The casterId. + */ + int getCasterId(); + + /** + * uint32 skillId = 3; + * @return The skillId. + */ + int getSkillId(); + + /** + * .Vector forward = 4; + * @return Whether the forward field is set. + */ + boolean hasForward(); + /** + * .Vector forward = 4; + * @return The forward. + */ + emu.grasscutter.net.proto.VectorOuterClass.Vector getForward(); + /** + * .Vector forward = 4; + */ + emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getForwardOrBuilder(); + } + /** + * Protobuf type {@code EvtDoSkillSuccNotify} + */ + public static final class EvtDoSkillSuccNotify extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:EvtDoSkillSuccNotify) + EvtDoSkillSuccNotifyOrBuilder { + private static final long serialVersionUID = 0L; + // Use EvtDoSkillSuccNotify.newBuilder() to construct. + private EvtDoSkillSuccNotify(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private EvtDoSkillSuccNotify() { + forwardType_ = 0; + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new EvtDoSkillSuccNotify(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private EvtDoSkillSuccNotify( + 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 8: { + int rawValue = input.readEnum(); + + forwardType_ = rawValue; + break; + } + case 16: { + + casterId_ = input.readUInt32(); + break; + } + case 24: { + + skillId_ = input.readUInt32(); + break; + } + case 34: { + emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder subBuilder = null; + if (forward_ != null) { + subBuilder = forward_.toBuilder(); + } + forward_ = input.readMessage(emu.grasscutter.net.proto.VectorOuterClass.Vector.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(forward_); + forward_ = subBuilder.buildPartial(); + } + + 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.EvtDoSkillSuccNotifyOuterClass.internal_static_EvtDoSkillSuccNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.internal_static_EvtDoSkillSuccNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.class, emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.Builder.class); + } + + public static final int FORWARDTYPE_FIELD_NUMBER = 1; + private int forwardType_; + /** + * .ForwardType forwardType = 1; + * @return The enum numeric value on the wire for forwardType. + */ + @java.lang.Override public int getForwardTypeValue() { + return forwardType_; + } + /** + * .ForwardType forwardType = 1; + * @return The forwardType. + */ + @java.lang.Override public emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType getForwardType() { + @SuppressWarnings("deprecation") + emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType result = emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.valueOf(forwardType_); + return result == null ? emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.UNRECOGNIZED : result; + } + + public static final int CASTERID_FIELD_NUMBER = 2; + private int casterId_; + /** + * uint32 casterId = 2; + * @return The casterId. + */ + @java.lang.Override + public int getCasterId() { + return casterId_; + } + + public static final int SKILLID_FIELD_NUMBER = 3; + private int skillId_; + /** + * uint32 skillId = 3; + * @return The skillId. + */ + @java.lang.Override + public int getSkillId() { + return skillId_; + } + + public static final int FORWARD_FIELD_NUMBER = 4; + private emu.grasscutter.net.proto.VectorOuterClass.Vector forward_; + /** + * .Vector forward = 4; + * @return Whether the forward field is set. + */ + @java.lang.Override + public boolean hasForward() { + return forward_ != null; + } + /** + * .Vector forward = 4; + * @return The forward. + */ + @java.lang.Override + public emu.grasscutter.net.proto.VectorOuterClass.Vector getForward() { + return forward_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : forward_; + } + /** + * .Vector forward = 4; + */ + @java.lang.Override + public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getForwardOrBuilder() { + return getForward(); + } + + 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 (forwardType_ != emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.ForwardLocal.getNumber()) { + output.writeEnum(1, forwardType_); + } + if (casterId_ != 0) { + output.writeUInt32(2, casterId_); + } + if (skillId_ != 0) { + output.writeUInt32(3, skillId_); + } + if (forward_ != null) { + output.writeMessage(4, getForward()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (forwardType_ != emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.ForwardLocal.getNumber()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, forwardType_); + } + if (casterId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, casterId_); + } + if (skillId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(3, skillId_); + } + if (forward_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getForward()); + } + 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify other = (emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify) obj; + + if (forwardType_ != other.forwardType_) return false; + if (getCasterId() + != other.getCasterId()) return false; + if (getSkillId() + != other.getSkillId()) return false; + if (hasForward() != other.hasForward()) return false; + if (hasForward()) { + if (!getForward() + .equals(other.getForward())) 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) + FORWARDTYPE_FIELD_NUMBER; + hash = (53 * hash) + forwardType_; + hash = (37 * hash) + CASTERID_FIELD_NUMBER; + hash = (53 * hash) + getCasterId(); + hash = (37 * hash) + SKILLID_FIELD_NUMBER; + hash = (53 * hash) + getSkillId(); + if (hasForward()) { + hash = (37 * hash) + FORWARD_FIELD_NUMBER; + hash = (53 * hash) + getForward().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify 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 EvtDoSkillSuccNotify} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:EvtDoSkillSuccNotify) + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotifyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.internal_static_EvtDoSkillSuccNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.internal_static_EvtDoSkillSuccNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.class, emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.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(); + forwardType_ = 0; + + casterId_ = 0; + + skillId_ = 0; + + if (forwardBuilder_ == null) { + forward_ = null; + } else { + forward_ = null; + forwardBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.internal_static_EvtDoSkillSuccNotify_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify getDefaultInstanceForType() { + return emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify build() { + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify buildPartial() { + emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify result = new emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify(this); + result.forwardType_ = forwardType_; + result.casterId_ = casterId_; + result.skillId_ = skillId_; + if (forwardBuilder_ == null) { + result.forward_ = forward_; + } else { + result.forward_ = forwardBuilder_.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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify) { + return mergeFrom((emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify other) { + if (other == emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify.getDefaultInstance()) return this; + if (other.forwardType_ != 0) { + setForwardTypeValue(other.getForwardTypeValue()); + } + if (other.getCasterId() != 0) { + setCasterId(other.getCasterId()); + } + if (other.getSkillId() != 0) { + setSkillId(other.getSkillId()); + } + if (other.hasForward()) { + mergeForward(other.getForward()); + } + 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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int forwardType_ = 0; + /** + * .ForwardType forwardType = 1; + * @return The enum numeric value on the wire for forwardType. + */ + @java.lang.Override public int getForwardTypeValue() { + return forwardType_; + } + /** + * .ForwardType forwardType = 1; + * @param value The enum numeric value on the wire for forwardType to set. + * @return This builder for chaining. + */ + public Builder setForwardTypeValue(int value) { + + forwardType_ = value; + onChanged(); + return this; + } + /** + * .ForwardType forwardType = 1; + * @return The forwardType. + */ + @java.lang.Override + public emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType getForwardType() { + @SuppressWarnings("deprecation") + emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType result = emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.valueOf(forwardType_); + return result == null ? emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType.UNRECOGNIZED : result; + } + /** + * .ForwardType forwardType = 1; + * @param value The forwardType to set. + * @return This builder for chaining. + */ + public Builder setForwardType(emu.grasscutter.net.proto.ForwardTypeOuterClass.ForwardType value) { + if (value == null) { + throw new NullPointerException(); + } + + forwardType_ = value.getNumber(); + onChanged(); + return this; + } + /** + * .ForwardType forwardType = 1; + * @return This builder for chaining. + */ + public Builder clearForwardType() { + + forwardType_ = 0; + onChanged(); + return this; + } + + private int casterId_ ; + /** + * uint32 casterId = 2; + * @return The casterId. + */ + @java.lang.Override + public int getCasterId() { + return casterId_; + } + /** + * uint32 casterId = 2; + * @param value The casterId to set. + * @return This builder for chaining. + */ + public Builder setCasterId(int value) { + + casterId_ = value; + onChanged(); + return this; + } + /** + * uint32 casterId = 2; + * @return This builder for chaining. + */ + public Builder clearCasterId() { + + casterId_ = 0; + onChanged(); + return this; + } + + private int skillId_ ; + /** + * uint32 skillId = 3; + * @return The skillId. + */ + @java.lang.Override + public int getSkillId() { + return skillId_; + } + /** + * uint32 skillId = 3; + * @param value The skillId to set. + * @return This builder for chaining. + */ + public Builder setSkillId(int value) { + + skillId_ = value; + onChanged(); + return this; + } + /** + * uint32 skillId = 3; + * @return This builder for chaining. + */ + public Builder clearSkillId() { + + skillId_ = 0; + onChanged(); + return this; + } + + private emu.grasscutter.net.proto.VectorOuterClass.Vector forward_; + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> forwardBuilder_; + /** + * .Vector forward = 4; + * @return Whether the forward field is set. + */ + public boolean hasForward() { + return forwardBuilder_ != null || forward_ != null; + } + /** + * .Vector forward = 4; + * @return The forward. + */ + public emu.grasscutter.net.proto.VectorOuterClass.Vector getForward() { + if (forwardBuilder_ == null) { + return forward_ == null ? emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : forward_; + } else { + return forwardBuilder_.getMessage(); + } + } + /** + * .Vector forward = 4; + */ + public Builder setForward(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { + if (forwardBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + forward_ = value; + onChanged(); + } else { + forwardBuilder_.setMessage(value); + } + + return this; + } + /** + * .Vector forward = 4; + */ + public Builder setForward( + emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder builderForValue) { + if (forwardBuilder_ == null) { + forward_ = builderForValue.build(); + onChanged(); + } else { + forwardBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .Vector forward = 4; + */ + public Builder mergeForward(emu.grasscutter.net.proto.VectorOuterClass.Vector value) { + if (forwardBuilder_ == null) { + if (forward_ != null) { + forward_ = + emu.grasscutter.net.proto.VectorOuterClass.Vector.newBuilder(forward_).mergeFrom(value).buildPartial(); + } else { + forward_ = value; + } + onChanged(); + } else { + forwardBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .Vector forward = 4; + */ + public Builder clearForward() { + if (forwardBuilder_ == null) { + forward_ = null; + onChanged(); + } else { + forward_ = null; + forwardBuilder_ = null; + } + + return this; + } + /** + * .Vector forward = 4; + */ + public emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder getForwardBuilder() { + + onChanged(); + return getForwardFieldBuilder().getBuilder(); + } + /** + * .Vector forward = 4; + */ + public emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder getForwardOrBuilder() { + if (forwardBuilder_ != null) { + return forwardBuilder_.getMessageOrBuilder(); + } else { + return forward_ == null ? + emu.grasscutter.net.proto.VectorOuterClass.Vector.getDefaultInstance() : forward_; + } + } + /** + * .Vector forward = 4; + */ + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder> + getForwardFieldBuilder() { + if (forwardBuilder_ == null) { + forwardBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.VectorOuterClass.Vector, emu.grasscutter.net.proto.VectorOuterClass.Vector.Builder, emu.grasscutter.net.proto.VectorOuterClass.VectorOrBuilder>( + getForward(), + getParentForChildren(), + isClean()); + forward_ = null; + } + return forwardBuilder_; + } + @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:EvtDoSkillSuccNotify) + } + + // @@protoc_insertion_point(class_scope:EvtDoSkillSuccNotify) + private static final emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify(); + } + + public static emu.grasscutter.net.proto.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public EvtDoSkillSuccNotify parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new EvtDoSkillSuccNotify(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.EvtDoSkillSuccNotifyOuterClass.EvtDoSkillSuccNotify getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_EvtDoSkillSuccNotify_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_EvtDoSkillSuccNotify_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\032EvtDoSkillSuccNotify.proto\032\021ForwardTyp" + + "e.proto\032\014Vector.proto\"v\n\024EvtDoSkillSuccN" + + "otify\022!\n\013forwardType\030\001 \001(\0162\014.ForwardType" + + "\022\020\n\010casterId\030\002 \001(\r\022\017\n\007skillId\030\003 \001(\r\022\030\n\007f" + + "orward\030\004 \001(\0132\007.VectorB\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.ForwardTypeOuterClass.getDescriptor(), + emu.grasscutter.net.proto.VectorOuterClass.getDescriptor(), + }); + internal_static_EvtDoSkillSuccNotify_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_EvtDoSkillSuccNotify_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_EvtDoSkillSuccNotify_descriptor, + new java.lang.String[] { "ForwardType", "CasterId", "SkillId", "Forward", }); + emu.grasscutter.net.proto.ForwardTypeOuterClass.getDescriptor(); + emu.grasscutter.net.proto.VectorOuterClass.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/net/proto/SetEntityClientDataNotifyOuterClass.java b/src/main/java/emu/grasscutter/net/proto/SetEntityClientDataNotifyOuterClass.java new file mode 100644 index 000000000..5541ca15b --- /dev/null +++ b/src/main/java/emu/grasscutter/net/proto/SetEntityClientDataNotifyOuterClass.java @@ -0,0 +1,743 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: SetEntityClientDataNotify.proto + +package emu.grasscutter.net.proto; + +public final class SetEntityClientDataNotifyOuterClass { + private SetEntityClientDataNotifyOuterClass() {} + 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 SetEntityClientDataNotifyOrBuilder extends + // @@protoc_insertion_point(interface_extends:SetEntityClientDataNotify) + com.google.protobuf.MessageOrBuilder { + + /** + * uint32 entityId = 1; + * @return The entityId. + */ + int getEntityId(); + + /** + * .EntityClientData entityClientData = 2; + * @return Whether the entityClientData field is set. + */ + boolean hasEntityClientData(); + /** + * .EntityClientData entityClientData = 2; + * @return The entityClientData. + */ + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData getEntityClientData(); + /** + * .EntityClientData entityClientData = 2; + */ + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder getEntityClientDataOrBuilder(); + } + /** + * Protobuf type {@code SetEntityClientDataNotify} + */ + public static final class SetEntityClientDataNotify extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:SetEntityClientDataNotify) + SetEntityClientDataNotifyOrBuilder { + private static final long serialVersionUID = 0L; + // Use SetEntityClientDataNotify.newBuilder() to construct. + private SetEntityClientDataNotify(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private SetEntityClientDataNotify() { + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new SetEntityClientDataNotify(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private SetEntityClientDataNotify( + 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 8: { + + entityId_ = input.readUInt32(); + break; + } + case 18: { + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder subBuilder = null; + if (entityClientData_ != null) { + subBuilder = entityClientData_.toBuilder(); + } + entityClientData_ = input.readMessage(emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.parser(), extensionRegistry); + if (subBuilder != null) { + subBuilder.mergeFrom(entityClientData_); + entityClientData_ = subBuilder.buildPartial(); + } + + 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.SetEntityClientDataNotifyOuterClass.internal_static_SetEntityClientDataNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.internal_static_SetEntityClientDataNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.class, emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.Builder.class); + } + + public static final int ENTITYID_FIELD_NUMBER = 1; + private int entityId_; + /** + * uint32 entityId = 1; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + + public static final int ENTITYCLIENTDATA_FIELD_NUMBER = 2; + private emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData entityClientData_; + /** + * .EntityClientData entityClientData = 2; + * @return Whether the entityClientData field is set. + */ + @java.lang.Override + public boolean hasEntityClientData() { + return entityClientData_ != null; + } + /** + * .EntityClientData entityClientData = 2; + * @return The entityClientData. + */ + @java.lang.Override + public emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData getEntityClientData() { + return entityClientData_ == null ? emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.getDefaultInstance() : entityClientData_; + } + /** + * .EntityClientData entityClientData = 2; + */ + @java.lang.Override + public emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder getEntityClientDataOrBuilder() { + return getEntityClientData(); + } + + 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 (entityId_ != 0) { + output.writeUInt32(1, entityId_); + } + if (entityClientData_ != null) { + output.writeMessage(2, getEntityClientData()); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + if (entityId_ != 0) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(1, entityId_); + } + if (entityClientData_ != null) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, getEntityClientData()); + } + 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify)) { + return super.equals(obj); + } + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify other = (emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify) obj; + + if (getEntityId() + != other.getEntityId()) return false; + if (hasEntityClientData() != other.hasEntityClientData()) return false; + if (hasEntityClientData()) { + if (!getEntityClientData() + .equals(other.getEntityClientData())) 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) + ENTITYID_FIELD_NUMBER; + hash = (53 * hash) + getEntityId(); + if (hasEntityClientData()) { + hash = (37 * hash) + ENTITYCLIENTDATA_FIELD_NUMBER; + hash = (53 * hash) + getEntityClientData().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify 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 SetEntityClientDataNotify} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:SetEntityClientDataNotify) + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotifyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.internal_static_SetEntityClientDataNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.internal_static_SetEntityClientDataNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.class, emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.Builder.class); + } + + // Construct using emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.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(); + entityId_ = 0; + + if (entityClientDataBuilder_ == null) { + entityClientData_ = null; + } else { + entityClientData_ = null; + entityClientDataBuilder_ = null; + } + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.internal_static_SetEntityClientDataNotify_descriptor; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify getDefaultInstanceForType() { + return emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.getDefaultInstance(); + } + + @java.lang.Override + public emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify build() { + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify buildPartial() { + emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify result = new emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify(this); + result.entityId_ = entityId_; + if (entityClientDataBuilder_ == null) { + result.entityClientData_ = entityClientData_; + } else { + result.entityClientData_ = entityClientDataBuilder_.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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify) { + return mergeFrom((emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify other) { + if (other == emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify.getDefaultInstance()) return this; + if (other.getEntityId() != 0) { + setEntityId(other.getEntityId()); + } + if (other.hasEntityClientData()) { + mergeEntityClientData(other.getEntityClientData()); + } + 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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + + private int entityId_ ; + /** + * uint32 entityId = 1; + * @return The entityId. + */ + @java.lang.Override + public int getEntityId() { + return entityId_; + } + /** + * uint32 entityId = 1; + * @param value The entityId to set. + * @return This builder for chaining. + */ + public Builder setEntityId(int value) { + + entityId_ = value; + onChanged(); + return this; + } + /** + * uint32 entityId = 1; + * @return This builder for chaining. + */ + public Builder clearEntityId() { + + entityId_ = 0; + onChanged(); + return this; + } + + private emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData entityClientData_; + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder> entityClientDataBuilder_; + /** + * .EntityClientData entityClientData = 2; + * @return Whether the entityClientData field is set. + */ + public boolean hasEntityClientData() { + return entityClientDataBuilder_ != null || entityClientData_ != null; + } + /** + * .EntityClientData entityClientData = 2; + * @return The entityClientData. + */ + public emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData getEntityClientData() { + if (entityClientDataBuilder_ == null) { + return entityClientData_ == null ? emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.getDefaultInstance() : entityClientData_; + } else { + return entityClientDataBuilder_.getMessage(); + } + } + /** + * .EntityClientData entityClientData = 2; + */ + public Builder setEntityClientData(emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData value) { + if (entityClientDataBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + entityClientData_ = value; + onChanged(); + } else { + entityClientDataBuilder_.setMessage(value); + } + + return this; + } + /** + * .EntityClientData entityClientData = 2; + */ + public Builder setEntityClientData( + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder builderForValue) { + if (entityClientDataBuilder_ == null) { + entityClientData_ = builderForValue.build(); + onChanged(); + } else { + entityClientDataBuilder_.setMessage(builderForValue.build()); + } + + return this; + } + /** + * .EntityClientData entityClientData = 2; + */ + public Builder mergeEntityClientData(emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData value) { + if (entityClientDataBuilder_ == null) { + if (entityClientData_ != null) { + entityClientData_ = + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.newBuilder(entityClientData_).mergeFrom(value).buildPartial(); + } else { + entityClientData_ = value; + } + onChanged(); + } else { + entityClientDataBuilder_.mergeFrom(value); + } + + return this; + } + /** + * .EntityClientData entityClientData = 2; + */ + public Builder clearEntityClientData() { + if (entityClientDataBuilder_ == null) { + entityClientData_ = null; + onChanged(); + } else { + entityClientData_ = null; + entityClientDataBuilder_ = null; + } + + return this; + } + /** + * .EntityClientData entityClientData = 2; + */ + public emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder getEntityClientDataBuilder() { + + onChanged(); + return getEntityClientDataFieldBuilder().getBuilder(); + } + /** + * .EntityClientData entityClientData = 2; + */ + public emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder getEntityClientDataOrBuilder() { + if (entityClientDataBuilder_ != null) { + return entityClientDataBuilder_.getMessageOrBuilder(); + } else { + return entityClientData_ == null ? + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.getDefaultInstance() : entityClientData_; + } + } + /** + * .EntityClientData entityClientData = 2; + */ + private com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder> + getEntityClientDataFieldBuilder() { + if (entityClientDataBuilder_ == null) { + entityClientDataBuilder_ = new com.google.protobuf.SingleFieldBuilderV3< + emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientData.Builder, emu.grasscutter.net.proto.EntityClientDataOuterClass.EntityClientDataOrBuilder>( + getEntityClientData(), + getParentForChildren(), + isClean()); + entityClientData_ = null; + } + return entityClientDataBuilder_; + } + @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:SetEntityClientDataNotify) + } + + // @@protoc_insertion_point(class_scope:SetEntityClientDataNotify) + private static final emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify(); + } + + public static emu.grasscutter.net.proto.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public SetEntityClientDataNotify parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new SetEntityClientDataNotify(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.SetEntityClientDataNotifyOuterClass.SetEntityClientDataNotify getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_SetEntityClientDataNotify_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_SetEntityClientDataNotify_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\037SetEntityClientDataNotify.proto\032\026Entit" + + "yClientData.proto\"Z\n\031SetEntityClientData" + + "Notify\022\020\n\010entityId\030\001 \001(\r\022+\n\020entityClient" + + "Data\030\002 \001(\0132\021.EntityClientDataB\033\n\031emu.gra" + + "sscutter.net.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + emu.grasscutter.net.proto.EntityClientDataOuterClass.getDescriptor(), + }); + internal_static_SetEntityClientDataNotify_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_SetEntityClientDataNotify_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_SetEntityClientDataNotify_descriptor, + new java.lang.String[] { "EntityId", "EntityClientData", }); + emu.grasscutter.net.proto.EntityClientDataOuterClass.getDescriptor(); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientAbilityInitFinishNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientAbilityInitFinishNotify.java new file mode 100644 index 000000000..cfe697b91 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerClientAbilityInitFinishNotify.java @@ -0,0 +1,26 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; +import emu.grasscutter.net.proto.ClientAbilityInitFinishNotifyOuterClass.ClientAbilityInitFinishNotify; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.server.game.GameSession; + +@Opcodes(PacketOpcodes.ClientAbilityInitFinishNotify) +public class HandlerClientAbilityInitFinishNotify extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + ClientAbilityInitFinishNotify notif = ClientAbilityInitFinishNotify.parseFrom(payload); + + for (AbilityInvokeEntry entry : notif.getInvokesList()) { + session.getPlayer().getClientAbilityInitFinishHandler().addEntry(entry.getForwardType(), entry); + } + + if (notif.getInvokesList().size() > 0) { + session.getPlayer().getClientAbilityInitFinishHandler().update(session.getPlayer()); + } + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java index accbd253d..1a60f677b 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetEntityClientDataNotify.java @@ -1,5 +1,6 @@ package emu.grasscutter.server.packet.recv; +import emu.grasscutter.net.packet.GenshinPacket; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.packet.PacketHandler; @@ -10,7 +11,15 @@ public class HandlerSetEntityClientDataNotify extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - // Auto template + // Skip if there is no one to broadcast it too + if (session.getPlayer().getScene().getPlayerCount() <= 1) { + return; + } + + GenshinPacket packet = new GenshinPacket(PacketOpcodes.SetEntityClientDataNotify, true); + packet.setData(payload); + + session.getPlayer().getScene().broadcastPacketToOthers(session.getPlayer(), packet); } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java new file mode 100644 index 000000000..dc676c4d1 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketClientAbilityInitFinishNotify.java @@ -0,0 +1,29 @@ +package emu.grasscutter.server.packet.send; + +import java.util.List; + +import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AbilityInvokeEntryOuterClass.AbilityInvokeEntry; +import emu.grasscutter.net.proto.ClientAbilityInitFinishNotifyOuterClass.ClientAbilityInitFinishNotify; + +public class PacketClientAbilityInitFinishNotify extends GenshinPacket { + + public PacketClientAbilityInitFinishNotify(List entries) { + super(PacketOpcodes.ClientAbilityInitFinishNotify, true); + + int entityId = 0; + + if (entries.size() > 0) { + AbilityInvokeEntry entry = entries.get(0); + entityId = entry.getEntityId(); + } + + ClientAbilityInitFinishNotify proto = ClientAbilityInitFinishNotify.newBuilder() + .setEntityId(entityId) + .addAllInvokes(entries) + .build(); + + this.setData(proto); + } +} From a507172d8124e9db18d80c6f96db939084b2cb9a Mon Sep 17 00:00:00 2001 From: alt3ri <95161279+alt3ri@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:24:32 +0700 Subject: [PATCH 7/8] Replace SetHealth -> SetStats Now you can set basic stats of your current character, but I left a little notice: Input and In-game output (character stats) are not really accurate. So to get an accurate stat: For HP, ATK , DEF, Elemental Mastery (EM): input less than 10 digits. Example: /stats atk 81923 (81293 ATK) For Energy Recharge (ER), Crit Rate, Crit DMG: input less than 6 digits(0-99999) to get the game current format. Example: /stats cdmg 14236 (142.4% Crit DMG) (!) The modified stats will be set to default after you logged out. Press F to pay respect to SetHealth (2022 - 2022) --- .../grasscutter/commands/PlayerCommands.java | 125 ++++++++++++++---- 1 file changed, 102 insertions(+), 23 deletions(-) diff --git a/src/main/java/emu/grasscutter/commands/PlayerCommands.java b/src/main/java/emu/grasscutter/commands/PlayerCommands.java index 7426284da..ec56bda7a 100644 --- a/src/main/java/emu/grasscutter/commands/PlayerCommands.java +++ b/src/main/java/emu/grasscutter/commands/PlayerCommands.java @@ -455,32 +455,111 @@ public final class PlayerCommands { } } - @Command(label = "sethealth", aliases = {"sethp"}, - usage = "sethealth ", execution = Command.Execution.PLAYER, description = "Sets your health to the specified value", - permission = "player.sethealth") - public static class SetHealthCommand implements CommandHandler { - - @Override +@Command(label = "setstats", aliases = {"stats"}, + usage = "Usage: setstats|stats ", execution = Command.Execution.PLAYER) + public static class SetStatsCommand implements CommandHandler { + @Override public void execute(GenshinPlayer player, List args) { - if (args.size() < 1) { - CommandHandler.sendMessage(null, "Usage: sethealth "); - return; - } - - try { - int health = Integer.parseInt(args.get(0)); - EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); - if (entity == null) + String stat = args.get(0); + switch(stat){ + default: + CommandHandler.sendMessage(player, "Usage: setstats|stats "); return; - - entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, health); - entity.getWorld().broadcastPacket( - new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); - player.dropMessage("Health set to " + health + "."); - } catch (NumberFormatException ignored) { - CommandHandler.sendMessage(null, "Invalid health value."); + case "hp": + try { + int health = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_HP, health); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_HP)); + player.dropMessage("HP set to " + health + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid HP value."); + return; + } + break; + case "def": + try { + int def = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_DEFENSE, def); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_DEFENSE)); + player.dropMessage("DEF set to " + def + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid DEF value."); + return; + } + break; + case "atk": + try { + int atk = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + entity.setFightProperty(FightProperty.FIGHT_PROP_CUR_ATTACK, atk); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CUR_ATTACK)); + player.dropMessage("ATK set to " + atk + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid ATK value."); + return; + } + break; + case "em": + try { + int em = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + entity.setFightProperty(FightProperty.FIGHT_PROP_ELEMENT_MASTERY, em); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_ELEMENT_MASTERY)); + player.dropMessage("Elemental Mastery set to " + em + "."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid EM value."); + return; + } + break; + case "er": + try { + float er = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + float erecharge = er / 10000; + entity.setFightProperty(FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY, erecharge); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CHARGE_EFFICIENCY)); + float iger = erecharge * 100; + player.dropMessage("Energy recharge set to " + iger + "%."); + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid ER value."); + return; + } + break; + case "crate": + try { + float cr = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + float crate = cr / 10000; + entity.setFightProperty(FightProperty.FIGHT_PROP_CRITICAL, crate); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CRITICAL)); + float igcrate = crate * 100; + player.dropMessage("Crit Rate set to " + igcrate + "%."); + + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid Crit Rate value."); + return; + } + break; + case "cdmg": + try { + float cdmg = Integer.parseInt(args.get(1)); + EntityAvatar entity = player.getTeamManager().getCurrentAvatarEntity(); + float cdamage = cdmg / 10000; + entity.setFightProperty(FightProperty.FIGHT_PROP_CRITICAL_HURT, cdamage); + entity.getWorld().broadcastPacket(new PacketEntityFightPropUpdateNotify(entity, FightProperty.FIGHT_PROP_CRITICAL_HURT)); + float igcdmg = cdamage * 100; + player.dropMessage("Crit DMG set to " + igcdmg + "%"); + + } catch (NumberFormatException ignored) { + CommandHandler.sendMessage(null, "Invalid Crit DMG value."); + return; + } + break; + } - } + } } @Command(label = "setworldlevel", aliases = {"setworldlvl"}, usage = "setworldlevel ", From 11ca0cd7359c545495074a504d567afbeaf41867 Mon Sep 17 00:00:00 2001 From: iTruth Date: Wed, 20 Apr 2022 21:14:18 +0800 Subject: [PATCH 8/8] Fix playerOpt is always throw an exception when it's null --- src/main/java/emu/grasscutter/server/game/GameServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/emu/grasscutter/server/game/GameServer.java b/src/main/java/emu/grasscutter/server/game/GameServer.java index b42ced55c..b99063cb6 100644 --- a/src/main/java/emu/grasscutter/server/game/GameServer.java +++ b/src/main/java/emu/grasscutter/server/game/GameServer.java @@ -145,7 +145,7 @@ public final class GameServer extends MihoyoKcpServer { public Account getAccountByName(String username) { Optional playerOpt = getPlayers().values().stream().filter(player -> player.getAccount().getUsername().equals(username)).findFirst(); - if (playerOpt.get() != null) { + if (playerOpt.isPresent()) { return playerOpt.get().getAccount(); } return DatabaseHelper.getAccountByName(username);