basic GetQuestData

This commit is contained in:
Hiro
2023-11-30 09:23:54 +02:00
parent 89acec994a
commit e6647b04f8
8 changed files with 1517 additions and 1 deletions

View File

@@ -0,0 +1,174 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
public final class GetQuestDataCsReqOuterClass {
/**
* Protobuf type {@code GetQuestDataCsReq}
*/
public static final class GetQuestDataCsReq extends ProtoMessage<GetQuestDataCsReq> implements Cloneable {
private static final long serialVersionUID = 0L;
private GetQuestDataCsReq() {
}
/**
* @return a new empty instance of {@code GetQuestDataCsReq}
*/
public static GetQuestDataCsReq newInstance() {
return new GetQuestDataCsReq();
}
@Override
public GetQuestDataCsReq copyFrom(final GetQuestDataCsReq other) {
cachedSize = other.cachedSize;
return this;
}
@Override
public GetQuestDataCsReq mergeFrom(final GetQuestDataCsReq other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
return this;
}
@Override
public GetQuestDataCsReq clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
return this;
}
@Override
public GetQuestDataCsReq clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof GetQuestDataCsReq)) {
return false;
}
GetQuestDataCsReq other = (GetQuestDataCsReq) o;
return true;
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
}
@Override
protected int computeSerializedSize() {
int size = 0;
return size;
}
@Override
@SuppressWarnings("fallthrough")
public GetQuestDataCsReq mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
output.endObject();
}
@Override
public GetQuestDataCsReq mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public GetQuestDataCsReq clone() {
return new GetQuestDataCsReq().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static GetQuestDataCsReq parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new GetQuestDataCsReq(), data).checkInitialized();
}
public static GetQuestDataCsReq parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new GetQuestDataCsReq(), input).checkInitialized();
}
public static GetQuestDataCsReq parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new GetQuestDataCsReq(), input).checkInitialized();
}
/**
* @return factory for creating GetQuestDataCsReq messages
*/
public static MessageFactory<GetQuestDataCsReq> getFactory() {
return GetQuestDataCsReqFactory.INSTANCE;
}
private enum GetQuestDataCsReqFactory implements MessageFactory<GetQuestDataCsReq> {
INSTANCE;
@Override
public GetQuestDataCsReq create() {
return GetQuestDataCsReq.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
}
}
}

View File

@@ -0,0 +1,455 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedMessage;
public final class GetQuestDataScRspOuterClass {
/**
* Protobuf type {@code GetQuestDataScRsp}
*/
public static final class GetQuestDataScRsp extends ProtoMessage<GetQuestDataScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 total_achievement_exp = 1;</code>
*/
private int totalAchievementExp;
/**
* <code>optional uint32 retcode = 8;</code>
*/
private int retcode;
/**
* <code>repeated .Quest quest_list = 10;</code>
*/
private final RepeatedMessage<QuestOuterClass.Quest> questList = RepeatedMessage.newEmptyInstance(QuestOuterClass.Quest.getFactory());
private GetQuestDataScRsp() {
}
/**
* @return a new empty instance of {@code GetQuestDataScRsp}
*/
public static GetQuestDataScRsp newInstance() {
return new GetQuestDataScRsp();
}
/**
* <code>optional uint32 total_achievement_exp = 1;</code>
* @return whether the totalAchievementExp field is set
*/
public boolean hasTotalAchievementExp() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 total_achievement_exp = 1;</code>
* @return this
*/
public GetQuestDataScRsp clearTotalAchievementExp() {
bitField0_ &= ~0x00000001;
totalAchievementExp = 0;
return this;
}
/**
* <code>optional uint32 total_achievement_exp = 1;</code>
* @return the totalAchievementExp
*/
public int getTotalAchievementExp() {
return totalAchievementExp;
}
/**
* <code>optional uint32 total_achievement_exp = 1;</code>
* @param value the totalAchievementExp to set
* @return this
*/
public GetQuestDataScRsp setTotalAchievementExp(final int value) {
bitField0_ |= 0x00000001;
totalAchievementExp = value;
return this;
}
/**
* <code>optional uint32 retcode = 8;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 retcode = 8;</code>
* @return this
*/
public GetQuestDataScRsp clearRetcode() {
bitField0_ &= ~0x00000002;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 8;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 8;</code>
* @param value the retcode to set
* @return this
*/
public GetQuestDataScRsp setRetcode(final int value) {
bitField0_ |= 0x00000002;
retcode = value;
return this;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
* @return whether the questList field is set
*/
public boolean hasQuestList() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
* @return this
*/
public GetQuestDataScRsp clearQuestList() {
bitField0_ &= ~0x00000004;
questList.clear();
return this;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableQuestList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<QuestOuterClass.Quest> getQuestList() {
return questList;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<QuestOuterClass.Quest> getMutableQuestList() {
bitField0_ |= 0x00000004;
return questList;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
* @param value the questList to add
* @return this
*/
public GetQuestDataScRsp addQuestList(final QuestOuterClass.Quest value) {
bitField0_ |= 0x00000004;
questList.add(value);
return this;
}
/**
* <code>repeated .Quest quest_list = 10;</code>
* @param values the questList to add
* @return this
*/
public GetQuestDataScRsp addAllQuestList(final QuestOuterClass.Quest... values) {
bitField0_ |= 0x00000004;
questList.addAll(values);
return this;
}
@Override
public GetQuestDataScRsp copyFrom(final GetQuestDataScRsp other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
totalAchievementExp = other.totalAchievementExp;
retcode = other.retcode;
questList.copyFrom(other.questList);
}
return this;
}
@Override
public GetQuestDataScRsp mergeFrom(final GetQuestDataScRsp other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasTotalAchievementExp()) {
setTotalAchievementExp(other.totalAchievementExp);
}
if (other.hasRetcode()) {
setRetcode(other.retcode);
}
if (other.hasQuestList()) {
getMutableQuestList().addAll(other.questList);
}
return this;
}
@Override
public GetQuestDataScRsp clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
totalAchievementExp = 0;
retcode = 0;
questList.clear();
return this;
}
@Override
public GetQuestDataScRsp clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
questList.clearQuick();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof GetQuestDataScRsp)) {
return false;
}
GetQuestDataScRsp other = (GetQuestDataScRsp) o;
return bitField0_ == other.bitField0_
&& (!hasTotalAchievementExp() || totalAchievementExp == other.totalAchievementExp)
&& (!hasRetcode() || retcode == other.retcode)
&& (!hasQuestList() || questList.equals(other.questList));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 8);
output.writeUInt32NoTag(totalAchievementExp);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 64);
output.writeUInt32NoTag(retcode);
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < questList.length(); i++) {
output.writeRawByte((byte) 82);
output.writeMessageNoTag(questList.get(i));
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(totalAchievementExp);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 * questList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(questList);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public GetQuestDataScRsp mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 8: {
// totalAchievementExp
totalAchievementExp = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 64) {
break;
}
}
case 64: {
// retcode
retcode = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 82) {
break;
}
}
case 82: {
// questList
tag = input.readRepeatedMessage(questList, tag);
bitField0_ |= 0x00000004;
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.totalAchievementExp, totalAchievementExp);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.retcode, retcode);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedMessage(FieldNames.questList, questList);
}
output.endObject();
}
@Override
public GetQuestDataScRsp mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 255336658:
case -1295039982: {
if (input.isAtField(FieldNames.totalAchievementExp)) {
if (!input.trySkipNullValue()) {
totalAchievementExp = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case 1097936398: {
if (input.isAtField(FieldNames.retcode)) {
if (!input.trySkipNullValue()) {
retcode = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case -1783104352:
case 575966683: {
if (input.isAtField(FieldNames.questList)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(questList);
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public GetQuestDataScRsp clone() {
return new GetQuestDataScRsp().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static GetQuestDataScRsp parseFrom(final byte[] data) throws
InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new GetQuestDataScRsp(), data).checkInitialized();
}
public static GetQuestDataScRsp parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new GetQuestDataScRsp(), input).checkInitialized();
}
public static GetQuestDataScRsp parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new GetQuestDataScRsp(), input).checkInitialized();
}
/**
* @return factory for creating GetQuestDataScRsp messages
*/
public static MessageFactory<GetQuestDataScRsp> getFactory() {
return GetQuestDataScRspFactory.INSTANCE;
}
private enum GetQuestDataScRspFactory implements MessageFactory<GetQuestDataScRsp> {
INSTANCE;
@Override
public GetQuestDataScRsp create() {
return GetQuestDataScRsp.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName totalAchievementExp = FieldName.forField("totalAchievementExp", "total_achievement_exp");
static final FieldName retcode = FieldName.forField("retcode");
static final FieldName questList = FieldName.forField("questList", "quest_list");
}
}
}

View File

@@ -0,0 +1,809 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoEnum;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.ProtoUtil;
import us.hebi.quickbuf.RepeatedInt;
public final class QuestOuterClass {
/**
* Protobuf type {@code Quest}
*/
public static final class Quest extends ProtoMessage<Quest> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional int64 finish_time = 12;</code>
*/
private long finishTime;
/**
* <code>optional uint32 progress = 8;</code>
*/
private int progress;
/**
* <code>optional uint32 id = 11;</code>
*/
private int id;
/**
* <code>optional .Quest.QuestStatus status = 13;</code>
*/
private int status;
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
*/
private final RepeatedInt takenAchievementLevelList = RepeatedInt.newEmptyInstance();
private Quest() {
}
/**
* @return a new empty instance of {@code Quest}
*/
public static Quest newInstance() {
return new Quest();
}
/**
* <code>optional int64 finish_time = 12;</code>
* @return whether the finishTime field is set
*/
public boolean hasFinishTime() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional int64 finish_time = 12;</code>
* @return this
*/
public Quest clearFinishTime() {
bitField0_ &= ~0x00000001;
finishTime = 0L;
return this;
}
/**
* <code>optional int64 finish_time = 12;</code>
* @return the finishTime
*/
public long getFinishTime() {
return finishTime;
}
/**
* <code>optional int64 finish_time = 12;</code>
* @param value the finishTime to set
* @return this
*/
public Quest setFinishTime(final long value) {
bitField0_ |= 0x00000001;
finishTime = value;
return this;
}
/**
* <code>optional uint32 progress = 8;</code>
* @return whether the progress field is set
*/
public boolean hasProgress() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 progress = 8;</code>
* @return this
*/
public Quest clearProgress() {
bitField0_ &= ~0x00000002;
progress = 0;
return this;
}
/**
* <code>optional uint32 progress = 8;</code>
* @return the progress
*/
public int getProgress() {
return progress;
}
/**
* <code>optional uint32 progress = 8;</code>
* @param value the progress to set
* @return this
*/
public Quest setProgress(final int value) {
bitField0_ |= 0x00000002;
progress = value;
return this;
}
/**
* <code>optional uint32 id = 11;</code>
* @return whether the id field is set
*/
public boolean hasId() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 id = 11;</code>
* @return this
*/
public Quest clearId() {
bitField0_ &= ~0x00000004;
id = 0;
return this;
}
/**
* <code>optional uint32 id = 11;</code>
* @return the id
*/
public int getId() {
return id;
}
/**
* <code>optional uint32 id = 11;</code>
* @param value the id to set
* @return this
*/
public Quest setId(final int value) {
bitField0_ |= 0x00000004;
id = value;
return this;
}
/**
* <code>optional .Quest.QuestStatus status = 13;</code>
* @return whether the status field is set
*/
public boolean hasStatus() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional .Quest.QuestStatus status = 13;</code>
* @return this
*/
public Quest clearStatus() {
bitField0_ &= ~0x00000008;
status = 0;
return this;
}
/**
* <code>optional .Quest.QuestStatus status = 13;</code>
* @return the status
*/
public QuestStatus getStatus() {
return QuestStatus.forNumber(status);
}
/**
* Gets the value of the internal enum store. The result is
* equivalent to {@link Quest#getStatus()}.getNumber().
*
* @return numeric wire representation
*/
public int getStatusValue() {
return status;
}
/**
* Sets the value of the internal enum store. This does not
* do any validity checks, so be sure to use appropriate value
* constants from {@link QuestStatus}. Setting an invalid value
* can cause {@link Quest#getStatus()} to return null
*
* @param value the numeric wire value to set
* @return this
*/
public Quest setStatusValue(final int value) {
bitField0_ |= 0x00000008;
status = value;
return this;
}
/**
* <code>optional .Quest.QuestStatus status = 13;</code>
* @param value the status to set
* @return this
*/
public Quest setStatus(final QuestStatus value) {
bitField0_ |= 0x00000008;
status = value.getNumber();
return this;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
* @return whether the takenAchievementLevelList field is set
*/
public boolean hasTakenAchievementLevelList() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
* @return this
*/
public Quest clearTakenAchievementLevelList() {
bitField0_ &= ~0x00000010;
takenAchievementLevelList.clear();
return this;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableTakenAchievementLevelList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getTakenAchievementLevelList() {
return takenAchievementLevelList;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedInt getMutableTakenAchievementLevelList() {
bitField0_ |= 0x00000010;
return takenAchievementLevelList;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
* @param value the takenAchievementLevelList to add
* @return this
*/
public Quest addTakenAchievementLevelList(final int value) {
bitField0_ |= 0x00000010;
takenAchievementLevelList.add(value);
return this;
}
/**
* <code>repeated uint32 taken_achievement_level_list = 3;</code>
* @param values the takenAchievementLevelList to add
* @return this
*/
public Quest addAllTakenAchievementLevelList(final int... values) {
bitField0_ |= 0x00000010;
takenAchievementLevelList.addAll(values);
return this;
}
@Override
public Quest copyFrom(final Quest other) {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
finishTime = other.finishTime;
progress = other.progress;
id = other.id;
status = other.status;
takenAchievementLevelList.copyFrom(other.takenAchievementLevelList);
}
return this;
}
@Override
public Quest mergeFrom(final Quest other) {
if (other.isEmpty()) {
return this;
}
cachedSize = -1;
if (other.hasFinishTime()) {
setFinishTime(other.finishTime);
}
if (other.hasProgress()) {
setProgress(other.progress);
}
if (other.hasId()) {
setId(other.id);
}
if (other.hasStatus()) {
setStatusValue(other.status);
}
if (other.hasTakenAchievementLevelList()) {
getMutableTakenAchievementLevelList().addAll(other.takenAchievementLevelList);
}
return this;
}
@Override
public Quest clear() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
finishTime = 0L;
progress = 0;
id = 0;
status = 0;
takenAchievementLevelList.clear();
return this;
}
@Override
public Quest clearQuick() {
if (isEmpty()) {
return this;
}
cachedSize = -1;
bitField0_ = 0;
takenAchievementLevelList.clear();
return this;
}
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
}
if (!(o instanceof Quest)) {
return false;
}
Quest other = (Quest) o;
return bitField0_ == other.bitField0_
&& (!hasFinishTime() || finishTime == other.finishTime)
&& (!hasProgress() || progress == other.progress)
&& (!hasId() || id == other.id)
&& (!hasStatus() || status == other.status)
&& (!hasTakenAchievementLevelList() || takenAchievementLevelList.equals(other.takenAchievementLevelList));
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 96);
output.writeInt64NoTag(finishTime);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 64);
output.writeUInt32NoTag(progress);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 88);
output.writeUInt32NoTag(id);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 104);
output.writeEnumNoTag(status);
}
if ((bitField0_ & 0x00000010) != 0) {
for (int i = 0; i < takenAchievementLevelList.length(); i++) {
output.writeRawByte((byte) 24);
output.writeUInt32NoTag(takenAchievementLevelList.array()[i]);
}
}
}
@Override
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeInt64SizeNoTag(finishTime);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(progress);
}
if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(id);
}
if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeEnumSizeNoTag(status);
}
if ((bitField0_ & 0x00000010) != 0) {
size += (1 * takenAchievementLevelList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(takenAchievementLevelList);
}
return size;
}
@Override
@SuppressWarnings("fallthrough")
public Quest mergeFrom(final ProtoSource input) throws IOException {
// Enabled Fall-Through Optimization (QuickBuffers)
int tag = input.readTag();
while (true) {
switch (tag) {
case 96: {
// finishTime
finishTime = input.readInt64();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 64) {
break;
}
}
case 64: {
// progress
progress = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 88) {
break;
}
}
case 88: {
// id
id = input.readUInt32();
bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 104) {
break;
}
}
case 104: {
// status
final int value = input.readInt32();
if (QuestStatus.forNumber(value) != null) {
status = value;
bitField0_ |= 0x00000008;
}
tag = input.readTag();
if (tag != 26) {
break;
}
}
case 26: {
// takenAchievementLevelList [packed=true]
input.readPackedUInt32(takenAchievementLevelList, tag);
bitField0_ |= 0x00000010;
tag = input.readTag();
if (tag != 0) {
break;
}
}
case 0: {
return this;
}
default: {
if (!input.skipField(tag)) {
return this;
}
tag = input.readTag();
break;
}
case 24: {
// takenAchievementLevelList [packed=false]
tag = input.readRepeatedUInt32(takenAchievementLevelList, tag);
bitField0_ |= 0x00000010;
break;
}
}
}
}
@Override
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
output.writeInt64(FieldNames.finishTime, finishTime);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.progress, progress);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.id, id);
}
if ((bitField0_ & 0x00000008) != 0) {
output.writeEnum(FieldNames.status, status, QuestStatus.converter());
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRepeatedUInt32(FieldNames.takenAchievementLevelList, takenAchievementLevelList);
}
output.endObject();
}
@Override
public Quest mergeFrom(final JsonSource input) throws IOException {
if (!input.beginObject()) {
return this;
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
case 1151521280:
case 1347904249: {
if (input.isAtField(FieldNames.finishTime)) {
if (!input.trySkipNullValue()) {
finishTime = input.readInt64();
bitField0_ |= 0x00000001;
}
} else {
input.skipUnknownField();
}
break;
}
case -1001078227: {
if (input.isAtField(FieldNames.progress)) {
if (!input.trySkipNullValue()) {
progress = input.readUInt32();
bitField0_ |= 0x00000002;
}
} else {
input.skipUnknownField();
}
break;
}
case 3355: {
if (input.isAtField(FieldNames.id)) {
if (!input.trySkipNullValue()) {
id = input.readUInt32();
bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
}
break;
}
case -892481550: {
if (input.isAtField(FieldNames.status)) {
if (!input.trySkipNullValue()) {
final QuestStatus value = input.readEnum(QuestStatus.converter());
if (value != null) {
status = value.getNumber();
bitField0_ |= 0x00000008;
} else {
input.skipUnknownEnumValue();
}
}
} else {
input.skipUnknownField();
}
break;
}
case 149879610:
case 1076639233: {
if (input.isAtField(FieldNames.takenAchievementLevelList)) {
if (!input.trySkipNullValue()) {
input.readRepeatedUInt32(takenAchievementLevelList);
bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
}
break;
}
default: {
input.skipUnknownField();
break;
}
}
}
input.endObject();
return this;
}
@Override
public Quest clone() {
return new Quest().copyFrom(this);
}
@Override
public boolean isEmpty() {
return ((bitField0_) == 0);
}
public static Quest parseFrom(final byte[] data) throws InvalidProtocolBufferException {
return ProtoMessage.mergeFrom(new Quest(), data).checkInitialized();
}
public static Quest parseFrom(final ProtoSource input) throws IOException {
return ProtoMessage.mergeFrom(new Quest(), input).checkInitialized();
}
public static Quest parseFrom(final JsonSource input) throws IOException {
return ProtoMessage.mergeFrom(new Quest(), input).checkInitialized();
}
/**
* @return factory for creating Quest messages
*/
public static MessageFactory<Quest> getFactory() {
return QuestFactory.INSTANCE;
}
/**
* Protobuf enum {@code QuestStatus}
*/
public enum QuestStatus implements ProtoEnum<QuestStatus> {
/**
* <code>QUEST_NONE = 0;</code>
*/
QUEST_NONE("QUEST_NONE", 0),
/**
* <code>QUEST_DOING = 1;</code>
*/
QUEST_DOING("QUEST_DOING", 1),
/**
* <code>QUEST_FINISH = 2;</code>
*/
QUEST_FINISH("QUEST_FINISH", 2),
/**
* <code>QUEST_CLOSE = 3;</code>
*/
QUEST_CLOSE("QUEST_CLOSE", 3),
/**
* <code>QUEST_DELETE = 4;</code>
*/
QUEST_DELETE("QUEST_DELETE", 4);
/**
* <code>QUEST_NONE = 0;</code>
*/
public static final int QUEST_NONE_VALUE = 0;
/**
* <code>QUEST_DOING = 1;</code>
*/
public static final int QUEST_DOING_VALUE = 1;
/**
* <code>QUEST_FINISH = 2;</code>
*/
public static final int QUEST_FINISH_VALUE = 2;
/**
* <code>QUEST_CLOSE = 3;</code>
*/
public static final int QUEST_CLOSE_VALUE = 3;
/**
* <code>QUEST_DELETE = 4;</code>
*/
public static final int QUEST_DELETE_VALUE = 4;
private final String name;
private final int number;
private QuestStatus(String name, int number) {
this.name = name;
this.number = number;
}
/**
* @return the string representation of enum entry
*/
@Override
public String getName() {
return name;
}
/**
* @return the numeric wire value of this enum entry
*/
@Override
public int getNumber() {
return number;
}
/**
* @return a converter that maps between this enum's numeric and text representations
*/
public static ProtoEnum.EnumConverter<QuestStatus> converter() {
return QuestStatusConverter.INSTANCE;
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @return The enum associated with the given numeric wire value, or null if unknown.
*/
public static QuestStatus forNumber(int value) {
return QuestStatusConverter.INSTANCE.forNumber(value);
}
/**
* @param value The numeric wire value of the corresponding enum entry.
* @param other Fallback value in case the value is not known.
* @return The enum associated with the given numeric wire value, or the fallback value if unknown.
*/
public static QuestStatus forNumberOr(int number, QuestStatus other) {
QuestStatus value = forNumber(number);
return value == null ? other : value;
}
enum QuestStatusConverter implements ProtoEnum.EnumConverter<QuestStatus> {
INSTANCE;
private static final QuestStatus[] lookup = new QuestStatus[5];
static {
lookup[0] = QUEST_NONE;
lookup[1] = QUEST_DOING;
lookup[2] = QUEST_FINISH;
lookup[3] = QUEST_CLOSE;
lookup[4] = QUEST_DELETE;
}
@Override
public final QuestStatus forNumber(final int value) {
if (value >= 0 && value < lookup.length) {
return lookup[value];
}
return null;
}
@Override
public final QuestStatus forName(final CharSequence value) {
if (value.length() == 10) {
if (ProtoUtil.isEqual("QUEST_NONE", value)) {
return QUEST_NONE;
}
}
if (value.length() == 11) {
if (ProtoUtil.isEqual("QUEST_DOING", value)) {
return QUEST_DOING;
}
if (ProtoUtil.isEqual("QUEST_CLOSE", value)) {
return QUEST_CLOSE;
}
}
if (value.length() == 12) {
if (ProtoUtil.isEqual("QUEST_FINISH", value)) {
return QUEST_FINISH;
}
if (ProtoUtil.isEqual("QUEST_DELETE", value)) {
return QUEST_DELETE;
}
}
return null;
}
}
}
private enum QuestFactory implements MessageFactory<Quest> {
INSTANCE;
@Override
public Quest create() {
return Quest.newInstance();
}
}
/**
* Contains name constants used for serializing JSON
*/
static class FieldNames {
static final FieldName finishTime = FieldName.forField("finishTime", "finish_time");
static final FieldName progress = FieldName.forField("progress");
static final FieldName id = FieldName.forField("id");
static final FieldName status = FieldName.forField("status");
static final FieldName takenAchievementLevelList = FieldName.forField("takenAchievementLevelList", "taken_achievement_level_list");
}
}
}

View File

@@ -60,6 +60,7 @@ public class GameData {
private static Int2ObjectMap<PhoneThemeExcel> phoneThemeExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<MonsterDropExcel> monsterDropExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<MonsterExcel> monsterExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<QuestExcel> questExcelMap = new Int2ObjectLinkedOpenHashMap<>();
private static Int2ObjectMap<PlayerLevelExcel> playerLevelExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<ExpTypeExcel> expTypeExcelMap = new Int2ObjectOpenHashMap<>();
@@ -141,6 +142,17 @@ public class GameData {
return allIds;
}
public static List<Integer> getAllQuestIds() {
List<Integer> allIds = new ArrayList<>();
for (Int2ObjectMap.Entry<QuestExcel> entry : questExcelMap.int2ObjectEntrySet()) {
QuestExcel questExcel = entry.getValue();
allIds.add(questExcel.getId());
}
return allIds;
}
public static List<Integer> getAllMonsterIds() {
List<Integer> allIds = new ArrayList<>();

View File

@@ -0,0 +1,17 @@
package emu.lunarcore.data.excel;
import emu.lunarcore.data.GameResource;
import emu.lunarcore.data.ResourceType;
import emu.lunarcore.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = {"QuestData.json"}, loadPriority = LoadPriority.NORMAL)
public class QuestExcel extends GameResource {
private int QuestID;
@Override
public int getId() {
return QuestID;
}
}

View File

@@ -19,7 +19,8 @@ public class CmdIdUtils {
CmdId.PlayerHeartBeatCsReq,
CmdId.PlayerHeartBeatScRsp,
CmdId.SceneEntityMoveCsReq,
CmdId.SceneEntityMoveScRsp
CmdId.SceneEntityMoveScRsp,
CmdId.GetQuestDataScRsp
);
private static Int2ObjectMap<String> opcodeMap;

View File

@@ -0,0 +1,16 @@
package emu.lunarcore.server.packet.recv;
import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler;
import emu.lunarcore.server.packet.send.PacketGetQuestDataScRsp;
@Opcodes(CmdId.GetQuestDataCsReq)
public class HandlerGetQuestDataCsReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] data) throws Exception {
session.send(new PacketGetQuestDataScRsp());
}
}

View File

@@ -0,0 +1,32 @@
package emu.lunarcore.server.packet.send;
import emu.lunarcore.proto.GetQuestDataScRspOuterClass.GetQuestDataScRsp;
import emu.lunarcore.proto.QuestOuterClass.Quest;
import emu.lunarcore.proto.QuestOuterClass.Quest.QuestStatus;
import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.data.GameData;
public class PacketGetQuestDataScRsp extends BasePacket {
public PacketGetQuestDataScRsp() {
super(CmdId.GetQuestDataScRsp);
var allIds = GameData.getAllQuestIds();
var data = GetQuestDataScRsp.newInstance()
.setTotalAchievementExp(69);
for (int questId : allIds) {
var questItem = Quest.newInstance()
.setId(questId)
.setStatus(QuestStatus.QUEST_FINISH)
.setFinishTime(10000L)
.setProgress(1);
data.addQuestList(questItem);
}
this.setData(data);
}
}