Simply implement achievement system and add achievement command (#2068)

* Implement achievement system

* Update src/main/java/emu/grasscutter/command/commands/AchievementCommand.java

Co-authored-by: Der Chien <b03902015@ntu.edu.tw>

* fix: redundant codes

* fix: redundant codes

* Update language files

---------

Co-authored-by: Der Chien <b03902015@ntu.edu.tw>
This commit is contained in:
hamusuke 2023-02-26 14:14:27 +09:00 committed by GitHub
parent 51479e2abd
commit 3ab3d5bc04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 7418 additions and 1 deletions

View File

@ -0,0 +1,857 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Achievement.proto
package emu.grasscutter.net.proto;
public final class AchievementOuterClass {
private AchievementOuterClass() {}
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 AchievementOrBuilder extends
// @@protoc_insertion_point(interface_extends:Achievement)
com.google.protobuf.MessageOrBuilder {
/**
* <code>uint32 curProgress = 10;</code>
* @return The curProgress.
*/
int getCurProgress();
/**
* <code>uint32 id = 13;</code>
* @return The id.
*/
int getId();
/**
* <code>uint32 totalProgress = 14;</code>
* @return The totalProgress.
*/
int getTotalProgress();
/**
* <code>.Status status = 5;</code>
* @return The enum numeric value on the wire for status.
*/
int getStatusValue();
/**
* <code>.Status status = 5;</code>
* @return The status.
*/
emu.grasscutter.net.proto.StatusOuterClass.Status getStatus();
/**
* <code>uint32 finishTimestamp = 6;</code>
* @return The finishTimestamp.
*/
int getFinishTimestamp();
}
/**
* Protobuf type {@code Achievement}
*/
public static final class Achievement extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Achievement)
AchievementOrBuilder {
private static final long serialVersionUID = 0L;
// Use Achievement.newBuilder() to construct.
private Achievement(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private Achievement() {
status_ = 0;
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new Achievement();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private Achievement(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
this();
if (extensionRegistry == null) {
throw new java.lang.NullPointerException();
}
com.google.protobuf.UnknownFieldSet.Builder unknownFields =
com.google.protobuf.UnknownFieldSet.newBuilder();
try {
boolean done = false;
while (!done) {
int tag = input.readTag();
switch (tag) {
case 0:
done = true;
break;
case 40: {
int rawValue = input.readEnum();
status_ = rawValue;
break;
}
case 48: {
finishTimestamp_ = input.readUInt32();
break;
}
case 80: {
curProgress_ = input.readUInt32();
break;
}
case 104: {
id_ = input.readUInt32();
break;
}
case 112: {
totalProgress_ = input.readUInt32();
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.AchievementOuterClass.internal_static_Achievement_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.AchievementOuterClass.internal_static_Achievement_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.AchievementOuterClass.Achievement.class, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder.class);
}
public static final int CURPROGRESS_FIELD_NUMBER = 10;
private int curProgress_;
/**
* <code>uint32 curProgress = 10;</code>
* @return The curProgress.
*/
@java.lang.Override
public int getCurProgress() {
return curProgress_;
}
public static final int ID_FIELD_NUMBER = 13;
private int id_;
/**
* <code>uint32 id = 13;</code>
* @return The id.
*/
@java.lang.Override
public int getId() {
return id_;
}
public static final int TOTALPROGRESS_FIELD_NUMBER = 14;
private int totalProgress_;
/**
* <code>uint32 totalProgress = 14;</code>
* @return The totalProgress.
*/
@java.lang.Override
public int getTotalProgress() {
return totalProgress_;
}
public static final int STATUS_FIELD_NUMBER = 5;
private int status_;
/**
* <code>.Status status = 5;</code>
* @return The enum numeric value on the wire for status.
*/
@java.lang.Override public int getStatusValue() {
return status_;
}
/**
* <code>.Status status = 5;</code>
* @return The status.
*/
@java.lang.Override public emu.grasscutter.net.proto.StatusOuterClass.Status getStatus() {
@SuppressWarnings("deprecation")
emu.grasscutter.net.proto.StatusOuterClass.Status result = emu.grasscutter.net.proto.StatusOuterClass.Status.valueOf(status_);
return result == null ? emu.grasscutter.net.proto.StatusOuterClass.Status.UNRECOGNIZED : result;
}
public static final int FINISHTIMESTAMP_FIELD_NUMBER = 6;
private int finishTimestamp_;
/**
* <code>uint32 finishTimestamp = 6;</code>
* @return The finishTimestamp.
*/
@java.lang.Override
public int getFinishTimestamp() {
return finishTimestamp_;
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
if (status_ != emu.grasscutter.net.proto.StatusOuterClass.Status.STATUS_INVALID.getNumber()) {
output.writeEnum(5, status_);
}
if (finishTimestamp_ != 0) {
output.writeUInt32(6, finishTimestamp_);
}
if (curProgress_ != 0) {
output.writeUInt32(10, curProgress_);
}
if (id_ != 0) {
output.writeUInt32(13, id_);
}
if (totalProgress_ != 0) {
output.writeUInt32(14, totalProgress_);
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
if (status_ != emu.grasscutter.net.proto.StatusOuterClass.Status.STATUS_INVALID.getNumber()) {
size += com.google.protobuf.CodedOutputStream
.computeEnumSize(5, status_);
}
if (finishTimestamp_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(6, finishTimestamp_);
}
if (curProgress_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(10, curProgress_);
}
if (id_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(13, id_);
}
if (totalProgress_ != 0) {
size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(14, totalProgress_);
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof emu.grasscutter.net.proto.AchievementOuterClass.Achievement)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.AchievementOuterClass.Achievement other = (emu.grasscutter.net.proto.AchievementOuterClass.Achievement) obj;
if (getCurProgress()
!= other.getCurProgress()) return false;
if (getId()
!= other.getId()) return false;
if (getTotalProgress()
!= other.getTotalProgress()) return false;
if (status_ != other.status_) return false;
if (getFinishTimestamp()
!= other.getFinishTimestamp()) return false;
if (!unknownFields.equals(other.unknownFields)) return false;
return true;
}
@java.lang.Override
public int hashCode() {
if (memoizedHashCode != 0) {
return memoizedHashCode;
}
int hash = 41;
hash = (19 * hash) + getDescriptor().hashCode();
hash = (37 * hash) + CURPROGRESS_FIELD_NUMBER;
hash = (53 * hash) + getCurProgress();
hash = (37 * hash) + ID_FIELD_NUMBER;
hash = (53 * hash) + getId();
hash = (37 * hash) + TOTALPROGRESS_FIELD_NUMBER;
hash = (53 * hash) + getTotalProgress();
hash = (37 * hash) + STATUS_FIELD_NUMBER;
hash = (53 * hash) + status_;
hash = (37 * hash) + FINISHTIMESTAMP_FIELD_NUMBER;
hash = (53 * hash) + getFinishTimestamp();
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(emu.grasscutter.net.proto.AchievementOuterClass.Achievement prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code Achievement}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:Achievement)
emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.AchievementOuterClass.internal_static_Achievement_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.AchievementOuterClass.internal_static_Achievement_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.AchievementOuterClass.Achievement.class, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder.class);
}
// Construct using emu.grasscutter.net.proto.AchievementOuterClass.Achievement.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();
curProgress_ = 0;
id_ = 0;
totalProgress_ = 0;
status_ = 0;
finishTimestamp_ = 0;
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.AchievementOuterClass.internal_static_Achievement_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement getDefaultInstanceForType() {
return emu.grasscutter.net.proto.AchievementOuterClass.Achievement.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement build() {
emu.grasscutter.net.proto.AchievementOuterClass.Achievement result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement buildPartial() {
emu.grasscutter.net.proto.AchievementOuterClass.Achievement result = new emu.grasscutter.net.proto.AchievementOuterClass.Achievement(this);
result.curProgress_ = curProgress_;
result.id_ = id_;
result.totalProgress_ = totalProgress_;
result.status_ = status_;
result.finishTimestamp_ = finishTimestamp_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof emu.grasscutter.net.proto.AchievementOuterClass.Achievement) {
return mergeFrom((emu.grasscutter.net.proto.AchievementOuterClass.Achievement)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.AchievementOuterClass.Achievement other) {
if (other == emu.grasscutter.net.proto.AchievementOuterClass.Achievement.getDefaultInstance()) return this;
if (other.getCurProgress() != 0) {
setCurProgress(other.getCurProgress());
}
if (other.getId() != 0) {
setId(other.getId());
}
if (other.getTotalProgress() != 0) {
setTotalProgress(other.getTotalProgress());
}
if (other.status_ != 0) {
setStatusValue(other.getStatusValue());
}
if (other.getFinishTimestamp() != 0) {
setFinishTimestamp(other.getFinishTimestamp());
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
emu.grasscutter.net.proto.AchievementOuterClass.Achievement parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.AchievementOuterClass.Achievement) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int curProgress_ ;
/**
* <code>uint32 curProgress = 10;</code>
* @return The curProgress.
*/
@java.lang.Override
public int getCurProgress() {
return curProgress_;
}
/**
* <code>uint32 curProgress = 10;</code>
* @param value The curProgress to set.
* @return This builder for chaining.
*/
public Builder setCurProgress(int value) {
curProgress_ = value;
onChanged();
return this;
}
/**
* <code>uint32 curProgress = 10;</code>
* @return This builder for chaining.
*/
public Builder clearCurProgress() {
curProgress_ = 0;
onChanged();
return this;
}
private int id_ ;
/**
* <code>uint32 id = 13;</code>
* @return The id.
*/
@java.lang.Override
public int getId() {
return id_;
}
/**
* <code>uint32 id = 13;</code>
* @param value The id to set.
* @return This builder for chaining.
*/
public Builder setId(int value) {
id_ = value;
onChanged();
return this;
}
/**
* <code>uint32 id = 13;</code>
* @return This builder for chaining.
*/
public Builder clearId() {
id_ = 0;
onChanged();
return this;
}
private int totalProgress_ ;
/**
* <code>uint32 totalProgress = 14;</code>
* @return The totalProgress.
*/
@java.lang.Override
public int getTotalProgress() {
return totalProgress_;
}
/**
* <code>uint32 totalProgress = 14;</code>
* @param value The totalProgress to set.
* @return This builder for chaining.
*/
public Builder setTotalProgress(int value) {
totalProgress_ = value;
onChanged();
return this;
}
/**
* <code>uint32 totalProgress = 14;</code>
* @return This builder for chaining.
*/
public Builder clearTotalProgress() {
totalProgress_ = 0;
onChanged();
return this;
}
private int status_ = 0;
/**
* <code>.Status status = 5;</code>
* @return The enum numeric value on the wire for status.
*/
@java.lang.Override public int getStatusValue() {
return status_;
}
/**
* <code>.Status status = 5;</code>
* @param value The enum numeric value on the wire for status to set.
* @return This builder for chaining.
*/
public Builder setStatusValue(int value) {
status_ = value;
onChanged();
return this;
}
/**
* <code>.Status status = 5;</code>
* @return The status.
*/
@java.lang.Override
public emu.grasscutter.net.proto.StatusOuterClass.Status getStatus() {
@SuppressWarnings("deprecation")
emu.grasscutter.net.proto.StatusOuterClass.Status result = emu.grasscutter.net.proto.StatusOuterClass.Status.valueOf(status_);
return result == null ? emu.grasscutter.net.proto.StatusOuterClass.Status.UNRECOGNIZED : result;
}
/**
* <code>.Status status = 5;</code>
* @param value The status to set.
* @return This builder for chaining.
*/
public Builder setStatus(emu.grasscutter.net.proto.StatusOuterClass.Status value) {
if (value == null) {
throw new NullPointerException();
}
status_ = value.getNumber();
onChanged();
return this;
}
/**
* <code>.Status status = 5;</code>
* @return This builder for chaining.
*/
public Builder clearStatus() {
status_ = 0;
onChanged();
return this;
}
private int finishTimestamp_ ;
/**
* <code>uint32 finishTimestamp = 6;</code>
* @return The finishTimestamp.
*/
@java.lang.Override
public int getFinishTimestamp() {
return finishTimestamp_;
}
/**
* <code>uint32 finishTimestamp = 6;</code>
* @param value The finishTimestamp to set.
* @return This builder for chaining.
*/
public Builder setFinishTimestamp(int value) {
finishTimestamp_ = value;
onChanged();
return this;
}
/**
* <code>uint32 finishTimestamp = 6;</code>
* @return This builder for chaining.
*/
public Builder clearFinishTimestamp() {
finishTimestamp_ = 0;
onChanged();
return this;
}
@java.lang.Override
public final Builder setUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
}
@java.lang.Override
public final Builder mergeUnknownFields(
final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.mergeUnknownFields(unknownFields);
}
// @@protoc_insertion_point(builder_scope:Achievement)
}
// @@protoc_insertion_point(class_scope:Achievement)
private static final emu.grasscutter.net.proto.AchievementOuterClass.Achievement DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.AchievementOuterClass.Achievement();
}
public static emu.grasscutter.net.proto.AchievementOuterClass.Achievement getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<Achievement>
PARSER = new com.google.protobuf.AbstractParser<Achievement>() {
@java.lang.Override
public Achievement parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new Achievement(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<Achievement> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<Achievement> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_Achievement_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_Achievement_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\021Achievement.proto\032\014Status.proto\"w\n\013Ach" +
"ievement\022\023\n\013curProgress\030\n \001(\r\022\n\n\002id\030\r \001(" +
"\r\022\025\n\rtotalProgress\030\016 \001(\r\022\027\n\006status\030\005 \001(\016" +
"2\007.Status\022\027\n\017finishTimestamp\030\006 \001(\rB\033\n\031em" +
"u.grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
emu.grasscutter.net.proto.StatusOuterClass.getDescriptor(),
});
internal_static_Achievement_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_Achievement_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_Achievement_descriptor,
new java.lang.String[] { "CurProgress", "Id", "TotalProgress", "Status", "FinishTimestamp", });
emu.grasscutter.net.proto.StatusOuterClass.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,977 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: AchievementUpdateNotify.proto
package emu.grasscutter.net.proto;
public final class AchievementUpdateNotifyOuterClass {
private AchievementUpdateNotifyOuterClass() {}
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 AchievementUpdateNotifyOrBuilder extends
// @@protoc_insertion_point(interface_extends:AchievementUpdateNotify)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement>
getAchievementListList();
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
emu.grasscutter.net.proto.AchievementOuterClass.Achievement getAchievementList(int index);
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
int getAchievementListCount();
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
java.util.List<? extends emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder>
getAchievementListOrBuilderList();
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder getAchievementListOrBuilder(
int index);
}
/**
* Protobuf type {@code AchievementUpdateNotify}
*/
public static final class AchievementUpdateNotify extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:AchievementUpdateNotify)
AchievementUpdateNotifyOrBuilder {
private static final long serialVersionUID = 0L;
// Use AchievementUpdateNotify.newBuilder() to construct.
private AchievementUpdateNotify(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private AchievementUpdateNotify() {
achievementList_ = java.util.Collections.emptyList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new AchievementUpdateNotify();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private AchievementUpdateNotify(
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 34: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
achievementList_ = new java.util.ArrayList<emu.grasscutter.net.proto.AchievementOuterClass.Achievement>();
mutable_bitField0_ |= 0x00000001;
}
achievementList_.add(
input.readMessage(emu.grasscutter.net.proto.AchievementOuterClass.Achievement.parser(), extensionRegistry));
break;
}
default: {
if (!parseUnknownField(
input, unknownFields, extensionRegistry, tag)) {
done = true;
}
break;
}
}
}
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
throw e.setUnfinishedMessage(this);
} catch (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
achievementList_ = java.util.Collections.unmodifiableList(achievementList_);
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.internal_static_AchievementUpdateNotify_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.internal_static_AchievementUpdateNotify_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.class, emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.Builder.class);
}
/**
* Protobuf enum {@code AchievementUpdateNotify.LKDGLEKOFGN}
*/
public enum LKDGLEKOFGN
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>NONE = 0;</code>
*/
NONE(0, 0),
/**
* <code>PEPPOHPHJOJ = 2695;</code>
*/
PEPPOHPHJOJ(1, 2695),
/**
* <code>NNBKOLMPOEA = 1;</code>
*/
NNBKOLMPOEA(3, 1),
UNRECOGNIZED(-1, -1),
;
/**
* <code>DCDNILFDFLB = 0;</code>
*/
public static final LKDGLEKOFGN DCDNILFDFLB = NONE;
/**
* <code>NONE = 0;</code>
*/
public static final int NONE_VALUE = 0;
/**
* <code>PEPPOHPHJOJ = 2695;</code>
*/
public static final int PEPPOHPHJOJ_VALUE = 2695;
/**
* <code>DCDNILFDFLB = 0;</code>
*/
public static final int DCDNILFDFLB_VALUE = 0;
/**
* <code>NNBKOLMPOEA = 1;</code>
*/
public static final int NNBKOLMPOEA_VALUE = 1;
public final int getNumber() {
if (index == -1) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static LKDGLEKOFGN valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static LKDGLEKOFGN forNumber(int value) {
switch (value) {
case 0: return NONE;
case 2695: return PEPPOHPHJOJ;
case 1: return NNBKOLMPOEA;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<LKDGLEKOFGN>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
LKDGLEKOFGN> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<LKDGLEKOFGN>() {
public LKDGLEKOFGN findValueByNumber(int number) {
return LKDGLEKOFGN.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (index == -1) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.getDescriptor().getEnumTypes().get(0);
}
private static final LKDGLEKOFGN[] VALUES = getStaticValuesArray();
private static LKDGLEKOFGN[] getStaticValuesArray() {
return new LKDGLEKOFGN[] {
NONE, PEPPOHPHJOJ, DCDNILFDFLB, NNBKOLMPOEA,
};
}
public static LKDGLEKOFGN valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private LKDGLEKOFGN(int index, int value) {
this.index = index;
this.value = value;
}
// @@protoc_insertion_point(enum_scope:AchievementUpdateNotify.LKDGLEKOFGN)
}
public static final int ACHIEVEMENTLIST_FIELD_NUMBER = 4;
private java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement> achievementList_;
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
@java.lang.Override
public java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement> getAchievementListList() {
return achievementList_;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
@java.lang.Override
public java.util.List<? extends emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder>
getAchievementListOrBuilderList() {
return achievementList_;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
@java.lang.Override
public int getAchievementListCount() {
return achievementList_.size();
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement getAchievementList(int index) {
return achievementList_.get(index);
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
@java.lang.Override
public emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder getAchievementListOrBuilder(
int index) {
return achievementList_.get(index);
}
private byte memoizedIsInitialized = -1;
@java.lang.Override
public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized;
if (isInitialized == 1) return true;
if (isInitialized == 0) return false;
memoizedIsInitialized = 1;
return true;
}
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
for (int i = 0; i < achievementList_.size(); i++) {
output.writeMessage(4, achievementList_.get(i));
}
unknownFields.writeTo(output);
}
@java.lang.Override
public int getSerializedSize() {
int size = memoizedSize;
if (size != -1) return size;
size = 0;
for (int i = 0; i < achievementList_.size(); i++) {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(4, achievementList_.get(i));
}
size += unknownFields.getSerializedSize();
memoizedSize = size;
return size;
}
@java.lang.Override
public boolean equals(final java.lang.Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify other = (emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify) obj;
if (!getAchievementListList()
.equals(other.getAchievementListList())) 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 (getAchievementListCount() > 0) {
hash = (37 * hash) + ACHIEVEMENTLIST_FIELD_NUMBER;
hash = (53 * hash) + getAchievementListList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code AchievementUpdateNotify}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:AchievementUpdateNotify)
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotifyOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.internal_static_AchievementUpdateNotify_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.internal_static_AchievementUpdateNotify_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.class, emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.Builder.class);
}
// Construct using emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.newBuilder()
private Builder() {
maybeForceBuilderInitialization();
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
maybeForceBuilderInitialization();
}
private void maybeForceBuilderInitialization() {
if (com.google.protobuf.GeneratedMessageV3
.alwaysUseFieldBuilders) {
getAchievementListFieldBuilder();
}
}
@java.lang.Override
public Builder clear() {
super.clear();
if (achievementListBuilder_ == null) {
achievementList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
} else {
achievementListBuilder_.clear();
}
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.internal_static_AchievementUpdateNotify_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify getDefaultInstanceForType() {
return emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify build() {
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify buildPartial() {
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify result = new emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify(this);
int from_bitField0_ = bitField0_;
if (achievementListBuilder_ == null) {
if (((bitField0_ & 0x00000001) != 0)) {
achievementList_ = java.util.Collections.unmodifiableList(achievementList_);
bitField0_ = (bitField0_ & ~0x00000001);
}
result.achievementList_ = achievementList_;
} else {
result.achievementList_ = achievementListBuilder_.build();
}
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify) {
return mergeFrom((emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify other) {
if (other == emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.getDefaultInstance()) return this;
if (achievementListBuilder_ == null) {
if (!other.achievementList_.isEmpty()) {
if (achievementList_.isEmpty()) {
achievementList_ = other.achievementList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureAchievementListIsMutable();
achievementList_.addAll(other.achievementList_);
}
onChanged();
}
} else {
if (!other.achievementList_.isEmpty()) {
if (achievementListBuilder_.isEmpty()) {
achievementListBuilder_.dispose();
achievementListBuilder_ = null;
achievementList_ = other.achievementList_;
bitField0_ = (bitField0_ & ~0x00000001);
achievementListBuilder_ =
com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders ?
getAchievementListFieldBuilder() : null;
} else {
achievementListBuilder_.addAllMessages(other.achievementList_);
}
}
}
this.mergeUnknownFields(other.unknownFields);
onChanged();
return this;
}
@java.lang.Override
public final boolean isInitialized() {
return true;
}
@java.lang.Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement> achievementList_ =
java.util.Collections.emptyList();
private void ensureAchievementListIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
achievementList_ = new java.util.ArrayList<emu.grasscutter.net.proto.AchievementOuterClass.Achievement>(achievementList_);
bitField0_ |= 0x00000001;
}
}
private com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.AchievementOuterClass.Achievement, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder, emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder> achievementListBuilder_;
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement> getAchievementListList() {
if (achievementListBuilder_ == null) {
return java.util.Collections.unmodifiableList(achievementList_);
} else {
return achievementListBuilder_.getMessageList();
}
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public int getAchievementListCount() {
if (achievementListBuilder_ == null) {
return achievementList_.size();
} else {
return achievementListBuilder_.getCount();
}
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement getAchievementList(int index) {
if (achievementListBuilder_ == null) {
return achievementList_.get(index);
} else {
return achievementListBuilder_.getMessage(index);
}
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder setAchievementList(
int index, emu.grasscutter.net.proto.AchievementOuterClass.Achievement value) {
if (achievementListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAchievementListIsMutable();
achievementList_.set(index, value);
onChanged();
} else {
achievementListBuilder_.setMessage(index, value);
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder setAchievementList(
int index, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder builderForValue) {
if (achievementListBuilder_ == null) {
ensureAchievementListIsMutable();
achievementList_.set(index, builderForValue.build());
onChanged();
} else {
achievementListBuilder_.setMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder addAchievementList(emu.grasscutter.net.proto.AchievementOuterClass.Achievement value) {
if (achievementListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAchievementListIsMutable();
achievementList_.add(value);
onChanged();
} else {
achievementListBuilder_.addMessage(value);
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder addAchievementList(
int index, emu.grasscutter.net.proto.AchievementOuterClass.Achievement value) {
if (achievementListBuilder_ == null) {
if (value == null) {
throw new NullPointerException();
}
ensureAchievementListIsMutable();
achievementList_.add(index, value);
onChanged();
} else {
achievementListBuilder_.addMessage(index, value);
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder addAchievementList(
emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder builderForValue) {
if (achievementListBuilder_ == null) {
ensureAchievementListIsMutable();
achievementList_.add(builderForValue.build());
onChanged();
} else {
achievementListBuilder_.addMessage(builderForValue.build());
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder addAchievementList(
int index, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder builderForValue) {
if (achievementListBuilder_ == null) {
ensureAchievementListIsMutable();
achievementList_.add(index, builderForValue.build());
onChanged();
} else {
achievementListBuilder_.addMessage(index, builderForValue.build());
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder addAllAchievementList(
java.lang.Iterable<? extends emu.grasscutter.net.proto.AchievementOuterClass.Achievement> values) {
if (achievementListBuilder_ == null) {
ensureAchievementListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, achievementList_);
onChanged();
} else {
achievementListBuilder_.addAllMessages(values);
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder clearAchievementList() {
if (achievementListBuilder_ == null) {
achievementList_ = java.util.Collections.emptyList();
bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
} else {
achievementListBuilder_.clear();
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public Builder removeAchievementList(int index) {
if (achievementListBuilder_ == null) {
ensureAchievementListIsMutable();
achievementList_.remove(index);
onChanged();
} else {
achievementListBuilder_.remove(index);
}
return this;
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder getAchievementListBuilder(
int index) {
return getAchievementListFieldBuilder().getBuilder(index);
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder getAchievementListOrBuilder(
int index) {
if (achievementListBuilder_ == null) {
return achievementList_.get(index); } else {
return achievementListBuilder_.getMessageOrBuilder(index);
}
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public java.util.List<? extends emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder>
getAchievementListOrBuilderList() {
if (achievementListBuilder_ != null) {
return achievementListBuilder_.getMessageOrBuilderList();
} else {
return java.util.Collections.unmodifiableList(achievementList_);
}
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder addAchievementListBuilder() {
return getAchievementListFieldBuilder().addBuilder(
emu.grasscutter.net.proto.AchievementOuterClass.Achievement.getDefaultInstance());
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder addAchievementListBuilder(
int index) {
return getAchievementListFieldBuilder().addBuilder(
index, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.getDefaultInstance());
}
/**
* <code>repeated .Achievement achievementList = 4;</code>
*/
public java.util.List<emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder>
getAchievementListBuilderList() {
return getAchievementListFieldBuilder().getBuilderList();
}
private com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.AchievementOuterClass.Achievement, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder, emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder>
getAchievementListFieldBuilder() {
if (achievementListBuilder_ == null) {
achievementListBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
emu.grasscutter.net.proto.AchievementOuterClass.Achievement, emu.grasscutter.net.proto.AchievementOuterClass.Achievement.Builder, emu.grasscutter.net.proto.AchievementOuterClass.AchievementOrBuilder>(
achievementList_,
((bitField0_ & 0x00000001) != 0),
getParentForChildren(),
isClean());
achievementList_ = null;
}
return achievementListBuilder_;
}
@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:AchievementUpdateNotify)
}
// @@protoc_insertion_point(class_scope:AchievementUpdateNotify)
private static final emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify();
}
public static emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<AchievementUpdateNotify>
PARSER = new com.google.protobuf.AbstractParser<AchievementUpdateNotify>() {
@java.lang.Override
public AchievementUpdateNotify parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new AchievementUpdateNotify(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<AchievementUpdateNotify> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<AchievementUpdateNotify> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass.AchievementUpdateNotify getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_AchievementUpdateNotify_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_AchievementUpdateNotify_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\035AchievementUpdateNotify.proto\032\021Achieve" +
"ment.proto\"\221\001\n\027AchievementUpdateNotify\022%" +
"\n\017achievementList\030\004 \003(\0132\014.Achievement\"O\n" +
"\013LKDGLEKOFGN\022\010\n\004NONE\020\000\022\020\n\013PEPPOHPHJOJ\020\207\025" +
"\022\017\n\013DCDNILFDFLB\020\000\022\017\n\013NNBKOLMPOEA\020\001\032\002\020\001B\033" +
"\n\031emu.grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
emu.grasscutter.net.proto.AchievementOuterClass.getDescriptor(),
});
internal_static_AchievementUpdateNotify_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_AchievementUpdateNotify_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_AchievementUpdateNotify_descriptor,
new java.lang.String[] { "AchievementList", });
emu.grasscutter.net.proto.AchievementOuterClass.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,164 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: Status.proto
package emu.grasscutter.net.proto;
public final class StatusOuterClass {
private StatusOuterClass() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
/**
* Protobuf enum {@code Status}
*/
public enum Status
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>STATUS_INVALID = 0;</code>
*/
STATUS_INVALID(0),
/**
* <code>STATUS_UNFINISHED = 1;</code>
*/
STATUS_UNFINISHED(1),
/**
* <code>STATUS_FINISHED = 2;</code>
*/
STATUS_FINISHED(2),
/**
* <code>STATUS_REWARD_TAKEN = 3;</code>
*/
STATUS_REWARD_TAKEN(3),
UNRECOGNIZED(-1),
;
/**
* <code>STATUS_INVALID = 0;</code>
*/
public static final int STATUS_INVALID_VALUE = 0;
/**
* <code>STATUS_UNFINISHED = 1;</code>
*/
public static final int STATUS_UNFINISHED_VALUE = 1;
/**
* <code>STATUS_FINISHED = 2;</code>
*/
public static final int STATUS_FINISHED_VALUE = 2;
/**
* <code>STATUS_REWARD_TAKEN = 3;</code>
*/
public static final int STATUS_REWARD_TAKEN_VALUE = 3;
public final int getNumber() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static Status valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static Status forNumber(int value) {
switch (value) {
case 0: return STATUS_INVALID;
case 1: return STATUS_UNFINISHED;
case 2: return STATUS_FINISHED;
case 3: return STATUS_REWARD_TAKEN;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<Status>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
Status> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<Status>() {
public Status findValueByNumber(int number) {
return Status.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (this == UNRECOGNIZED) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(ordinal());
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return emu.grasscutter.net.proto.StatusOuterClass.getDescriptor().getEnumTypes().get(0);
}
private static final Status[] VALUES = values();
public static Status valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int value;
private Status(int value) {
this.value = value;
}
// @@protoc_insertion_point(enum_scope:Status)
}
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n\014Status.proto*a\n\006Status\022\022\n\016STATUS_INVAL" +
"ID\020\000\022\025\n\021STATUS_UNFINISHED\020\001\022\023\n\017STATUS_FI" +
"NISHED\020\002\022\027\n\023STATUS_REWARD_TAKEN\020\003B\033\n\031emu" +
".grasscutter.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,805 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TakeAchievementGoalRewardReq.proto
package emu.grasscutter.net.proto;
public final class TakeAchievementGoalRewardReqOuterClass {
private TakeAchievementGoalRewardReqOuterClass() {}
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 TakeAchievementGoalRewardReqOrBuilder extends
// @@protoc_insertion_point(interface_extends:TakeAchievementGoalRewardReq)
com.google.protobuf.MessageOrBuilder {
/**
* <code>repeated uint32 idList = 7;</code>
* @return A list containing the idList.
*/
java.util.List<java.lang.Integer> getIdListList();
/**
* <code>repeated uint32 idList = 7;</code>
* @return The count of idList.
*/
int getIdListCount();
/**
* <code>repeated uint32 idList = 7;</code>
* @param index The index of the element to return.
* @return The idList at the given index.
*/
int getIdList(int index);
}
/**
* Protobuf type {@code TakeAchievementGoalRewardReq}
*/
public static final class TakeAchievementGoalRewardReq extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:TakeAchievementGoalRewardReq)
TakeAchievementGoalRewardReqOrBuilder {
private static final long serialVersionUID = 0L;
// Use TakeAchievementGoalRewardReq.newBuilder() to construct.
private TakeAchievementGoalRewardReq(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
super(builder);
}
private TakeAchievementGoalRewardReq() {
idList_ = emptyIntList();
}
@java.lang.Override
@SuppressWarnings({"unused"})
protected java.lang.Object newInstance(
UnusedPrivateParameter unused) {
return new TakeAchievementGoalRewardReq();
}
@java.lang.Override
public final com.google.protobuf.UnknownFieldSet
getUnknownFields() {
return this.unknownFields;
}
private TakeAchievementGoalRewardReq(
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 56: {
if (!((mutable_bitField0_ & 0x00000001) != 0)) {
idList_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
idList_.addInt(input.readUInt32());
break;
}
case 58: {
int length = input.readRawVarint32();
int limit = input.pushLimit(length);
if (!((mutable_bitField0_ & 0x00000001) != 0) && input.getBytesUntilLimit() > 0) {
idList_ = newIntList();
mutable_bitField0_ |= 0x00000001;
}
while (input.getBytesUntilLimit() > 0) {
idList_.addInt(input.readUInt32());
}
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 (java.io.IOException e) {
throw new com.google.protobuf.InvalidProtocolBufferException(
e).setUnfinishedMessage(this);
} finally {
if (((mutable_bitField0_ & 0x00000001) != 0)) {
idList_.makeImmutable(); // C
}
this.unknownFields = unknownFields.build();
makeExtensionsImmutable();
}
}
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.internal_static_TakeAchievementGoalRewardReq_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.internal_static_TakeAchievementGoalRewardReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.class, emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.Builder.class);
}
/**
* Protobuf enum {@code TakeAchievementGoalRewardReq.DOKFANBCKNJ}
*/
public enum DOKFANBCKNJ
implements com.google.protobuf.ProtocolMessageEnum {
/**
* <code>NONE = 0;</code>
*/
NONE(0, 0),
/**
* <code>PEPPOHPHJOJ = 2669;</code>
*/
PEPPOHPHJOJ(1, 2669),
/**
* <code>NNBKOLMPOEA = 1;</code>
*/
NNBKOLMPOEA(3, 1),
UNRECOGNIZED(-1, -1),
;
/**
* <code>DCDNILFDFLB = 0;</code>
*/
public static final DOKFANBCKNJ DCDNILFDFLB = NONE;
/**
* <code>EAJIABGAOCI = 1;</code>
*/
public static final DOKFANBCKNJ EAJIABGAOCI = NNBKOLMPOEA;
/**
* <code>NONE = 0;</code>
*/
public static final int NONE_VALUE = 0;
/**
* <code>PEPPOHPHJOJ = 2669;</code>
*/
public static final int PEPPOHPHJOJ_VALUE = 2669;
/**
* <code>DCDNILFDFLB = 0;</code>
*/
public static final int DCDNILFDFLB_VALUE = 0;
/**
* <code>NNBKOLMPOEA = 1;</code>
*/
public static final int NNBKOLMPOEA_VALUE = 1;
/**
* <code>EAJIABGAOCI = 1;</code>
*/
public static final int EAJIABGAOCI_VALUE = 1;
public final int getNumber() {
if (index == -1) {
throw new java.lang.IllegalArgumentException(
"Can't get the number of an unknown enum value.");
}
return value;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
* @deprecated Use {@link #forNumber(int)} instead.
*/
@java.lang.Deprecated
public static DOKFANBCKNJ valueOf(int value) {
return forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value.
*/
public static DOKFANBCKNJ forNumber(int value) {
switch (value) {
case 0: return NONE;
case 2669: return PEPPOHPHJOJ;
case 1: return NNBKOLMPOEA;
default: return null;
}
}
public static com.google.protobuf.Internal.EnumLiteMap<DOKFANBCKNJ>
internalGetValueMap() {
return internalValueMap;
}
private static final com.google.protobuf.Internal.EnumLiteMap<
DOKFANBCKNJ> internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<DOKFANBCKNJ>() {
public DOKFANBCKNJ findValueByNumber(int number) {
return DOKFANBCKNJ.forNumber(number);
}
};
public final com.google.protobuf.Descriptors.EnumValueDescriptor
getValueDescriptor() {
if (index == -1) {
throw new java.lang.IllegalStateException(
"Can't get the descriptor of an unrecognized enum value.");
}
return getDescriptor().getValues().get(index);
}
public final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptorForType() {
return getDescriptor();
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.getDescriptor().getEnumTypes().get(0);
}
private static final DOKFANBCKNJ[] VALUES = getStaticValuesArray();
private static DOKFANBCKNJ[] getStaticValuesArray() {
return new DOKFANBCKNJ[] {
NONE, PEPPOHPHJOJ, DCDNILFDFLB, NNBKOLMPOEA, EAJIABGAOCI,
};
}
public static DOKFANBCKNJ valueOf(
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
if (desc.getType() != getDescriptor()) {
throw new java.lang.IllegalArgumentException(
"EnumValueDescriptor is not for this type.");
}
if (desc.getIndex() == -1) {
return UNRECOGNIZED;
}
return VALUES[desc.getIndex()];
}
private final int index;
private final int value;
private DOKFANBCKNJ(int index, int value) {
this.index = index;
this.value = value;
}
// @@protoc_insertion_point(enum_scope:TakeAchievementGoalRewardReq.DOKFANBCKNJ)
}
public static final int IDLIST_FIELD_NUMBER = 7;
private com.google.protobuf.Internal.IntList idList_;
/**
* <code>repeated uint32 idList = 7;</code>
* @return A list containing the idList.
*/
@java.lang.Override
public java.util.List<java.lang.Integer>
getIdListList() {
return idList_;
}
/**
* <code>repeated uint32 idList = 7;</code>
* @return The count of idList.
*/
public int getIdListCount() {
return idList_.size();
}
/**
* <code>repeated uint32 idList = 7;</code>
* @param index The index of the element to return.
* @return The idList at the given index.
*/
public int getIdList(int index) {
return idList_.getInt(index);
}
private int idListMemoizedSerializedSize = -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 (getIdListList().size() > 0) {
output.writeUInt32NoTag(58);
output.writeUInt32NoTag(idListMemoizedSerializedSize);
}
for (int i = 0; i < idList_.size(); i++) {
output.writeUInt32NoTag(idList_.getInt(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 < idList_.size(); i++) {
dataSize += com.google.protobuf.CodedOutputStream
.computeUInt32SizeNoTag(idList_.getInt(i));
}
size += dataSize;
if (!getIdListList().isEmpty()) {
size += 1;
size += com.google.protobuf.CodedOutputStream
.computeInt32SizeNoTag(dataSize);
}
idListMemoizedSerializedSize = 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 emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq)) {
return super.equals(obj);
}
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq other = (emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq) obj;
if (!getIdListList()
.equals(other.getIdListList())) 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 (getIdListCount() > 0) {
hash = (37 * hash) + IDLIST_FIELD_NUMBER;
hash = (53 * hash) + getIdListList().hashCode();
}
hash = (29 * hash) + unknownFields.hashCode();
memoizedHashCode = hash;
return hash;
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
java.nio.ByteBuffer data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
java.nio.ByteBuffer data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
com.google.protobuf.ByteString data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(byte[] data)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
byte[] data,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return PARSER.parseFrom(data, extensionRegistry);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseDelimitedFrom(java.io.InputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseDelimitedFrom(
java.io.InputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
com.google.protobuf.CodedInputStream input)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input);
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parseFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
return com.google.protobuf.GeneratedMessageV3
.parseWithIOException(PARSER, input, extensionRegistry);
}
@java.lang.Override
public Builder newBuilderForType() { return newBuilder(); }
public static Builder newBuilder() {
return DEFAULT_INSTANCE.toBuilder();
}
public static Builder newBuilder(emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq prototype) {
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
}
@java.lang.Override
public Builder toBuilder() {
return this == DEFAULT_INSTANCE
? new Builder() : new Builder().mergeFrom(this);
}
@java.lang.Override
protected Builder newBuilderForType(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
Builder builder = new Builder(parent);
return builder;
}
/**
* Protobuf type {@code TakeAchievementGoalRewardReq}
*/
public static final class Builder extends
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
// @@protoc_insertion_point(builder_implements:TakeAchievementGoalRewardReq)
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReqOrBuilder {
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.internal_static_TakeAchievementGoalRewardReq_descriptor;
}
@java.lang.Override
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internalGetFieldAccessorTable() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.internal_static_TakeAchievementGoalRewardReq_fieldAccessorTable
.ensureFieldAccessorsInitialized(
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.class, emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.Builder.class);
}
// Construct using emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.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();
idList_ = emptyIntList();
bitField0_ = (bitField0_ & ~0x00000001);
return this;
}
@java.lang.Override
public com.google.protobuf.Descriptors.Descriptor
getDescriptorForType() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.internal_static_TakeAchievementGoalRewardReq_descriptor;
}
@java.lang.Override
public emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq getDefaultInstanceForType() {
return emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.getDefaultInstance();
}
@java.lang.Override
public emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq build() {
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result);
}
return result;
}
@java.lang.Override
public emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq buildPartial() {
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq result = new emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq(this);
int from_bitField0_ = bitField0_;
if (((bitField0_ & 0x00000001) != 0)) {
idList_.makeImmutable();
bitField0_ = (bitField0_ & ~0x00000001);
}
result.idList_ = idList_;
onBuilt();
return result;
}
@java.lang.Override
public Builder clone() {
return super.clone();
}
@java.lang.Override
public Builder setField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.setField(field, value);
}
@java.lang.Override
public Builder clearField(
com.google.protobuf.Descriptors.FieldDescriptor field) {
return super.clearField(field);
}
@java.lang.Override
public Builder clearOneof(
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
return super.clearOneof(oneof);
}
@java.lang.Override
public Builder setRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
int index, java.lang.Object value) {
return super.setRepeatedField(field, index, value);
}
@java.lang.Override
public Builder addRepeatedField(
com.google.protobuf.Descriptors.FieldDescriptor field,
java.lang.Object value) {
return super.addRepeatedField(field, value);
}
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq) {
return mergeFrom((emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq)other);
} else {
super.mergeFrom(other);
return this;
}
}
public Builder mergeFrom(emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq other) {
if (other == emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.getDefaultInstance()) return this;
if (!other.idList_.isEmpty()) {
if (idList_.isEmpty()) {
idList_ = other.idList_;
bitField0_ = (bitField0_ & ~0x00000001);
} else {
ensureIdListIsMutable();
idList_.addAll(other.idList_);
}
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 {
emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq parsedMessage = null;
try {
parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
parsedMessage = (emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
if (parsedMessage != null) {
mergeFrom(parsedMessage);
}
}
return this;
}
private int bitField0_;
private com.google.protobuf.Internal.IntList idList_ = emptyIntList();
private void ensureIdListIsMutable() {
if (!((bitField0_ & 0x00000001) != 0)) {
idList_ = mutableCopy(idList_);
bitField0_ |= 0x00000001;
}
}
/**
* <code>repeated uint32 idList = 7;</code>
* @return A list containing the idList.
*/
public java.util.List<java.lang.Integer>
getIdListList() {
return ((bitField0_ & 0x00000001) != 0) ?
java.util.Collections.unmodifiableList(idList_) : idList_;
}
/**
* <code>repeated uint32 idList = 7;</code>
* @return The count of idList.
*/
public int getIdListCount() {
return idList_.size();
}
/**
* <code>repeated uint32 idList = 7;</code>
* @param index The index of the element to return.
* @return The idList at the given index.
*/
public int getIdList(int index) {
return idList_.getInt(index);
}
/**
* <code>repeated uint32 idList = 7;</code>
* @param index The index to set the value at.
* @param value The idList to set.
* @return This builder for chaining.
*/
public Builder setIdList(
int index, int value) {
ensureIdListIsMutable();
idList_.setInt(index, value);
onChanged();
return this;
}
/**
* <code>repeated uint32 idList = 7;</code>
* @param value The idList to add.
* @return This builder for chaining.
*/
public Builder addIdList(int value) {
ensureIdListIsMutable();
idList_.addInt(value);
onChanged();
return this;
}
/**
* <code>repeated uint32 idList = 7;</code>
* @param values The idList to add.
* @return This builder for chaining.
*/
public Builder addAllIdList(
java.lang.Iterable<? extends java.lang.Integer> values) {
ensureIdListIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, idList_);
onChanged();
return this;
}
/**
* <code>repeated uint32 idList = 7;</code>
* @return This builder for chaining.
*/
public Builder clearIdList() {
idList_ = emptyIntList();
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:TakeAchievementGoalRewardReq)
}
// @@protoc_insertion_point(class_scope:TakeAchievementGoalRewardReq)
private static final emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq DEFAULT_INSTANCE;
static {
DEFAULT_INSTANCE = new emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq();
}
public static emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq getDefaultInstance() {
return DEFAULT_INSTANCE;
}
private static final com.google.protobuf.Parser<TakeAchievementGoalRewardReq>
PARSER = new com.google.protobuf.AbstractParser<TakeAchievementGoalRewardReq>() {
@java.lang.Override
public TakeAchievementGoalRewardReq parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
return new TakeAchievementGoalRewardReq(input, extensionRegistry);
}
};
public static com.google.protobuf.Parser<TakeAchievementGoalRewardReq> parser() {
return PARSER;
}
@java.lang.Override
public com.google.protobuf.Parser<TakeAchievementGoalRewardReq> getParserForType() {
return PARSER;
}
@java.lang.Override
public emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq getDefaultInstanceForType() {
return DEFAULT_INSTANCE;
}
}
private static final com.google.protobuf.Descriptors.Descriptor
internal_static_TakeAchievementGoalRewardReq_descriptor;
private static final
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
internal_static_TakeAchievementGoalRewardReq_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\"TakeAchievementGoalRewardReq.proto\"\220\001\n" +
"\034TakeAchievementGoalRewardReq\022\016\n\006idList\030" +
"\007 \003(\r\"`\n\013DOKFANBCKNJ\022\010\n\004NONE\020\000\022\020\n\013PEPPOH" +
"PHJOJ\020\355\024\022\017\n\013DCDNILFDFLB\020\000\022\017\n\013NNBKOLMPOEA" +
"\020\001\022\017\n\013EAJIABGAOCI\020\001\032\002\020\001B\033\n\031emu.grasscutt" +
"er.net.protob\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
});
internal_static_TakeAchievementGoalRewardReq_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_TakeAchievementGoalRewardReq_fieldAccessorTable = new
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
internal_static_TakeAchievementGoalRewardReq_descriptor,
new java.lang.String[] { "IdList", });
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -0,0 +1,130 @@
package emu.grasscutter.command.commands;
import emu.grasscutter.command.Command;
import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.AchievementData;
import emu.grasscutter.game.achievement.AchievementControlReturns;
import emu.grasscutter.game.achievement.Achievements;
import emu.grasscutter.game.player.Player;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicInteger;
@Command(
label = "achievement",
usage = {"(grant|revoke) <achievementId>", "progress <achievementId> <progress>", "grantall", "revokeall"},
aliases = {"am"},
permission = "player.achievement",
permissionTargeted = "player.achievement.others",
targetRequirement = Command.TargetRequirement.PLAYER,
threading = true)
public class AchievementCommand implements CommandHandler {
@Override
public void execute(Player sender, Player targetPlayer, List<String> args) {
if (args.size() < 1) {
this.sendUsageMessage(sender);
return;
}
var command = args.remove(0).toLowerCase();
var achievements = Achievements.getByPlayer(targetPlayer);
switch (command) {
case "grant" -> this.grant(sender, targetPlayer, achievements, args);
case "revoke" -> this.revoke(sender, targetPlayer, achievements, args);
case "progress" -> this.progress(sender, targetPlayer, achievements, args);
case "grantall" -> grantAll(sender, targetPlayer, achievements);
case "revokeall" -> revokeAll(sender, targetPlayer, achievements);
default -> this.sendUsageMessage(sender);
}
}
private void grant(Player sender, Player targetPlayer, Achievements achievements, List<String> args) {
if (args.size() < 1) {
this.sendUsageMessage(sender);
}
parseInt(args.remove(0)).ifPresentOrElse(integer -> {
var ret = achievements.grant(integer);
switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage(sender, "grant", targetPlayer.getNickname());
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(sender, ret.getRet().getKey());
case ALREADY_ACHIEVED -> CommandHandler.sendTranslatedMessage(sender, ret.getRet().getKey(), targetPlayer.getNickname());
}
}, () -> this.sendUsageMessage(sender));
}
private void revoke(Player sender, Player targetPlayer, Achievements achievements, List<String> args) {
if (args.size() < 1) {
this.sendUsageMessage(sender);
}
parseInt(args.remove(0)).ifPresentOrElse(integer -> {
var ret = achievements.revoke(integer);
switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage(sender, "revoke", targetPlayer.getNickname());
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(sender, ret.getRet().getKey());
case NOT_YET_ACHIEVED -> CommandHandler.sendTranslatedMessage(sender, ret.getRet().getKey(), targetPlayer.getNickname());
}
}, () -> this.sendUsageMessage(sender));
}
private void progress(Player sender, Player targetPlayer, Achievements achievements, List<String> args) {
if (args.size() < 2) {
this.sendUsageMessage(sender);
}
parseInt(args.remove(0)).ifPresentOrElse(integer -> {
parseInt(args.remove(0)).ifPresentOrElse(progress -> {
var ret = achievements.progress(integer, progress);
switch (ret.getRet()) {
case SUCCESS -> sendSuccessMessage(sender, "progress", targetPlayer.getNickname(), integer, progress);
case ACHIEVEMENT_NOT_FOUND -> CommandHandler.sendTranslatedMessage(sender, ret.getRet().getKey());
}
}, () -> this.sendUsageMessage(sender));
}, () -> this.sendUsageMessage(sender));
}
private static void sendSuccessMessage(Player sender, String cmd, Object... args) {
CommandHandler.sendTranslatedMessage(sender, AchievementControlReturns.Return.SUCCESS.getKey() + cmd, args);
}
private static Optional<Integer> parseInt(String s) {
try {
return Optional.of(Integer.parseInt(s));
} catch (NumberFormatException e) {
return Optional.empty();
}
}
private static void grantAll(Player sender, Player targetPlayer, Achievements achievements) {
var counter = new AtomicInteger();
GameData.getAchievementDataMap().values().stream()
.filter(AchievementData::isUsed)
.filter(AchievementData::isParent)
.forEach(data -> {
var success = achievements.grant(data.getId());
if (success.getRet() == AchievementControlReturns.Return.SUCCESS) {
counter.addAndGet(success.getChangedAchievementStatusNum());
}
});
sendSuccessMessage(sender, "grantall", counter.intValue(), targetPlayer.getNickname());
}
private static void revokeAll(Player sender, Player targetPlayer, Achievements achievements) {
var counter = new AtomicInteger();
GameData.getAchievementDataMap().values().stream()
.filter(AchievementData::isUsed)
.filter(AchievementData::isParent)
.forEach(data -> {
var success = achievements.revoke(data.getId());
if (success.getRet() == AchievementControlReturns.Return.SUCCESS) {
counter.addAndGet(success.getChangedAchievementStatusNum());
}
});
sendSuccessMessage(sender, "revokeall", counter.intValue(), targetPlayer.getNickname());
}
}

View File

@ -41,6 +41,8 @@ public class GameData {
// ExcelConfigs
@Getter private static final ArrayList<CodexReliquaryData> codexReliquaryArrayList = new ArrayList<>();
private static final Int2ObjectMap<AchievementData> achievementDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<AchievementGoalData> achievementGoalDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<ActivityData> activityDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<ActivityShopData> activityShopDataMap = new Int2ObjectOpenHashMap<>();
@Getter private static final Int2ObjectMap<ActivityWatcherData> activityWatcherDataMap = new Int2ObjectOpenHashMap<>();
@ -233,4 +235,9 @@ public class GameData {
return shopGoods;
}
public static Int2ObjectMap<AchievementData> getAchievementDataMap() {
AchievementData.divideIntoGroups();
return achievementDataMap;
}
}

View File

@ -0,0 +1,96 @@
package emu.grasscutter.data.excels;
import com.github.davidmoten.guavamini.Lists;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import lombok.Getter;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
@Getter
@ResourceType(name = "AchievementExcelConfigData.json")
public class AchievementData extends GameResource {
private static final AtomicBoolean isDivided = new AtomicBoolean();
private int goalId;
private int preStageAchievementId;
private Set<Integer> groupAchievementIdList = new HashSet<>();
private boolean isParent;
private long titleTextMapHash;
private long descTextMapHash;
private int finishRewardId;
private boolean isDeleteWatcherAfterFinish;
private int id;
private BattlePassMissionData.TriggerConfig triggerConfig;
private int progress;
private boolean isDisuse;
public boolean hasPreStageAchievement() {
return this.preStageAchievementId != 0;
}
public boolean hasGroupAchievements() {
return !this.groupAchievementIdList.isEmpty();
}
public boolean isUsed() {
return !this.isDisuse;
}
public Set<Integer> getGroupAchievementIdList() {
return this.groupAchievementIdList.stream().collect(Collectors.toUnmodifiableSet());
}
public Set<Integer> getExcludedGroupAchievementIdList() {
return this.groupAchievementIdList.stream().filter(integer -> integer != this.getId()).collect(Collectors.toUnmodifiableSet());
}
public static void divideIntoGroups() {
if (isDivided.get()) {
return;
}
isDivided.set(true);
var map = GameData.getAchievementDataMap();
var achievementDataList = map.values().stream().filter(AchievementData::isUsed).toList();
for (var data : achievementDataList) {
if (!data.hasPreStageAchievement() || data.hasGroupAchievements()) {
continue;
}
List<Integer> ids = Lists.newArrayList();
int parentId = data.getId();
while (true) {
var next = map.get(parentId + 1);
if (next == null || parentId != next.getPreStageAchievementId()) {
break;
}
parentId++;
}
map.get(parentId).isParent = true;
while (true) {
ids.add(parentId);
var previous = map.get(--parentId);
if (previous == null) {
break;
} else if (!previous.hasPreStageAchievement()) {
ids.add(parentId);
break;
}
}
for (int i : ids) {
map.get(i).groupAchievementIdList.addAll(ids);
}
}
map.values().stream().filter(a -> !a.hasGroupAchievements() && a.isUsed()).forEach(a -> a.isParent = true);
}
}

View File

@ -0,0 +1,13 @@
package emu.grasscutter.data.excels;
import emu.grasscutter.data.GameResource;
import emu.grasscutter.data.ResourceType;
import lombok.Getter;
@Getter
@ResourceType(name = "AchievementGoalExcelConfigData.json")
public class AchievementGoalData extends GameResource {
private int id;
private long nameTextMapHash;
private int finishRewardId;
}

View File

@ -11,6 +11,7 @@ import dev.morphia.query.experimental.filters.Filters;
import emu.grasscutter.GameConstants;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.game.Account;
import emu.grasscutter.game.achievement.Achievements;
import emu.grasscutter.game.activity.PlayerActivityData;
import emu.grasscutter.game.activity.musicgame.MusicGameBeatmap;
import emu.grasscutter.game.avatar.Avatar;
@ -133,6 +134,7 @@ public final class DatabaseHelper {
}
int uid = player.getUid();
// Delete data from collections
DatabaseManager.getGameDatabase().getCollection("achievements").deleteMany(eq("uid", uid));
DatabaseManager.getGameDatabase().getCollection("activities").deleteMany(eq("uid", uid));
DatabaseManager.getGameDatabase().getCollection("homes").deleteMany(eq("ownerUid", uid));
DatabaseManager.getGameDatabase().getCollection("mail").deleteMany(eq("ownerUid", uid));
@ -359,4 +361,14 @@ public final class DatabaseHelper {
public static void saveMusicGameBeatmap(MusicGameBeatmap musicGameBeatmap) {
DatabaseManager.getGameDatastore().save(musicGameBeatmap);
}
public static Achievements getAchievementData(int uid) {
return DatabaseManager.getGameDatastore().find(Achievements.class)
.filter(Filters.and(Filters.eq("uid", uid)))
.first();
}
public static void saveAchievementData(Achievements achievements) {
DatabaseManager.getGameDatastore().save(achievements);
}
}

View File

@ -0,0 +1,38 @@
package emu.grasscutter.game.achievement;
import dev.morphia.annotations.Entity;
import emu.grasscutter.net.proto.AchievementOuterClass;
import emu.grasscutter.net.proto.StatusOuterClass;
import lombok.Getter;
import lombok.Setter;
@Entity
@Getter
public class Achievement {
@Setter
private StatusOuterClass.Status status;
private int id;
private int totalProgress;
@Setter
private int curProgress;
@Setter
private int finishTimestampSec;
public Achievement(StatusOuterClass.Status status, int id, int totalProgress, int curProgress, int finishTimestampSec) {
this.status = status;
this.id = id;
this.totalProgress = totalProgress;
this.curProgress = curProgress;
this.finishTimestampSec = finishTimestampSec;
}
public AchievementOuterClass.Achievement toProto() {
return AchievementOuterClass.Achievement.newBuilder()
.setStatus(this.getStatus())
.setId(this.getId())
.setTotalProgress(this.getTotalProgress())
.setCurProgress(this.getCurProgress())
.setFinishTimestamp(this.getFinishTimestampSec())
.build();
}
}

View File

@ -0,0 +1,48 @@
package emu.grasscutter.game.achievement;
import lombok.Getter;
@Getter
public class AchievementControlReturns {
private final Return ret;
private final int changedAchievementStatusNum;
private AchievementControlReturns(Return ret) {
this(ret, 0);
}
private AchievementControlReturns(Return ret, int changedAchievementStatusNum) {
this.ret = ret;
this.changedAchievementStatusNum = changedAchievementStatusNum;
}
public static AchievementControlReturns success(int changedAchievementStatusNum) {
return new AchievementControlReturns(Return.SUCCESS, changedAchievementStatusNum);
}
public static AchievementControlReturns achievementNotFound() {
return new AchievementControlReturns(Return.ACHIEVEMENT_NOT_FOUND);
}
public static AchievementControlReturns alreadyAchieved() {
return new AchievementControlReturns(Return.ALREADY_ACHIEVED);
}
public static AchievementControlReturns notYetAchieved() {
return new AchievementControlReturns(Return.NOT_YET_ACHIEVED);
}
public enum Return {
SUCCESS("commands.achievement.success."),
ACHIEVEMENT_NOT_FOUND("commands.achievement.fail.achievement_not_found"),
ALREADY_ACHIEVED("commands.achievement.fail.already_achieved"),
NOT_YET_ACHIEVED("commands.achievement.fail.not_yet_achieved");
@Getter
private final String key;
Return(String key) {
this.key = key;
}
}
}

View File

@ -0,0 +1,290 @@
package emu.grasscutter.game.achievement;
import com.github.davidmoten.guavamini.Lists;
import dev.morphia.annotations.Entity;
import dev.morphia.annotations.Id;
import dev.morphia.annotations.Transient;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.excels.AchievementData;
import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.inventory.GameItem;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.game.props.ActionReason;
import emu.grasscutter.net.proto.StatusOuterClass;
import emu.grasscutter.server.packet.send.PacketAchievementAllDataNotify;
import emu.grasscutter.server.packet.send.PacketAchievementUpdateNotify;
import emu.grasscutter.server.packet.send.PacketTakeAchievementGoalRewardRsp;
import emu.grasscutter.server.packet.send.PacketTakeAchievementRewardRsp;
import lombok.Builder;
import lombok.Data;
import lombok.Getter;
import org.bson.types.ObjectId;
import javax.annotation.Nullable;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.IntSupplier;
@Entity("achievements")
@Data
@Builder(builderMethodName = "of")
public class Achievements {
private static final IntSupplier currentTimeSecs = () -> (int) (System.currentTimeMillis() / 1000L);
private static final Achievement INVALID = new Achievement(StatusOuterClass.Status.STATUS_INVALID, -1, 0, 0, 0);
@Id
private ObjectId id;
private int uid;
@Transient
private Player player;
private Map<Integer, Achievement> achievementList;
@Getter
private int finishedAchievementNum;
private List<Integer> takenGoalRewardIdList;
public static Achievements getByPlayer(Player player) {
var achievements = player.getAchievements() == null ? DatabaseHelper.getAchievementData(player.getUid()) : player.getAchievements();
if (achievements == null) {
achievements = create(player.getUid());
}
return achievements;
}
public static Achievements create(int uid) {
var newAchievement = Achievements.of()
.uid(uid)
.achievementList(init())
.finishedAchievementNum(0)
.takenGoalRewardIdList(Lists.newArrayList())
.build();
newAchievement.save();
return newAchievement;
}
private static Map<Integer, Achievement> init() {
Map<Integer, Achievement> map = new HashMap<>();
GameData.getAchievementDataMap().values().stream()
.filter(AchievementData::isUsed)
.forEach(a -> {
map.put(a.getId(), new Achievement(StatusOuterClass.Status.STATUS_UNFINISHED, a.getId(), a.getProgress(), 0, 0));
});
return map;
}
public AchievementControlReturns grant(int achievementId) {
var a = this.getAchievement(achievementId);
if (a == null || this.isFinished(achievementId)) {
return a == null ? AchievementControlReturns.achievementNotFound() : AchievementControlReturns.alreadyAchieved();
}
return this.progress(achievementId, a.getTotalProgress());
}
public AchievementControlReturns revoke(int achievementId) {
var a = this.getAchievement(achievementId);
if (a == null || !this.isFinished(achievementId)) {
return a == null ? AchievementControlReturns.achievementNotFound() : AchievementControlReturns.notYetAchieved();
}
return this.progress(achievementId, 0);
}
public AchievementControlReturns progress(int achievementId, int progress) {
var a = this.getAchievement(achievementId);
if (a == null) {
return AchievementControlReturns.achievementNotFound();
}
a.setCurProgress(progress);
return AchievementControlReturns.success(this.notifyOtherAchievements(a));
}
private int notifyOtherAchievements(Achievement a) {
var changedNum = new AtomicInteger();
changedNum.addAndGet(this.update(a) ? 1 : 0);
GameData.getAchievementDataMap().get(a.getId())
.getExcludedGroupAchievementIdList().stream()
.map(this::getAchievement)
.filter(Objects::nonNull)
.forEach(other -> {
other.setCurProgress(a.getCurProgress());
changedNum.addAndGet(this.update(other) ? 1 : 0);
});
this.computeFinishedAchievementNum();
this.save();
this.sendUpdatePacket(a);
return changedNum.intValue();
}
private boolean update(Achievement a) {
if (a.getStatus() == StatusOuterClass.Status.STATUS_UNFINISHED && a.getCurProgress() >= a.getTotalProgress()) {
a.setStatus(StatusOuterClass.Status.STATUS_FINISHED);
a.setFinishTimestampSec(currentTimeSecs.getAsInt());
return true;
} else if (this.isFinished(a.getId()) && a.getCurProgress() < a.getTotalProgress()) {
a.setStatus(StatusOuterClass.Status.STATUS_UNFINISHED);
a.setFinishTimestampSec(0);
return true;
}
return false;
}
private void computeFinishedAchievementNum() {
this.finishedAchievementNum = GameData.getAchievementDataMap().values().stream()
.filter(a -> this.isFinished(a.getId()))
.mapToInt(value -> 1)
.sum();
}
private void sendUpdatePacket(Achievement achievement) {
List<Achievement> achievements = Lists.newArrayList(achievement);
achievements.addAll(GameData.getAchievementDataMap().get(achievement.getId())
.getExcludedGroupAchievementIdList()
.stream().map(this::getAchievement)
.filter(Objects::nonNull)
.toList()
);
this.sendUpdatePacket(achievements);
}
private void sendUpdatePacket(List<Achievement> achievement) {
if (this.isPacketSendable()) {
this.player.sendPacket(new PacketAchievementUpdateNotify(achievement));
}
}
@Nullable
public Achievement getAchievement(int achievementId) {
if (this.isInvalid(achievementId)) {
return null;
}
return this.getAchievementList().computeIfAbsent(achievementId, id -> {
return new Achievement(StatusOuterClass.Status.STATUS_UNFINISHED, id, GameData.getAchievementDataMap().get(id.intValue()).getProgress(), 0, 0);
});
}
public boolean isInvalid(int achievementId) {
var data = GameData.getAchievementDataMap().get(achievementId);
return data == null || data.isDisuse();
}
public StatusOuterClass.Status getStatus(int achievementId) {
return this.getAchievementList().getOrDefault(achievementId, INVALID).getStatus();
}
public boolean isFinished(int achievementId) {
var status = this.getStatus(achievementId);
return status == StatusOuterClass.Status.STATUS_FINISHED || status == StatusOuterClass.Status.STATUS_REWARD_TAKEN;
}
public void takeReward(List<Integer> ids) {
List<GameItem> rewards = Lists.newArrayList();
for (int i : ids) {
var target = GameData.getAchievementDataMap().get(i);
if (target == null) {
Grasscutter.getLogger().warn("null returned while taking reward!");
return;
}
if (this.isRewardTaken(i)) {
this.player.sendPacket(new PacketTakeAchievementRewardRsp());
return;
}
var data = GameData.getRewardDataMap().get(target.getFinishRewardId());
if (data == null) {
Grasscutter.getLogger().warn("null returned while getting reward data!");
continue;
}
data.getRewardItemList().forEach(itemParamData -> {
var itemData = GameData.getItemDataMap().get(itemParamData.getId());
if (itemData == null) {
Grasscutter.getLogger().warn("itemData == null!");
return;
}
rewards.add(new GameItem(itemData, itemParamData.getCount()));
});
var a = this.getAchievement(i);
a.setStatus(StatusOuterClass.Status.STATUS_REWARD_TAKEN);
this.save();
this.sendUpdatePacket(a);
}
this.player.getInventory().addItems(rewards, ActionReason.AchievementReward);
this.player.sendPacket(new PacketTakeAchievementRewardRsp(ids, rewards.stream().map(GameItem::toItemParam).toList()));
}
public void takeGoalReward(List<Integer> ids) {
List<GameItem> rewards = Lists.newArrayList();
for (int i : ids) {
if (this.takenGoalRewardIdList.contains(i)) {
this.player.sendPacket(new PacketTakeAchievementGoalRewardRsp());
}
var goalData = GameData.getAchievementGoalDataMap().get(i);
if (goalData == null) {
Grasscutter.getLogger().warn("null returned while getting goal reward data!");
continue;
}
var data = GameData.getRewardDataMap().get(goalData.getFinishRewardId());
if (data == null) {
Grasscutter.getLogger().warn("null returned while getting reward data!");
continue;
}
data.getRewardItemList().forEach(itemParamData -> {
var itemData = GameData.getItemDataMap().get(itemParamData.getId());
if (itemData == null) {
Grasscutter.getLogger().warn("itemData == null!");
return;
}
rewards.add(new GameItem(itemData, itemParamData.getCount()));
});
this.takenGoalRewardIdList.add(i);
this.save();
}
this.player.getInventory().addItems(rewards, ActionReason.AchievementGoalReward);
this.player.sendPacket(new PacketTakeAchievementGoalRewardRsp(ids, rewards.stream().map(GameItem::toItemParam).toList()));
}
public boolean isRewardTaken(int achievementId) {
return this.getStatus(achievementId) == StatusOuterClass.Status.STATUS_REWARD_TAKEN;
}
public boolean isRewardLeft(int achievementId) {
return this.getStatus(achievementId) == StatusOuterClass.Status.STATUS_FINISHED;
}
private boolean isPacketSendable() {
return this.player != null;
}
public void save() {
DatabaseHelper.saveAchievementData(this);
}
public void onLogin(Player player) {
if (this.player == null) {
this.player = player;
}
this.player.sendPacket(new PacketAchievementAllDataNotify(this.player));
}
}

View File

@ -10,6 +10,7 @@ import emu.grasscutter.database.DatabaseHelper;
import emu.grasscutter.game.Account;
import emu.grasscutter.game.CoopRequest;
import emu.grasscutter.game.ability.AbilityManager;
import emu.grasscutter.game.achievement.Achievements;
import emu.grasscutter.game.activity.ActivityManager;
import emu.grasscutter.game.avatar.Avatar;
import emu.grasscutter.game.avatar.AvatarStorage;
@ -168,6 +169,7 @@ public class Player {
@Getter private transient SatiationManager satiationManager;
// Manager data (Save-able to the database)
@Getter private transient Achievements achievements;
private PlayerProfile playerProfile; // Getter has null-check
@Getter private TeamManager teamManager;
private TowerData towerData; // Getter has null-check
@ -973,11 +975,15 @@ public class Player {
.setIsShowAvatar(this.isShowAvatars())
.addAllShowAvatarInfoList(socialShowAvatarInfoList)
.addAllShowNameCardIdList(this.getShowNameCardInfoList())
.setFinishAchievementNum(0)
.setFinishAchievementNum(this.getFinishedAchievementNum())
.setFriendEnterHomeOptionValue(this.getHome() == null ? 0 : this.getHome().getEnterHomeOption());
return social;
}
public int getFinishedAchievementNum() {
return Achievements.getByPlayer(this).getFinishedAchievementNum();
}
public List<ShowAvatarInfoOuterClass.ShowAvatarInfo> getShowAvatarInfoList() {
List<ShowAvatarInfoOuterClass.ShowAvatarInfo> showAvatarInfoList = new ArrayList<>();
@ -1172,6 +1178,7 @@ public class Player {
}
// Load from db
this.achievements = Achievements.getByPlayer(this);
this.getAvatars().loadFromDatabase();
this.getInventory().loadFromDatabase();
this.loadBattlePassManager(); // Call before avatar postLoad to avoid null pointer
@ -1224,6 +1231,10 @@ public class Player {
session.send(new PacketQuestListNotify(this));
session.send(new PacketCodexDataFullNotify(this));
session.send(new PacketAllWidgetDataNotify(this));
//Achievements
this.achievements.onLogin(this);
session.send(new PacketWidgetGadgetAllDataNotify());
session.send(new PacketCombineDataNotify(this.unlockedCombines));
session.send(new PacketGetChatEmojiCollectionRsp(this.getChatEmojiIdList()));

View File

@ -0,0 +1,16 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TakeAchievementGoalRewardReqOuterClass;
import emu.grasscutter.server.game.GameSession;
@Opcodes(PacketOpcodes.TakeAchievementGoalRewardReq)
public class HandlerTakeAchievementGoalRewardReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = TakeAchievementGoalRewardReqOuterClass.TakeAchievementGoalRewardReq.parseFrom(payload);
session.getPlayer().getAchievements().takeGoalReward(req.getIdListList());
}
}

View File

@ -0,0 +1,16 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
import emu.grasscutter.net.packet.PacketHandler;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.TakeAchievementRewardReqOuterClass;
import emu.grasscutter.server.game.GameSession;
@Opcodes(PacketOpcodes.TakeAchievementRewardReq)
public class HandlerTakeAchievementRewardReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var req = TakeAchievementRewardReqOuterClass.TakeAchievementRewardReq.parseFrom(payload);
session.getPlayer().getAchievements().takeReward(req.getIdListList());
}
}

View File

@ -0,0 +1,21 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.achievement.Achievement;
import emu.grasscutter.game.player.Player;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AchievementAllDataNotifyOuterClass;
public class PacketAchievementAllDataNotify extends BasePacket {
public PacketAchievementAllDataNotify(Player player) {
super(PacketOpcodes.AchievementAllDataNotify);
var achievements = player.getAchievements();
var notify = AchievementAllDataNotifyOuterClass.AchievementAllDataNotify.newBuilder()
.addAllAchievementList(achievements.getAchievementList().values().stream().map(Achievement::toProto).toList())
.addAllRewardTakenGoalIdList(achievements.getTakenGoalRewardIdList())
.build();
this.setData(notify);
}
}

View File

@ -0,0 +1,20 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.game.achievement.Achievement;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.AchievementUpdateNotifyOuterClass;
import java.util.List;
public class PacketAchievementUpdateNotify extends BasePacket {
public PacketAchievementUpdateNotify(List<Achievement> achievements) {
super(PacketOpcodes.AchievementUpdateNotify);
var notify = AchievementUpdateNotifyOuterClass.AchievementUpdateNotify.newBuilder()
.addAllAchievementList(achievements.stream().map(Achievement::toProto).toList())
.build();
this.setData(notify);
}
}

View File

@ -0,0 +1,29 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.TakeAchievementGoalRewardRspOuterClass;
import java.util.List;
public class PacketTakeAchievementGoalRewardRsp extends BasePacket {
public PacketTakeAchievementGoalRewardRsp() {
super(PacketOpcodes.TakeAchievementGoalRewardRsp);
this.setData(TakeAchievementGoalRewardRspOuterClass.TakeAchievementGoalRewardRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_REWARD_HAS_TAKEN_VALUE)
.build());
}
public PacketTakeAchievementGoalRewardRsp(List<Integer> ids, List<ItemParamOuterClass.ItemParam> items) {
super(PacketOpcodes.TakeAchievementGoalRewardRsp);
var rsp = TakeAchievementGoalRewardRspOuterClass.TakeAchievementGoalRewardRsp.newBuilder()
.addAllIdList(ids)
.addAllItemList(items)
.build();
this.setData(rsp);
}
}

View File

@ -0,0 +1,29 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.ItemParamOuterClass;
import emu.grasscutter.net.proto.RetcodeOuterClass;
import emu.grasscutter.net.proto.TakeAchievementRewardRspOuterClass;
import java.util.List;
public class PacketTakeAchievementRewardRsp extends BasePacket {
public PacketTakeAchievementRewardRsp() {
super(PacketOpcodes.TakeAchievementRewardRsp);
this.setData(TakeAchievementRewardRspOuterClass.TakeAchievementRewardRsp.newBuilder()
.setRetcode(RetcodeOuterClass.Retcode.RET_REWARD_HAS_TAKEN_VALUE)
.build());
}
public PacketTakeAchievementRewardRsp(List<Integer> idList, List<ItemParamOuterClass.ItemParam> items) {
super(PacketOpcodes.TakeAchievementRewardRsp);
var rsp = TakeAchievementRewardRspOuterClass.TakeAchievementRewardRsp.newBuilder()
.addAllIdList(idList)
.addAllItemList(items)
.build();
this.setData(rsp);
}
}

View File

@ -22,6 +22,7 @@ import emu.grasscutter.command.CommandHandler;
import emu.grasscutter.command.CommandMap;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.ResourceLoader;
import emu.grasscutter.data.excels.AchievementData;
import emu.grasscutter.data.excels.AvatarData;
import emu.grasscutter.data.excels.ItemData;
import emu.grasscutter.utils.Language;
@ -59,6 +60,7 @@ public final class Tools {
val monsterDataMap = new Int2ObjectRBTreeMap<>(GameData.getMonsterDataMap());
val sceneDataMap = new Int2ObjectRBTreeMap<>(GameData.getSceneDataMap());
val questDataMap = new Int2ObjectRBTreeMap<>(GameData.getQuestDataMap());
val achievementDataMap = new Int2ObjectRBTreeMap<>(GameData.getAchievementDataMap());
Function<SortedMap<?, ?>, String> getPad = m -> "%" + m.lastKey().toString().length() + "s : ";
@ -145,6 +147,14 @@ public final class Tools {
padQuestId.formatted(id) + "{0} - {1}",
mainQuestTitles.get(data.getMainId()),
data.getDescTextMapHash()));
// Achievements
h.newSection("Achievements");
val padAchievementId = getPad.apply(achievementDataMap);
achievementDataMap.values().stream()
.filter(AchievementData::isUsed)
.forEach(data -> {
h.newTranslatedLine(padAchievementId.formatted(data.getId()) + "{0} - {1}", data.getTitleTextMapHash(), data.getDescTextMapHash());
});
// Write txt files
for (int i = 0; i < TextStrings.NUM_LANGUAGES; i++) {

View File

@ -5,6 +5,7 @@ import com.google.gson.JsonObject;
import emu.grasscutter.Grasscutter;
import emu.grasscutter.data.GameData;
import emu.grasscutter.data.ResourceLoader;
import emu.grasscutter.data.excels.AchievementData;
import emu.grasscutter.game.player.Player;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
@ -429,6 +430,12 @@ public final class Language {
Grasscutter.getLogger().info("Generating TextMaps cache");
ResourceLoader.loadAll();
IntSet usedHashes = new IntOpenHashSet();
GameData.getAchievementDataMap().values().stream()
.filter(AchievementData::isUsed)
.forEach(a -> {
usedHashes.add((int) a.getTitleTextMapHash());
usedHashes.add((int) a.getDescTextMapHash());
});
GameData.getAvatarDataMap().forEach((k, v) -> usedHashes.add((int) v.getNameTextMapHash()));
GameData.getAvatarSkillDataMap().forEach((k, v) -> {
usedHashes.add((int) v.getNameTextMapHash());

View File

@ -124,6 +124,21 @@
"no_account": "Account not found.",
"description": "Modify user accounts"
},
"achievement": {
"success": {
"grant": "Granted the achievement to %s.",
"revoke": "Revoked the achievement from %s.",
"progress": "Set progress of %s's achievement(id: %s) to %s.",
"grantall": "Granted %s achievement(s) to %s.",
"revokeall": "Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "Achievement not found.",
"already_achieved": "%s has already achieved the achievement.",
"not_yet_achieved": "%s hasn't achieved the achievement yet."
},
"description": "Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "Send an announcement successfully, you can revoke it by /a revoke %s.",
"refresh_success": "Refresh announcement config file successfully. [Total %s]",

View File

@ -124,6 +124,21 @@
"no_account": "Cuenta no encontrada.",
"description": "Modifica las cuentas de usuarios"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "Se envió el anuncio correctamente, puedes revocarlo con /a revoke %s.",
"refresh_success": "Se actualizó el archivo de configuración de anuncio correctamente. [Total %s]",

View File

@ -124,6 +124,21 @@
"no_account": "Compte introuvable.",
"description": "Modifie les comptes utilisateurs"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "L'annonce à bien été envoyée, vous pouvez la révoquer en utilisant /a revoke %s.",
"refresh_success": "Le fichier de configuration des annonces à bien été actualisée. [Total : %s]",

View File

@ -124,6 +124,21 @@
"no_account": "Account non trovato.",
"description": "Modifica account utente"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "Invia un annuncio con successo, puoi revocarlo /a revoca %s.",
"refresh_success": "Aggiorna il file di configurazione dell'annuncio con successo. [Totale %s]",

View File

@ -124,6 +124,21 @@
"no_account": "アカウントが見つかりません。",
"description": "アカウントを作成、削除、または変更します。"
},
"achievement": {
"success": {
"grant": "%sにアチーブメントを付与しました。",
"revoke": "%sからアチーブメントを剥奪しました。",
"progress": "%sのアチーブメント(id: %s)の進捗を%sに設定しました。",
"grantall": "%2$sに%1$s個のアチーブメントを付与しました。",
"revokeall": "%2$sから%1$s個のアチーブメントを剥奪しました。"
},
"fail": {
"achievement_not_found": "アチーブメントが見つかりませんでした。",
"already_achieved": "%sはすでにそのアチーブメントを達成しています。",
"not_yet_achieved": "%sはまだそのアチーブメントを達成していません。"
},
"description": "アチーブメントを付与、剥奪、またはその進捗を設定します。"
},
"announce": {
"send_success": "アナウンスの送信に成功しました。アナウンスは /a revoke %s で取り消すことができます。",
"refresh_success": "アナウンス構成ファイルを正常に更新します。 [合計 %s]",

View File

@ -124,6 +124,21 @@
"no_account": "계정을 찾을 수 없습니다.",
"description": "사용자 계정을 수정합니다"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "공지 발송에 성공했습니다, 취소하고 싶으면 /a revoke %s를 입력하세요.",
"refresh_success": "공지 구성파일을 새로 고쳤습니다. [Total %s]",

View File

@ -124,6 +124,21 @@
"no_account": "Nie znaleziono konta.",
"description": "Twórz lub usuń konta."
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "Ogłoszenie zostało pomyślnie wysłane. Możesz je odwołać używając \"announce revoke %s\".",
"refresh_success": "Odświeżono konfigurację ogłoszeń (w sumie jest ich %s).",

View File

@ -124,6 +124,21 @@
"no_account": "Contul nu a fost găsit.",
"description": "Modificați conturile de utilizator"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "🇺🇸Send an announcement successfully, you can revoke it by /a revoke %s.",
"refresh_success": "🇺🇸Refresh announcement config file successfully. [Total %s]",

View File

@ -124,6 +124,21 @@
"no_account": "Аккаунт не найден.",
"description": "Вносит изменения в аккаунты пользователей"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "Объявление было отправлено успешно, вы можете отзвать его с помощью команды /a revoke %s.",
"refresh_success": "Конфигурационный файл объявления был успешно обновлён. [Всего %s]",

View File

@ -124,6 +124,21 @@
"no_account": "账号不存在。",
"description": "创建或删除账号"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "成功发送了一则公告,你可以通过 /a revoke %s 撤销。",
"refresh_success": "成功刷新了公告配置。[共 %s 个]",

View File

@ -124,6 +124,21 @@
"no_account": "帳號不存在。",
"description": "建立或刪除帳號。"
},
"achievement": {
"success": {
"grant": "🇺🇸Granted the achievement to %s.",
"revoke": "🇺🇸Revoked the achievement from %s.",
"progress": "🇺🇸Set progress of %s's achievement(id: %s) to %s.",
"grantall": "🇺🇸Granted %s achievement(s) to %s.",
"revokeall": "🇺🇸Revoked %s achievement(s) from %s."
},
"fail": {
"achievement_not_found": "🇺🇸Achievement not found.",
"already_achieved": "🇺🇸%s has already achieved the achievement.",
"not_yet_achieved": "🇺🇸%s hasn't achieved the achievement yet."
},
"description": "🇺🇸Grant, Revoke or Progress achievements."
},
"announce": {
"send_success": "成功發送了一則公告,你可以通過 /a revoke %s 撤銷。",
"refresh_success": "已重新整理了%s個公告。",