From 86ab379559cd7e9021fe35d6376a84cca3ee0740 Mon Sep 17 00:00:00 2001 From: Hiro Date: Tue, 28 Nov 2023 04:58:10 +0200 Subject: [PATCH] update Banners.json and attempt to fix GachaCeiling --- data/Banners.json | 431 ++++++++++++++--- .../proto/GachaCeilingOuterClass.java | 95 +++- .../proto/GetGachaCeilingCsReqOuterClass.java | 259 ++++++++++ .../proto/GetGachaCeilingScRspOuterClass.java | 441 ++++++++++++++++++ .../emu/lunarcore/game/gacha/GachaBanner.java | 22 + .../recv/HandlerGetGachaCeilingCsReq.java | 19 + .../send/PacketGetGachaCeilingScRsp.java | 37 ++ 7 files changed, 1238 insertions(+), 66 deletions(-) create mode 100644 src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java create mode 100644 src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java create mode 100644 src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java diff --git a/data/Banners.json b/data/Banners.json index 0d7d052f7..95efc49bb 100644 --- a/data/Banners.json +++ b/data/Banners.json @@ -1,61 +1,374 @@ [ - { - "id": 1001, - "gachaType": "Normal", - "beginTime": 0, - "endTime": 0, - "rateUpItems5": [], - "rateUpItems4": [] - }, - { - "id": 2014, - "gachaType": "AvatarUp", - "beginTime": 0, - "endTime": 1924992000, - "rateUpItems5": [1217], - "rateUpItems4": [1002, 1008, 1103] - }, - { - "id": 3014, - "gachaType": "WeaponUp", - "beginTime": 0, - "endTime": 1924992000, - "eventChance": 75, - "rateUpItems5": [23017], - "rateUpItems4": [21007, 21016, 21017] - }, - { - "id": 2015, - "gachaType": "AvatarUp", - "beginTime": 0, - "endTime": 1924992000, - "rateUpItems5": [1302], - "rateUpItems4": [1009, 1110, 1215] - }, - { - "id": 3015, - "gachaType": "WeaponUp", - "beginTime": 0, - "endTime": 1924992000, - "eventChance": 75, - "rateUpItems5": [23018], - "rateUpItems4": [21000, 21006, 21019] - }, - { - "id": 2016, - "gachaType": "AvatarUp", - "beginTime": 0, - "endTime": 1924992000, - "rateUpItems5": [1006], - "rateUpItems4": [1009, 1110, 1215] - }, - { - "id": 3016, - "gachaType": "WeaponUp", - "beginTime": 0, - "endTime": 1924992000, - "eventChance": 75, - "rateUpItems5": [23007], - "rateUpItems4": [21000, 21006, 21019] - } + { + "id": 1001, + "gachaType": "Normal", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [1001,1002,1003,1004,1008,1009,1013,1101,1103,1104,1105,1106,1107,1108,1109,1201,1202,1206,1209,1211,21000,21001,21002,21003,21004,21005,21006,21007,21008,21009,21010,21011,21012,21013,21014,21015,21016,21017,21018,21019,21020,23000,23002,23003,23004,23005,23012,23013], + "rateUpItems4": [23002,1003,1101,1104,23000,23003] + }, + { + "id": 2001, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1102 + ], + "rateUpItems4": [ + 1105, + 1106, + 1109 + ] + }, + { + "id": 3001, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23001 + ], + "rateUpItems4": [ + 21001, + 21005, + 21000 + ] + }, + { + "id": 2002, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1204 + ], + "rateUpItems4": [ + 1206, + 1001, + 1103 + ] + }, + { + "id": 3002, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23010 + ], + "rateUpItems4": [ + 21003, + 21002, + 21013 + ] + }, + { + "id": 2005, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1006 + ], + "rateUpItems4": [ + 1002, + 1009, + 1103 + ] + }, + { + "id": 3005, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23007 + ], + "rateUpItems4": [ + 21017, + 21004, + 21013 + ] + }, + { + "id": 2006, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1203 + ], + "rateUpItems4": [ + 1106, + 1201, + 1207 + ] + }, + { + "id": 3006, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23008 + ], + "rateUpItems4": [ + 21001, + 21018, + 21020 + ] + }, + { + "id": 2007, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1205 + ], + "rateUpItems4": [ + 1008, + 1206, + 1105 + ] + }, + { + "id": 3007, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23009 + ], + "rateUpItems4": [ + 21012, + 21010, + 21007 + ] + }, + { + "id": 2008, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1005 + ], + "rateUpItems4": [ + 1111, + 1108, + 1103 + ] + }, + { + "id": 3008, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23006 + ], + "rateUpItems4": [ + 21015, + 21008, + 21006 + ] + }, + { + "id": 2009, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1213 + ], + "rateUpItems4": [ + 1207, + 1009, + 1001 + ] + }, + { + "id": 3009, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23015 + ], + "rateUpItems4": [ + 21011, + 21018, + 21009 + ] + }, + { + "id": 2010, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1208 + ], + "rateUpItems4": [ + 1110, + 1109, + 1106 + ] + }, + { + "id": 3010, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23011 + ], + "rateUpItems4": [ + 21016, + 21014, + 21019 + ] + }, + { + "id": 2011, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1212 + ], + "rateUpItems4": [ + 1202, + 1201, + 1108 + ] + }, + { + "id": 3011, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23014 + ], + "rateUpItems4": [ + 21008, + 21004, + 21013 + ] + }, + { + "id": 2012, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1112 + ], + "rateUpItems4": [ + 1210, + 1111, + 1206 + ] + }, + { + "id": 3012, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23016 + ], + "rateUpItems4": [ + 21003, + 21018, + 21015 + ] + }, + { + "id": 2014, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1217 + ], + "rateUpItems4": [ + 1002, + 1008, + 1103 + ] + }, + { + "id": 3014, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23017 + ], + "rateUpItems4": [ + 21007, + 21017, + 21016 + ] + }, + { + "id": 2015, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1302 + ], + "rateUpItems4": [ + 1215, + 1110, + 1009 + ] + }, + { + "id": 3015, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23018 + ], + "rateUpItems4": [ + 21019, + 21000, + 21006 + ] + }, + { + "id": 2016, + "gachaType": "AvatarUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 1006 + ], + "rateUpItems4": [ + 1215, + 1110, + 1009 + ] + }, + { + "id": 3016, + "gachaType": "WeaponUp", + "beginTime": 0, + "endTime": 1924992000, + "rateUpItems5": [ + 23007 + ], + "rateUpItems4": [ + 21019, + 21000, + 21006 + ] + } ] \ No newline at end of file diff --git a/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java b/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java index 42c629842..6a6dca9a1 100644 --- a/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/GachaCeilingOuterClass.java @@ -19,6 +19,11 @@ public final class GachaCeilingOuterClass { public static final class GachaCeiling extends ProtoMessage implements Cloneable { private static final long serialVersionUID = 0L; + /** + * optional uint32 ceiling_num = 14; + */ + private int ceilingNum; + /** * repeated .GachaCeilingAvatar avatar_list = 15; */ @@ -34,12 +39,49 @@ public static GachaCeiling newInstance() { return new GachaCeiling(); } + /** + * optional uint32 ceiling_num = 14; + * @return whether the ceilingNum field is set + */ + public boolean hasCeilingNum() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 ceiling_num = 14; + * @return this + */ + public GachaCeiling clearCeilingNum() { + bitField0_ &= ~0x00000001; + ceilingNum = 0; + return this; + } + + /** + * optional uint32 ceiling_num = 14; + * @return the ceilingNum + */ + public int getCeilingNum() { + return ceilingNum; + } + + /** + * optional uint32 ceiling_num = 14; + * @param value the ceilingNum to set + * @return this + */ + public GachaCeiling setCeilingNum(final int value) { + bitField0_ |= 0x00000001; + ceilingNum = value; + return this; + } + /** * repeated .GachaCeilingAvatar avatar_list = 15; * @return whether the avatarList field is set */ public boolean hasAvatarList() { - return (bitField0_ & 0x00000001) != 0; + return (bitField0_ & 0x00000002) != 0; } /** @@ -47,7 +89,7 @@ public boolean hasAvatarList() { * @return this */ public GachaCeiling clearAvatarList() { - bitField0_ &= ~0x00000001; + bitField0_ &= ~0x00000002; avatarList.clear(); return this; } @@ -76,7 +118,7 @@ public RepeatedMessage getAvata * @return internal storage object for modifications */ public RepeatedMessage getMutableAvatarList() { - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; return avatarList; } @@ -86,7 +128,7 @@ public RepeatedMessage getMutab * @return this */ public GachaCeiling addAvatarList(final GachaCeilingAvatarOuterClass.GachaCeilingAvatar value) { - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; avatarList.add(value); return this; } @@ -98,7 +140,7 @@ public GachaCeiling addAvatarList(final GachaCeilingAvatarOuterClass.GachaCeilin */ public GachaCeiling addAllAvatarList( final GachaCeilingAvatarOuterClass.GachaCeilingAvatar... values) { - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; avatarList.addAll(values); return this; } @@ -108,6 +150,7 @@ public GachaCeiling copyFrom(final GachaCeiling other) { cachedSize = other.cachedSize; if ((bitField0_ | other.bitField0_) != 0) { bitField0_ = other.bitField0_; + ceilingNum = other.ceilingNum; avatarList.copyFrom(other.avatarList); } return this; @@ -119,6 +162,9 @@ public GachaCeiling mergeFrom(final GachaCeiling other) { return this; } cachedSize = -1; + if (other.hasCeilingNum()) { + setCeilingNum(other.ceilingNum); + } if (other.hasAvatarList()) { getMutableAvatarList().addAll(other.avatarList); } @@ -132,6 +178,7 @@ public GachaCeiling clear() { } cachedSize = -1; bitField0_ = 0; + ceilingNum = 0; avatarList.clear(); return this; } @@ -157,12 +204,17 @@ public boolean equals(Object o) { } GachaCeiling other = (GachaCeiling) o; return bitField0_ == other.bitField0_ + && (!hasCeilingNum() || ceilingNum == other.ceilingNum) && (!hasAvatarList() || avatarList.equals(other.avatarList)); } @Override public void writeTo(final ProtoSink output) throws IOException { if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 112); + output.writeUInt32NoTag(ceilingNum); + } + if ((bitField0_ & 0x00000002) != 0) { for (int i = 0; i < avatarList.length(); i++) { output.writeRawByte((byte) 122); output.writeMessageNoTag(avatarList.get(i)); @@ -174,6 +226,9 @@ public void writeTo(final ProtoSink output) throws IOException { protected int computeSerializedSize() { int size = 0; if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(ceilingNum); + } + if ((bitField0_ & 0x00000002) != 0) { size += (1 * avatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(avatarList); } return size; @@ -186,10 +241,19 @@ public GachaCeiling mergeFrom(final ProtoSource input) throws IOException { int tag = input.readTag(); while (true) { switch (tag) { + case 112: { + // ceilingNum + ceilingNum = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 122) { + break; + } + } case 122: { // avatarList tag = input.readRepeatedMessage(avatarList, tag); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; if (tag != 0) { break; } @@ -212,6 +276,9 @@ public GachaCeiling mergeFrom(final ProtoSource input) throws IOException { public void writeTo(final JsonSink output) throws IOException { output.beginObject(); if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.ceilingNum, ceilingNum); + } + if ((bitField0_ & 0x00000002) != 0) { output.writeRepeatedMessage(FieldNames.avatarList, avatarList); } output.endObject(); @@ -224,12 +291,24 @@ public GachaCeiling mergeFrom(final JsonSource input) throws IOException { } while (!input.isAtEnd()) { switch (input.readFieldHash()) { + case -1655838327: + case 209119492: { + if (input.isAtField(FieldNames.ceilingNum)) { + if (!input.trySkipNullValue()) { + ceilingNum = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } case -403402345: case 397055940: { if (input.isAtField(FieldNames.avatarList)) { if (!input.trySkipNullValue()) { input.readRepeatedMessage(avatarList); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; } } else { input.skipUnknownField(); @@ -288,6 +367,8 @@ public GachaCeiling create() { * Contains name constants used for serializing JSON */ static class FieldNames { + static final FieldName ceilingNum = FieldName.forField("ceilingNum", "ceiling_num"); + 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 new file mode 100644 index 000000000..ed647fe5b --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingCsReqOuterClass.java @@ -0,0 +1,259 @@ +// 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 GetGachaCeilingCsReqOuterClass { + /** + * Protobuf type {@code GetGachaCeilingCsReq} + */ + public static final class GetGachaCeilingCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 unkfield = 4; + */ + private int unkfield; + + private GetGachaCeilingCsReq() { + } + + /** + * @return a new empty instance of {@code GetGachaCeilingCsReq} + */ + public static GetGachaCeilingCsReq newInstance() { + return new GetGachaCeilingCsReq(); + } + + /** + * optional uint32 unkfield = 4; + * @return whether the unkfield field is set + */ + public boolean hasUnkfield() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 unkfield = 4; + * @return this + */ + public GetGachaCeilingCsReq clearUnkfield() { + bitField0_ &= ~0x00000001; + unkfield = 0; + return this; + } + + /** + * optional uint32 unkfield = 4; + * @return the unkfield + */ + public int getUnkfield() { + return unkfield; + } + + /** + * optional uint32 unkfield = 4; + * @param value the unkfield to set + * @return this + */ + public GetGachaCeilingCsReq setUnkfield(final int value) { + bitField0_ |= 0x00000001; + unkfield = value; + return this; + } + + @Override + public GetGachaCeilingCsReq copyFrom(final GetGachaCeilingCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + unkfield = other.unkfield; + } + return this; + } + + @Override + public GetGachaCeilingCsReq mergeFrom(final GetGachaCeilingCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasUnkfield()) { + setUnkfield(other.unkfield); + } + return this; + } + + @Override + public GetGachaCeilingCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + unkfield = 0; + return this; + } + + @Override + public GetGachaCeilingCsReq 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 GetGachaCeilingCsReq)) { + return false; + } + GetGachaCeilingCsReq other = (GetGachaCeilingCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasUnkfield() || unkfield == other.unkfield); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 32); + output.writeUInt32NoTag(unkfield); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetGachaCeilingCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 32: { + // unkfield + unkfield = input.readUInt32(); + bitField0_ |= 0x00000001; + 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.unkfield, unkfield); + } + output.endObject(); + } + + @Override + public GetGachaCeilingCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -247717048: { + if (input.isAtField(FieldNames.unkfield)) { + if (!input.trySkipNullValue()) { + unkfield = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetGachaCeilingCsReq clone() { + return new GetGachaCeilingCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetGachaCeilingCsReq parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetGachaCeilingCsReq(), data).checkInitialized(); + } + + public static GetGachaCeilingCsReq parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetGachaCeilingCsReq(), input).checkInitialized(); + } + + public static GetGachaCeilingCsReq parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetGachaCeilingCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating GetGachaCeilingCsReq messages + */ + public static MessageFactory getFactory() { + return GetGachaCeilingCsReqFactory.INSTANCE; + } + + private enum GetGachaCeilingCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public GetGachaCeilingCsReq create() { + return GetGachaCeilingCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName unkfield = FieldName.forField("unkfield"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java new file mode 100644 index 000000000..f823da2ee --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetGachaCeilingScRspOuterClass.java @@ -0,0 +1,441 @@ +// 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 GetGachaCeilingScRspOuterClass { + /** + * Protobuf type {@code GetGachaCeilingScRsp} + */ + public static final class GetGachaCeilingScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 unkfield = 14; + */ + private int unkfield; + + /** + * optional uint32 retcode = 15; + */ + private int retcode; + + /** + * optional .GachaCeiling gacha_ceiling = 6; + */ + private final GachaCeilingOuterClass.GachaCeiling gachaCeiling = GachaCeilingOuterClass.GachaCeiling.newInstance(); + + private GetGachaCeilingScRsp() { + } + + /** + * @return a new empty instance of {@code GetGachaCeilingScRsp} + */ + public static GetGachaCeilingScRsp newInstance() { + return new GetGachaCeilingScRsp(); + } + + /** + * optional uint32 unkfield = 14; + * @return whether the unkfield field is set + */ + public boolean hasUnkfield() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 unkfield = 14; + * @return this + */ + public GetGachaCeilingScRsp clearUnkfield() { + bitField0_ &= ~0x00000001; + unkfield = 0; + return this; + } + + /** + * optional uint32 unkfield = 14; + * @return the unkfield + */ + public int getUnkfield() { + return unkfield; + } + + /** + * optional uint32 unkfield = 14; + * @param value the unkfield to set + * @return this + */ + public GetGachaCeilingScRsp setUnkfield(final int value) { + bitField0_ |= 0x00000001; + unkfield = value; + return this; + } + + /** + * optional uint32 retcode = 15; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 retcode = 15; + * @return this + */ + public GetGachaCeilingScRsp clearRetcode() { + bitField0_ &= ~0x00000002; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 15; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 15; + * @param value the retcode to set + * @return this + */ + public GetGachaCeilingScRsp setRetcode(final int value) { + bitField0_ |= 0x00000002; + retcode = value; + return this; + } + + /** + * optional .GachaCeiling gacha_ceiling = 6; + * @return whether the gachaCeiling field is set + */ + public boolean hasGachaCeiling() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional .GachaCeiling gacha_ceiling = 6; + * @return this + */ + public GetGachaCeilingScRsp clearGachaCeiling() { + bitField0_ &= ~0x00000004; + gachaCeiling.clear(); + return this; + } + + /** + * optional .GachaCeiling gacha_ceiling = 6; + * + * 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 = 6; + * + * 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_ |= 0x00000004; + return gachaCeiling; + } + + /** + * optional .GachaCeiling gacha_ceiling = 6; + * @param value the gachaCeiling to set + * @return this + */ + public GetGachaCeilingScRsp setGachaCeiling(final GachaCeilingOuterClass.GachaCeiling value) { + bitField0_ |= 0x00000004; + gachaCeiling.copyFrom(value); + return this; + } + + @Override + public GetGachaCeilingScRsp copyFrom(final GetGachaCeilingScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + unkfield = other.unkfield; + retcode = other.retcode; + gachaCeiling.copyFrom(other.gachaCeiling); + } + return this; + } + + @Override + public GetGachaCeilingScRsp mergeFrom(final GetGachaCeilingScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasUnkfield()) { + setUnkfield(other.unkfield); + } + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasGachaCeiling()) { + getMutableGachaCeiling().mergeFrom(other.gachaCeiling); + } + return this; + } + + @Override + public GetGachaCeilingScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + unkfield = 0; + retcode = 0; + gachaCeiling.clear(); + return this; + } + + @Override + public GetGachaCeilingScRsp clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + gachaCeiling.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetGachaCeilingScRsp)) { + return false; + } + GetGachaCeilingScRsp other = (GetGachaCeilingScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasUnkfield() || unkfield == other.unkfield) + && (!hasRetcode() || retcode == other.retcode) + && (!hasGachaCeiling() || gachaCeiling.equals(other.gachaCeiling)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 112); + output.writeUInt32NoTag(unkfield); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 120); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 50); + output.writeMessageNoTag(gachaCeiling); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(unkfield); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(gachaCeiling); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetGachaCeilingScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 112: { + // unkfield + unkfield = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 120) { + break; + } + } + case 120: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 50) { + break; + } + } + case 50: { + // gachaCeiling + input.readMessage(gachaCeiling); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.unkfield, unkfield); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.retcode, retcode); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeMessage(FieldNames.gachaCeiling, gachaCeiling); + } + output.endObject(); + } + + @Override + public GetGachaCeilingScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -247717048: { + if (input.isAtField(FieldNames.unkfield)) { + if (!input.trySkipNullValue()) { + unkfield = 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 507275483: + case -1792489728: { + if (input.isAtField(FieldNames.gachaCeiling)) { + if (!input.trySkipNullValue()) { + input.readMessage(gachaCeiling); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetGachaCeilingScRsp clone() { + return new GetGachaCeilingScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetGachaCeilingScRsp parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetGachaCeilingScRsp(), data).checkInitialized(); + } + + public static GetGachaCeilingScRsp parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetGachaCeilingScRsp(), input).checkInitialized(); + } + + public static GetGachaCeilingScRsp parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetGachaCeilingScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating GetGachaCeilingScRsp messages + */ + public static MessageFactory getFactory() { + return GetGachaCeilingScRspFactory.INSTANCE; + } + + private enum GetGachaCeilingScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public GetGachaCeilingScRsp create() { + return GetGachaCeilingScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName unkfield = FieldName.forField("unkfield"); + + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName gachaCeiling = FieldName.forField("gachaCeiling", "gacha_ceiling"); + } + } +} diff --git a/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java b/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java index 078dd52e1..474c1c855 100644 --- a/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java +++ b/src/main/java/emu/lunarcore/game/gacha/GachaBanner.java @@ -1,6 +1,7 @@ package emu.lunarcore.game.gacha; import emu.lunarcore.proto.GachaCeilingOuterClass.GachaCeiling; +import emu.lunarcore.proto.GachaCeilingAvatarOuterClass.GachaCeilingAvatar; import emu.lunarcore.proto.GachaInfoOuterClass.GachaInfo; import lombok.Getter; @@ -13,6 +14,13 @@ 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() { var info = GachaInfo.newInstance() @@ -41,6 +49,20 @@ public GachaInfo toProto() { } } + if (this.getId() == 1001) { + GachaCeilingAvatar ceilingavatarinfo1 = createCeilingAvatarInfo(1003); + GachaCeilingAvatar ceilingavatarinfo2 = createCeilingAvatarInfo(1107); + GachaCeilingAvatar ceilingavatarinfo3 = createCeilingAvatarInfo(1211); + + GachaCeiling ceilinginfo = GachaCeiling.newInstance() + .addAvatarList(ceilingavatarinfo1) + .addAvatarList(ceilingavatarinfo2) + .addAvatarList(ceilingavatarinfo3) + .setCeilingNum(169); + + info.setGachaCeiling(ceilinginfo); + } + return info; } } diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java new file mode 100644 index 000000000..982544ff7 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetGachaCeilingCsReq.java @@ -0,0 +1,19 @@ +package emu.lunarcore.server.packet.recv; + +import emu.lunarcore.server.game.GameSession; +import emu.lunarcore.server.packet.CmdId; +import emu.lunarcore.server.packet.Opcodes; +import emu.lunarcore.server.packet.PacketHandler; +import emu.lunarcore.server.packet.send.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())); + } + +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java new file mode 100644 index 000000000..897cea3ff --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetGachaCeilingScRsp.java @@ -0,0 +1,37 @@ +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.proto.GetGachaCeilingScRspOuterClass.GetGachaCeilingScRsp; + +public class PacketGetGachaCeilingScRsp extends BasePacket { + + private GachaCeilingAvatar createCeilingAvatarInfo(int avatarId) { + return GachaCeilingAvatar.newInstance() + .setRepeatedCnt(1) + .setAvatarId(avatarId); + } + + public PacketGetGachaCeilingScRsp(int unkfield) { + 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); + this.setData(proto); + } +}