From edee1accf2333ed15051480049dcb784c563ce83 Mon Sep 17 00:00:00 2001 From: Hiro Date: Thu, 30 Nov 2023 11:12:56 +0200 Subject: [PATCH] GetMainMissionCustomValue handler --- ...MainMissionCustomValueCsReqOuterClass.java | 303 ++++++++++++++ ...MainMissionCustomValueScRspOuterClass.java | 378 +++++++++++++++++ .../proto/MainMissionOuterClass.java | 391 ++++++++++++++++++ ...HandlerGetMainMissionCustomValueCsReq.java | 18 + .../PacketGetMainMissionCustomValueScRsp.java | 25 ++ 5 files changed, 1115 insertions(+) create mode 100644 src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueCsReqOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueScRspOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/MainMissionOuterClass.java create mode 100644 src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMainMissionCustomValueCsReq.java create mode 100644 src/main/java/emu/lunarcore/server/packet/send/PacketGetMainMissionCustomValueScRsp.java diff --git a/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueCsReqOuterClass.java new file mode 100644 index 0000000..189dcce --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueCsReqOuterClass.java @@ -0,0 +1,303 @@ +// 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.RepeatedInt; + +public final class GetMainMissionCustomValueCsReqOuterClass { + /** + * Protobuf type {@code GetMainMissionCustomValueCsReq} + */ + public static final class GetMainMissionCustomValueCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated uint32 main_mission_id_list = 13; + */ + private final RepeatedInt mainMissionIdList = RepeatedInt.newEmptyInstance(); + + private GetMainMissionCustomValueCsReq() { + } + + /** + * @return a new empty instance of {@code GetMainMissionCustomValueCsReq} + */ + public static GetMainMissionCustomValueCsReq newInstance() { + return new GetMainMissionCustomValueCsReq(); + } + + /** + * repeated uint32 main_mission_id_list = 13; + * @return whether the mainMissionIdList field is set + */ + public boolean hasMainMissionIdList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated uint32 main_mission_id_list = 13; + * @return this + */ + public GetMainMissionCustomValueCsReq clearMainMissionIdList() { + bitField0_ &= ~0x00000001; + mainMissionIdList.clear(); + return this; + } + + /** + * repeated uint32 main_mission_id_list = 13; + * + * 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 #getMutableMainMissionIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getMainMissionIdList() { + return mainMissionIdList; + } + + /** + * repeated uint32 main_mission_id_list = 13; + * + * 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 getMutableMainMissionIdList() { + bitField0_ |= 0x00000001; + return mainMissionIdList; + } + + /** + * repeated uint32 main_mission_id_list = 13; + * @param value the mainMissionIdList to add + * @return this + */ + public GetMainMissionCustomValueCsReq addMainMissionIdList(final int value) { + bitField0_ |= 0x00000001; + mainMissionIdList.add(value); + return this; + } + + /** + * repeated uint32 main_mission_id_list = 13; + * @param values the mainMissionIdList to add + * @return this + */ + public GetMainMissionCustomValueCsReq addAllMainMissionIdList(final int... values) { + bitField0_ |= 0x00000001; + mainMissionIdList.addAll(values); + return this; + } + + @Override + public GetMainMissionCustomValueCsReq copyFrom(final GetMainMissionCustomValueCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + mainMissionIdList.copyFrom(other.mainMissionIdList); + } + return this; + } + + @Override + public GetMainMissionCustomValueCsReq mergeFrom(final GetMainMissionCustomValueCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasMainMissionIdList()) { + getMutableMainMissionIdList().addAll(other.mainMissionIdList); + } + return this; + } + + @Override + public GetMainMissionCustomValueCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mainMissionIdList.clear(); + return this; + } + + @Override + public GetMainMissionCustomValueCsReq clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mainMissionIdList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetMainMissionCustomValueCsReq)) { + return false; + } + GetMainMissionCustomValueCsReq other = (GetMainMissionCustomValueCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasMainMissionIdList() || mainMissionIdList.equals(other.mainMissionIdList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < mainMissionIdList.length(); i++) { + output.writeRawByte((byte) 104); + output.writeUInt32NoTag(mainMissionIdList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * mainMissionIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(mainMissionIdList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetMainMissionCustomValueCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 106: { + // mainMissionIdList [packed=true] + input.readPackedUInt32(mainMissionIdList, tag); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 104: { + // mainMissionIdList [packed=false] + tag = input.readRepeatedUInt32(mainMissionIdList, tag); + bitField0_ |= 0x00000001; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedUInt32(FieldNames.mainMissionIdList, mainMissionIdList); + } + output.endObject(); + } + + @Override + public GetMainMissionCustomValueCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1438400460: + case -1382679799: { + if (input.isAtField(FieldNames.mainMissionIdList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(mainMissionIdList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetMainMissionCustomValueCsReq clone() { + return new GetMainMissionCustomValueCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetMainMissionCustomValueCsReq parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueCsReq(), data).checkInitialized(); + } + + public static GetMainMissionCustomValueCsReq parseFrom(final ProtoSource input) throws + IOException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueCsReq(), input).checkInitialized(); + } + + public static GetMainMissionCustomValueCsReq parseFrom(final JsonSource input) throws + IOException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating GetMainMissionCustomValueCsReq messages + */ + public static MessageFactory getFactory() { + return GetMainMissionCustomValueCsReqFactory.INSTANCE; + } + + private enum GetMainMissionCustomValueCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public GetMainMissionCustomValueCsReq create() { + return GetMainMissionCustomValueCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName mainMissionIdList = FieldName.forField("mainMissionIdList", "main_mission_id_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueScRspOuterClass.java new file mode 100644 index 0000000..419952e --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetMainMissionCustomValueScRspOuterClass.java @@ -0,0 +1,378 @@ +// 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 GetMainMissionCustomValueScRspOuterClass { + /** + * Protobuf type {@code GetMainMissionCustomValueScRsp} + */ + public static final class GetMainMissionCustomValueScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 2; + */ + private int retcode; + + /** + * repeated .MainMission main_mission_list = 5; + */ + private final RepeatedMessage mainMissionList = RepeatedMessage.newEmptyInstance(MainMissionOuterClass.MainMission.getFactory()); + + private GetMainMissionCustomValueScRsp() { + } + + /** + * @return a new empty instance of {@code GetMainMissionCustomValueScRsp} + */ + public static GetMainMissionCustomValueScRsp newInstance() { + return new GetMainMissionCustomValueScRsp(); + } + + /** + * optional uint32 retcode = 2; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 2; + * @return this + */ + public GetMainMissionCustomValueScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 2; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 2; + * @param value the retcode to set + * @return this + */ + public GetMainMissionCustomValueScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + * repeated .MainMission main_mission_list = 5; + * @return whether the mainMissionList field is set + */ + public boolean hasMainMissionList() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * repeated .MainMission main_mission_list = 5; + * @return this + */ + public GetMainMissionCustomValueScRsp clearMainMissionList() { + bitField0_ &= ~0x00000002; + mainMissionList.clear(); + return this; + } + + /** + * repeated .MainMission main_mission_list = 5; + * + * 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 #getMutableMainMissionList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getMainMissionList() { + return mainMissionList; + } + + /** + * repeated .MainMission main_mission_list = 5; + * + * 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 getMutableMainMissionList() { + bitField0_ |= 0x00000002; + return mainMissionList; + } + + /** + * repeated .MainMission main_mission_list = 5; + * @param value the mainMissionList to add + * @return this + */ + public GetMainMissionCustomValueScRsp addMainMissionList( + final MainMissionOuterClass.MainMission value) { + bitField0_ |= 0x00000002; + mainMissionList.add(value); + return this; + } + + /** + * repeated .MainMission main_mission_list = 5; + * @param values the mainMissionList to add + * @return this + */ + public GetMainMissionCustomValueScRsp addAllMainMissionList( + final MainMissionOuterClass.MainMission... values) { + bitField0_ |= 0x00000002; + mainMissionList.addAll(values); + return this; + } + + @Override + public GetMainMissionCustomValueScRsp copyFrom(final GetMainMissionCustomValueScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + mainMissionList.copyFrom(other.mainMissionList); + } + return this; + } + + @Override + public GetMainMissionCustomValueScRsp mergeFrom(final GetMainMissionCustomValueScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasMainMissionList()) { + getMutableMainMissionList().addAll(other.mainMissionList); + } + return this; + } + + @Override + public GetMainMissionCustomValueScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + mainMissionList.clear(); + return this; + } + + @Override + public GetMainMissionCustomValueScRsp clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mainMissionList.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetMainMissionCustomValueScRsp)) { + return false; + } + GetMainMissionCustomValueScRsp other = (GetMainMissionCustomValueScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasMainMissionList() || mainMissionList.equals(other.mainMissionList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 16); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + for (int i = 0; i < mainMissionList.length(); i++) { + output.writeRawByte((byte) 42); + output.writeMessageNoTag(mainMissionList.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += (1 * mainMissionList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(mainMissionList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetMainMissionCustomValueScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 16: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 42) { + break; + } + } + case 42: { + // mainMissionList + tag = input.readRepeatedMessage(mainMissionList, tag); + bitField0_ |= 0x00000002; + 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.retcode, retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRepeatedMessage(FieldNames.mainMissionList, mainMissionList); + } + output.endObject(); + } + + @Override + public GetMainMissionCustomValueScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1097936398: { + if (input.isAtField(FieldNames.retcode)) { + if (!input.trySkipNullValue()) { + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1352596271: + case 939604023: { + if (input.isAtField(FieldNames.mainMissionList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(mainMissionList); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetMainMissionCustomValueScRsp clone() { + return new GetMainMissionCustomValueScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetMainMissionCustomValueScRsp parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueScRsp(), data).checkInitialized(); + } + + public static GetMainMissionCustomValueScRsp parseFrom(final ProtoSource input) throws + IOException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueScRsp(), input).checkInitialized(); + } + + public static GetMainMissionCustomValueScRsp parseFrom(final JsonSource input) throws + IOException { + return ProtoMessage.mergeFrom(new GetMainMissionCustomValueScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating GetMainMissionCustomValueScRsp messages + */ + public static MessageFactory getFactory() { + return GetMainMissionCustomValueScRspFactory.INSTANCE; + } + + private enum GetMainMissionCustomValueScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public GetMainMissionCustomValueScRsp create() { + return GetMainMissionCustomValueScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName mainMissionList = FieldName.forField("mainMissionList", "main_mission_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/MainMissionOuterClass.java b/src/generated/main/emu/lunarcore/proto/MainMissionOuterClass.java new file mode 100644 index 0000000..1699aae --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/MainMissionOuterClass.java @@ -0,0 +1,391 @@ +// 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; + +public final class MainMissionOuterClass { + /** + * Protobuf type {@code MainMission} + */ + public static final class MainMission extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 id = 4; + */ + private int id; + + /** + *
+     *  repeated AMHBFDNMDLF AKGBLNHFPLG = 14;
+     * 
+ * + * optional .MissionStatus status = 9; + */ + private int status; + + private MainMission() { + } + + /** + * @return a new empty instance of {@code MainMission} + */ + public static MainMission newInstance() { + return new MainMission(); + } + + /** + * optional uint32 id = 4; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 id = 4; + * @return this + */ + public MainMission clearId() { + bitField0_ &= ~0x00000001; + id = 0; + return this; + } + + /** + * optional uint32 id = 4; + * @return the id + */ + public int getId() { + return id; + } + + /** + * optional uint32 id = 4; + * @param value the id to set + * @return this + */ + public MainMission setId(final int value) { + bitField0_ |= 0x00000001; + id = value; + return this; + } + + /** + *
+     *  repeated AMHBFDNMDLF AKGBLNHFPLG = 14;
+     * 
+ * + * optional .MissionStatus status = 9; + * @return whether the status field is set + */ + public boolean hasStatus() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + *
+     *  repeated AMHBFDNMDLF AKGBLNHFPLG = 14;
+     * 
+ * + * optional .MissionStatus status = 9; + * @return this + */ + public MainMission clearStatus() { + bitField0_ &= ~0x00000002; + status = 0; + return this; + } + + /** + *
+     *  repeated AMHBFDNMDLF AKGBLNHFPLG = 14;
+     * 
+ * + * optional .MissionStatus status = 9; + * @return the status + */ + public MissionStatusOuterClass.MissionStatus getStatus() { + return MissionStatusOuterClass.MissionStatus.forNumber(status); + } + + /** + * Gets the value of the internal enum store. The result is + * equivalent to {@link MainMission#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 MissionStatusOuterClass.MissionStatus}. Setting an invalid value + * can cause {@link MainMission#getStatus()} to return null + * + * @param value the numeric wire value to set + * @return this + */ + public MainMission setStatusValue(final int value) { + bitField0_ |= 0x00000002; + status = value; + return this; + } + + /** + *
+     *  repeated AMHBFDNMDLF AKGBLNHFPLG = 14;
+     * 
+ * + * optional .MissionStatus status = 9; + * @param value the status to set + * @return this + */ + public MainMission setStatus(final MissionStatusOuterClass.MissionStatus value) { + bitField0_ |= 0x00000002; + status = value.getNumber(); + return this; + } + + @Override + public MainMission copyFrom(final MainMission other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + id = other.id; + status = other.status; + } + return this; + } + + @Override + public MainMission mergeFrom(final MainMission other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasId()) { + setId(other.id); + } + if (other.hasStatus()) { + setStatusValue(other.status); + } + return this; + } + + @Override + public MainMission clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id = 0; + status = 0; + return this; + } + + @Override + public MainMission clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof MainMission)) { + return false; + } + MainMission other = (MainMission) o; + return bitField0_ == other.bitField0_ + && (!hasId() || id == other.id) + && (!hasStatus() || status == other.status); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 32); + output.writeUInt32NoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 72); + output.writeEnumNoTag(status); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeEnumSizeNoTag(status); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public MainMission mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 32: { + // id + id = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 72) { + break; + } + } + case 72: { + // status + final int value = input.readInt32(); + if (MissionStatusOuterClass.MissionStatus.forNumber(value) != null) { + status = value; + bitField0_ |= 0x00000002; + } + tag = input.readTag(); + 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.id, id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeEnum(FieldNames.status, status, MissionStatusOuterClass.MissionStatus.converter()); + } + output.endObject(); + } + + @Override + public MainMission mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -892481550: { + if (input.isAtField(FieldNames.status)) { + if (!input.trySkipNullValue()) { + final MissionStatusOuterClass.MissionStatus value = input.readEnum(MissionStatusOuterClass.MissionStatus.converter()); + if (value != null) { + status = value.getNumber(); + bitField0_ |= 0x00000002; + } else { + input.skipUnknownEnumValue(); + } + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public MainMission clone() { + return new MainMission().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static MainMission parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new MainMission(), data).checkInitialized(); + } + + public static MainMission parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new MainMission(), input).checkInitialized(); + } + + public static MainMission parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new MainMission(), input).checkInitialized(); + } + + /** + * @return factory for creating MainMission messages + */ + public static MessageFactory getFactory() { + return MainMissionFactory.INSTANCE; + } + + private enum MainMissionFactory implements MessageFactory { + INSTANCE; + + @Override + public MainMission create() { + return MainMission.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName id = FieldName.forField("id"); + + static final FieldName status = FieldName.forField("status"); + } + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMainMissionCustomValueCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMainMissionCustomValueCsReq.java new file mode 100644 index 0000000..33106f3 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMainMissionCustomValueCsReq.java @@ -0,0 +1,18 @@ +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.proto.GetMainMissionCustomValueCsReqOuterClass.GetMainMissionCustomValueCsReq; +import emu.lunarcore.server.packet.send.PacketGetMainMissionCustomValueScRsp; + +@Opcodes(CmdId.GetMainMissionCustomValueCsReq) +public class HandlerGetMainMissionCustomValueCsReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] data) throws Exception { + var req = GetMainMissionCustomValueCsReq.parseFrom(data); + session.send(new PacketGetMainMissionCustomValueScRsp(req.getMainMissionIdList().toArray())); + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetMainMissionCustomValueScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetMainMissionCustomValueScRsp.java new file mode 100644 index 0000000..aff276a --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetMainMissionCustomValueScRsp.java @@ -0,0 +1,25 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.data.GameData; +import emu.lunarcore.proto.GetMainMissionCustomValueScRspOuterClass.GetMainMissionCustomValueScRsp; +import emu.lunarcore.proto.MainMissionOuterClass.MainMission; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; + +public class PacketGetMainMissionCustomValueScRsp extends BasePacket { + + // TODO cache packet + public PacketGetMainMissionCustomValueScRsp(int[] mainMissionIdList) { + super(CmdId.GetMainMissionCustomValueScRsp); + + var data = GetMainMissionCustomValueScRsp.newInstance(); + + for (int mainMissionId : mainMissionIdList) { + MainMission mainMission = MainMission.newInstance() + .setId(mainMissionId); + data.addMainMissionList(mainMission); + } + + this.setData(data); + } +}