diff --git a/src/generated/main/java/org/sorapointa/proto/AvatarDelNotifyOuterClass.java b/src/generated/main/java/org/sorapointa/proto/AvatarDelNotifyOuterClass.java new file mode 100644 index 00000000..ed8b1cc7 --- /dev/null +++ b/src/generated/main/java/org/sorapointa/proto/AvatarDelNotifyOuterClass.java @@ -0,0 +1,677 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: AvatarDelNotify.proto + +package org.sorapointa.proto; + +public final class AvatarDelNotifyOuterClass { + private AvatarDelNotifyOuterClass() {} + 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 AvatarDelNotifyOrBuilder extends + // @@protoc_insertion_point(interface_extends:AvatarDelNotify) + com.google.protobuf.MessageOrBuilder { + + /** + * repeated uint64 avatar_guid_list = 13; + * @return A list containing the avatarGuidList. + */ + java.util.List getAvatarGuidListList(); + /** + * repeated uint64 avatar_guid_list = 13; + * @return The count of avatarGuidList. + */ + int getAvatarGuidListCount(); + /** + * repeated uint64 avatar_guid_list = 13; + * @param index The index of the element to return. + * @return The avatarGuidList at the given index. + */ + long getAvatarGuidList(int index); + } + /** + *
+   * CmdId: 1773
+   * EnetChannelId: 0
+   * EnetIsReliable: true
+   * 
+ * + * Protobuf type {@code AvatarDelNotify} + */ + public static final class AvatarDelNotify extends + com.google.protobuf.GeneratedMessageV3 implements + // @@protoc_insertion_point(message_implements:AvatarDelNotify) + AvatarDelNotifyOrBuilder { + private static final long serialVersionUID = 0L; + // Use AvatarDelNotify.newBuilder() to construct. + private AvatarDelNotify(com.google.protobuf.GeneratedMessageV3.Builder builder) { + super(builder); + } + private AvatarDelNotify() { + avatarGuidList_ = emptyLongList(); + } + + @java.lang.Override + @SuppressWarnings({"unused"}) + protected java.lang.Object newInstance( + UnusedPrivateParameter unused) { + return new AvatarDelNotify(); + } + + @java.lang.Override + public final com.google.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AvatarDelNotify( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + this(); + if (extensionRegistry == null) { + throw new java.lang.NullPointerException(); + } + int mutable_bitField0_ = 0; + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + case 104: { + if (!((mutable_bitField0_ & 0x00000001) != 0)) { + avatarGuidList_ = newLongList(); + mutable_bitField0_ |= 0x00000001; + } + avatarGuidList_.addLong(input.readUInt64()); + break; + } + case 106: { + int length = input.readRawVarint32(); + int limit = input.pushLimit(length); + if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) { + avatarGuidList_ = newLongList(); + mutable_bitField0_ |= 0x00000001; + } + while (input.getBytesUntilLimit() > 0) { + avatarGuidList_.addLong(input.readUInt64()); + } + input.popLimit(limit); + 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 { + if (((mutable_bitField0_ & 0x00000001) != 0)) { + avatarGuidList_.makeImmutable(); // C + } + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.internal_static_AvatarDelNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.internal_static_AvatarDelNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.class, org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.Builder.class); + } + + public static final int AVATAR_GUID_LIST_FIELD_NUMBER = 13; + private com.google.protobuf.Internal.LongList avatarGuidList_; + /** + * repeated uint64 avatar_guid_list = 13; + * @return A list containing the avatarGuidList. + */ + @java.lang.Override + public java.util.List + getAvatarGuidListList() { + return avatarGuidList_; + } + /** + * repeated uint64 avatar_guid_list = 13; + * @return The count of avatarGuidList. + */ + public int getAvatarGuidListCount() { + return avatarGuidList_.size(); + } + /** + * repeated uint64 avatar_guid_list = 13; + * @param index The index of the element to return. + * @return The avatarGuidList at the given index. + */ + public long getAvatarGuidList(int index) { + return avatarGuidList_.getLong(index); + } + private int avatarGuidListMemoizedSerializedSize = -1; + + 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 { + getSerializedSize(); + if (getAvatarGuidListList().size() > 0) { + output.writeUInt32NoTag(106); + output.writeUInt32NoTag(avatarGuidListMemoizedSerializedSize); + } + for (int i = 0; i < avatarGuidList_.size(); i++) { + output.writeUInt64NoTag(avatarGuidList_.getLong(i)); + } + unknownFields.writeTo(output); + } + + @java.lang.Override + public int getSerializedSize() { + int size = memoizedSize; + if (size != -1) return size; + + size = 0; + { + int dataSize = 0; + for (int i = 0; i < avatarGuidList_.size(); i++) { + dataSize += com.google.protobuf.CodedOutputStream + .computeUInt64SizeNoTag(avatarGuidList_.getLong(i)); + } + size += dataSize; + if (!getAvatarGuidListList().isEmpty()) { + size += 1; + size += com.google.protobuf.CodedOutputStream + .computeInt32SizeNoTag(dataSize); + } + avatarGuidListMemoizedSerializedSize = dataSize; + } + 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 org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify)) { + return super.equals(obj); + } + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify other = (org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify) obj; + + if (!getAvatarGuidListList() + .equals(other.getAvatarGuidListList())) return false; + if (!unknownFields.equals(other.unknownFields)) return false; + return true; + } + + @java.lang.Override + public int hashCode() { + if (memoizedHashCode != 0) { + return memoizedHashCode; + } + int hash = 41; + hash = (19 * hash) + getDescriptor().hashCode(); + if (getAvatarGuidListCount() > 0) { + hash = (37 * hash) + AVATAR_GUID_LIST_FIELD_NUMBER; + hash = (53 * hash) + getAvatarGuidListList().hashCode(); + } + hash = (29 * hash) + unknownFields.hashCode(); + memoizedHashCode = hash; + return hash; + } + + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + java.nio.ByteBuffer data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + java.nio.ByteBuffer data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return PARSER.parseFrom(data, extensionRegistry); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify 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 org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseDelimitedWithIOException(PARSER, input); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify 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 org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return com.google.protobuf.GeneratedMessageV3 + .parseWithIOException(PARSER, input); + } + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify 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(org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify 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; + } + /** + *
+     * CmdId: 1773
+     * EnetChannelId: 0
+     * EnetIsReliable: true
+     * 
+ * + * Protobuf type {@code AvatarDelNotify} + */ + public static final class Builder extends + com.google.protobuf.GeneratedMessageV3.Builder implements + // @@protoc_insertion_point(builder_implements:AvatarDelNotify) + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotifyOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.internal_static_AvatarDelNotify_descriptor; + } + + @java.lang.Override + protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internalGetFieldAccessorTable() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.internal_static_AvatarDelNotify_fieldAccessorTable + .ensureFieldAccessorsInitialized( + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.class, org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.Builder.class); + } + + // Construct using org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.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(); + avatarGuidList_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + + @java.lang.Override + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.internal_static_AvatarDelNotify_descriptor; + } + + @java.lang.Override + public org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify getDefaultInstanceForType() { + return org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.getDefaultInstance(); + } + + @java.lang.Override + public org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify build() { + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + @java.lang.Override + public org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify buildPartial() { + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify result = new org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify(this); + int from_bitField0_ = bitField0_; + if (((bitField0_ & 0x00000001) != 0)) { + avatarGuidList_.makeImmutable(); + bitField0_ = (bitField0_ & ~0x00000001); + } + result.avatarGuidList_ = avatarGuidList_; + 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 org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify) { + return mergeFrom((org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify other) { + if (other == org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify.getDefaultInstance()) return this; + if (!other.avatarGuidList_.isEmpty()) { + if (avatarGuidList_.isEmpty()) { + avatarGuidList_ = other.avatarGuidList_; + bitField0_ = (bitField0_ & ~0x00000001); + } else { + ensureAvatarGuidListIsMutable(); + avatarGuidList_.addAll(other.avatarGuidList_); + } + onChanged(); + } + 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 { + org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify parsedMessage = null; + try { + parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); + } catch (com.google.protobuf.InvalidProtocolBufferException e) { + parsedMessage = (org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify) e.getUnfinishedMessage(); + throw e.unwrapIOException(); + } finally { + if (parsedMessage != null) { + mergeFrom(parsedMessage); + } + } + return this; + } + private int bitField0_; + + private com.google.protobuf.Internal.LongList avatarGuidList_ = emptyLongList(); + private void ensureAvatarGuidListIsMutable() { + if (!((bitField0_ & 0x00000001) != 0)) { + avatarGuidList_ = mutableCopy(avatarGuidList_); + bitField0_ |= 0x00000001; + } + } + /** + * repeated uint64 avatar_guid_list = 13; + * @return A list containing the avatarGuidList. + */ + public java.util.List + getAvatarGuidListList() { + return ((bitField0_ & 0x00000001) != 0) ? + java.util.Collections.unmodifiableList(avatarGuidList_) : avatarGuidList_; + } + /** + * repeated uint64 avatar_guid_list = 13; + * @return The count of avatarGuidList. + */ + public int getAvatarGuidListCount() { + return avatarGuidList_.size(); + } + /** + * repeated uint64 avatar_guid_list = 13; + * @param index The index of the element to return. + * @return The avatarGuidList at the given index. + */ + public long getAvatarGuidList(int index) { + return avatarGuidList_.getLong(index); + } + /** + * repeated uint64 avatar_guid_list = 13; + * @param index The index to set the value at. + * @param value The avatarGuidList to set. + * @return This builder for chaining. + */ + public Builder setAvatarGuidList( + int index, long value) { + ensureAvatarGuidListIsMutable(); + avatarGuidList_.setLong(index, value); + onChanged(); + return this; + } + /** + * repeated uint64 avatar_guid_list = 13; + * @param value The avatarGuidList to add. + * @return This builder for chaining. + */ + public Builder addAvatarGuidList(long value) { + ensureAvatarGuidListIsMutable(); + avatarGuidList_.addLong(value); + onChanged(); + return this; + } + /** + * repeated uint64 avatar_guid_list = 13; + * @param values The avatarGuidList to add. + * @return This builder for chaining. + */ + public Builder addAllAvatarGuidList( + java.lang.Iterable values) { + ensureAvatarGuidListIsMutable(); + com.google.protobuf.AbstractMessageLite.Builder.addAll( + values, avatarGuidList_); + onChanged(); + return this; + } + /** + * repeated uint64 avatar_guid_list = 13; + * @return This builder for chaining. + */ + public Builder clearAvatarGuidList() { + avatarGuidList_ = emptyLongList(); + bitField0_ = (bitField0_ & ~0x00000001); + 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:AvatarDelNotify) + } + + // @@protoc_insertion_point(class_scope:AvatarDelNotify) + private static final org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify DEFAULT_INSTANCE; + static { + DEFAULT_INSTANCE = new org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify(); + } + + public static org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final com.google.protobuf.Parser + PARSER = new com.google.protobuf.AbstractParser() { + @java.lang.Override + public AvatarDelNotify parsePartialFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return new AvatarDelNotify(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 org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify getDefaultInstanceForType() { + return DEFAULT_INSTANCE; + } + + } + + private static final com.google.protobuf.Descriptors.Descriptor + internal_static_AvatarDelNotify_descriptor; + private static final + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable + internal_static_AvatarDelNotify_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\025AvatarDelNotify.proto\"+\n\017AvatarDelNoti" + + "fy\022\030\n\020avatar_guid_list\030\r \003(\004B\026\n\024org.sora" + + "pointa.protob\006proto3" + }; + descriptor = com.google.protobuf.Descriptors.FileDescriptor + .internalBuildGeneratedFileFrom(descriptorData, + new com.google.protobuf.Descriptors.FileDescriptor[] { + }); + internal_static_AvatarDelNotify_descriptor = + getDescriptor().getMessageTypes().get(0); + internal_static_AvatarDelNotify_fieldAccessorTable = new + com.google.protobuf.GeneratedMessageV3.FieldAccessorTable( + internal_static_AvatarDelNotify_descriptor, + new java.lang.String[] { "AvatarGuidList", }); + } + + // @@protoc_insertion_point(outer_class_scope) +} diff --git a/src/main/java/emu/grasscutter/data/GameData.java b/src/main/java/emu/grasscutter/data/GameData.java index adfb2fb0..0b6640b0 100644 --- a/src/main/java/emu/grasscutter/data/GameData.java +++ b/src/main/java/emu/grasscutter/data/GameData.java @@ -112,6 +112,9 @@ public class GameData { @Getter private static final Int2ObjectMap towerFloorDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap towerLevelDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap towerScheduleDataMap = new Int2ObjectOpenHashMap<>(); + @Getter private static final Int2ObjectMap trialAvatarDataMap = new Int2ObjectOpenHashMap<>(); + @Getter private static final Int2ObjectMap trialAvatarTemplateDataMap = new Int2ObjectOpenHashMap<>(); + @Getter private static final Int2ObjectMap trialReliquaryDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap triggerExcelConfigDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap weaponCurveDataMap = new Int2ObjectOpenHashMap<>(); @Getter private static final Int2ObjectMap weaponLevelDataMap = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/emu/grasscutter/data/excels/QuestData.java b/src/main/java/emu/grasscutter/data/excels/QuestData.java index 28e18e56..82b0fc93 100644 --- a/src/main/java/emu/grasscutter/data/excels/QuestData.java +++ b/src/main/java/emu/grasscutter/data/excels/QuestData.java @@ -35,6 +35,7 @@ public class QuestData extends GameResource { private List finishExec; private List failExec; private Guide guide; + private List trialAvatarList; //ResourceLoader not happy if you remove getId() ~~ public int getId() { diff --git a/src/main/java/emu/grasscutter/data/excels/TrialAvatarData.java b/src/main/java/emu/grasscutter/data/excels/TrialAvatarData.java new file mode 100644 index 00000000..0974ec85 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/TrialAvatarData.java @@ -0,0 +1,19 @@ +package emu.grasscutter.data.excels; + +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import lombok.*; +import java.util.List; + +@ResourceType(name = "TrialAvatarExcelConfigData.json") +@EqualsAndHashCode(callSuper=false) +@Data +public class TrialAvatarData extends GameResource { + private int trialAvatarId; + private List trialAvatarParamList; + + @Override + public int getId() { + return trialAvatarId; + } +} diff --git a/src/main/java/emu/grasscutter/data/excels/TrialAvatarTemplateData.java b/src/main/java/emu/grasscutter/data/excels/TrialAvatarTemplateData.java new file mode 100644 index 00000000..96ca2519 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/TrialAvatarTemplateData.java @@ -0,0 +1,20 @@ +package emu.grasscutter.data.excels; + +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import lombok.*; +import java.util.List; + +@ResourceType(name = "TrialAvatarTemplateExcelConfigData.json") +@EqualsAndHashCode(callSuper=false) +@Data +public class TrialAvatarTemplateData extends GameResource { + private int TrialAvatarLevel; + private List TrialReliquaryList; + private int TrialAvatarSkillLevel; + + @Override + public int getId() { + return TrialAvatarLevel; + } +} diff --git a/src/main/java/emu/grasscutter/data/excels/TrialReliquaryData.java b/src/main/java/emu/grasscutter/data/excels/TrialReliquaryData.java new file mode 100644 index 00000000..3dcfb829 --- /dev/null +++ b/src/main/java/emu/grasscutter/data/excels/TrialReliquaryData.java @@ -0,0 +1,22 @@ +package emu.grasscutter.data.excels; + +import emu.grasscutter.data.GameResource; +import emu.grasscutter.data.ResourceType; +import lombok.*; +import java.util.List; + +@ResourceType(name = "TrialReliquaryExcelConfigData.json") +@EqualsAndHashCode(callSuper=false) +@Data +public class TrialReliquaryData extends GameResource { + private int Id; + private int ReliquaryId; + private int Level; + private int MainPropId; + private List AppendPropList; + + @Override + public int getId() { + return Id; + } +} diff --git a/src/main/java/emu/grasscutter/game/avatar/Avatar.java b/src/main/java/emu/grasscutter/game/avatar/Avatar.java index d245f826..ed33a268 100644 --- a/src/main/java/emu/grasscutter/game/avatar/Avatar.java +++ b/src/main/java/emu/grasscutter/game/avatar/Avatar.java @@ -34,6 +34,9 @@ import emu.grasscutter.net.proto.FetterDataOuterClass.FetterData; import emu.grasscutter.net.proto.ShowAvatarInfoOuterClass; import emu.grasscutter.net.proto.ShowAvatarInfoOuterClass.ShowAvatarInfo; import emu.grasscutter.net.proto.ShowEquipOuterClass.ShowEquip; +import emu.grasscutter.net.proto.TrialAvatarInfoOuterClass.TrialAvatarInfo; +import emu.grasscutter.net.proto.TrialAvatarGrantRecordOuterClass.TrialAvatarGrantRecord; +import emu.grasscutter.net.proto.TrialAvatarGrantRecordOuterClass.TrialAvatarGrantRecord.GrantReason; import emu.grasscutter.server.packet.send.*; import emu.grasscutter.utils.ProtoHelper; import it.unimi.dsi.fastutil.ints.*; @@ -86,6 +89,15 @@ public class Avatar { @Getter @Setter private int nameCardRewardId; @Getter @Setter private int nameCardId; + // trial avatar property + @Getter @Setter private int trialAvatarId = 0; + // cannot store to db if grant reason is not integer + @Getter @Setter private int grantReason = GrantReason.GRANT_REASON_INVALID.getNumber(); + @Getter @Setter private int fromParentQuestId = 0; + // so far no outer class or prop value has information of this, but from packet i sniff + // 1 = normal, 2 = trial avatar + @Getter @Setter private int avatarType = 1; + @Deprecated // Do not use. Morhpia only! public Avatar() { this.equips = new Int2ObjectOpenHashMap<>(); @@ -861,11 +873,9 @@ public class Avatar { } int cardId = this.getNameCardId(); - - if (this.getPlayer().getNameCardList().contains(cardId)) { - avatarFetter.addRewardedFetterLevelList(10); - } - + // if (this.getPlayer().getNameCardList().contains(cardId)) { + // avatarFetter.addRewardedFetterLevelList(10); + // } AvatarInfo.Builder avatarInfo = AvatarInfo.newBuilder() .setAvatarId(this.getAvatarId()) .setGuid(this.getGuid()) @@ -876,12 +886,16 @@ public class Avatar { .setCoreProudSkillLevel(this.getCoreProudSkillLevel()) .putAllSkillLevelMap(this.getSkillLevelMap()) .addAllInherentProudSkillList(this.getProudSkillList()) - .putAllProudSkillExtraLevelMap(this.getProudSkillBonusMap()) - .setAvatarType(1) + .putAllProudSkillExtraLevelMap(getProudSkillBonusMap()) + .setAvatarType(this.getAvatarType()) .setBornTime(this.getBornTime()) - .setFetterInfo(avatarFetter) .setWearingFlycloakId(this.getFlyCloak()) - .setCostumeId(this.getCostume()); + .setCostumeId(this.getCostume()) + .setIsFocus(false); + + if (this.getAvatarType() == 1){ + avatarInfo.setFetterInfo(avatarFetter); + } this.getSkillExtraChargeMap().forEach((skillId, count) -> avatarInfo.putSkillMap(skillId, AvatarSkillInfo.newBuilder().setMaxChargeCount(count).build())); @@ -894,6 +908,7 @@ public class Avatar { avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_VAL.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_VAL, 0)); avatarInfo.putPropMap(PlayerProperty.PROP_SATIATION_PENALTY_TIME.getId(), ProtoHelper.newPropValue(PlayerProperty.PROP_SATIATION_PENALTY_TIME, 0)); + avatarInfo.setTrialAvatarInfo(trialAvatarInfoProto()); return avatarInfo.build(); } @@ -937,6 +952,91 @@ public class Avatar { return showAvatarInfo.build(); } + public void setTrialAvatarInfo(TrialAvatarData trialAvatar, GrantReason grantReason, int fromParentQuestId){ + this.setLevel(trialAvatar.getTrialAvatarParamList().get(1)); + this.setTrialItems(trialAvatar.getTrialAvatarParamList().get(1)); + this.setTrialAvatarId(trialAvatar.getTrialAvatarId()); + this.setGrantReason(grantReason.getNumber()); + this.setFromParentQuestId(fromParentQuestId); + this.setAvatarType(2); + } + + public void setTrialItems(int trialAvatarLevel){ + // add enhanced verion of trial weapon + GameItem weapon = new GameItem(getAvatarData().getInitialWeapon()+100); + if (weapon.getItemData() == null){ + weapon = new GameItem(getAvatarData().getInitialWeapon()); + } + weapon.setLevel(trialAvatarLevel); + weapon.setExp(0); + weapon.setPromoteLevel(0); + getEquips().put(weapon.getEquipSlot(), weapon); + + int trialAvatarTemplateLevel = trialAvatarLevel <= 9 ? 1 : + (int) (Math.floor(trialAvatarLevel / 10) * 10); // round trial level to fit template levels + + TrialAvatarTemplateData templateData = GameData.getTrialAvatarTemplateDataMap().get(trialAvatarTemplateLevel); + if (templateData == null){ + return; + } + + // add trial artifacts + for (int id : templateData.getTrialReliquaryList()){ + TrialReliquaryData reliquaryData = GameData.getTrialReliquaryDataMap().get(id); + if (reliquaryData == null) continue; + + GameItem relic = new GameItem(reliquaryData.getReliquaryId()); + relic.setLevel(reliquaryData.getLevel()); + relic.setMainPropId(reliquaryData.getMainPropId()); + List appendPropList = reliquaryData.getAppendPropList(); + if (appendPropList.size() > 0){ + for (Integer trialAppendProp : appendPropList){ + relic.getAppendPropIdList().add(trialAppendProp); + } + } + getEquips().put(relic.getEquipSlot(), relic); + } + + // add costume if any (ambor, rosiaria, mona, Jean) + for (AvatarCostumeData costumeData : GameData.getAvatarCostumeDataItemIdMap().values()){ + if (costumeData.getCharacterId() == this.getAvatarId()){ + this.setCostume(costumeData.getId()); + break; + } + } + } + + public void equipTrialItems(){ + getEquips().forEach((itemEquipTypeValues, item) -> { + item.setEquipCharacter(getAvatarId()); + item.setOwner(getPlayer()); + if (item.getItemData().getEquipType() == EquipType.EQUIP_WEAPON && getPlayer().getWorld() != null) { + item.setWeaponEntityId(this.getPlayer().getWorld().getNextEntityId(EntityIdType.WEAPON)); + getPlayer().sendPacket(new PacketAvatarEquipChangeNotify(this, item)); + } + }); + } + + public TrialAvatarInfo trialAvatarInfoProto(){ + TrialAvatarInfo.Builder trialAvatar = TrialAvatarInfo.newBuilder() + .setTrialAvatarId(this.getTrialAvatarId()) + .setGrantRecord(TrialAvatarGrantRecord.newBuilder() + .setGrantReason(this.getGrantReason()) + .setFromParentQuestId(this.getFromParentQuestId())); + + if (this.getTrialAvatarId() > 0){ // if it is actual trial avatar + // add artifacts or wepon for trial character + int itemCount = 0; + for (GameItem item : this.getEquips().values()) { + trialAvatar.addTrialEquipList(itemCount, item.toProto()); + itemCount++; + } + + } + + return trialAvatar.build(); + } + @PostLoad private void onLoad() { diff --git a/src/main/java/emu/grasscutter/game/player/Player.java b/src/main/java/emu/grasscutter/game/player/Player.java index 6d2c0724..0a90227e 100644 --- a/src/main/java/emu/grasscutter/game/player/Player.java +++ b/src/main/java/emu/grasscutter/game/player/Player.java @@ -7,6 +7,7 @@ import emu.grasscutter.data.GameData; import emu.grasscutter.data.binout.ConfigLevelEntity; import emu.grasscutter.data.excels.AvatarData; import emu.grasscutter.data.excels.PlayerLevelData; +import emu.grasscutter.data.excels.TrialAvatarData; import emu.grasscutter.data.excels.WeatherData; import emu.grasscutter.database.DatabaseHelper; import emu.grasscutter.game.Account; @@ -63,6 +64,7 @@ import emu.grasscutter.net.proto.PropChangeReasonOuterClass.PropChangeReason; import emu.grasscutter.net.proto.ShowAvatarInfoOuterClass; import emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail; import emu.grasscutter.net.proto.SocialShowAvatarInfoOuterClass; +import emu.grasscutter.net.proto.TrialAvatarGrantRecordOuterClass.TrialAvatarGrantRecord.GrantReason; import emu.grasscutter.scripts.data.SceneRegion; import emu.grasscutter.server.event.player.PlayerJoinEvent; import emu.grasscutter.server.event.player.PlayerQuitEvent; @@ -74,6 +76,7 @@ import emu.grasscutter.utils.DateHelper; import emu.grasscutter.utils.MessageHandler; import emu.grasscutter.utils.Position; import emu.grasscutter.utils.Utils; +import org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; @@ -797,6 +800,43 @@ public class Player { addAvatar(new Avatar(avatarId), true); } + public boolean addTrialAvatarForQuest(int trialAvatarId, int questMainId){ + // TODO, other trial avatar like activity and element trial dungeon might have + // completely different scenario, this function is currently used for Quest Exec only + TrialAvatarData trialAvatar = GameData.getTrialAvatarDataMap().get(trialAvatarId); + Avatar avatar = new Avatar(trialAvatar.getTrialAvatarParamList().get(0)); + if (avatar.getAvatarData() == null || !hasSentLoginPackets()) { + return false; + } + avatar.setOwner(this); + // Add trial weapons and relics + avatar.setTrialAvatarInfo(trialAvatar, GrantReason.GRANT_REASON_BY_QUEST, questMainId); + avatar.equipTrialItems(); + // Recalc stats + avatar.recalcStats(); + + // Packet, mimic official server behaviour, add to player's bag but not saving to db + sendPacket(new PacketAvatarAddNotify(avatar, false)); + // add to avatar to temporary trial team + getTeamManager().addAvatarToTrialTeam(avatar); + // Packet, mimic official server behaviour, neccessary to stop player from modifying team + sendPacket(new PacketAvatarTeamUpdateNotify(this)); + return true; + } + + public boolean removeTrialAvatar(){ + if (getTeamManager().getTrialTeamGuid() == null || getTeamManager().getTrialTeamGuid().size() == 0) { + return false; + } + // Packet, mimic official server behaviour + sendPacket(new PacketAvatarDelNotify(getTeamManager().getTrialTeamGuid().values().stream().toList())); + // Reset temporary trial team + getTeamManager().getTrialTeamGuid().clear(); + // Packet, mimic official server behaviour, necessary to unlock team modifying + sendPacket(new PacketAvatarTeamUpdateNotify()); + return true; + } + public void addFlycloak(int flycloakId) { this.getFlyCloakList().add(flycloakId); this.sendPacket(new PacketAvatarGainFlycloakNotify(flycloakId)); diff --git a/src/main/java/emu/grasscutter/game/player/TeamManager.java b/src/main/java/emu/grasscutter/game/player/TeamManager.java index aa68f6bf..40ccc1e1 100644 --- a/src/main/java/emu/grasscutter/game/player/TeamManager.java +++ b/src/main/java/emu/grasscutter/game/player/TeamManager.java @@ -63,6 +63,8 @@ public class TeamManager extends BasePlayerDataManager { @Transient private int useTemporarilyTeamIndex = -1; @Transient private List temporaryTeam; // Temporary Team for tower + // Trial Teams, using hashmap not list since only one unique trial avatar can be in a single team + @Transient @Getter private Map trialTeamGuid; public TeamManager() { this.mpTeam = new TeamInfo(); @@ -70,6 +72,7 @@ public class TeamManager extends BasePlayerDataManager { this.gadgets = new HashSet<>(); this.teamResonances = new IntOpenHashSet(); this.teamResonancesConfig = new IntOpenHashSet(); + this.trialTeamGuid = new HashMap<>(); } public TeamManager(Player player) { @@ -288,6 +291,17 @@ public class TeamManager extends BasePlayerDataManager { } } + public void updateTeamProperties(){ + // Update team resonances + updateTeamResonances(); + + // Packets + getPlayer().sendPacket(new PacketSceneTeamUpdateNotify(getPlayer())); + + // Skill charges packet - Yes, this is official server behavior as of 2.6.0 + getActiveTeam().stream().map(EntityAvatar::getAvatar).forEach(Avatar::sendSkillExtraChargeMap); + } + public void updateTeamEntities(BasePacket responsePacket) { // Sanity check - Should never happen if (this.getCurrentTeamInfo().getAvatars().size() <= 0) { @@ -336,15 +350,8 @@ public class TeamManager extends BasePlayerDataManager { prevSelectedAvatarIndex = Math.min(this.currentCharacterIndex, this.getActiveTeam().size() - 1); } this.currentCharacterIndex = prevSelectedAvatarIndex; - - // Update team resonances - this.updateTeamResonances(); - - // Packets - this.getPlayer().getWorld().broadcastPacket(new PacketSceneTeamUpdateNotify(this.getPlayer())); - - // Skill charges packet - Yes, this is official server behavior as of 2.6.0 - this.getActiveTeam().stream().map(EntityAvatar::getAvatar).forEach(Avatar::sendSkillExtraChargeMap); + + updateTeamProperties(); // Run callback if (responsePacket != null) { @@ -410,6 +417,32 @@ public class TeamManager extends BasePlayerDataManager { this.addAvatarsToTeam(teamInfo, newTeam); } + public void addAvatarToTrialTeam(Avatar avatar){ + // add to trial team + getTrialTeamGuid().put(avatar.getAvatarId(), avatar.getGuid()); + EntityAvatar newEntity = new EntityAvatar(getPlayer().getScene(), avatar); + boolean inTeam = false; + int index; + // replace avatar with trial avatar if in team already + // Note: index increments to the size of active team before exiting loop + for (index = 0; index < getActiveTeam().size(); index++){ + EntityAvatar activeEntity = getActiveTeam().get(index); + if (activeEntity.getAvatar().getAvatarId() == avatar.getAvatarId()){ + inTeam = true; + getActiveTeam().set(index, newEntity); + break; + } + + } + if (!inTeam){ + getActiveTeam().add(newEntity); + } + // select the newly added trial avatar + // Limit character index in case it's out of bounds + setCurrentCharacterIndex(index >= getActiveTeam().size() ? index-1 : index); + updateTeamProperties(); // is necessary to update team at scene + } + public void setupTemporaryTeam(List> guidList) { this.temporaryTeam = guidList.stream().map(list -> { // Sanity checks diff --git a/src/main/java/emu/grasscutter/game/quest/GameQuest.java b/src/main/java/emu/grasscutter/game/quest/GameQuest.java index d51ab3f2..3342237c 100644 --- a/src/main/java/emu/grasscutter/game/quest/GameQuest.java +++ b/src/main/java/emu/grasscutter/game/quest/GameQuest.java @@ -199,6 +199,13 @@ public class GameQuest { getQuestData().getFailExec().forEach(e -> getOwner().getServer().getQuestSystem().triggerExec(this, e, e.getParam())); + // TODO, QUEST_EXEC_REMOVE_TRIAL_AVATAR only triggers when quest is finished, + // so the following code must also be placed somewhere on quest fails, + // not sure if this is the right placed though + if (getQuestData().getTrialAvatarList() != null) { + getOwner().removeTrialAvatar(); + } + Grasscutter.getLogger().debug("Quest {} is failed", subQuestId); } diff --git a/src/main/java/emu/grasscutter/game/quest/enums/QuestExec.java b/src/main/java/emu/grasscutter/game/quest/enums/QuestExec.java index 95e1191c..351348aa 100644 --- a/src/main/java/emu/grasscutter/game/quest/enums/QuestExec.java +++ b/src/main/java/emu/grasscutter/game/quest/enums/QuestExec.java @@ -14,21 +14,21 @@ public enum QuestExec implements QuestTrigger { QUEST_EXEC_UNLOCK_AREA (3), QUEST_EXEC_UNLOCK_FORCE (4), // missing, currently unused QUEST_EXEC_LOCK_FORCE (5), // missing, currently unused - QUEST_EXEC_CHANGE_AVATAR_ELEMET (6), // missing + QUEST_EXEC_CHANGE_AVATAR_ELEMET (6), QUEST_EXEC_REFRESH_GROUP_MONSTER (7), // missing QUEST_EXEC_SET_IS_FLYABLE (8), // missing, maybe gives glider QUEST_EXEC_SET_IS_WEATHER_LOCKED (9), // missing QUEST_EXEC_SET_IS_GAME_TIME_LOCKED (10), // missing QUEST_EXEC_SET_IS_TRANSFERABLE (11), // missing, currently unused - QUEST_EXEC_GRANT_TRIAL_AVATAR (12), // missing + QUEST_EXEC_GRANT_TRIAL_AVATAR (12), QUEST_EXEC_OPEN_BORED (13), // missing, currently unused - QUEST_EXEC_ROLLBACK_QUEST (14), // missing + QUEST_EXEC_ROLLBACK_QUEST (14), QUEST_EXEC_NOTIFY_GROUP_LUA (15), QUEST_EXEC_SET_OPEN_STATE (16), // missing QUEST_EXEC_LOCK_POINT (17), // missing QUEST_EXEC_DEL_PACK_ITEM_BATCH (18), QUEST_EXEC_REFRESH_GROUP_SUITE (19), - QUEST_EXEC_REMOVE_TRIAL_AVATAR (20), // missing + QUEST_EXEC_REMOVE_TRIAL_AVATAR (20), QUEST_EXEC_SET_GAME_TIME (21), // missing QUEST_EXEC_SET_WEATHER_GADGET (22), // missing QUEST_EXEC_ADD_QUEST_PROGRESS (23), @@ -38,7 +38,7 @@ public enum QuestExec implements QuestTrigger { QUEST_EXEC_REFRESH_GROUP_SUITE_RANDOM (27), // missing QUEST_EXEC_ACTIVE_ITEM_GIVING (28), // missing QUEST_EXEC_DEL_ALL_SPECIFIC_PACK_ITEM (29), // missing - QUEST_EXEC_ROLLBACK_PARENT_QUEST (30), // missing + QUEST_EXEC_ROLLBACK_PARENT_QUEST (30), QUEST_EXEC_LOCK_AVATAR_TEAM (31), // missing QUEST_EXEC_UNLOCK_AVATAR_TEAM (32), // missing QUEST_EXEC_UPDATE_PARENT_QUEST_REWARD_INDEX (33), // missing @@ -47,7 +47,7 @@ public enum QuestExec implements QuestTrigger { QUEST_EXEC_DEC_DAILY_TASK_VAR (36), // missing, currently unused QUEST_EXEC_ACTIVE_ACTIVITY_COND_STATE (37), // missing QUEST_EXEC_INACTIVE_ACTIVITY_COND_STATE (38), // missing - QUEST_EXEC_ADD_CUR_AVATAR_ENERGY (39), // missing + QUEST_EXEC_ADD_CUR_AVATAR_ENERGY (39), QUEST_EXEC_START_BARGAIN (41), // missing QUEST_EXEC_STOP_BARGAIN (42), // missing QUEST_EXEC_SET_QUEST_GLOBAL_VAR (43), diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java new file mode 100644 index 00000000..a866f2e7 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecGrantTrialAvatar.java @@ -0,0 +1,18 @@ +package emu.grasscutter.game.quest.exec; + +import emu.grasscutter.Grasscutter; + +import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.game.quest.GameQuest; +import emu.grasscutter.game.quest.QuestValueExec; +import emu.grasscutter.game.quest.enums.QuestExec; +import emu.grasscutter.game.quest.handlers.QuestExecHandler; + +@QuestValueExec(QuestExec.QUEST_EXEC_GRANT_TRIAL_AVATAR) +public class ExecGrantTrialAvatar extends QuestExecHandler { + @Override + public boolean execute(GameQuest quest, QuestData.QuestExecParam condition, String... paramStr) { + Grasscutter.getLogger().info("Added trial avatar to team for quest {}", quest.getSubQuestId()); + return quest.getOwner().addTrialAvatarForQuest(Integer.parseInt(paramStr[0]), quest.getMainQuestId()); + } +} diff --git a/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java b/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java new file mode 100644 index 00000000..6795ce09 --- /dev/null +++ b/src/main/java/emu/grasscutter/game/quest/exec/ExecRemoveTrialAvatar.java @@ -0,0 +1,18 @@ +package emu.grasscutter.game.quest.exec; + +import emu.grasscutter.Grasscutter; + +import emu.grasscutter.data.excels.QuestData; +import emu.grasscutter.game.quest.GameQuest; +import emu.grasscutter.game.quest.QuestValueExec; +import emu.grasscutter.game.quest.enums.QuestExec; +import emu.grasscutter.game.quest.handlers.QuestExecHandler; + +@QuestValueExec(QuestExec.QUEST_EXEC_REMOVE_TRIAL_AVATAR) +public class ExecRemoveTrialAvatar extends QuestExecHandler { + @Override + public boolean execute(GameQuest quest, QuestData.QuestExecParam condition, String... paramStr) { + Grasscutter.getLogger().info("Removed trial avatar from team for quest {}", quest.getSubQuestId()); + return quest.getOwner().removeTrialAvatar(); + } +} diff --git a/src/main/java/emu/grasscutter/game/world/World.java b/src/main/java/emu/grasscutter/game/world/World.java index 403fcb1d..eca5aa94 100644 --- a/src/main/java/emu/grasscutter/game/world/World.java +++ b/src/main/java/emu/grasscutter/game/world/World.java @@ -256,10 +256,11 @@ public class World implements Iterable { newScene.addPlayer(player); player.setAvatarsAbilityForScene(newScene); // Dungeon - if(dungeonData!=null){ - var dungeonManager = new DungeonManager(newScene, dungeonData); - dungeonManager.startDungeon(); - } + // Dungeon system is handling this already + // if(dungeonData!=null){ + // var dungeonManager = new DungeonManager(newScene, dungeonData); + // dungeonManager.startDungeon(); + // } SceneConfig config = newScene.getScriptManager().getConfig(); if (teleportTo == null && config != null) { if (config.born_pos != null) { diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDelNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDelNotify.java new file mode 100644 index 00000000..39a7507d --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarDelNotify.java @@ -0,0 +1,20 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import org.sorapointa.proto.AvatarDelNotifyOuterClass.AvatarDelNotify; + +import java.util.List; + +public class PacketAvatarDelNotify extends BasePacket { + + public PacketAvatarDelNotify(List avatarGuidList) { + super(PacketOpcodes.AvatarDelNotify); + + AvatarDelNotify proto = AvatarDelNotify.newBuilder() + .addAllAvatarGuidList(avatarGuidList) + .build(); + + this.setData(proto); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java index 63f43dd0..da3a961d 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketAvatarTeamUpdateNotify.java @@ -1,8 +1,15 @@ package emu.grasscutter.server.packet.send; +import java.util.Map.Entry; +import java.util.ArrayList; + +import emu.grasscutter.Grasscutter; +import emu.grasscutter.game.avatar.Avatar; import emu.grasscutter.game.player.Player; +import emu.grasscutter.game.player.TeamInfo; import emu.grasscutter.net.packet.BasePacket; import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.AvatarTeamOuterClass.AvatarTeam; import emu.grasscutter.net.proto.AvatarTeamUpdateNotifyOuterClass.AvatarTeamUpdateNotify; public class PacketAvatarTeamUpdateNotify extends BasePacket { @@ -11,9 +18,20 @@ public class PacketAvatarTeamUpdateNotify extends BasePacket { super(PacketOpcodes.AvatarTeamUpdateNotify); AvatarTeamUpdateNotify.Builder proto = AvatarTeamUpdateNotify.newBuilder(); - - player.getTeamManager().getTeams().forEach((id, teamInfo) -> proto.putAvatarTeamMap(id, teamInfo.toProto(player))); - + if (player.getTeamManager().getTrialTeamGuid() != null && player.getTeamManager().getTrialTeamGuid().size() > 0){ + proto.addAllTempAvatarGuidList(player.getTeamManager().getTrialTeamGuid().values().stream().toList()); + } else{ + for (Entry entry : player.getTeamManager().getTeams().entrySet()) { + TeamInfo teamInfo = entry.getValue(); + proto.putAvatarTeamMap(entry.getKey(), teamInfo.toProto(player)); + } + } this.setData(proto); } + + public PacketAvatarTeamUpdateNotify() { + // neccessary to unlock team modify if it was previously locked + super(PacketOpcodes.AvatarTeamUpdateNotify); + this.setData(AvatarTeamUpdateNotify.newBuilder().build()); + } }