From 29e5b130d34d4f94bcc2f997fc55b2a07f259218 Mon Sep 17 00:00:00 2001
From: Melledy <121644117+Melledy@users.noreply.github.com>
Date: Mon, 27 Nov 2023 22:19:36 -0800
Subject: [PATCH] Fix standard banner display and handle gacha ceiling exchange
properly
---
.../proto/DoGachaScRspOuterClass.java | 127 +++-
.../ExchangeGachaCeilingCsReqOuterClass.java | 341 ++++++++++
.../ExchangeGachaCeilingScRspOuterClass.java | 626 ++++++++++++++++++
.../proto/GachaCeilingOuterClass.java | 95 ++-
.../proto/GetGachaCeilingCsReqOuterClass.java | 61 +-
.../proto/GetGachaCeilingScRspOuterClass.java | 61 +-
.../java/emu/lunarcore/GameConstants.java | 3 +
.../emu/lunarcore/game/gacha/GachaBanner.java | 58 +-
.../lunarcore/game/gacha/GachaService.java | 68 +-
.../emu/lunarcore/game/gacha/GachaType.java | 13 +-
.../lunarcore/game/gacha/PlayerGachaInfo.java | 52 +-
.../HandlerExchangeGachaCeilingCsReq.java | 21 +
.../recv/HandlerGetGachaCeilingCsReq.java | 4 +-
.../packet/send/PacketDoGachaScRsp.java | 4 +-
.../send/PacketExchangeGachaCeilingScRsp.java | 32 +
.../send/PacketGetGachaCeilingScRsp.java | 29 +-
.../packet/send/PacketGetGachaInfoScRsp.java | 2 +-
17 files changed, 1403 insertions(+), 194 deletions(-)
create mode 100644 src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingCsReqOuterClass.java
create mode 100644 src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingScRspOuterClass.java
create mode 100644 src/main/java/emu/lunarcore/server/packet/recv/HandlerExchangeGachaCeilingCsReq.java
create mode 100644 src/main/java/emu/lunarcore/server/packet/send/PacketExchangeGachaCeilingScRsp.java
diff --git a/src/generated/main/emu/lunarcore/proto/DoGachaScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/DoGachaScRspOuterClass.java
index d21ce93..4788147 100644
--- a/src/generated/main/emu/lunarcore/proto/DoGachaScRspOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/DoGachaScRspOuterClass.java
@@ -24,6 +24,11 @@ public final class DoGachaScRspOuterClass {
*/
private int gachaId;
+ /**
+ * optional uint32 ceiling_num = 5;
+ */
+ private int ceilingNum;
+
/**
* optional uint32 gacha_num = 11;
*/
@@ -86,12 +91,49 @@ public final class DoGachaScRspOuterClass {
return this;
}
+ /**
+ * optional uint32 ceiling_num = 5;
+ * @return whether the ceilingNum field is set
+ */
+ public boolean hasCeilingNum() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * optional uint32 ceiling_num = 5;
+ * @return this
+ */
+ public DoGachaScRsp clearCeilingNum() {
+ bitField0_ &= ~0x00000002;
+ ceilingNum = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 ceiling_num = 5;
+ * @return the ceilingNum
+ */
+ public int getCeilingNum() {
+ return ceilingNum;
+ }
+
+ /**
+ * optional uint32 ceiling_num = 5;
+ * @param value the ceilingNum to set
+ * @return this
+ */
+ public DoGachaScRsp setCeilingNum(final int value) {
+ bitField0_ |= 0x00000002;
+ ceilingNum = value;
+ return this;
+ }
+
/**
* optional uint32 gacha_num = 11;
* @return whether the gachaNum field is set
*/
public boolean hasGachaNum() {
- return (bitField0_ & 0x00000002) != 0;
+ return (bitField0_ & 0x00000004) != 0;
}
/**
@@ -99,7 +141,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp clearGachaNum() {
- bitField0_ &= ~0x00000002;
+ bitField0_ &= ~0x00000004;
gachaNum = 0;
return this;
}
@@ -118,7 +160,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp setGachaNum(final int value) {
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
gachaNum = value;
return this;
}
@@ -128,7 +170,7 @@ public final class DoGachaScRspOuterClass {
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
- return (bitField0_ & 0x00000004) != 0;
+ return (bitField0_ & 0x00000008) != 0;
}
/**
@@ -136,7 +178,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp clearRetcode() {
- bitField0_ &= ~0x00000004;
+ bitField0_ &= ~0x00000008;
retcode = 0;
return this;
}
@@ -155,7 +197,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp setRetcode(final int value) {
- bitField0_ |= 0x00000004;
+ bitField0_ |= 0x00000008;
retcode = value;
return this;
}
@@ -165,7 +207,7 @@ public final class DoGachaScRspOuterClass {
* @return whether the gachaItemList field is set
*/
public boolean hasGachaItemList() {
- return (bitField0_ & 0x00000008) != 0;
+ return (bitField0_ & 0x00000010) != 0;
}
/**
@@ -173,7 +215,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp clearGachaItemList() {
- bitField0_ &= ~0x00000008;
+ bitField0_ &= ~0x00000010;
gachaItemList.clear();
return this;
}
@@ -202,7 +244,7 @@ public final class DoGachaScRspOuterClass {
* @return internal storage object for modifications
*/
public RepeatedMessage getMutableGachaItemList() {
- bitField0_ |= 0x00000008;
+ bitField0_ |= 0x00000010;
return gachaItemList;
}
@@ -212,7 +254,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp addGachaItemList(final GachaItemOuterClass.GachaItem value) {
- bitField0_ |= 0x00000008;
+ bitField0_ |= 0x00000010;
gachaItemList.add(value);
return this;
}
@@ -223,7 +265,7 @@ public final class DoGachaScRspOuterClass {
* @return this
*/
public DoGachaScRsp addAllGachaItemList(final GachaItemOuterClass.GachaItem... values) {
- bitField0_ |= 0x00000008;
+ bitField0_ |= 0x00000010;
gachaItemList.addAll(values);
return this;
}
@@ -234,6 +276,7 @@ public final class DoGachaScRspOuterClass {
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
gachaId = other.gachaId;
+ ceilingNum = other.ceilingNum;
gachaNum = other.gachaNum;
retcode = other.retcode;
gachaItemList.copyFrom(other.gachaItemList);
@@ -250,6 +293,9 @@ public final class DoGachaScRspOuterClass {
if (other.hasGachaId()) {
setGachaId(other.gachaId);
}
+ if (other.hasCeilingNum()) {
+ setCeilingNum(other.ceilingNum);
+ }
if (other.hasGachaNum()) {
setGachaNum(other.gachaNum);
}
@@ -270,6 +316,7 @@ public final class DoGachaScRspOuterClass {
cachedSize = -1;
bitField0_ = 0;
gachaId = 0;
+ ceilingNum = 0;
gachaNum = 0;
retcode = 0;
gachaItemList.clear();
@@ -298,6 +345,7 @@ public final class DoGachaScRspOuterClass {
DoGachaScRsp other = (DoGachaScRsp) o;
return bitField0_ == other.bitField0_
&& (!hasGachaId() || gachaId == other.gachaId)
+ && (!hasCeilingNum() || ceilingNum == other.ceilingNum)
&& (!hasGachaNum() || gachaNum == other.gachaNum)
&& (!hasRetcode() || retcode == other.retcode)
&& (!hasGachaItemList() || gachaItemList.equals(other.gachaItemList));
@@ -310,14 +358,18 @@ public final class DoGachaScRspOuterClass {
output.writeUInt32NoTag(gachaId);
}
if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRawByte((byte) 40);
+ output.writeUInt32NoTag(ceilingNum);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 88);
output.writeUInt32NoTag(gachaNum);
}
- if ((bitField0_ & 0x00000004) != 0) {
+ if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 104);
output.writeUInt32NoTag(retcode);
}
- if ((bitField0_ & 0x00000008) != 0) {
+ if ((bitField0_ & 0x00000010) != 0) {
for (int i = 0; i < gachaItemList.length(); i++) {
output.writeRawByte((byte) 74);
output.writeMessageNoTag(gachaItemList.get(i));
@@ -332,12 +384,15 @@ public final class DoGachaScRspOuterClass {
size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaId);
}
if ((bitField0_ & 0x00000002) != 0) {
- size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaNum);
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum);
}
if ((bitField0_ & 0x00000004) != 0) {
- size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaNum);
}
if ((bitField0_ & 0x00000008) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
+ }
+ if ((bitField0_ & 0x00000010) != 0) {
size += (1 * gachaItemList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(gachaItemList);
}
return size;
@@ -355,6 +410,15 @@ public final class DoGachaScRspOuterClass {
gachaId = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
+ if (tag != 40) {
+ break;
+ }
+ }
+ case 40: {
+ // ceilingNum
+ ceilingNum = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ tag = input.readTag();
if (tag != 88) {
break;
}
@@ -362,7 +426,7 @@ public final class DoGachaScRspOuterClass {
case 88: {
// gachaNum
gachaNum = input.readUInt32();
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
tag = input.readTag();
if (tag != 104) {
break;
@@ -371,7 +435,7 @@ public final class DoGachaScRspOuterClass {
case 104: {
// retcode
retcode = input.readUInt32();
- bitField0_ |= 0x00000004;
+ bitField0_ |= 0x00000008;
tag = input.readTag();
if (tag != 74) {
break;
@@ -380,7 +444,7 @@ public final class DoGachaScRspOuterClass {
case 74: {
// gachaItemList
tag = input.readRepeatedMessage(gachaItemList, tag);
- bitField0_ |= 0x00000008;
+ bitField0_ |= 0x00000010;
if (tag != 0) {
break;
}
@@ -406,12 +470,15 @@ public final class DoGachaScRspOuterClass {
output.writeUInt32(FieldNames.gachaId, gachaId);
}
if ((bitField0_ & 0x00000002) != 0) {
- output.writeUInt32(FieldNames.gachaNum, gachaNum);
+ output.writeUInt32(FieldNames.ceilingNum, ceilingNum);
}
if ((bitField0_ & 0x00000004) != 0) {
- output.writeUInt32(FieldNames.retcode, retcode);
+ output.writeUInt32(FieldNames.gachaNum, gachaNum);
}
if ((bitField0_ & 0x00000008) != 0) {
+ output.writeUInt32(FieldNames.retcode, retcode);
+ }
+ if ((bitField0_ & 0x00000010) != 0) {
output.writeRepeatedMessage(FieldNames.gachaItemList, gachaItemList);
}
output.endObject();
@@ -436,12 +503,24 @@ public final class DoGachaScRspOuterClass {
}
break;
}
+ case -1655838327:
+ case 209119492: {
+ if (input.isAtField(FieldNames.ceilingNum)) {
+ if (!input.trySkipNullValue()) {
+ ceilingNum = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
case -2052317532:
case 803166025: {
if (input.isAtField(FieldNames.gachaNum)) {
if (!input.trySkipNullValue()) {
gachaNum = input.readUInt32();
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
@@ -452,7 +531,7 @@ public final class DoGachaScRspOuterClass {
if (input.isAtField(FieldNames.retcode)) {
if (!input.trySkipNullValue()) {
retcode = input.readUInt32();
- bitField0_ |= 0x00000004;
+ bitField0_ |= 0x00000008;
}
} else {
input.skipUnknownField();
@@ -464,7 +543,7 @@ public final class DoGachaScRspOuterClass {
if (input.isAtField(FieldNames.gachaItemList)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(gachaItemList);
- bitField0_ |= 0x00000008;
+ bitField0_ |= 0x00000010;
}
} else {
input.skipUnknownField();
@@ -525,6 +604,8 @@ public final class DoGachaScRspOuterClass {
static class FieldNames {
static final FieldName gachaId = FieldName.forField("gachaId", "gacha_id");
+ static final FieldName ceilingNum = FieldName.forField("ceilingNum", "ceiling_num");
+
static final FieldName gachaNum = FieldName.forField("gachaNum", "gacha_num");
static final FieldName retcode = FieldName.forField("retcode");
diff --git a/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingCsReqOuterClass.java
new file mode 100644
index 0000000..f2e0121
--- /dev/null
+++ b/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingCsReqOuterClass.java
@@ -0,0 +1,341 @@
+// 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 ExchangeGachaCeilingCsReqOuterClass {
+ /**
+ * Protobuf type {@code ExchangeGachaCeilingCsReq}
+ */
+ public static final class ExchangeGachaCeilingCsReq extends ProtoMessage implements Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * optional uint32 gacha_type = 10;
+ */
+ private int gachaType;
+
+ /**
+ * optional uint32 avatar_id = 12;
+ */
+ private int avatarId;
+
+ private ExchangeGachaCeilingCsReq() {
+ }
+
+ /**
+ * @return a new empty instance of {@code ExchangeGachaCeilingCsReq}
+ */
+ public static ExchangeGachaCeilingCsReq newInstance() {
+ return new ExchangeGachaCeilingCsReq();
+ }
+
+ /**
+ * optional uint32 gacha_type = 10;
+ * @return whether the gachaType field is set
+ */
+ public boolean hasGachaType() {
+ return (bitField0_ & 0x00000001) != 0;
+ }
+
+ /**
+ * optional uint32 gacha_type = 10;
+ * @return this
+ */
+ public ExchangeGachaCeilingCsReq clearGachaType() {
+ bitField0_ &= ~0x00000001;
+ gachaType = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 gacha_type = 10;
+ * @return the gachaType
+ */
+ public int getGachaType() {
+ return gachaType;
+ }
+
+ /**
+ * optional uint32 gacha_type = 10;
+ * @param value the gachaType to set
+ * @return this
+ */
+ public ExchangeGachaCeilingCsReq setGachaType(final int value) {
+ bitField0_ |= 0x00000001;
+ gachaType = value;
+ return this;
+ }
+
+ /**
+ * optional uint32 avatar_id = 12;
+ * @return whether the avatarId field is set
+ */
+ public boolean hasAvatarId() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * optional uint32 avatar_id = 12;
+ * @return this
+ */
+ public ExchangeGachaCeilingCsReq clearAvatarId() {
+ bitField0_ &= ~0x00000002;
+ avatarId = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 avatar_id = 12;
+ * @return the avatarId
+ */
+ public int getAvatarId() {
+ return avatarId;
+ }
+
+ /**
+ * optional uint32 avatar_id = 12;
+ * @param value the avatarId to set
+ * @return this
+ */
+ public ExchangeGachaCeilingCsReq setAvatarId(final int value) {
+ bitField0_ |= 0x00000002;
+ avatarId = value;
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq copyFrom(final ExchangeGachaCeilingCsReq other) {
+ cachedSize = other.cachedSize;
+ if ((bitField0_ | other.bitField0_) != 0) {
+ bitField0_ = other.bitField0_;
+ gachaType = other.gachaType;
+ avatarId = other.avatarId;
+ }
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq mergeFrom(final ExchangeGachaCeilingCsReq other) {
+ if (other.isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ if (other.hasGachaType()) {
+ setGachaType(other.gachaType);
+ }
+ if (other.hasAvatarId()) {
+ setAvatarId(other.avatarId);
+ }
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq clear() {
+ if (isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ bitField0_ = 0;
+ gachaType = 0;
+ avatarId = 0;
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq 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 ExchangeGachaCeilingCsReq)) {
+ return false;
+ }
+ ExchangeGachaCeilingCsReq other = (ExchangeGachaCeilingCsReq) o;
+ return bitField0_ == other.bitField0_
+ && (!hasGachaType() || gachaType == other.gachaType)
+ && (!hasAvatarId() || avatarId == other.avatarId);
+ }
+
+ @Override
+ public void writeTo(final ProtoSink output) throws IOException {
+ if ((bitField0_ & 0x00000001) != 0) {
+ output.writeRawByte((byte) 80);
+ output.writeUInt32NoTag(gachaType);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRawByte((byte) 96);
+ output.writeUInt32NoTag(avatarId);
+ }
+ }
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = 0;
+ if ((bitField0_ & 0x00000001) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(avatarId);
+ }
+ return size;
+ }
+
+ @Override
+ @SuppressWarnings("fallthrough")
+ public ExchangeGachaCeilingCsReq mergeFrom(final ProtoSource input) throws IOException {
+ // Enabled Fall-Through Optimization (QuickBuffers)
+ int tag = input.readTag();
+ while (true) {
+ switch (tag) {
+ case 80: {
+ // gachaType
+ gachaType = input.readUInt32();
+ bitField0_ |= 0x00000001;
+ tag = input.readTag();
+ if (tag != 96) {
+ break;
+ }
+ }
+ case 96: {
+ // avatarId
+ avatarId = input.readUInt32();
+ 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.gachaType, gachaType);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeUInt32(FieldNames.avatarId, avatarId);
+ }
+ output.endObject();
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq mergeFrom(final JsonSource input) throws IOException {
+ if (!input.beginObject()) {
+ return this;
+ }
+ while (!input.isAtEnd()) {
+ switch (input.readFieldHash()) {
+ case 802848732:
+ case -871474217: {
+ if (input.isAtField(FieldNames.gachaType)) {
+ if (!input.trySkipNullValue()) {
+ gachaType = input.readUInt32();
+ bitField0_ |= 0x00000001;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ case 1787287636:
+ case -428636735: {
+ if (input.isAtField(FieldNames.avatarId)) {
+ if (!input.trySkipNullValue()) {
+ avatarId = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ default: {
+ input.skipUnknownField();
+ break;
+ }
+ }
+ }
+ input.endObject();
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingCsReq clone() {
+ return new ExchangeGachaCeilingCsReq().copyFrom(this);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return ((bitField0_) == 0);
+ }
+
+ public static ExchangeGachaCeilingCsReq parseFrom(final byte[] data) throws
+ InvalidProtocolBufferException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingCsReq(), data).checkInitialized();
+ }
+
+ public static ExchangeGachaCeilingCsReq parseFrom(final ProtoSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingCsReq(), input).checkInitialized();
+ }
+
+ public static ExchangeGachaCeilingCsReq parseFrom(final JsonSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingCsReq(), input).checkInitialized();
+ }
+
+ /**
+ * @return factory for creating ExchangeGachaCeilingCsReq messages
+ */
+ public static MessageFactory getFactory() {
+ return ExchangeGachaCeilingCsReqFactory.INSTANCE;
+ }
+
+ private enum ExchangeGachaCeilingCsReqFactory implements MessageFactory {
+ INSTANCE;
+
+ @Override
+ public ExchangeGachaCeilingCsReq create() {
+ return ExchangeGachaCeilingCsReq.newInstance();
+ }
+ }
+
+ /**
+ * Contains name constants used for serializing JSON
+ */
+ static class FieldNames {
+ static final FieldName gachaType = FieldName.forField("gachaType", "gacha_type");
+
+ static final FieldName avatarId = FieldName.forField("avatarId", "avatar_id");
+ }
+ }
+}
diff --git a/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingScRspOuterClass.java
new file mode 100644
index 0000000..74d7d58
--- /dev/null
+++ b/src/generated/main/emu/lunarcore/proto/ExchangeGachaCeilingScRspOuterClass.java
@@ -0,0 +1,626 @@
+// 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 ExchangeGachaCeilingScRspOuterClass {
+ /**
+ * Protobuf type {@code ExchangeGachaCeilingScRsp}
+ */
+ public static final class ExchangeGachaCeilingScRsp extends ProtoMessage implements Cloneable {
+ private static final long serialVersionUID = 0L;
+
+ /**
+ * optional uint32 avatar_id = 5;
+ */
+ private int avatarId;
+
+ /**
+ * optional uint32 retcode = 9;
+ */
+ private int retcode;
+
+ /**
+ * optional uint32 gacha_type = 12;
+ */
+ private int gachaType;
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ */
+ private final ItemListOuterClass.ItemList transferItemList = ItemListOuterClass.ItemList.newInstance();
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ */
+ private final GachaCeilingOuterClass.GachaCeiling gachaCeiling = GachaCeilingOuterClass.GachaCeiling.newInstance();
+
+ private ExchangeGachaCeilingScRsp() {
+ }
+
+ /**
+ * @return a new empty instance of {@code ExchangeGachaCeilingScRsp}
+ */
+ public static ExchangeGachaCeilingScRsp newInstance() {
+ return new ExchangeGachaCeilingScRsp();
+ }
+
+ /**
+ * optional uint32 avatar_id = 5;
+ * @return whether the avatarId field is set
+ */
+ public boolean hasAvatarId() {
+ return (bitField0_ & 0x00000001) != 0;
+ }
+
+ /**
+ * optional uint32 avatar_id = 5;
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp clearAvatarId() {
+ bitField0_ &= ~0x00000001;
+ avatarId = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 avatar_id = 5;
+ * @return the avatarId
+ */
+ public int getAvatarId() {
+ return avatarId;
+ }
+
+ /**
+ * optional uint32 avatar_id = 5;
+ * @param value the avatarId to set
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp setAvatarId(final int value) {
+ bitField0_ |= 0x00000001;
+ avatarId = value;
+ return this;
+ }
+
+ /**
+ * optional uint32 retcode = 9;
+ * @return whether the retcode field is set
+ */
+ public boolean hasRetcode() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * optional uint32 retcode = 9;
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp clearRetcode() {
+ bitField0_ &= ~0x00000002;
+ retcode = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 retcode = 9;
+ * @return the retcode
+ */
+ public int getRetcode() {
+ return retcode;
+ }
+
+ /**
+ * optional uint32 retcode = 9;
+ * @param value the retcode to set
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp setRetcode(final int value) {
+ bitField0_ |= 0x00000002;
+ retcode = value;
+ return this;
+ }
+
+ /**
+ * optional uint32 gacha_type = 12;
+ * @return whether the gachaType field is set
+ */
+ public boolean hasGachaType() {
+ return (bitField0_ & 0x00000004) != 0;
+ }
+
+ /**
+ * optional uint32 gacha_type = 12;
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp clearGachaType() {
+ bitField0_ &= ~0x00000004;
+ gachaType = 0;
+ return this;
+ }
+
+ /**
+ * optional uint32 gacha_type = 12;
+ * @return the gachaType
+ */
+ public int getGachaType() {
+ return gachaType;
+ }
+
+ /**
+ * optional uint32 gacha_type = 12;
+ * @param value the gachaType to set
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp setGachaType(final int value) {
+ bitField0_ |= 0x00000004;
+ gachaType = value;
+ return this;
+ }
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ * @return whether the transferItemList field is set
+ */
+ public boolean hasTransferItemList() {
+ return (bitField0_ & 0x00000008) != 0;
+ }
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp clearTransferItemList() {
+ bitField0_ &= ~0x00000008;
+ transferItemList.clear();
+ return this;
+ }
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ *
+ * 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 #getMutableTransferItemList()} if you want to modify it.
+ *
+ * @return internal storage object for reading
+ */
+ public ItemListOuterClass.ItemList getTransferItemList() {
+ return transferItemList;
+ }
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ *
+ * 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 ItemListOuterClass.ItemList getMutableTransferItemList() {
+ bitField0_ |= 0x00000008;
+ return transferItemList;
+ }
+
+ /**
+ * optional .ItemList transfer_item_list = 2;
+ * @param value the transferItemList to set
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp setTransferItemList(final ItemListOuterClass.ItemList value) {
+ bitField0_ |= 0x00000008;
+ transferItemList.copyFrom(value);
+ return this;
+ }
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ * @return whether the gachaCeiling field is set
+ */
+ public boolean hasGachaCeiling() {
+ return (bitField0_ & 0x00000010) != 0;
+ }
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp clearGachaCeiling() {
+ bitField0_ &= ~0x00000010;
+ gachaCeiling.clear();
+ return this;
+ }
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ *
+ * 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 #getMutableGachaCeiling()} if you want to modify it.
+ *
+ * @return internal storage object for reading
+ */
+ public GachaCeilingOuterClass.GachaCeiling getGachaCeiling() {
+ return gachaCeiling;
+ }
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ *
+ * 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 GachaCeilingOuterClass.GachaCeiling getMutableGachaCeiling() {
+ bitField0_ |= 0x00000010;
+ return gachaCeiling;
+ }
+
+ /**
+ * optional .GachaCeiling gacha_ceiling = 7;
+ * @param value the gachaCeiling to set
+ * @return this
+ */
+ public ExchangeGachaCeilingScRsp setGachaCeiling(
+ final GachaCeilingOuterClass.GachaCeiling value) {
+ bitField0_ |= 0x00000010;
+ gachaCeiling.copyFrom(value);
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp copyFrom(final ExchangeGachaCeilingScRsp other) {
+ cachedSize = other.cachedSize;
+ if ((bitField0_ | other.bitField0_) != 0) {
+ bitField0_ = other.bitField0_;
+ avatarId = other.avatarId;
+ retcode = other.retcode;
+ gachaType = other.gachaType;
+ transferItemList.copyFrom(other.transferItemList);
+ gachaCeiling.copyFrom(other.gachaCeiling);
+ }
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp mergeFrom(final ExchangeGachaCeilingScRsp other) {
+ if (other.isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ if (other.hasAvatarId()) {
+ setAvatarId(other.avatarId);
+ }
+ if (other.hasRetcode()) {
+ setRetcode(other.retcode);
+ }
+ if (other.hasGachaType()) {
+ setGachaType(other.gachaType);
+ }
+ if (other.hasTransferItemList()) {
+ getMutableTransferItemList().mergeFrom(other.transferItemList);
+ }
+ if (other.hasGachaCeiling()) {
+ getMutableGachaCeiling().mergeFrom(other.gachaCeiling);
+ }
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp clear() {
+ if (isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ bitField0_ = 0;
+ avatarId = 0;
+ retcode = 0;
+ gachaType = 0;
+ transferItemList.clear();
+ gachaCeiling.clear();
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp clearQuick() {
+ if (isEmpty()) {
+ return this;
+ }
+ cachedSize = -1;
+ bitField0_ = 0;
+ transferItemList.clearQuick();
+ gachaCeiling.clearQuick();
+ return this;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof ExchangeGachaCeilingScRsp)) {
+ return false;
+ }
+ ExchangeGachaCeilingScRsp other = (ExchangeGachaCeilingScRsp) o;
+ return bitField0_ == other.bitField0_
+ && (!hasAvatarId() || avatarId == other.avatarId)
+ && (!hasRetcode() || retcode == other.retcode)
+ && (!hasGachaType() || gachaType == other.gachaType)
+ && (!hasTransferItemList() || transferItemList.equals(other.transferItemList))
+ && (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling));
+ }
+
+ @Override
+ public void writeTo(final ProtoSink output) throws IOException {
+ if ((bitField0_ & 0x00000001) != 0) {
+ output.writeRawByte((byte) 40);
+ output.writeUInt32NoTag(avatarId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRawByte((byte) 72);
+ output.writeUInt32NoTag(retcode);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
+ output.writeRawByte((byte) 96);
+ output.writeUInt32NoTag(gachaType);
+ }
+ if ((bitField0_ & 0x00000008) != 0) {
+ output.writeRawByte((byte) 18);
+ output.writeMessageNoTag(transferItemList);
+ }
+ if ((bitField0_ & 0x00000010) != 0) {
+ output.writeRawByte((byte) 58);
+ output.writeMessageNoTag(gachaCeiling);
+ }
+ }
+
+ @Override
+ protected int computeSerializedSize() {
+ int size = 0;
+ if ((bitField0_ & 0x00000001) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(avatarId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
+ }
+ if ((bitField0_ & 0x00000008) != 0) {
+ size += 1 + ProtoSink.computeMessageSizeNoTag(transferItemList);
+ }
+ if ((bitField0_ & 0x00000010) != 0) {
+ size += 1 + ProtoSink.computeMessageSizeNoTag(gachaCeiling);
+ }
+ return size;
+ }
+
+ @Override
+ @SuppressWarnings("fallthrough")
+ public ExchangeGachaCeilingScRsp mergeFrom(final ProtoSource input) throws IOException {
+ // Enabled Fall-Through Optimization (QuickBuffers)
+ int tag = input.readTag();
+ while (true) {
+ switch (tag) {
+ case 40: {
+ // avatarId
+ avatarId = input.readUInt32();
+ bitField0_ |= 0x00000001;
+ tag = input.readTag();
+ if (tag != 72) {
+ break;
+ }
+ }
+ case 72: {
+ // retcode
+ retcode = input.readUInt32();
+ bitField0_ |= 0x00000002;
+ tag = input.readTag();
+ if (tag != 96) {
+ break;
+ }
+ }
+ case 96: {
+ // gachaType
+ gachaType = input.readUInt32();
+ bitField0_ |= 0x00000004;
+ tag = input.readTag();
+ if (tag != 18) {
+ break;
+ }
+ }
+ case 18: {
+ // transferItemList
+ input.readMessage(transferItemList);
+ bitField0_ |= 0x00000008;
+ tag = input.readTag();
+ if (tag != 58) {
+ break;
+ }
+ }
+ case 58: {
+ // gachaCeiling
+ input.readMessage(gachaCeiling);
+ bitField0_ |= 0x00000010;
+ 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.avatarId, avatarId);
+ }
+ if ((bitField0_ & 0x00000002) != 0) {
+ output.writeUInt32(FieldNames.retcode, retcode);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
+ output.writeUInt32(FieldNames.gachaType, gachaType);
+ }
+ if ((bitField0_ & 0x00000008) != 0) {
+ output.writeMessage(FieldNames.transferItemList, transferItemList);
+ }
+ if ((bitField0_ & 0x00000010) != 0) {
+ output.writeMessage(FieldNames.gachaCeiling, gachaCeiling);
+ }
+ output.endObject();
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp mergeFrom(final JsonSource input) throws IOException {
+ if (!input.beginObject()) {
+ return this;
+ }
+ while (!input.isAtEnd()) {
+ switch (input.readFieldHash()) {
+ case 1787287636:
+ case -428636735: {
+ if (input.isAtField(FieldNames.avatarId)) {
+ if (!input.trySkipNullValue()) {
+ avatarId = 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 802848732:
+ case -871474217: {
+ if (input.isAtField(FieldNames.gachaType)) {
+ if (!input.trySkipNullValue()) {
+ gachaType = input.readUInt32();
+ bitField0_ |= 0x00000004;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ case -997597348:
+ case 263056118: {
+ if (input.isAtField(FieldNames.transferItemList)) {
+ if (!input.trySkipNullValue()) {
+ input.readMessage(transferItemList);
+ bitField0_ |= 0x00000008;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ case 507275483:
+ case -1792489728: {
+ if (input.isAtField(FieldNames.gachaCeiling)) {
+ if (!input.trySkipNullValue()) {
+ input.readMessage(gachaCeiling);
+ bitField0_ |= 0x00000010;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
+ default: {
+ input.skipUnknownField();
+ break;
+ }
+ }
+ }
+ input.endObject();
+ return this;
+ }
+
+ @Override
+ public ExchangeGachaCeilingScRsp clone() {
+ return new ExchangeGachaCeilingScRsp().copyFrom(this);
+ }
+
+ @Override
+ public boolean isEmpty() {
+ return ((bitField0_) == 0);
+ }
+
+ public static ExchangeGachaCeilingScRsp parseFrom(final byte[] data) throws
+ InvalidProtocolBufferException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingScRsp(), data).checkInitialized();
+ }
+
+ public static ExchangeGachaCeilingScRsp parseFrom(final ProtoSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingScRsp(), input).checkInitialized();
+ }
+
+ public static ExchangeGachaCeilingScRsp parseFrom(final JsonSource input) throws IOException {
+ return ProtoMessage.mergeFrom(new ExchangeGachaCeilingScRsp(), input).checkInitialized();
+ }
+
+ /**
+ * @return factory for creating ExchangeGachaCeilingScRsp messages
+ */
+ public static MessageFactory getFactory() {
+ return ExchangeGachaCeilingScRspFactory.INSTANCE;
+ }
+
+ private enum ExchangeGachaCeilingScRspFactory implements MessageFactory {
+ INSTANCE;
+
+ @Override
+ public ExchangeGachaCeilingScRsp create() {
+ return ExchangeGachaCeilingScRsp.newInstance();
+ }
+ }
+
+ /**
+ * Contains name constants used for serializing JSON
+ */
+ static class FieldNames {
+ static final FieldName avatarId = FieldName.forField("avatarId", "avatar_id");
+
+ static final FieldName retcode = FieldName.forField("retcode");
+
+ static final FieldName gachaType = FieldName.forField("gachaType", "gacha_type");
+
+ static final FieldName transferItemList = FieldName.forField("transferItemList", "transfer_item_list");
+
+ static final FieldName gachaCeiling = FieldName.forField("gachaCeiling", "gacha_ceiling");
+ }
+ }
+}
diff --git a/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java b/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java
index 6a6dca9..59930b6 100644
--- a/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java
@@ -24,6 +24,11 @@ public final class GachaCeilingOuterClass {
*/
private int ceilingNum;
+ /**
+ * optional bool is_claimed = 9;
+ */
+ private boolean isClaimed;
+
/**
* repeated .GachaCeilingAvatar avatar_list = 15;
*/
@@ -76,12 +81,49 @@ public final class GachaCeilingOuterClass {
return this;
}
+ /**
+ * optional bool is_claimed = 9;
+ * @return whether the isClaimed field is set
+ */
+ public boolean hasIsClaimed() {
+ return (bitField0_ & 0x00000002) != 0;
+ }
+
+ /**
+ * optional bool is_claimed = 9;
+ * @return this
+ */
+ public GachaCeiling clearIsClaimed() {
+ bitField0_ &= ~0x00000002;
+ isClaimed = false;
+ return this;
+ }
+
+ /**
+ * optional bool is_claimed = 9;
+ * @return the isClaimed
+ */
+ public boolean getIsClaimed() {
+ return isClaimed;
+ }
+
+ /**
+ * optional bool is_claimed = 9;
+ * @param value the isClaimed to set
+ * @return this
+ */
+ public GachaCeiling setIsClaimed(final boolean value) {
+ bitField0_ |= 0x00000002;
+ isClaimed = value;
+ return this;
+ }
+
/**
* repeated .GachaCeilingAvatar avatar_list = 15;
* @return whether the avatarList field is set
*/
public boolean hasAvatarList() {
- return (bitField0_ & 0x00000002) != 0;
+ return (bitField0_ & 0x00000004) != 0;
}
/**
@@ -89,7 +131,7 @@ public final class GachaCeilingOuterClass {
* @return this
*/
public GachaCeiling clearAvatarList() {
- bitField0_ &= ~0x00000002;
+ bitField0_ &= ~0x00000004;
avatarList.clear();
return this;
}
@@ -118,7 +160,7 @@ public final class GachaCeilingOuterClass {
* @return internal storage object for modifications
*/
public RepeatedMessage getMutableAvatarList() {
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
return avatarList;
}
@@ -128,7 +170,7 @@ public final class GachaCeilingOuterClass {
* @return this
*/
public GachaCeiling addAvatarList(final GachaCeilingAvatarOuterClass.GachaCeilingAvatar value) {
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
avatarList.add(value);
return this;
}
@@ -140,7 +182,7 @@ public final class GachaCeilingOuterClass {
*/
public GachaCeiling addAllAvatarList(
final GachaCeilingAvatarOuterClass.GachaCeilingAvatar... values) {
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
avatarList.addAll(values);
return this;
}
@@ -151,6 +193,7 @@ public final class GachaCeilingOuterClass {
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
ceilingNum = other.ceilingNum;
+ isClaimed = other.isClaimed;
avatarList.copyFrom(other.avatarList);
}
return this;
@@ -165,6 +208,9 @@ public final class GachaCeilingOuterClass {
if (other.hasCeilingNum()) {
setCeilingNum(other.ceilingNum);
}
+ if (other.hasIsClaimed()) {
+ setIsClaimed(other.isClaimed);
+ }
if (other.hasAvatarList()) {
getMutableAvatarList().addAll(other.avatarList);
}
@@ -179,6 +225,7 @@ public final class GachaCeilingOuterClass {
cachedSize = -1;
bitField0_ = 0;
ceilingNum = 0;
+ isClaimed = false;
avatarList.clear();
return this;
}
@@ -205,6 +252,7 @@ public final class GachaCeilingOuterClass {
GachaCeiling other = (GachaCeiling) o;
return bitField0_ == other.bitField0_
&& (!hasCeilingNum() || ceilingNum == other.ceilingNum)
+ && (!hasIsClaimed() || isClaimed == other.isClaimed)
&& (!hasAvatarList() || avatarList.equals(other.avatarList));
}
@@ -215,6 +263,10 @@ public final class GachaCeilingOuterClass {
output.writeUInt32NoTag(ceilingNum);
}
if ((bitField0_ & 0x00000002) != 0) {
+ output.writeRawByte((byte) 72);
+ output.writeBoolNoTag(isClaimed);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < avatarList.length(); i++) {
output.writeRawByte((byte) 122);
output.writeMessageNoTag(avatarList.get(i));
@@ -229,6 +281,9 @@ public final class GachaCeilingOuterClass {
size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum);
}
if ((bitField0_ & 0x00000002) != 0) {
+ size += 2;
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
size += (1 * avatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(avatarList);
}
return size;
@@ -246,6 +301,15 @@ public final class GachaCeilingOuterClass {
ceilingNum = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
+ if (tag != 72) {
+ break;
+ }
+ }
+ case 72: {
+ // isClaimed
+ isClaimed = input.readBool();
+ bitField0_ |= 0x00000002;
+ tag = input.readTag();
if (tag != 122) {
break;
}
@@ -253,7 +317,7 @@ public final class GachaCeilingOuterClass {
case 122: {
// avatarList
tag = input.readRepeatedMessage(avatarList, tag);
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
if (tag != 0) {
break;
}
@@ -279,6 +343,9 @@ public final class GachaCeilingOuterClass {
output.writeUInt32(FieldNames.ceilingNum, ceilingNum);
}
if ((bitField0_ & 0x00000002) != 0) {
+ output.writeBool(FieldNames.isClaimed, isClaimed);
+ }
+ if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedMessage(FieldNames.avatarList, avatarList);
}
output.endObject();
@@ -303,12 +370,24 @@ public final class GachaCeilingOuterClass {
}
break;
}
+ case 273538385:
+ case -1941340218: {
+ if (input.isAtField(FieldNames.isClaimed)) {
+ if (!input.trySkipNullValue()) {
+ isClaimed = input.readBool();
+ bitField0_ |= 0x00000002;
+ }
+ } else {
+ input.skipUnknownField();
+ }
+ break;
+ }
case -403402345:
case 397055940: {
if (input.isAtField(FieldNames.avatarList)) {
if (!input.trySkipNullValue()) {
input.readRepeatedMessage(avatarList);
- bitField0_ |= 0x00000002;
+ bitField0_ |= 0x00000004;
}
} else {
input.skipUnknownField();
@@ -369,6 +448,8 @@ public final class GachaCeilingOuterClass {
static class FieldNames {
static final FieldName ceilingNum = FieldName.forField("ceilingNum", "ceiling_num");
+ static final FieldName isClaimed = FieldName.forField("isClaimed", "is_claimed");
+
static final FieldName avatarList = FieldName.forField("avatarList", "avatar_list");
}
}
diff --git a/src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java
index ed647fe..c9ae508 100644
--- a/src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java
@@ -19,9 +19,9 @@ public final class GetGachaCeilingCsReqOuterClass {
private static final long serialVersionUID = 0L;
/**
- * optional uint32 unkfield = 4;
+ * optional uint32 gacha_type = 4;
*/
- private int unkfield;
+ private int gachaType;
private GetGachaCeilingCsReq() {
}
@@ -34,39 +34,39 @@ public final class GetGachaCeilingCsReqOuterClass {
}
/**
- * optional uint32 unkfield = 4;
- * @return whether the unkfield field is set
+ * optional uint32 gacha_type = 4;
+ * @return whether the gachaType field is set
*/
- public boolean hasUnkfield() {
+ public boolean hasGachaType() {
return (bitField0_ & 0x00000001) != 0;
}
/**
- * optional uint32 unkfield = 4;
+ * optional uint32 gacha_type = 4;
* @return this
*/
- public GetGachaCeilingCsReq clearUnkfield() {
+ public GetGachaCeilingCsReq clearGachaType() {
bitField0_ &= ~0x00000001;
- unkfield = 0;
+ gachaType = 0;
return this;
}
/**
- * optional uint32 unkfield = 4;
- * @return the unkfield
+ * optional uint32 gacha_type = 4;
+ * @return the gachaType
*/
- public int getUnkfield() {
- return unkfield;
+ public int getGachaType() {
+ return gachaType;
}
/**
- * optional uint32 unkfield = 4;
- * @param value the unkfield to set
+ * optional uint32 gacha_type = 4;
+ * @param value the gachaType to set
* @return this
*/
- public GetGachaCeilingCsReq setUnkfield(final int value) {
+ public GetGachaCeilingCsReq setGachaType(final int value) {
bitField0_ |= 0x00000001;
- unkfield = value;
+ gachaType = value;
return this;
}
@@ -75,7 +75,7 @@ public final class GetGachaCeilingCsReqOuterClass {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
- unkfield = other.unkfield;
+ gachaType = other.gachaType;
}
return this;
}
@@ -86,8 +86,8 @@ public final class GetGachaCeilingCsReqOuterClass {
return this;
}
cachedSize = -1;
- if (other.hasUnkfield()) {
- setUnkfield(other.unkfield);
+ if (other.hasGachaType()) {
+ setGachaType(other.gachaType);
}
return this;
}
@@ -99,7 +99,7 @@ public final class GetGachaCeilingCsReqOuterClass {
}
cachedSize = -1;
bitField0_ = 0;
- unkfield = 0;
+ gachaType = 0;
return this;
}
@@ -123,14 +123,14 @@ public final class GetGachaCeilingCsReqOuterClass {
}
GetGachaCeilingCsReq other = (GetGachaCeilingCsReq) o;
return bitField0_ == other.bitField0_
- && (!hasUnkfield() || unkfield == other.unkfield);
+ && (!hasGachaType() || gachaType == other.gachaType);
}
@Override
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 32);
- output.writeUInt32NoTag(unkfield);
+ output.writeUInt32NoTag(gachaType);
}
}
@@ -138,7 +138,7 @@ public final class GetGachaCeilingCsReqOuterClass {
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
- size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield);
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
}
return size;
}
@@ -151,8 +151,8 @@ public final class GetGachaCeilingCsReqOuterClass {
while (true) {
switch (tag) {
case 32: {
- // unkfield
- unkfield = input.readUInt32();
+ // gachaType
+ gachaType = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 0) {
@@ -177,7 +177,7 @@ public final class GetGachaCeilingCsReqOuterClass {
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
- output.writeUInt32(FieldNames.unkfield, unkfield);
+ output.writeUInt32(FieldNames.gachaType, gachaType);
}
output.endObject();
}
@@ -189,10 +189,11 @@ public final class GetGachaCeilingCsReqOuterClass {
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
- case -247717048: {
- if (input.isAtField(FieldNames.unkfield)) {
+ case 802848732:
+ case -871474217: {
+ if (input.isAtField(FieldNames.gachaType)) {
if (!input.trySkipNullValue()) {
- unkfield = input.readUInt32();
+ gachaType = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
@@ -253,7 +254,7 @@ public final class GetGachaCeilingCsReqOuterClass {
* Contains name constants used for serializing JSON
*/
static class FieldNames {
- static final FieldName unkfield = FieldName.forField("unkfield");
+ static final FieldName gachaType = FieldName.forField("gachaType", "gacha_type");
}
}
}
diff --git a/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java
index f823da2..131c21d 100644
--- a/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java
+++ b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java
@@ -19,9 +19,9 @@ public final class GetGachaCeilingScRspOuterClass {
private static final long serialVersionUID = 0L;
/**
- * optional uint32 unkfield = 14;
+ * optional uint32 gacha_type = 14;
*/
- private int unkfield;
+ private int gachaType;
/**
* optional uint32 retcode = 15;
@@ -44,39 +44,39 @@ public final class GetGachaCeilingScRspOuterClass {
}
/**
- * optional uint32 unkfield = 14;
- * @return whether the unkfield field is set
+ * optional uint32 gacha_type = 14;
+ * @return whether the gachaType field is set
*/
- public boolean hasUnkfield() {
+ public boolean hasGachaType() {
return (bitField0_ & 0x00000001) != 0;
}
/**
- * optional uint32 unkfield = 14;
+ * optional uint32 gacha_type = 14;
* @return this
*/
- public GetGachaCeilingScRsp clearUnkfield() {
+ public GetGachaCeilingScRsp clearGachaType() {
bitField0_ &= ~0x00000001;
- unkfield = 0;
+ gachaType = 0;
return this;
}
/**
- * optional uint32 unkfield = 14;
- * @return the unkfield
+ * optional uint32 gacha_type = 14;
+ * @return the gachaType
*/
- public int getUnkfield() {
- return unkfield;
+ public int getGachaType() {
+ return gachaType;
}
/**
- * optional uint32 unkfield = 14;
- * @param value the unkfield to set
+ * optional uint32 gacha_type = 14;
+ * @param value the gachaType to set
* @return this
*/
- public GetGachaCeilingScRsp setUnkfield(final int value) {
+ public GetGachaCeilingScRsp setGachaType(final int value) {
bitField0_ |= 0x00000001;
- unkfield = value;
+ gachaType = value;
return this;
}
@@ -179,7 +179,7 @@ public final class GetGachaCeilingScRspOuterClass {
cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_;
- unkfield = other.unkfield;
+ gachaType = other.gachaType;
retcode = other.retcode;
gachaCeiling.copyFrom(other.gachaCeiling);
}
@@ -192,8 +192,8 @@ public final class GetGachaCeilingScRspOuterClass {
return this;
}
cachedSize = -1;
- if (other.hasUnkfield()) {
- setUnkfield(other.unkfield);
+ if (other.hasGachaType()) {
+ setGachaType(other.gachaType);
}
if (other.hasRetcode()) {
setRetcode(other.retcode);
@@ -211,7 +211,7 @@ public final class GetGachaCeilingScRspOuterClass {
}
cachedSize = -1;
bitField0_ = 0;
- unkfield = 0;
+ gachaType = 0;
retcode = 0;
gachaCeiling.clear();
return this;
@@ -238,7 +238,7 @@ public final class GetGachaCeilingScRspOuterClass {
}
GetGachaCeilingScRsp other = (GetGachaCeilingScRsp) o;
return bitField0_ == other.bitField0_
- && (!hasUnkfield() || unkfield == other.unkfield)
+ && (!hasGachaType() || gachaType == other.gachaType)
&& (!hasRetcode() || retcode == other.retcode)
&& (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling));
}
@@ -247,7 +247,7 @@ public final class GetGachaCeilingScRspOuterClass {
public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 112);
- output.writeUInt32NoTag(unkfield);
+ output.writeUInt32NoTag(gachaType);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 120);
@@ -263,7 +263,7 @@ public final class GetGachaCeilingScRspOuterClass {
protected int computeSerializedSize() {
int size = 0;
if ((bitField0_ & 0x00000001) != 0) {
- size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield);
+ size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
}
if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
@@ -282,8 +282,8 @@ public final class GetGachaCeilingScRspOuterClass {
while (true) {
switch (tag) {
case 112: {
- // unkfield
- unkfield = input.readUInt32();
+ // gachaType
+ gachaType = input.readUInt32();
bitField0_ |= 0x00000001;
tag = input.readTag();
if (tag != 120) {
@@ -326,7 +326,7 @@ public final class GetGachaCeilingScRspOuterClass {
public void writeTo(final JsonSink output) throws IOException {
output.beginObject();
if ((bitField0_ & 0x00000001) != 0) {
- output.writeUInt32(FieldNames.unkfield, unkfield);
+ output.writeUInt32(FieldNames.gachaType, gachaType);
}
if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.retcode, retcode);
@@ -344,10 +344,11 @@ public final class GetGachaCeilingScRspOuterClass {
}
while (!input.isAtEnd()) {
switch (input.readFieldHash()) {
- case -247717048: {
- if (input.isAtField(FieldNames.unkfield)) {
+ case 802848732:
+ case -871474217: {
+ if (input.isAtField(FieldNames.gachaType)) {
if (!input.trySkipNullValue()) {
- unkfield = input.readUInt32();
+ gachaType = input.readUInt32();
bitField0_ |= 0x00000001;
}
} else {
@@ -431,7 +432,7 @@ public final class GetGachaCeilingScRspOuterClass {
* Contains name constants used for serializing JSON
*/
static class FieldNames {
- static final FieldName unkfield = FieldName.forField("unkfield");
+ static final FieldName gachaType = FieldName.forField("gachaType", "gacha_type");
static final FieldName retcode = FieldName.forField("retcode");
diff --git a/src/main/java/emu/lunarcore/GameConstants.java b/src/main/java/emu/lunarcore/GameConstants.java
index f46af09..9a62095 100644
--- a/src/main/java/emu/lunarcore/GameConstants.java
+++ b/src/main/java/emu/lunarcore/GameConstants.java
@@ -33,6 +33,9 @@ public class GameConstants {
public static final int MATERIAL_COIN_ID = 2; // Material id for credits. DO NOT CHANGE
public static final int TRAILBLAZER_EXP_ID = 22;
+ // Gacha
+ public static final int GACHA_CEILING_MAX = 300; // Yes, I know this is in an excel
+
// Challenge
public static final int CHALLENGE_ENTRANCE = 100000103;
diff --git a/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java b/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java
index 474c1c8..660a393 100644
--- a/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java
+++ b/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java
@@ -1,7 +1,6 @@
package emu.lunarcore.game.gacha;
-import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling;
-import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar;
+import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.GachaInfoOuterClass.GachaInfo;
import lombok.Getter;
@@ -14,53 +13,36 @@ public class GachaBanner {
private int[] rateUpItems5;
private int[] rateUpItems4;
private int eventChance = 50;
- private GachaCeiling gachaCeiling;
- private GachaCeilingAvatar createCeilingAvatarInfo(int avatarId) {
- return GachaCeilingAvatar.newInstance()
- .setRepeatedCnt(1)
- .setAvatarId(avatarId);
- }
-
- public GachaInfo toProto() {
+ public GachaInfo toProto(GachaService service, Player player) {
var info = GachaInfo.newInstance()
.setGachaId(this.getId())
.setDetailUrl("")
.setHistoryUrl("");
- if (this.gachaType == GachaType.Normal) {
- // Gacha ceiling
- info.setGachaCeiling(GachaCeiling.newInstance());
- } else {
+ if (this.gachaType != GachaType.Normal) {
info.setBeginTime(this.getBeginTime());
info.setEndTime(this.getEndTime());
}
-
- if (this.getRateUpItems4().length > 0) {
- for (int id : getRateUpItems4()) {
- info.addUpInfo(id);
- }
- }
-
- if (this.getRateUpItems5().length > 0) {
- for (int id : getRateUpItems5()) {
- info.addUpInfo(id);
- info.addFeatured(id);
- }
- }
-
+
if (this.getId() == 1001) {
- GachaCeilingAvatar ceilingavatarinfo1 = createCeilingAvatarInfo(1003);
- GachaCeilingAvatar ceilingavatarinfo2 = createCeilingAvatarInfo(1107);
- GachaCeilingAvatar ceilingavatarinfo3 = createCeilingAvatarInfo(1211);
+ info.setGachaCeiling(player.getGachaInfo().toGachaCeiling(player));
+
+ info.addAllUpInfo(service.getPurpleAvatars());
+ info.addAllUpInfo(service.getYellowAvatars());
+ info.addAllUpInfo(service.getPurpleWeapons());
+ info.addAllUpInfo(service.getYellowWeapons());
+
+ info.addAllFeatured(service.getDefaultFeaturedIds());
+ } else {
+ if (this.getRateUpItems4().length > 0) {
+ info.addAllUpInfo(getRateUpItems4());
+ }
- GachaCeiling ceilinginfo = GachaCeiling.newInstance()
- .addAvatarList(ceilingavatarinfo1)
- .addAvatarList(ceilingavatarinfo2)
- .addAvatarList(ceilingavatarinfo3)
- .setCeilingNum(169);
-
- info.setGachaCeiling(ceilinginfo);
+ if (this.getRateUpItems5().length > 0) {
+ info.addAllUpInfo(getRateUpItems5());
+ info.addAllFeatured(getRateUpItems5());
+ }
}
return info;
diff --git a/src/main/java/emu/lunarcore/game/gacha/GachaService.java b/src/main/java/emu/lunarcore/game/gacha/GachaService.java
index ee34ea3..83a1aa9 100644
--- a/src/main/java/emu/lunarcore/game/gacha/GachaService.java
+++ b/src/main/java/emu/lunarcore/game/gacha/GachaService.java
@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ThreadLocalRandom;
+import emu.lunarcore.GameConstants;
import emu.lunarcore.LunarCore;
import emu.lunarcore.data.GameData;
import emu.lunarcore.data.excel.ItemExcel;
@@ -21,21 +22,25 @@ import emu.lunarcore.server.game.BaseGameService;
import emu.lunarcore.server.game.GameServer;
import emu.lunarcore.server.packet.send.PacketDoGachaScRsp;
import emu.lunarcore.util.JsonUtils;
+import emu.lunarcore.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList;
+import lombok.Getter;
+@Getter
public class GachaService extends BaseGameService {
private final Int2ObjectMap gachaBanners;
private GetGachaInfoScRsp cachedProto;
private int[] yellowAvatars = new int[] {1003, 1004, 1101, 1107, 1104, 1209, 1211};
private int[] yellowWeapons = new int[] {23000, 23002, 23003, 23004, 23005, 23012, 23013};
- private int[] purpleAvatars = new int[] {1001, 1002, 1008, 1009, 1013, 1103, 1105, 1106, 1108, 1109, 1111, 1201, 1202, 1206, 1207};
+ private int[] purpleAvatars = new int[] {1001, 1002, 1008, 1009, 1013, 1103, 1105, 1106, 1108, 1109, 1110, 1111, 1201, 1202, 1206, 1207, 1210};
private int[] purpleWeapons = new int[] {21000, 21001, 21002, 21003, 21004, 21005, 21006, 21007, 21008, 21009, 21010, 21011, 21012, 21013, 21014, 21015, 21016, 21017, 21018, 21019, 21020};
private int[] blueWeapons = new int[] {20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015, 20016, 20017, 20018, 20019, 20020};
-
+ private int[] defaultFeaturedIds = new int[] {23002, 1003, 1101, 1104, 23000, 23003};
+
private static int starglightId = 252;
private static int embersId = 251;
@@ -45,10 +50,6 @@ public class GachaService extends BaseGameService {
this.load();
}
- public Int2ObjectMap getGachaBanners() {
- return gachaBanners;
- }
-
public int randomRange(int min, int max) {
return ThreadLocalRandom.current().nextInt(max - min + 1) + min;
}
@@ -69,10 +70,9 @@ public class GachaService extends BaseGameService {
}
public synchronized void doPulls(Player player, int gachaId, int times) {
- // Sanity check
- if (times != 10 && times != 1) {
- return;
- }
+ // Sanity checks
+ if (times != 10 && times != 1) return;
+
if (player.getInventory().getInventoryTab(ItemMainType.Equipment).getSize() + times > player.getInventory().getInventoryTab(ItemMainType.Equipment).getMaxCapacity()) {
player.sendPacket(new PacketDoGachaScRsp());
return;
@@ -94,6 +94,12 @@ public class GachaService extends BaseGameService {
player.getInventory().removeItem(costItem, times);
}
+
+ // Add gacha ceiling
+ if (banner.getGachaType() == GachaType.Normal || banner.getGachaType() == GachaType.Newbie) {
+ player.getGachaInfo().addCeilingNum(times);
+ player.save();
+ }
// Roll
PlayerGachaBannerInfo gachaInfo = player.getGachaInfo().getBannerInfo(banner.getGachaType());
@@ -255,24 +261,44 @@ public class GachaService extends BaseGameService {
}
// Packets
- player.sendPacket(new PacketDoGachaScRsp(banner, times, list));
+ player.sendPacket(new PacketDoGachaScRsp(player, banner, times, list));
+ }
+
+ public List exchangeGachaCeiling(Player player, int avatarId) {
+ // Sanity check
+ if (player.getGachaInfo().getCeilingNum() < GameConstants.GACHA_CEILING_MAX || player.getGachaInfo().isCeilingClaimed()) {
+ return null;
+ }
+
+ // Make sure the player is getting a valid avatar
+ if (!Utils.arrayContains(this.getYellowAvatars(), avatarId)) {
+ return null;
+ }
+
+ // Add items
+ List items = new ArrayList<>();
+
+ if (player.getAvatars().hasAvatar(avatarId)) {
+ // Add eidolon if player already has the avatar
+ items.add(new GameItem(avatarId + 10000));
+ } else {
+ items.add(new GameItem(avatarId));
+ }
+
+ player.getInventory().addItems(items);
+ player.getGachaInfo().setCeilingClaimed(true);
+ player.save();
+
+ return items;
}
- private synchronized GetGachaInfoScRsp createProto() {
+ public synchronized GetGachaInfoScRsp toProto(Player player) {
var proto = GetGachaInfoScRsp.newInstance();
for (GachaBanner banner : getGachaBanners().values()) {
- proto.addGachaInfoList(banner.toProto());
+ proto.addGachaInfoList(banner.toProto(this, player));
}
return proto;
}
-
- public GetGachaInfoScRsp toProto() {
- if (this.cachedProto == null) {
- this.cachedProto = createProto();
- }
-
- return this.cachedProto;
- }
}
diff --git a/src/main/java/emu/lunarcore/game/gacha/GachaType.java b/src/main/java/emu/lunarcore/game/gacha/GachaType.java
index 16c45d6..14f3fe6 100644
--- a/src/main/java/emu/lunarcore/game/gacha/GachaType.java
+++ b/src/main/java/emu/lunarcore/game/gacha/GachaType.java
@@ -4,16 +4,19 @@ import lombok.Getter;
@Getter
public enum GachaType {
- Newbie (101, 1, 2),
- Normal (101, 1, 2),
- AvatarUp (102, 1, 1),
- WeaponUp (102, 2, 2);
+ Unknown (0, 0, 0, 0),
+ Newbie (1, 101, 1, 2),
+ Normal (2, 101, 1, 2),
+ AvatarUp (11, 102, 1, 1),
+ WeaponUp (12, 102, 2, 2);
+ private int id;
private int costItem;
private int minItemType;
private int maxItemType;
- private GachaType(int costItem, int min, int max) {
+ private GachaType(int id, int costItem, int min, int max) {
+ this.id = id;
this.costItem = costItem;
this.minItemType = min;
this.maxItemType = max;
diff --git a/src/main/java/emu/lunarcore/game/gacha/PlayerGachaInfo.java b/src/main/java/emu/lunarcore/game/gacha/PlayerGachaInfo.java
index 35daddd..94c6b25 100644
--- a/src/main/java/emu/lunarcore/game/gacha/PlayerGachaInfo.java
+++ b/src/main/java/emu/lunarcore/game/gacha/PlayerGachaInfo.java
@@ -1,29 +1,31 @@
package emu.lunarcore.game.gacha;
import dev.morphia.annotations.Entity;
+import emu.lunarcore.GameConstants;
+import emu.lunarcore.game.avatar.GameAvatar;
+import emu.lunarcore.game.player.Player;
+import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar;
+import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling;
+import lombok.Getter;
+import lombok.Setter;
-@Entity(useDiscriminator = false)
+@Getter @Entity(useDiscriminator = false)
public class PlayerGachaInfo {
private PlayerGachaBannerInfo standardBanner;
private PlayerGachaBannerInfo eventCharacterBanner;
private PlayerGachaBannerInfo eventWeaponBanner;
+
+ private int ceilingNum;
+ @Setter private boolean ceilingClaimed;
public PlayerGachaInfo() {
this.standardBanner = new PlayerGachaBannerInfo();
this.eventCharacterBanner = new PlayerGachaBannerInfo();
this.eventWeaponBanner = new PlayerGachaBannerInfo();
}
-
- public PlayerGachaBannerInfo getStandardBanner() {
- return standardBanner;
- }
-
- public PlayerGachaBannerInfo getEventCharacterBanner() {
- return eventCharacterBanner;
- }
-
- public PlayerGachaBannerInfo getEventWeaponBanner() {
- return eventWeaponBanner;
+
+ public void addCeilingNum(int amount) {
+ this.ceilingNum = Math.min(ceilingNum + amount, GameConstants.GACHA_CEILING_MAX);
}
public PlayerGachaBannerInfo getBannerInfo(GachaType type) {
@@ -35,4 +37,30 @@ public class PlayerGachaInfo {
return this.standardBanner;
}
+
+ public GachaCeiling toGachaCeiling(Player player) {
+ var proto = GachaCeiling.newInstance()
+ .setIsClaimed(this.isCeilingClaimed())
+ .setCeilingNum(this.getCeilingNum());
+
+ // Gacha ceiling avatars are the avatars that we can pick
+ var ceilingAvatars = player.getServer().getGachaService().getYellowAvatars();
+ for (int i = 0; i < ceilingAvatars.length; i++) {
+ int avatarId = ceilingAvatars[i];
+ int repeatedCount = 0; // Eidolon count
+
+ GameAvatar avatar = player.getAvatarById(avatarId);
+ if (avatar != null) {
+ repeatedCount = avatar.getRank();
+ }
+
+ var ceilingAvatar = GachaCeilingAvatar.newInstance()
+ .setRepeatedCnt(repeatedCount)
+ .setAvatarId(avatarId);
+
+ proto.addAvatarList(ceilingAvatar);
+ }
+
+ return proto;
+ }
}
diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerExchangeGachaCeilingCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerExchangeGachaCeilingCsReq.java
new file mode 100644
index 0000000..828d807
--- /dev/null
+++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerExchangeGachaCeilingCsReq.java
@@ -0,0 +1,21 @@
+package emu.lunarcore.server.packet.recv;
+
+import emu.lunarcore.proto.ExchangeGachaCeilingCsReqOuterClass.ExchangeGachaCeilingCsReq;
+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.PacketExchangeGachaCeilingScRsp;
+
+@Opcodes(CmdId.ExchangeGachaCeilingCsReq)
+public class HandlerExchangeGachaCeilingCsReq extends PacketHandler {
+
+ @Override
+ public void handle(GameSession session, byte[] data) throws Exception {
+ var req = ExchangeGachaCeilingCsReq.parseFrom(data);
+
+ var items = session.getServer().getGachaService().exchangeGachaCeiling(session.getPlayer(), req.getAvatarId());
+ session.send(new PacketExchangeGachaCeilingScRsp(session.getPlayer(), req.getGachaType(), req.getAvatarId(), items));
+ }
+
+}
diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java
index 982544f..d66bcf3 100644
--- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java
+++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java
@@ -5,15 +5,13 @@ import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler;
import emu.lunarcore.server.packet.send.PacketGetGachaCeilingScRsp;
-import emu.lunarcore.proto.GetGachaCeilingCsReqOuterClass.GetGachaCeilingCsReq;
@Opcodes(CmdId.GetGachaCeilingCsReq)
public class HandlerGetGachaCeilingCsReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] data) throws Exception {
- var req = GetGachaCeilingCsReq.parseFrom(data);
- session.send(new PacketGetGachaCeilingScRsp(req.getUnkfield()));
+ session.send(new PacketGetGachaCeilingScRsp(session.getPlayer()));
}
}
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketDoGachaScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketDoGachaScRsp.java
index 1eaeb0e..8b3b914 100644
--- a/src/main/java/emu/lunarcore/server/packet/send/PacketDoGachaScRsp.java
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketDoGachaScRsp.java
@@ -3,6 +3,7 @@ package emu.lunarcore.server.packet.send;
import java.util.List;
import emu.lunarcore.game.gacha.GachaBanner;
+import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.DoGachaScRspOuterClass.DoGachaScRsp;
import emu.lunarcore.proto.GachaItemOuterClass.GachaItem;
import emu.lunarcore.server.packet.BasePacket;
@@ -16,11 +17,12 @@ public class PacketDoGachaScRsp extends BasePacket {
this.setData(DoGachaScRsp.newInstance().setRetcode(1));
}
- public PacketDoGachaScRsp(GachaBanner banner, int num, List items) {
+ public PacketDoGachaScRsp(Player player, GachaBanner banner, int num, List items) {
super(CmdId.DoGachaScRsp);
var data = DoGachaScRsp.newInstance()
.setGachaNum(num)
+ .setCeilingNum(player.getGachaInfo().getCeilingNum())
.setGachaId(banner.getId());
for (GachaItem item : items) {
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketExchangeGachaCeilingScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketExchangeGachaCeilingScRsp.java
new file mode 100644
index 0000000..59d831b
--- /dev/null
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketExchangeGachaCeilingScRsp.java
@@ -0,0 +1,32 @@
+package emu.lunarcore.server.packet.send;
+
+import java.util.Collection;
+
+import emu.lunarcore.game.inventory.GameItem;
+import emu.lunarcore.game.player.Player;
+import emu.lunarcore.proto.ExchangeGachaCeilingScRspOuterClass.ExchangeGachaCeilingScRsp;
+import emu.lunarcore.server.packet.BasePacket;
+import emu.lunarcore.server.packet.CmdId;
+
+public class PacketExchangeGachaCeilingScRsp extends BasePacket {
+
+ public PacketExchangeGachaCeilingScRsp(Player player, int gachaType, int avatarId, Collection items) {
+ super(CmdId.ExchangeGachaCeilingScRsp);
+
+ var data = ExchangeGachaCeilingScRsp.newInstance();
+
+ if (items == null) {
+ data.setRetcode(1);
+ } else {
+ data.setGachaCeiling(player.getGachaInfo().toGachaCeiling(player));
+ data.setGachaType(gachaType);
+ data.setAvatarId(avatarId);
+
+ for (var item : items) {
+ data.getMutableTransferItemList().addItemList(item.toProto());
+ }
+ }
+
+ this.setData(data);
+ }
+}
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java
index 897cea3..d347b57 100644
--- a/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java
@@ -1,37 +1,20 @@
package emu.lunarcore.server.packet.send;
import emu.lunarcore.server.packet.CmdId;
-import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.BasePacket;
-import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling;
-import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar;
+import emu.lunarcore.game.gacha.GachaType;
+import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.GetGachaCeilingScRspOuterClass.GetGachaCeilingScRsp;
public class PacketGetGachaCeilingScRsp extends BasePacket {
- private GachaCeilingAvatar createCeilingAvatarInfo(int avatarId) {
- return GachaCeilingAvatar.newInstance()
- .setRepeatedCnt(1)
- .setAvatarId(avatarId);
- }
-
- public PacketGetGachaCeilingScRsp(int unkfield) {
+ public PacketGetGachaCeilingScRsp(Player player) {
super(CmdId.GetGachaCeilingScRsp);
- GachaCeilingAvatar ceilingavatarinfo1 = createCeilingAvatarInfo(1003);
- GachaCeilingAvatar ceilingavatarinfo2 = createCeilingAvatarInfo(1107);
- GachaCeilingAvatar ceilingavatarinfo3 = createCeilingAvatarInfo(1211);
-
-
- GachaCeiling gachaceiling = GachaCeiling.newInstance()
- .addAvatarList(ceilingavatarinfo1)
- .addAvatarList(ceilingavatarinfo2)
- .addAvatarList(ceilingavatarinfo3)
- .setCeilingNum(169);
-
var proto = GetGachaCeilingScRsp.newInstance()
- .setGachaCeiling(gachaceiling)
- .setUnkfield(unkfield);
+ .setGachaType(GachaType.Normal.getId())
+ .setGachaCeiling(player.getGachaInfo().toGachaCeiling(player));
+
this.setData(proto);
}
}
diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaInfoScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaInfoScRsp.java
index 2109abd..453847e 100644
--- a/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaInfoScRsp.java
+++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaInfoScRsp.java
@@ -9,6 +9,6 @@ public class PacketGetGachaInfoScRsp extends BasePacket {
public PacketGetGachaInfoScRsp(GameSession session) {
super(CmdId.GetGachaInfoScRsp);
- this.setData(session.getServer().getGachaService().toProto());
+ this.setData(session.getServer().getGachaService().toProto(session.getPlayer()));
}
}