From 1a22d4f09e83ff5e9a6d6d497236bc6aafe4e7a4 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Sat, 30 Dec 2023 22:13:22 -0800 Subject: [PATCH] Implement farm stage gacha info handler --- .../proto/FarmStageGachaInfoOuterClass.java | 422 ++++++++++++++++++ .../GetFarmStageGachaInfoCsReqOuterClass.java | 301 +++++++++++++ .../GetFarmStageGachaInfoScRspOuterClass.java | 378 ++++++++++++++++ .../HandlerGetFarmStageGachaInfoCsReq.java | 20 + .../PacketGetFarmStageGachaInfoScRsp.java | 26 ++ 5 files changed, 1147 insertions(+) create mode 100644 src/generated/main/emu/lunarcore/proto/FarmStageGachaInfoOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoCsReqOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoScRspOuterClass.java create mode 100644 src/main/java/emu/lunarcore/server/packet/recv/HandlerGetFarmStageGachaInfoCsReq.java create mode 100644 src/main/java/emu/lunarcore/server/packet/send/PacketGetFarmStageGachaInfoScRsp.java diff --git a/src/generated/main/emu/lunarcore/proto/FarmStageGachaInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/FarmStageGachaInfoOuterClass.java new file mode 100644 index 0000000..ed2673b --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/FarmStageGachaInfoOuterClass.java @@ -0,0 +1,422 @@ +// 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 FarmStageGachaInfoOuterClass { + /** + * Protobuf type {@code FarmStageGachaInfo} + */ + public static final class FarmStageGachaInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional int64 end_time = 4; + */ + private long endTime; + + /** + * optional int64 begin_time = 5; + */ + private long beginTime; + + /** + * optional uint32 gacha_id = 3; + */ + private int gachaId; + + private FarmStageGachaInfo() { + } + + /** + * @return a new empty instance of {@code FarmStageGachaInfo} + */ + public static FarmStageGachaInfo newInstance() { + return new FarmStageGachaInfo(); + } + + /** + * optional int64 end_time = 4; + * @return whether the endTime field is set + */ + public boolean hasEndTime() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional int64 end_time = 4; + * @return this + */ + public FarmStageGachaInfo clearEndTime() { + bitField0_ &= ~0x00000001; + endTime = 0L; + return this; + } + + /** + * optional int64 end_time = 4; + * @return the endTime + */ + public long getEndTime() { + return endTime; + } + + /** + * optional int64 end_time = 4; + * @param value the endTime to set + * @return this + */ + public FarmStageGachaInfo setEndTime(final long value) { + bitField0_ |= 0x00000001; + endTime = value; + return this; + } + + /** + * optional int64 begin_time = 5; + * @return whether the beginTime field is set + */ + public boolean hasBeginTime() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional int64 begin_time = 5; + * @return this + */ + public FarmStageGachaInfo clearBeginTime() { + bitField0_ &= ~0x00000002; + beginTime = 0L; + return this; + } + + /** + * optional int64 begin_time = 5; + * @return the beginTime + */ + public long getBeginTime() { + return beginTime; + } + + /** + * optional int64 begin_time = 5; + * @param value the beginTime to set + * @return this + */ + public FarmStageGachaInfo setBeginTime(final long value) { + bitField0_ |= 0x00000002; + beginTime = value; + return this; + } + + /** + * optional uint32 gacha_id = 3; + * @return whether the gachaId field is set + */ + public boolean hasGachaId() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 gacha_id = 3; + * @return this + */ + public FarmStageGachaInfo clearGachaId() { + bitField0_ &= ~0x00000004; + gachaId = 0; + return this; + } + + /** + * optional uint32 gacha_id = 3; + * @return the gachaId + */ + public int getGachaId() { + return gachaId; + } + + /** + * optional uint32 gacha_id = 3; + * @param value the gachaId to set + * @return this + */ + public FarmStageGachaInfo setGachaId(final int value) { + bitField0_ |= 0x00000004; + gachaId = value; + return this; + } + + @Override + public FarmStageGachaInfo copyFrom(final FarmStageGachaInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + endTime = other.endTime; + beginTime = other.beginTime; + gachaId = other.gachaId; + } + return this; + } + + @Override + public FarmStageGachaInfo mergeFrom(final FarmStageGachaInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasEndTime()) { + setEndTime(other.endTime); + } + if (other.hasBeginTime()) { + setBeginTime(other.beginTime); + } + if (other.hasGachaId()) { + setGachaId(other.gachaId); + } + return this; + } + + @Override + public FarmStageGachaInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + endTime = 0L; + beginTime = 0L; + gachaId = 0; + return this; + } + + @Override + public FarmStageGachaInfo 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 FarmStageGachaInfo)) { + return false; + } + FarmStageGachaInfo other = (FarmStageGachaInfo) o; + return bitField0_ == other.bitField0_ + && (!hasEndTime() || endTime == other.endTime) + && (!hasBeginTime() || beginTime == other.beginTime) + && (!hasGachaId() || gachaId == other.gachaId); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 32); + output.writeInt64NoTag(endTime); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 40); + output.writeInt64NoTag(beginTime); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 24); + output.writeUInt32NoTag(gachaId); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeInt64SizeNoTag(endTime); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeInt64SizeNoTag(beginTime); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaId); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public FarmStageGachaInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 32: { + // endTime + endTime = input.readInt64(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 40) { + break; + } + } + case 40: { + // beginTime + beginTime = input.readInt64(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 24) { + break; + } + } + case 24: { + // gachaId + gachaId = input.readUInt32(); + bitField0_ |= 0x00000004; + 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.writeInt64(FieldNames.endTime, endTime); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeInt64(FieldNames.beginTime, beginTime); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.gachaId, gachaId); + } + output.endObject(); + } + + @Override + public FarmStageGachaInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1607243192: + case 1725551537: { + if (input.isAtField(FieldNames.endTime)) { + if (!input.trySkipNullValue()) { + endTime = input.readInt64(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1072839914: + case 1112183971: { + if (input.isAtField(FieldNames.beginTime)) { + if (!input.trySkipNullValue()) { + beginTime = input.readInt64(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case -204751299: + case -2052301576: { + if (input.isAtField(FieldNames.gachaId)) { + if (!input.trySkipNullValue()) { + gachaId = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public FarmStageGachaInfo clone() { + return new FarmStageGachaInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static FarmStageGachaInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new FarmStageGachaInfo(), data).checkInitialized(); + } + + public static FarmStageGachaInfo parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new FarmStageGachaInfo(), input).checkInitialized(); + } + + public static FarmStageGachaInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new FarmStageGachaInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating FarmStageGachaInfo messages + */ + public static MessageFactory getFactory() { + return FarmStageGachaInfoFactory.INSTANCE; + } + + private enum FarmStageGachaInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public FarmStageGachaInfo create() { + return FarmStageGachaInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName endTime = FieldName.forField("endTime", "end_time"); + + static final FieldName beginTime = FieldName.forField("beginTime", "begin_time"); + + static final FieldName gachaId = FieldName.forField("gachaId", "gacha_id"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoCsReqOuterClass.java new file mode 100644 index 0000000..6e86d0b --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoCsReqOuterClass.java @@ -0,0 +1,301 @@ +// 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 GetFarmStageGachaInfoCsReqOuterClass { + /** + * Protobuf type {@code GetFarmStageGachaInfoCsReq} + */ + public static final class GetFarmStageGachaInfoCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + */ + private final RepeatedInt farmStageGachaIdList = RepeatedInt.newEmptyInstance(); + + private GetFarmStageGachaInfoCsReq() { + } + + /** + * @return a new empty instance of {@code GetFarmStageGachaInfoCsReq} + */ + public static GetFarmStageGachaInfoCsReq newInstance() { + return new GetFarmStageGachaInfoCsReq(); + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * @return whether the farmStageGachaIdList field is set + */ + public boolean hasFarmStageGachaIdList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * @return this + */ + public GetFarmStageGachaInfoCsReq clearFarmStageGachaIdList() { + bitField0_ &= ~0x00000001; + farmStageGachaIdList.clear(); + return this; + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * + * 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 #getMutableFarmStageGachaIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getFarmStageGachaIdList() { + return farmStageGachaIdList; + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * + * 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 getMutableFarmStageGachaIdList() { + bitField0_ |= 0x00000001; + return farmStageGachaIdList; + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * @param value the farmStageGachaIdList to add + * @return this + */ + public GetFarmStageGachaInfoCsReq addFarmStageGachaIdList(final int value) { + bitField0_ |= 0x00000001; + farmStageGachaIdList.add(value); + return this; + } + + /** + * repeated uint32 farm_stage_gacha_id_list = 11; + * @param values the farmStageGachaIdList to add + * @return this + */ + public GetFarmStageGachaInfoCsReq addAllFarmStageGachaIdList(final int... values) { + bitField0_ |= 0x00000001; + farmStageGachaIdList.addAll(values); + return this; + } + + @Override + public GetFarmStageGachaInfoCsReq copyFrom(final GetFarmStageGachaInfoCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + farmStageGachaIdList.copyFrom(other.farmStageGachaIdList); + } + return this; + } + + @Override + public GetFarmStageGachaInfoCsReq mergeFrom(final GetFarmStageGachaInfoCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasFarmStageGachaIdList()) { + getMutableFarmStageGachaIdList().addAll(other.farmStageGachaIdList); + } + return this; + } + + @Override + public GetFarmStageGachaInfoCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + farmStageGachaIdList.clear(); + return this; + } + + @Override + public GetFarmStageGachaInfoCsReq clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + farmStageGachaIdList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetFarmStageGachaInfoCsReq)) { + return false; + } + GetFarmStageGachaInfoCsReq other = (GetFarmStageGachaInfoCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasFarmStageGachaIdList() || farmStageGachaIdList.equals(other.farmStageGachaIdList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < farmStageGachaIdList.length(); i++) { + output.writeRawByte((byte) 88); + output.writeUInt32NoTag(farmStageGachaIdList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * farmStageGachaIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(farmStageGachaIdList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetFarmStageGachaInfoCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 90: { + // farmStageGachaIdList [packed=true] + input.readPackedUInt32(farmStageGachaIdList, 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 88: { + // farmStageGachaIdList [packed=false] + tag = input.readRepeatedUInt32(farmStageGachaIdList, tag); + bitField0_ |= 0x00000001; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedUInt32(FieldNames.farmStageGachaIdList, farmStageGachaIdList); + } + output.endObject(); + } + + @Override + public GetFarmStageGachaInfoCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 2055808755: + case -1677519237: { + if (input.isAtField(FieldNames.farmStageGachaIdList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(farmStageGachaIdList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetFarmStageGachaInfoCsReq clone() { + return new GetFarmStageGachaInfoCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetFarmStageGachaInfoCsReq parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoCsReq(), data).checkInitialized(); + } + + public static GetFarmStageGachaInfoCsReq parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoCsReq(), input).checkInitialized(); + } + + public static GetFarmStageGachaInfoCsReq parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating GetFarmStageGachaInfoCsReq messages + */ + public static MessageFactory getFactory() { + return GetFarmStageGachaInfoCsReqFactory.INSTANCE; + } + + private enum GetFarmStageGachaInfoCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public GetFarmStageGachaInfoCsReq create() { + return GetFarmStageGachaInfoCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName farmStageGachaIdList = FieldName.forField("farmStageGachaIdList", "farm_stage_gacha_id_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoScRspOuterClass.java new file mode 100644 index 0000000..57abe2e --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetFarmStageGachaInfoScRspOuterClass.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 GetFarmStageGachaInfoScRspOuterClass { + /** + * Protobuf type {@code GetFarmStageGachaInfoScRsp} + */ + public static final class GetFarmStageGachaInfoScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 12; + */ + private int retcode; + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + */ + private final RepeatedMessage farmStageGachaInfoList = RepeatedMessage.newEmptyInstance(FarmStageGachaInfoOuterClass.FarmStageGachaInfo.getFactory()); + + private GetFarmStageGachaInfoScRsp() { + } + + /** + * @return a new empty instance of {@code GetFarmStageGachaInfoScRsp} + */ + public static GetFarmStageGachaInfoScRsp newInstance() { + return new GetFarmStageGachaInfoScRsp(); + } + + /** + * optional uint32 retcode = 12; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 12; + * @return this + */ + public GetFarmStageGachaInfoScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 12; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 12; + * @param value the retcode to set + * @return this + */ + public GetFarmStageGachaInfoScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * @return whether the farmStageGachaInfoList field is set + */ + public boolean hasFarmStageGachaInfoList() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * @return this + */ + public GetFarmStageGachaInfoScRsp clearFarmStageGachaInfoList() { + bitField0_ &= ~0x00000002; + farmStageGachaInfoList.clear(); + return this; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * + * 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 #getMutableFarmStageGachaInfoList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getFarmStageGachaInfoList( + ) { + return farmStageGachaInfoList; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * + * 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 getMutableFarmStageGachaInfoList( + ) { + bitField0_ |= 0x00000002; + return farmStageGachaInfoList; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * @param value the farmStageGachaInfoList to add + * @return this + */ + public GetFarmStageGachaInfoScRsp addFarmStageGachaInfoList( + final FarmStageGachaInfoOuterClass.FarmStageGachaInfo value) { + bitField0_ |= 0x00000002; + farmStageGachaInfoList.add(value); + return this; + } + + /** + * repeated .FarmStageGachaInfo farm_stage_gacha_info_list = 10; + * @param values the farmStageGachaInfoList to add + * @return this + */ + public GetFarmStageGachaInfoScRsp addAllFarmStageGachaInfoList( + final FarmStageGachaInfoOuterClass.FarmStageGachaInfo... values) { + bitField0_ |= 0x00000002; + farmStageGachaInfoList.addAll(values); + return this; + } + + @Override + public GetFarmStageGachaInfoScRsp copyFrom(final GetFarmStageGachaInfoScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + farmStageGachaInfoList.copyFrom(other.farmStageGachaInfoList); + } + return this; + } + + @Override + public GetFarmStageGachaInfoScRsp mergeFrom(final GetFarmStageGachaInfoScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasFarmStageGachaInfoList()) { + getMutableFarmStageGachaInfoList().addAll(other.farmStageGachaInfoList); + } + return this; + } + + @Override + public GetFarmStageGachaInfoScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + farmStageGachaInfoList.clear(); + return this; + } + + @Override + public GetFarmStageGachaInfoScRsp clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + farmStageGachaInfoList.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetFarmStageGachaInfoScRsp)) { + return false; + } + GetFarmStageGachaInfoScRsp other = (GetFarmStageGachaInfoScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasFarmStageGachaInfoList() || farmStageGachaInfoList.equals(other.farmStageGachaInfoList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 96); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + for (int i = 0; i < farmStageGachaInfoList.length(); i++) { + output.writeRawByte((byte) 82); + output.writeMessageNoTag(farmStageGachaInfoList.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += (1 * farmStageGachaInfoList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(farmStageGachaInfoList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetFarmStageGachaInfoScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 96: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 82) { + break; + } + } + case 82: { + // farmStageGachaInfoList + tag = input.readRepeatedMessage(farmStageGachaInfoList, 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.farmStageGachaInfoList, farmStageGachaInfoList); + } + output.endObject(); + } + + @Override + public GetFarmStageGachaInfoScRsp 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 981089926: + case 758978696: { + if (input.isAtField(FieldNames.farmStageGachaInfoList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(farmStageGachaInfoList); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetFarmStageGachaInfoScRsp clone() { + return new GetFarmStageGachaInfoScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetFarmStageGachaInfoScRsp parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoScRsp(), data).checkInitialized(); + } + + public static GetFarmStageGachaInfoScRsp parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoScRsp(), input).checkInitialized(); + } + + public static GetFarmStageGachaInfoScRsp parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetFarmStageGachaInfoScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating GetFarmStageGachaInfoScRsp messages + */ + public static MessageFactory getFactory() { + return GetFarmStageGachaInfoScRspFactory.INSTANCE; + } + + private enum GetFarmStageGachaInfoScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public GetFarmStageGachaInfoScRsp create() { + return GetFarmStageGachaInfoScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName farmStageGachaInfoList = FieldName.forField("farmStageGachaInfoList", "farm_stage_gacha_info_list"); + } + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetFarmStageGachaInfoCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetFarmStageGachaInfoCsReq.java new file mode 100644 index 0000000..995fec3 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetFarmStageGachaInfoCsReq.java @@ -0,0 +1,20 @@ +package emu.lunarcore.server.packet.recv; + +import emu.lunarcore.proto.GetFarmStageGachaInfoCsReqOuterClass.GetFarmStageGachaInfoCsReq; +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.PacketGetFarmStageGachaInfoScRsp; + +@Opcodes(CmdId.GetFarmStageGachaInfoCsReq) +public class HandlerGetFarmStageGachaInfoCsReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] data) throws Exception { + var req = GetFarmStageGachaInfoCsReq.parseFrom(data); + + session.send(new PacketGetFarmStageGachaInfoScRsp(req.getFarmStageGachaIdList())); + } + +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetFarmStageGachaInfoScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetFarmStageGachaInfoScRsp.java new file mode 100644 index 0000000..22c58a0 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetFarmStageGachaInfoScRsp.java @@ -0,0 +1,26 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.proto.FarmStageGachaInfoOuterClass.FarmStageGachaInfo; +import emu.lunarcore.proto.GetFarmStageGachaInfoScRspOuterClass.GetFarmStageGachaInfoScRsp; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; +import us.hebi.quickbuf.RepeatedInt; + +public class PacketGetFarmStageGachaInfoScRsp extends BasePacket { + + public PacketGetFarmStageGachaInfoScRsp(RepeatedInt idList) { + super(CmdId.GetFarmStageGachaInfoScRsp); + + var data = GetFarmStageGachaInfoScRsp.newInstance(); + + for (var id : idList) { + var info = FarmStageGachaInfo.newInstance() + .setGachaId(id) + .setEndTime(Integer.MAX_VALUE); + + data.addFarmStageGachaInfoList(info); + } + + this.setData(data); + } +}