Added support for granting trial avatars (Quest Exec Only)

- Added files
-- ExcelData
* TrialAvatarData.java
* TrialAvatarTemplateData.java
* TrialReliquaryData.java

-- OuterClass
* AvatarDelNotifyOuterClass.java

-- Packets
* PacketAvatarDelNotify.java to remove trial avatar appearing in player's bag

-- QuestExec
* ExecGrantTrialAvatar.java
* ExecRemoveTrialAvatar.java

- Modified files
-- ExcelData
* GameData.java to cache excel data
* QuestData.java to read trial avatar list

-- Game files
* Avatar.java to set trial avatar information
* Player.java to send corresponding packages for trial avatar
* TeamManager.java to add trial avatar to temporary team
* GameQuest.java to remove trial avatar on quest fail
* World.java to not send extra startDungeon() which is already handled by dungeon system

-- Packets
-- PacketAvatarTeamUpdate.java to selectively send trial team or player's team information
This commit is contained in:
WQJ 2022-11-19 15:55:13 +11:00
parent 5e3c647b68
commit 0c7b8a34b3
16 changed files with 1028 additions and 31 deletions

View File

@ -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 {
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return A list containing the avatarGuidList.
*/
java.util.List<java.lang.Long> getAvatarGuidListList();
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return The count of avatarGuidList.
*/
int getAvatarGuidListCount();
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @param index The index of the element to return.
* @return The avatarGuidList at the given index.
*/
long getAvatarGuidList(int index);
}
/**
* <pre>
* CmdId: 1773
* EnetChannelId: 0
* EnetIsReliable: true
* </pre>
*
* 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_;
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return A list containing the avatarGuidList.
*/
@java.lang.Override
public java.util.List<java.lang.Long>
getAvatarGuidListList() {
return avatarGuidList_;
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return The count of avatarGuidList.
*/
public int getAvatarGuidListCount() {
return avatarGuidList_.size();
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @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;
}
/**
* <pre>
* CmdId: 1773
* EnetChannelId: 0
* EnetIsReliable: true
* </pre>
*
* Protobuf type {@code AvatarDelNotify}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<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;
}
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return A list containing the avatarGuidList.
*/
public java.util.List<java.lang.Long>
getAvatarGuidListList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(avatarGuidList_) : avatarGuidList_;
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @return The count of avatarGuidList.
*/
public int getAvatarGuidListCount() {
return avatarGuidList_.size();
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @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);
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @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;
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @param value The avatarGuidList to add.
* @return This builder for chaining.
*/
public Builder addAvatarGuidList(long value) {
ensureAvatarGuidListIsMutable();
avatarGuidList_.addLong(value);
onChanged();
return this;
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @param values The avatarGuidList to add.
* @return This builder for chaining.
*/
public Builder addAllAvatarGuidList(
java.lang.Iterable<? extends java.lang.Long> values) {
ensureAvatarGuidListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, avatarGuidList_);
onChanged();
return this;
}
/**
* <code>repeated uint64 avatar_guid_list = 13;</code>
* @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<AvatarDelNotify>
PARSER = new com.google.protobuf.AbstractParser<AvatarDelNotify>() {
@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<AvatarDelNotify> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<AvatarDelNotify> 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)
}

View File

@ -112,6 +112,9 @@ public class GameData {
@Getter private static final Int2ObjectMap<TowerFloorData> towerFloorDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TowerLevelData> towerLevelDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TowerScheduleData> towerScheduleDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TrialAvatarData> trialAvatarDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TrialAvatarTemplateData> trialAvatarTemplateDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TrialReliquaryData> trialReliquaryDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<TriggerExcelConfigData> triggerExcelConfigDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeaponCurveData> weaponCurveDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<WeaponLevelData> weaponLevelDataMap = new Int2ObjectOpenHashMap<>();

View File

@ -35,6 +35,7 @@ public class QuestData extends GameResource {
private List<QuestExecParam> finishExec;
private List<QuestExecParam> failExec;
private Guide guide;
private List<Integer> trialAvatarList;
//ResourceLoader not happy if you remove getId() ~~
public int getId() {

View File

@ -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<Integer> trialAvatarParamList;
@Override
public int getId() {
return trialAvatarId;
}
}

View File

@ -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<Integer> TrialReliquaryList;
private int TrialAvatarSkillLevel;
@Override
public int getId() {
return TrialAvatarLevel;
}
}

View File

@ -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<Integer> AppendPropList;
@Override
public int getId() {
return Id;
}
}

View File

@ -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<Integer> 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() {

View File

@ -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));

View File

@ -63,6 +63,8 @@ public class TeamManager extends BasePlayerDataManager {
@Transient private int useTemporarilyTeamIndex = -1;
@Transient private List<TeamInfo> 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<Integer, Long> 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) {
@ -337,14 +351,7 @@ public class TeamManager extends BasePlayerDataManager {
}
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<List<Long>> guidList) {
this.temporaryTeam = guidList.stream().map(list -> {
// Sanity checks

View File

@ -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);
}

View File

@ -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),

View File

@ -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());
}
}

View File

@ -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();
}
}

View File

@ -256,10 +256,11 @@ public class World implements Iterable<Player> {
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) {

View File

@ -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<Long> avatarGuidList) {
super(PacketOpcodes.AvatarDelNotify);
AvatarDelNotify proto = AvatarDelNotify.newBuilder()
.addAllAvatarGuidList(avatarGuidList)
.build();
this.setData(proto);
}
}

View File

@ -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<Integer, TeamInfo> 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());
}
}