Fix standard banner display and handle gacha ceiling exchange properly

This commit is contained in:
Melledy
2023-11-27 22:19:36 -08:00
parent 94af07d498
commit 29e5b130d3
17 changed files with 1403 additions and 194 deletions

View File

@@ -24,6 +24,11 @@ public final class DoGachaScRspOuterClass {
*/ */
private int gachaId; private int gachaId;
/**
* <code>optional uint32 ceiling_num = 5;</code>
*/
private int ceilingNum;
/** /**
* <code>optional uint32 gacha_num = 11;</code> * <code>optional uint32 gacha_num = 11;</code>
*/ */
@@ -86,12 +91,49 @@ public final class DoGachaScRspOuterClass {
return this; return this;
} }
/**
* <code>optional uint32 ceiling_num = 5;</code>
* @return whether the ceilingNum field is set
*/
public boolean hasCeilingNum() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 ceiling_num = 5;</code>
* @return this
*/
public DoGachaScRsp clearCeilingNum() {
bitField0_ &= ~0x00000002;
ceilingNum = 0;
return this;
}
/**
* <code>optional uint32 ceiling_num = 5;</code>
* @return the ceilingNum
*/
public int getCeilingNum() {
return ceilingNum;
}
/**
* <code>optional uint32 ceiling_num = 5;</code>
* @param value the ceilingNum to set
* @return this
*/
public DoGachaScRsp setCeilingNum(final int value) {
bitField0_ |= 0x00000002;
ceilingNum = value;
return this;
}
/** /**
* <code>optional uint32 gacha_num = 11;</code> * <code>optional uint32 gacha_num = 11;</code>
* @return whether the gachaNum field is set * @return whether the gachaNum field is set
*/ */
public boolean hasGachaNum() { public boolean hasGachaNum() {
return (bitField0_ & 0x00000002) != 0; return (bitField0_ & 0x00000004) != 0;
} }
/** /**
@@ -99,7 +141,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp clearGachaNum() { public DoGachaScRsp clearGachaNum() {
bitField0_ &= ~0x00000002; bitField0_ &= ~0x00000004;
gachaNum = 0; gachaNum = 0;
return this; return this;
} }
@@ -118,7 +160,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp setGachaNum(final int value) { public DoGachaScRsp setGachaNum(final int value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
gachaNum = value; gachaNum = value;
return this; return this;
} }
@@ -128,7 +170,7 @@ public final class DoGachaScRspOuterClass {
* @return whether the retcode field is set * @return whether the retcode field is set
*/ */
public boolean hasRetcode() { public boolean hasRetcode() {
return (bitField0_ & 0x00000004) != 0; return (bitField0_ & 0x00000008) != 0;
} }
/** /**
@@ -136,7 +178,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp clearRetcode() { public DoGachaScRsp clearRetcode() {
bitField0_ &= ~0x00000004; bitField0_ &= ~0x00000008;
retcode = 0; retcode = 0;
return this; return this;
} }
@@ -155,7 +197,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp setRetcode(final int value) { public DoGachaScRsp setRetcode(final int value) {
bitField0_ |= 0x00000004; bitField0_ |= 0x00000008;
retcode = value; retcode = value;
return this; return this;
} }
@@ -165,7 +207,7 @@ public final class DoGachaScRspOuterClass {
* @return whether the gachaItemList field is set * @return whether the gachaItemList field is set
*/ */
public boolean hasGachaItemList() { public boolean hasGachaItemList() {
return (bitField0_ & 0x00000008) != 0; return (bitField0_ & 0x00000010) != 0;
} }
/** /**
@@ -173,7 +215,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp clearGachaItemList() { public DoGachaScRsp clearGachaItemList() {
bitField0_ &= ~0x00000008; bitField0_ &= ~0x00000010;
gachaItemList.clear(); gachaItemList.clear();
return this; return this;
} }
@@ -202,7 +244,7 @@ public final class DoGachaScRspOuterClass {
* @return internal storage object for modifications * @return internal storage object for modifications
*/ */
public RepeatedMessage<GachaItemOuterClass.GachaItem> getMutableGachaItemList() { public RepeatedMessage<GachaItemOuterClass.GachaItem> getMutableGachaItemList() {
bitField0_ |= 0x00000008; bitField0_ |= 0x00000010;
return gachaItemList; return gachaItemList;
} }
@@ -212,7 +254,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp addGachaItemList(final GachaItemOuterClass.GachaItem value) { public DoGachaScRsp addGachaItemList(final GachaItemOuterClass.GachaItem value) {
bitField0_ |= 0x00000008; bitField0_ |= 0x00000010;
gachaItemList.add(value); gachaItemList.add(value);
return this; return this;
} }
@@ -223,7 +265,7 @@ public final class DoGachaScRspOuterClass {
* @return this * @return this
*/ */
public DoGachaScRsp addAllGachaItemList(final GachaItemOuterClass.GachaItem... values) { public DoGachaScRsp addAllGachaItemList(final GachaItemOuterClass.GachaItem... values) {
bitField0_ |= 0x00000008; bitField0_ |= 0x00000010;
gachaItemList.addAll(values); gachaItemList.addAll(values);
return this; return this;
} }
@@ -234,6 +276,7 @@ public final class DoGachaScRspOuterClass {
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
gachaId = other.gachaId; gachaId = other.gachaId;
ceilingNum = other.ceilingNum;
gachaNum = other.gachaNum; gachaNum = other.gachaNum;
retcode = other.retcode; retcode = other.retcode;
gachaItemList.copyFrom(other.gachaItemList); gachaItemList.copyFrom(other.gachaItemList);
@@ -250,6 +293,9 @@ public final class DoGachaScRspOuterClass {
if (other.hasGachaId()) { if (other.hasGachaId()) {
setGachaId(other.gachaId); setGachaId(other.gachaId);
} }
if (other.hasCeilingNum()) {
setCeilingNum(other.ceilingNum);
}
if (other.hasGachaNum()) { if (other.hasGachaNum()) {
setGachaNum(other.gachaNum); setGachaNum(other.gachaNum);
} }
@@ -270,6 +316,7 @@ public final class DoGachaScRspOuterClass {
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
gachaId = 0; gachaId = 0;
ceilingNum = 0;
gachaNum = 0; gachaNum = 0;
retcode = 0; retcode = 0;
gachaItemList.clear(); gachaItemList.clear();
@@ -298,6 +345,7 @@ public final class DoGachaScRspOuterClass {
DoGachaScRsp other = (DoGachaScRsp) o; DoGachaScRsp other = (DoGachaScRsp) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasGachaId() || gachaId == other.gachaId) && (!hasGachaId() || gachaId == other.gachaId)
&& (!hasCeilingNum() || ceilingNum == other.ceilingNum)
&& (!hasGachaNum() || gachaNum == other.gachaNum) && (!hasGachaNum() || gachaNum == other.gachaNum)
&& (!hasRetcode() || retcode == other.retcode) && (!hasRetcode() || retcode == other.retcode)
&& (!hasGachaItemList() || gachaItemList.equals(other.gachaItemList)); && (!hasGachaItemList() || gachaItemList.equals(other.gachaItemList));
@@ -310,14 +358,18 @@ public final class DoGachaScRspOuterClass {
output.writeUInt32NoTag(gachaId); output.writeUInt32NoTag(gachaId);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 40);
output.writeUInt32NoTag(ceilingNum);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRawByte((byte) 88); output.writeRawByte((byte) 88);
output.writeUInt32NoTag(gachaNum); output.writeUInt32NoTag(gachaNum);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000008) != 0) {
output.writeRawByte((byte) 104); output.writeRawByte((byte) 104);
output.writeUInt32NoTag(retcode); output.writeUInt32NoTag(retcode);
} }
if ((bitField0_ & 0x00000008) != 0) { if ((bitField0_ & 0x00000010) != 0) {
for (int i = 0; i < gachaItemList.length(); i++) { for (int i = 0; i < gachaItemList.length(); i++) {
output.writeRawByte((byte) 74); output.writeRawByte((byte) 74);
output.writeMessageNoTag(gachaItemList.get(i)); output.writeMessageNoTag(gachaItemList.get(i));
@@ -332,12 +384,15 @@ public final class DoGachaScRspOuterClass {
size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaId); size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaId);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaNum); size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000004) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaNum);
} }
if ((bitField0_ & 0x00000008) != 0) { if ((bitField0_ & 0x00000008) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
}
if ((bitField0_ & 0x00000010) != 0) {
size += (1 * gachaItemList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(gachaItemList); size += (1 * gachaItemList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(gachaItemList);
} }
return size; return size;
@@ -355,6 +410,15 @@ public final class DoGachaScRspOuterClass {
gachaId = input.readUInt32(); gachaId = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 40) {
break;
}
}
case 40: {
// ceilingNum
ceilingNum = input.readUInt32();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 88) { if (tag != 88) {
break; break;
} }
@@ -362,7 +426,7 @@ public final class DoGachaScRspOuterClass {
case 88: { case 88: {
// gachaNum // gachaNum
gachaNum = input.readUInt32(); gachaNum = input.readUInt32();
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
tag = input.readTag(); tag = input.readTag();
if (tag != 104) { if (tag != 104) {
break; break;
@@ -371,7 +435,7 @@ public final class DoGachaScRspOuterClass {
case 104: { case 104: {
// retcode // retcode
retcode = input.readUInt32(); retcode = input.readUInt32();
bitField0_ |= 0x00000004; bitField0_ |= 0x00000008;
tag = input.readTag(); tag = input.readTag();
if (tag != 74) { if (tag != 74) {
break; break;
@@ -380,7 +444,7 @@ public final class DoGachaScRspOuterClass {
case 74: { case 74: {
// gachaItemList // gachaItemList
tag = input.readRepeatedMessage(gachaItemList, tag); tag = input.readRepeatedMessage(gachaItemList, tag);
bitField0_ |= 0x00000008; bitField0_ |= 0x00000010;
if (tag != 0) { if (tag != 0) {
break; break;
} }
@@ -406,12 +470,15 @@ public final class DoGachaScRspOuterClass {
output.writeUInt32(FieldNames.gachaId, gachaId); output.writeUInt32(FieldNames.gachaId, gachaId);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.gachaNum, gachaNum); output.writeUInt32(FieldNames.ceilingNum, ceilingNum);
} }
if ((bitField0_ & 0x00000004) != 0) { if ((bitField0_ & 0x00000004) != 0) {
output.writeUInt32(FieldNames.retcode, retcode); output.writeUInt32(FieldNames.gachaNum, gachaNum);
} }
if ((bitField0_ & 0x00000008) != 0) { if ((bitField0_ & 0x00000008) != 0) {
output.writeUInt32(FieldNames.retcode, retcode);
}
if ((bitField0_ & 0x00000010) != 0) {
output.writeRepeatedMessage(FieldNames.gachaItemList, gachaItemList); output.writeRepeatedMessage(FieldNames.gachaItemList, gachaItemList);
} }
output.endObject(); output.endObject();
@@ -436,12 +503,24 @@ public final class DoGachaScRspOuterClass {
} }
break; 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 -2052317532:
case 803166025: { case 803166025: {
if (input.isAtField(FieldNames.gachaNum)) { if (input.isAtField(FieldNames.gachaNum)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
gachaNum = input.readUInt32(); gachaNum = input.readUInt32();
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
} }
} else { } else {
input.skipUnknownField(); input.skipUnknownField();
@@ -452,7 +531,7 @@ public final class DoGachaScRspOuterClass {
if (input.isAtField(FieldNames.retcode)) { if (input.isAtField(FieldNames.retcode)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
retcode = input.readUInt32(); retcode = input.readUInt32();
bitField0_ |= 0x00000004; bitField0_ |= 0x00000008;
} }
} else { } else {
input.skipUnknownField(); input.skipUnknownField();
@@ -464,7 +543,7 @@ public final class DoGachaScRspOuterClass {
if (input.isAtField(FieldNames.gachaItemList)) { if (input.isAtField(FieldNames.gachaItemList)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
input.readRepeatedMessage(gachaItemList); input.readRepeatedMessage(gachaItemList);
bitField0_ |= 0x00000008; bitField0_ |= 0x00000010;
} }
} else { } else {
input.skipUnknownField(); input.skipUnknownField();
@@ -525,6 +604,8 @@ public final class DoGachaScRspOuterClass {
static class FieldNames { static class FieldNames {
static final FieldName gachaId = FieldName.forField("gachaId", "gacha_id"); 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 gachaNum = FieldName.forField("gachaNum", "gacha_num");
static final FieldName retcode = FieldName.forField("retcode"); static final FieldName retcode = FieldName.forField("retcode");

View File

@@ -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<ExchangeGachaCeilingCsReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 gacha_type = 10;</code>
*/
private int gachaType;
/**
* <code>optional uint32 avatar_id = 12;</code>
*/
private int avatarId;
private ExchangeGachaCeilingCsReq() {
}
/**
* @return a new empty instance of {@code ExchangeGachaCeilingCsReq}
*/
public static ExchangeGachaCeilingCsReq newInstance() {
return new ExchangeGachaCeilingCsReq();
}
/**
* <code>optional uint32 gacha_type = 10;</code>
* @return whether the gachaType field is set
*/
public boolean hasGachaType() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 gacha_type = 10;</code>
* @return this
*/
public ExchangeGachaCeilingCsReq clearGachaType() {
bitField0_ &= ~0x00000001;
gachaType = 0;
return this;
}
/**
* <code>optional uint32 gacha_type = 10;</code>
* @return the gachaType
*/
public int getGachaType() {
return gachaType;
}
/**
* <code>optional uint32 gacha_type = 10;</code>
* @param value the gachaType to set
* @return this
*/
public ExchangeGachaCeilingCsReq setGachaType(final int value) {
bitField0_ |= 0x00000001;
gachaType = value;
return this;
}
/**
* <code>optional uint32 avatar_id = 12;</code>
* @return whether the avatarId field is set
*/
public boolean hasAvatarId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 avatar_id = 12;</code>
* @return this
*/
public ExchangeGachaCeilingCsReq clearAvatarId() {
bitField0_ &= ~0x00000002;
avatarId = 0;
return this;
}
/**
* <code>optional uint32 avatar_id = 12;</code>
* @return the avatarId
*/
public int getAvatarId() {
return avatarId;
}
/**
* <code>optional uint32 avatar_id = 12;</code>
* @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<ExchangeGachaCeilingCsReq> getFactory() {
return ExchangeGachaCeilingCsReqFactory.INSTANCE;
}
private enum ExchangeGachaCeilingCsReqFactory implements MessageFactory<ExchangeGachaCeilingCsReq> {
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");
}
}
}

View File

@@ -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<ExchangeGachaCeilingScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 avatar_id = 5;</code>
*/
private int avatarId;
/**
* <code>optional uint32 retcode = 9;</code>
*/
private int retcode;
/**
* <code>optional uint32 gacha_type = 12;</code>
*/
private int gachaType;
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
*/
private final ItemListOuterClass.ItemList transferItemList = ItemListOuterClass.ItemList.newInstance();
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
*/
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();
}
/**
* <code>optional uint32 avatar_id = 5;</code>
* @return whether the avatarId field is set
*/
public boolean hasAvatarId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 avatar_id = 5;</code>
* @return this
*/
public ExchangeGachaCeilingScRsp clearAvatarId() {
bitField0_ &= ~0x00000001;
avatarId = 0;
return this;
}
/**
* <code>optional uint32 avatar_id = 5;</code>
* @return the avatarId
*/
public int getAvatarId() {
return avatarId;
}
/**
* <code>optional uint32 avatar_id = 5;</code>
* @param value the avatarId to set
* @return this
*/
public ExchangeGachaCeilingScRsp setAvatarId(final int value) {
bitField0_ |= 0x00000001;
avatarId = value;
return this;
}
/**
* <code>optional uint32 retcode = 9;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 retcode = 9;</code>
* @return this
*/
public ExchangeGachaCeilingScRsp clearRetcode() {
bitField0_ &= ~0x00000002;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 9;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 9;</code>
* @param value the retcode to set
* @return this
*/
public ExchangeGachaCeilingScRsp setRetcode(final int value) {
bitField0_ |= 0x00000002;
retcode = value;
return this;
}
/**
* <code>optional uint32 gacha_type = 12;</code>
* @return whether the gachaType field is set
*/
public boolean hasGachaType() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 gacha_type = 12;</code>
* @return this
*/
public ExchangeGachaCeilingScRsp clearGachaType() {
bitField0_ &= ~0x00000004;
gachaType = 0;
return this;
}
/**
* <code>optional uint32 gacha_type = 12;</code>
* @return the gachaType
*/
public int getGachaType() {
return gachaType;
}
/**
* <code>optional uint32 gacha_type = 12;</code>
* @param value the gachaType to set
* @return this
*/
public ExchangeGachaCeilingScRsp setGachaType(final int value) {
bitField0_ |= 0x00000004;
gachaType = value;
return this;
}
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
* @return whether the transferItemList field is set
*/
public boolean hasTransferItemList() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
* @return this
*/
public ExchangeGachaCeilingScRsp clearTransferItemList() {
bitField0_ &= ~0x00000008;
transferItemList.clear();
return this;
}
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableTransferItemList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public ItemListOuterClass.ItemList getTransferItemList() {
return transferItemList;
}
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public ItemListOuterClass.ItemList getMutableTransferItemList() {
bitField0_ |= 0x00000008;
return transferItemList;
}
/**
* <code>optional .ItemList transfer_item_list = 2;</code>
* @param value the transferItemList to set
* @return this
*/
public ExchangeGachaCeilingScRsp setTransferItemList(final ItemListOuterClass.ItemList value) {
bitField0_ |= 0x00000008;
transferItemList.copyFrom(value);
return this;
}
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
* @return whether the gachaCeiling field is set
*/
public boolean hasGachaCeiling() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
* @return this
*/
public ExchangeGachaCeilingScRsp clearGachaCeiling() {
bitField0_ &= ~0x00000010;
gachaCeiling.clear();
return this;
}
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableGachaCeiling()} if you want to modify it.
*
* @return internal storage object for reading
*/
public GachaCeilingOuterClass.GachaCeiling getGachaCeiling() {
return gachaCeiling;
}
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public GachaCeilingOuterClass.GachaCeiling getMutableGachaCeiling() {
bitField0_ |= 0x00000010;
return gachaCeiling;
}
/**
* <code>optional .GachaCeiling gacha_ceiling = 7;</code>
* @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<ExchangeGachaCeilingScRsp> getFactory() {
return ExchangeGachaCeilingScRspFactory.INSTANCE;
}
private enum ExchangeGachaCeilingScRspFactory implements MessageFactory<ExchangeGachaCeilingScRsp> {
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");
}
}
}

View File

@@ -24,6 +24,11 @@ public final class GachaCeilingOuterClass {
*/ */
private int ceilingNum; private int ceilingNum;
/**
* <code>optional bool is_claimed = 9;</code>
*/
private boolean isClaimed;
/** /**
* <code>repeated .GachaCeilingAvatar avatar_list = 15;</code> * <code>repeated .GachaCeilingAvatar avatar_list = 15;</code>
*/ */
@@ -76,12 +81,49 @@ public final class GachaCeilingOuterClass {
return this; return this;
} }
/**
* <code>optional bool is_claimed = 9;</code>
* @return whether the isClaimed field is set
*/
public boolean hasIsClaimed() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional bool is_claimed = 9;</code>
* @return this
*/
public GachaCeiling clearIsClaimed() {
bitField0_ &= ~0x00000002;
isClaimed = false;
return this;
}
/**
* <code>optional bool is_claimed = 9;</code>
* @return the isClaimed
*/
public boolean getIsClaimed() {
return isClaimed;
}
/**
* <code>optional bool is_claimed = 9;</code>
* @param value the isClaimed to set
* @return this
*/
public GachaCeiling setIsClaimed(final boolean value) {
bitField0_ |= 0x00000002;
isClaimed = value;
return this;
}
/** /**
* <code>repeated .GachaCeilingAvatar avatar_list = 15;</code> * <code>repeated .GachaCeilingAvatar avatar_list = 15;</code>
* @return whether the avatarList field is set * @return whether the avatarList field is set
*/ */
public boolean hasAvatarList() { public boolean hasAvatarList() {
return (bitField0_ & 0x00000002) != 0; return (bitField0_ & 0x00000004) != 0;
} }
/** /**
@@ -89,7 +131,7 @@ public final class GachaCeilingOuterClass {
* @return this * @return this
*/ */
public GachaCeiling clearAvatarList() { public GachaCeiling clearAvatarList() {
bitField0_ &= ~0x00000002; bitField0_ &= ~0x00000004;
avatarList.clear(); avatarList.clear();
return this; return this;
} }
@@ -118,7 +160,7 @@ public final class GachaCeilingOuterClass {
* @return internal storage object for modifications * @return internal storage object for modifications
*/ */
public RepeatedMessage<GachaCeilingAvatarOuterClass.GachaCeilingAvatar> getMutableAvatarList() { public RepeatedMessage<GachaCeilingAvatarOuterClass.GachaCeilingAvatar> getMutableAvatarList() {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
return avatarList; return avatarList;
} }
@@ -128,7 +170,7 @@ public final class GachaCeilingOuterClass {
* @return this * @return this
*/ */
public GachaCeiling addAvatarList(final GachaCeilingAvatarOuterClass.GachaCeilingAvatar value) { public GachaCeiling addAvatarList(final GachaCeilingAvatarOuterClass.GachaCeilingAvatar value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
avatarList.add(value); avatarList.add(value);
return this; return this;
} }
@@ -140,7 +182,7 @@ public final class GachaCeilingOuterClass {
*/ */
public GachaCeiling addAllAvatarList( public GachaCeiling addAllAvatarList(
final GachaCeilingAvatarOuterClass.GachaCeilingAvatar... values) { final GachaCeilingAvatarOuterClass.GachaCeilingAvatar... values) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
avatarList.addAll(values); avatarList.addAll(values);
return this; return this;
} }
@@ -151,6 +193,7 @@ public final class GachaCeilingOuterClass {
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
ceilingNum = other.ceilingNum; ceilingNum = other.ceilingNum;
isClaimed = other.isClaimed;
avatarList.copyFrom(other.avatarList); avatarList.copyFrom(other.avatarList);
} }
return this; return this;
@@ -165,6 +208,9 @@ public final class GachaCeilingOuterClass {
if (other.hasCeilingNum()) { if (other.hasCeilingNum()) {
setCeilingNum(other.ceilingNum); setCeilingNum(other.ceilingNum);
} }
if (other.hasIsClaimed()) {
setIsClaimed(other.isClaimed);
}
if (other.hasAvatarList()) { if (other.hasAvatarList()) {
getMutableAvatarList().addAll(other.avatarList); getMutableAvatarList().addAll(other.avatarList);
} }
@@ -179,6 +225,7 @@ public final class GachaCeilingOuterClass {
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
ceilingNum = 0; ceilingNum = 0;
isClaimed = false;
avatarList.clear(); avatarList.clear();
return this; return this;
} }
@@ -205,6 +252,7 @@ public final class GachaCeilingOuterClass {
GachaCeiling other = (GachaCeiling) o; GachaCeiling other = (GachaCeiling) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasCeilingNum() || ceilingNum == other.ceilingNum) && (!hasCeilingNum() || ceilingNum == other.ceilingNum)
&& (!hasIsClaimed() || isClaimed == other.isClaimed)
&& (!hasAvatarList() || avatarList.equals(other.avatarList)); && (!hasAvatarList() || avatarList.equals(other.avatarList));
} }
@@ -215,6 +263,10 @@ public final class GachaCeilingOuterClass {
output.writeUInt32NoTag(ceilingNum); output.writeUInt32NoTag(ceilingNum);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 72);
output.writeBoolNoTag(isClaimed);
}
if ((bitField0_ & 0x00000004) != 0) {
for (int i = 0; i < avatarList.length(); i++) { for (int i = 0; i < avatarList.length(); i++) {
output.writeRawByte((byte) 122); output.writeRawByte((byte) 122);
output.writeMessageNoTag(avatarList.get(i)); output.writeMessageNoTag(avatarList.get(i));
@@ -229,6 +281,9 @@ public final class GachaCeilingOuterClass {
size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum); size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += 2;
}
if ((bitField0_ & 0x00000004) != 0) {
size += (1 * avatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(avatarList); size += (1 * avatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(avatarList);
} }
return size; return size;
@@ -246,6 +301,15 @@ public final class GachaCeilingOuterClass {
ceilingNum = input.readUInt32(); ceilingNum = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 72) {
break;
}
}
case 72: {
// isClaimed
isClaimed = input.readBool();
bitField0_ |= 0x00000002;
tag = input.readTag();
if (tag != 122) { if (tag != 122) {
break; break;
} }
@@ -253,7 +317,7 @@ public final class GachaCeilingOuterClass {
case 122: { case 122: {
// avatarList // avatarList
tag = input.readRepeatedMessage(avatarList, tag); tag = input.readRepeatedMessage(avatarList, tag);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
if (tag != 0) { if (tag != 0) {
break; break;
} }
@@ -279,6 +343,9 @@ public final class GachaCeilingOuterClass {
output.writeUInt32(FieldNames.ceilingNum, ceilingNum); output.writeUInt32(FieldNames.ceilingNum, ceilingNum);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeBool(FieldNames.isClaimed, isClaimed);
}
if ((bitField0_ & 0x00000004) != 0) {
output.writeRepeatedMessage(FieldNames.avatarList, avatarList); output.writeRepeatedMessage(FieldNames.avatarList, avatarList);
} }
output.endObject(); output.endObject();
@@ -303,12 +370,24 @@ public final class GachaCeilingOuterClass {
} }
break; 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 -403402345:
case 397055940: { case 397055940: {
if (input.isAtField(FieldNames.avatarList)) { if (input.isAtField(FieldNames.avatarList)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
input.readRepeatedMessage(avatarList); input.readRepeatedMessage(avatarList);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000004;
} }
} else { } else {
input.skipUnknownField(); input.skipUnknownField();
@@ -369,6 +448,8 @@ public final class GachaCeilingOuterClass {
static class FieldNames { static class FieldNames {
static final FieldName ceilingNum = FieldName.forField("ceilingNum", "ceiling_num"); 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"); static final FieldName avatarList = FieldName.forField("avatarList", "avatar_list");
} }
} }

View File

@@ -19,9 +19,9 @@ public final class GetGachaCeilingCsReqOuterClass {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/** /**
* <code>optional uint32 unkfield = 4;</code> * <code>optional uint32 gacha_type = 4;</code>
*/ */
private int unkfield; private int gachaType;
private GetGachaCeilingCsReq() { private GetGachaCeilingCsReq() {
} }
@@ -34,39 +34,39 @@ public final class GetGachaCeilingCsReqOuterClass {
} }
/** /**
* <code>optional uint32 unkfield = 4;</code> * <code>optional uint32 gacha_type = 4;</code>
* @return whether the unkfield field is set * @return whether the gachaType field is set
*/ */
public boolean hasUnkfield() { public boolean hasGachaType() {
return (bitField0_ & 0x00000001) != 0; return (bitField0_ & 0x00000001) != 0;
} }
/** /**
* <code>optional uint32 unkfield = 4;</code> * <code>optional uint32 gacha_type = 4;</code>
* @return this * @return this
*/ */
public GetGachaCeilingCsReq clearUnkfield() { public GetGachaCeilingCsReq clearGachaType() {
bitField0_ &= ~0x00000001; bitField0_ &= ~0x00000001;
unkfield = 0; gachaType = 0;
return this; return this;
} }
/** /**
* <code>optional uint32 unkfield = 4;</code> * <code>optional uint32 gacha_type = 4;</code>
* @return the unkfield * @return the gachaType
*/ */
public int getUnkfield() { public int getGachaType() {
return unkfield; return gachaType;
} }
/** /**
* <code>optional uint32 unkfield = 4;</code> * <code>optional uint32 gacha_type = 4;</code>
* @param value the unkfield to set * @param value the gachaType to set
* @return this * @return this
*/ */
public GetGachaCeilingCsReq setUnkfield(final int value) { public GetGachaCeilingCsReq setGachaType(final int value) {
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
unkfield = value; gachaType = value;
return this; return this;
} }
@@ -75,7 +75,7 @@ public final class GetGachaCeilingCsReqOuterClass {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
unkfield = other.unkfield; gachaType = other.gachaType;
} }
return this; return this;
} }
@@ -86,8 +86,8 @@ public final class GetGachaCeilingCsReqOuterClass {
return this; return this;
} }
cachedSize = -1; cachedSize = -1;
if (other.hasUnkfield()) { if (other.hasGachaType()) {
setUnkfield(other.unkfield); setGachaType(other.gachaType);
} }
return this; return this;
} }
@@ -99,7 +99,7 @@ public final class GetGachaCeilingCsReqOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
unkfield = 0; gachaType = 0;
return this; return this;
} }
@@ -123,14 +123,14 @@ public final class GetGachaCeilingCsReqOuterClass {
} }
GetGachaCeilingCsReq other = (GetGachaCeilingCsReq) o; GetGachaCeilingCsReq other = (GetGachaCeilingCsReq) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasUnkfield() || unkfield == other.unkfield); && (!hasGachaType() || gachaType == other.gachaType);
} }
@Override @Override
public void writeTo(final ProtoSink output) throws IOException { public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 32); output.writeRawByte((byte) 32);
output.writeUInt32NoTag(unkfield); output.writeUInt32NoTag(gachaType);
} }
} }
@@ -138,7 +138,7 @@ public final class GetGachaCeilingCsReqOuterClass {
protected int computeSerializedSize() { protected int computeSerializedSize() {
int size = 0; int size = 0;
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield); size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
} }
return size; return size;
} }
@@ -151,8 +151,8 @@ public final class GetGachaCeilingCsReqOuterClass {
while (true) { while (true) {
switch (tag) { switch (tag) {
case 32: { case 32: {
// unkfield // gachaType
unkfield = input.readUInt32(); gachaType = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 0) { if (tag != 0) {
@@ -177,7 +177,7 @@ public final class GetGachaCeilingCsReqOuterClass {
public void writeTo(final JsonSink output) throws IOException { public void writeTo(final JsonSink output) throws IOException {
output.beginObject(); output.beginObject();
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.unkfield, unkfield); output.writeUInt32(FieldNames.gachaType, gachaType);
} }
output.endObject(); output.endObject();
} }
@@ -189,10 +189,11 @@ public final class GetGachaCeilingCsReqOuterClass {
} }
while (!input.isAtEnd()) { while (!input.isAtEnd()) {
switch (input.readFieldHash()) { switch (input.readFieldHash()) {
case -247717048: { case 802848732:
if (input.isAtField(FieldNames.unkfield)) { case -871474217: {
if (input.isAtField(FieldNames.gachaType)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
unkfield = input.readUInt32(); gachaType = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
} }
} else { } else {
@@ -253,7 +254,7 @@ public final class GetGachaCeilingCsReqOuterClass {
* Contains name constants used for serializing JSON * Contains name constants used for serializing JSON
*/ */
static class FieldNames { static class FieldNames {
static final FieldName unkfield = FieldName.forField("unkfield"); static final FieldName gachaType = FieldName.forField("gachaType", "gacha_type");
} }
} }
} }

View File

@@ -19,9 +19,9 @@ public final class GetGachaCeilingScRspOuterClass {
private static final long serialVersionUID = 0L; private static final long serialVersionUID = 0L;
/** /**
* <code>optional uint32 unkfield = 14;</code> * <code>optional uint32 gacha_type = 14;</code>
*/ */
private int unkfield; private int gachaType;
/** /**
* <code>optional uint32 retcode = 15;</code> * <code>optional uint32 retcode = 15;</code>
@@ -44,39 +44,39 @@ public final class GetGachaCeilingScRspOuterClass {
} }
/** /**
* <code>optional uint32 unkfield = 14;</code> * <code>optional uint32 gacha_type = 14;</code>
* @return whether the unkfield field is set * @return whether the gachaType field is set
*/ */
public boolean hasUnkfield() { public boolean hasGachaType() {
return (bitField0_ & 0x00000001) != 0; return (bitField0_ & 0x00000001) != 0;
} }
/** /**
* <code>optional uint32 unkfield = 14;</code> * <code>optional uint32 gacha_type = 14;</code>
* @return this * @return this
*/ */
public GetGachaCeilingScRsp clearUnkfield() { public GetGachaCeilingScRsp clearGachaType() {
bitField0_ &= ~0x00000001; bitField0_ &= ~0x00000001;
unkfield = 0; gachaType = 0;
return this; return this;
} }
/** /**
* <code>optional uint32 unkfield = 14;</code> * <code>optional uint32 gacha_type = 14;</code>
* @return the unkfield * @return the gachaType
*/ */
public int getUnkfield() { public int getGachaType() {
return unkfield; return gachaType;
} }
/** /**
* <code>optional uint32 unkfield = 14;</code> * <code>optional uint32 gacha_type = 14;</code>
* @param value the unkfield to set * @param value the gachaType to set
* @return this * @return this
*/ */
public GetGachaCeilingScRsp setUnkfield(final int value) { public GetGachaCeilingScRsp setGachaType(final int value) {
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
unkfield = value; gachaType = value;
return this; return this;
} }
@@ -179,7 +179,7 @@ public final class GetGachaCeilingScRspOuterClass {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
if ((bitField0_ | other.bitField0_) != 0) { if ((bitField0_ | other.bitField0_) != 0) {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
unkfield = other.unkfield; gachaType = other.gachaType;
retcode = other.retcode; retcode = other.retcode;
gachaCeiling.copyFrom(other.gachaCeiling); gachaCeiling.copyFrom(other.gachaCeiling);
} }
@@ -192,8 +192,8 @@ public final class GetGachaCeilingScRspOuterClass {
return this; return this;
} }
cachedSize = -1; cachedSize = -1;
if (other.hasUnkfield()) { if (other.hasGachaType()) {
setUnkfield(other.unkfield); setGachaType(other.gachaType);
} }
if (other.hasRetcode()) { if (other.hasRetcode()) {
setRetcode(other.retcode); setRetcode(other.retcode);
@@ -211,7 +211,7 @@ public final class GetGachaCeilingScRspOuterClass {
} }
cachedSize = -1; cachedSize = -1;
bitField0_ = 0; bitField0_ = 0;
unkfield = 0; gachaType = 0;
retcode = 0; retcode = 0;
gachaCeiling.clear(); gachaCeiling.clear();
return this; return this;
@@ -238,7 +238,7 @@ public final class GetGachaCeilingScRspOuterClass {
} }
GetGachaCeilingScRsp other = (GetGachaCeilingScRsp) o; GetGachaCeilingScRsp other = (GetGachaCeilingScRsp) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasUnkfield() || unkfield == other.unkfield) && (!hasGachaType() || gachaType == other.gachaType)
&& (!hasRetcode() || retcode == other.retcode) && (!hasRetcode() || retcode == other.retcode)
&& (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling)); && (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling));
} }
@@ -247,7 +247,7 @@ public final class GetGachaCeilingScRspOuterClass {
public void writeTo(final ProtoSink output) throws IOException { public void writeTo(final ProtoSink output) throws IOException {
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeRawByte((byte) 112); output.writeRawByte((byte) 112);
output.writeUInt32NoTag(unkfield); output.writeUInt32NoTag(gachaType);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeRawByte((byte) 120); output.writeRawByte((byte) 120);
@@ -263,7 +263,7 @@ public final class GetGachaCeilingScRspOuterClass {
protected int computeSerializedSize() { protected int computeSerializedSize() {
int size = 0; int size = 0;
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield); size += 1 + ProtoSink.computeUInt32SizeNoTag(gachaType);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode);
@@ -282,8 +282,8 @@ public final class GetGachaCeilingScRspOuterClass {
while (true) { while (true) {
switch (tag) { switch (tag) {
case 112: { case 112: {
// unkfield // gachaType
unkfield = input.readUInt32(); gachaType = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
tag = input.readTag(); tag = input.readTag();
if (tag != 120) { if (tag != 120) {
@@ -326,7 +326,7 @@ public final class GetGachaCeilingScRspOuterClass {
public void writeTo(final JsonSink output) throws IOException { public void writeTo(final JsonSink output) throws IOException {
output.beginObject(); output.beginObject();
if ((bitField0_ & 0x00000001) != 0) { if ((bitField0_ & 0x00000001) != 0) {
output.writeUInt32(FieldNames.unkfield, unkfield); output.writeUInt32(FieldNames.gachaType, gachaType);
} }
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeUInt32(FieldNames.retcode, retcode); output.writeUInt32(FieldNames.retcode, retcode);
@@ -344,10 +344,11 @@ public final class GetGachaCeilingScRspOuterClass {
} }
while (!input.isAtEnd()) { while (!input.isAtEnd()) {
switch (input.readFieldHash()) { switch (input.readFieldHash()) {
case -247717048: { case 802848732:
if (input.isAtField(FieldNames.unkfield)) { case -871474217: {
if (input.isAtField(FieldNames.gachaType)) {
if (!input.trySkipNullValue()) { if (!input.trySkipNullValue()) {
unkfield = input.readUInt32(); gachaType = input.readUInt32();
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
} }
} else { } else {
@@ -431,7 +432,7 @@ public final class GetGachaCeilingScRspOuterClass {
* Contains name constants used for serializing JSON * Contains name constants used for serializing JSON
*/ */
static class FieldNames { 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"); static final FieldName retcode = FieldName.forField("retcode");

View File

@@ -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 MATERIAL_COIN_ID = 2; // Material id for credits. DO NOT CHANGE
public static final int TRAILBLAZER_EXP_ID = 22; 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 // Challenge
public static final int CHALLENGE_ENTRANCE = 100000103; public static final int CHALLENGE_ENTRANCE = 100000103;

View File

@@ -1,7 +1,6 @@
package emu.lunarcore.game.gacha; package emu.lunarcore.game.gacha;
import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling; import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar;
import emu.lunarcore.proto.GachaInfoOuterClass.GachaInfo; import emu.lunarcore.proto.GachaInfoOuterClass.GachaInfo;
import lombok.Getter; import lombok.Getter;
@@ -14,53 +13,36 @@ public class GachaBanner {
private int[] rateUpItems5; private int[] rateUpItems5;
private int[] rateUpItems4; private int[] rateUpItems4;
private int eventChance = 50; private int eventChance = 50;
private GachaCeiling gachaCeiling;
private GachaCeilingAvatar createCeilingAvatarInfo(int avatarId) { public GachaInfo toProto(GachaService service, Player player) {
return GachaCeilingAvatar.newInstance()
.setRepeatedCnt(1)
.setAvatarId(avatarId);
}
public GachaInfo toProto() {
var info = GachaInfo.newInstance() var info = GachaInfo.newInstance()
.setGachaId(this.getId()) .setGachaId(this.getId())
.setDetailUrl("") .setDetailUrl("")
.setHistoryUrl(""); .setHistoryUrl("");
if (this.gachaType == GachaType.Normal) { if (this.gachaType != GachaType.Normal) {
// Gacha ceiling
info.setGachaCeiling(GachaCeiling.newInstance());
} else {
info.setBeginTime(this.getBeginTime()); info.setBeginTime(this.getBeginTime());
info.setEndTime(this.getEndTime()); 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) { if (this.getId() == 1001) {
GachaCeilingAvatar ceilingavatarinfo1 = createCeilingAvatarInfo(1003); info.setGachaCeiling(player.getGachaInfo().toGachaCeiling(player));
GachaCeilingAvatar ceilingavatarinfo2 = createCeilingAvatarInfo(1107);
GachaCeilingAvatar ceilingavatarinfo3 = createCeilingAvatarInfo(1211); 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() if (this.getRateUpItems5().length > 0) {
.addAvatarList(ceilingavatarinfo1) info.addAllUpInfo(getRateUpItems5());
.addAvatarList(ceilingavatarinfo2) info.addAllFeatured(getRateUpItems5());
.addAvatarList(ceilingavatarinfo3) }
.setCeilingNum(169);
info.setGachaCeiling(ceilinginfo);
} }
return info; return info;

View File

@@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import emu.lunarcore.GameConstants;
import emu.lunarcore.LunarCore; import emu.lunarcore.LunarCore;
import emu.lunarcore.data.GameData; import emu.lunarcore.data.GameData;
import emu.lunarcore.data.excel.ItemExcel; 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.game.GameServer;
import emu.lunarcore.server.packet.send.PacketDoGachaScRsp; import emu.lunarcore.server.packet.send.PacketDoGachaScRsp;
import emu.lunarcore.util.JsonUtils; import emu.lunarcore.util.JsonUtils;
import emu.lunarcore.util.Utils;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntArrayList;
import it.unimi.dsi.fastutil.ints.IntList; import it.unimi.dsi.fastutil.ints.IntList;
import lombok.Getter;
@Getter
public class GachaService extends BaseGameService { public class GachaService extends BaseGameService {
private final Int2ObjectMap<GachaBanner> gachaBanners; private final Int2ObjectMap<GachaBanner> gachaBanners;
private GetGachaInfoScRsp cachedProto; private GetGachaInfoScRsp cachedProto;
private int[] yellowAvatars = new int[] {1003, 1004, 1101, 1107, 1104, 1209, 1211}; 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[] 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[] 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[] 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 starglightId = 252;
private static int embersId = 251; private static int embersId = 251;
@@ -45,10 +50,6 @@ public class GachaService extends BaseGameService {
this.load(); this.load();
} }
public Int2ObjectMap<GachaBanner> getGachaBanners() {
return gachaBanners;
}
public int randomRange(int min, int max) { public int randomRange(int min, int max) {
return ThreadLocalRandom.current().nextInt(max - min + 1) + min; 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) { public synchronized void doPulls(Player player, int gachaId, int times) {
// Sanity check // Sanity checks
if (times != 10 && times != 1) { if (times != 10 && times != 1) return;
return;
}
if (player.getInventory().getInventoryTab(ItemMainType.Equipment).getSize() + times > player.getInventory().getInventoryTab(ItemMainType.Equipment).getMaxCapacity()) { if (player.getInventory().getInventoryTab(ItemMainType.Equipment).getSize() + times > player.getInventory().getInventoryTab(ItemMainType.Equipment).getMaxCapacity()) {
player.sendPacket(new PacketDoGachaScRsp()); player.sendPacket(new PacketDoGachaScRsp());
return; return;
@@ -94,6 +94,12 @@ public class GachaService extends BaseGameService {
player.getInventory().removeItem(costItem, times); player.getInventory().removeItem(costItem, times);
} }
// Add gacha ceiling
if (banner.getGachaType() == GachaType.Normal || banner.getGachaType() == GachaType.Newbie) {
player.getGachaInfo().addCeilingNum(times);
player.save();
}
// Roll // Roll
PlayerGachaBannerInfo gachaInfo = player.getGachaInfo().getBannerInfo(banner.getGachaType()); PlayerGachaBannerInfo gachaInfo = player.getGachaInfo().getBannerInfo(banner.getGachaType());
@@ -255,24 +261,44 @@ public class GachaService extends BaseGameService {
} }
// Packets // Packets
player.sendPacket(new PacketDoGachaScRsp(banner, times, list)); player.sendPacket(new PacketDoGachaScRsp(player, banner, times, list));
}
public List<GameItem> 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<GameItem> 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(); var proto = GetGachaInfoScRsp.newInstance();
for (GachaBanner banner : getGachaBanners().values()) { for (GachaBanner banner : getGachaBanners().values()) {
proto.addGachaInfoList(banner.toProto()); proto.addGachaInfoList(banner.toProto(this, player));
} }
return proto; return proto;
} }
public GetGachaInfoScRsp toProto() {
if (this.cachedProto == null) {
this.cachedProto = createProto();
}
return this.cachedProto;
}
} }

View File

@@ -4,16 +4,19 @@ import lombok.Getter;
@Getter @Getter
public enum GachaType { public enum GachaType {
Newbie (101, 1, 2), Unknown (0, 0, 0, 0),
Normal (101, 1, 2), Newbie (1, 101, 1, 2),
AvatarUp (102, 1, 1), Normal (2, 101, 1, 2),
WeaponUp (102, 2, 2); AvatarUp (11, 102, 1, 1),
WeaponUp (12, 102, 2, 2);
private int id;
private int costItem; private int costItem;
private int minItemType; private int minItemType;
private int maxItemType; 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.costItem = costItem;
this.minItemType = min; this.minItemType = min;
this.maxItemType = max; this.maxItemType = max;

View File

@@ -1,29 +1,31 @@
package emu.lunarcore.game.gacha; package emu.lunarcore.game.gacha;
import dev.morphia.annotations.Entity; 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 { public class PlayerGachaInfo {
private PlayerGachaBannerInfo standardBanner; private PlayerGachaBannerInfo standardBanner;
private PlayerGachaBannerInfo eventCharacterBanner; private PlayerGachaBannerInfo eventCharacterBanner;
private PlayerGachaBannerInfo eventWeaponBanner; private PlayerGachaBannerInfo eventWeaponBanner;
private int ceilingNum;
@Setter private boolean ceilingClaimed;
public PlayerGachaInfo() { public PlayerGachaInfo() {
this.standardBanner = new PlayerGachaBannerInfo(); this.standardBanner = new PlayerGachaBannerInfo();
this.eventCharacterBanner = new PlayerGachaBannerInfo(); this.eventCharacterBanner = new PlayerGachaBannerInfo();
this.eventWeaponBanner = new PlayerGachaBannerInfo(); this.eventWeaponBanner = new PlayerGachaBannerInfo();
} }
public PlayerGachaBannerInfo getStandardBanner() { public void addCeilingNum(int amount) {
return standardBanner; this.ceilingNum = Math.min(ceilingNum + amount, GameConstants.GACHA_CEILING_MAX);
}
public PlayerGachaBannerInfo getEventCharacterBanner() {
return eventCharacterBanner;
}
public PlayerGachaBannerInfo getEventWeaponBanner() {
return eventWeaponBanner;
} }
public PlayerGachaBannerInfo getBannerInfo(GachaType type) { public PlayerGachaBannerInfo getBannerInfo(GachaType type) {
@@ -35,4 +37,30 @@ public class PlayerGachaInfo {
return this.standardBanner; 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;
}
} }

View File

@@ -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));
}
}

View File

@@ -5,15 +5,13 @@ import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.packet.Opcodes; import emu.lunarcore.server.packet.Opcodes;
import emu.lunarcore.server.packet.PacketHandler; import emu.lunarcore.server.packet.PacketHandler;
import emu.lunarcore.server.packet.send.PacketGetGachaCeilingScRsp; import emu.lunarcore.server.packet.send.PacketGetGachaCeilingScRsp;
import emu.lunarcore.proto.GetGachaCeilingCsReqOuterClass.GetGachaCeilingCsReq;
@Opcodes(CmdId.GetGachaCeilingCsReq) @Opcodes(CmdId.GetGachaCeilingCsReq)
public class HandlerGetGachaCeilingCsReq extends PacketHandler { public class HandlerGetGachaCeilingCsReq extends PacketHandler {
@Override @Override
public void handle(GameSession session, byte[] data) throws Exception { public void handle(GameSession session, byte[] data) throws Exception {
var req = GetGachaCeilingCsReq.parseFrom(data); session.send(new PacketGetGachaCeilingScRsp(session.getPlayer()));
session.send(new PacketGetGachaCeilingScRsp(req.getUnkfield()));
} }
} }

View File

@@ -3,6 +3,7 @@ package emu.lunarcore.server.packet.send;
import java.util.List; import java.util.List;
import emu.lunarcore.game.gacha.GachaBanner; import emu.lunarcore.game.gacha.GachaBanner;
import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.DoGachaScRspOuterClass.DoGachaScRsp; import emu.lunarcore.proto.DoGachaScRspOuterClass.DoGachaScRsp;
import emu.lunarcore.proto.GachaItemOuterClass.GachaItem; import emu.lunarcore.proto.GachaItemOuterClass.GachaItem;
import emu.lunarcore.server.packet.BasePacket; import emu.lunarcore.server.packet.BasePacket;
@@ -16,11 +17,12 @@ public class PacketDoGachaScRsp extends BasePacket {
this.setData(DoGachaScRsp.newInstance().setRetcode(1)); this.setData(DoGachaScRsp.newInstance().setRetcode(1));
} }
public PacketDoGachaScRsp(GachaBanner banner, int num, List<GachaItem> items) { public PacketDoGachaScRsp(Player player, GachaBanner banner, int num, List<GachaItem> items) {
super(CmdId.DoGachaScRsp); super(CmdId.DoGachaScRsp);
var data = DoGachaScRsp.newInstance() var data = DoGachaScRsp.newInstance()
.setGachaNum(num) .setGachaNum(num)
.setCeilingNum(player.getGachaInfo().getCeilingNum())
.setGachaId(banner.getId()); .setGachaId(banner.getId());
for (GachaItem item : items) { for (GachaItem item : items) {

View File

@@ -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<GameItem> 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);
}
}

View File

@@ -1,37 +1,20 @@
package emu.lunarcore.server.packet.send; package emu.lunarcore.server.packet.send;
import emu.lunarcore.server.packet.CmdId; import emu.lunarcore.server.packet.CmdId;
import emu.lunarcore.server.game.GameSession;
import emu.lunarcore.server.packet.BasePacket; import emu.lunarcore.server.packet.BasePacket;
import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling; import emu.lunarcore.game.gacha.GachaType;
import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar; import emu.lunarcore.game.player.Player;
import emu.lunarcore.proto.GetGachaCeilingScRspOuterClass.GetGachaCeilingScRsp; import emu.lunarcore.proto.GetGachaCeilingScRspOuterClass.GetGachaCeilingScRsp;
public class PacketGetGachaCeilingScRsp extends BasePacket { public class PacketGetGachaCeilingScRsp extends BasePacket {
private GachaCeilingAvatar createCeilingAvatarInfo(int avatarId) { public PacketGetGachaCeilingScRsp(Player player) {
return GachaCeilingAvatar.newInstance()
.setRepeatedCnt(1)
.setAvatarId(avatarId);
}
public PacketGetGachaCeilingScRsp(int unkfield) {
super(CmdId.GetGachaCeilingScRsp); 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() var proto = GetGachaCeilingScRsp.newInstance()
.setGachaCeiling(gachaceiling) .setGachaType(GachaType.Normal.getId())
.setUnkfield(unkfield); .setGachaCeiling(player.getGachaInfo().toGachaCeiling(player));
this.setData(proto); this.setData(proto);
} }
} }

View File

@@ -9,6 +9,6 @@ public class PacketGetGachaInfoScRsp extends BasePacket {
public PacketGetGachaInfoScRsp(GameSession session) { public PacketGetGachaInfoScRsp(GameSession session) {
super(CmdId.GetGachaInfoScRsp); super(CmdId.GetGachaInfoScRsp);
this.setData(session.getServer().getGachaService().toProto()); this.setData(session.getServer().getGachaService().toProto(session.getPlayer()));
} }
} }