From 90456b2a91324cf5fe6b46a971f488a80ef15ae0 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Mon, 1 Jan 2024 07:29:20 -0800 Subject: [PATCH] Basic implementation of challenge stories --- .../proto/ChallengeInfoOuterClass.java | 104 +++++- .../ChallengeStoryBuffInfoOuterClass.java | 301 +++++++++++++++ .../proto/ChallengeStoryInfoOuterClass.java | 282 +++++++++++++++ .../proto/StartChallengeCsReqOuterClass.java | 105 +++++- ...StartChallengeStoryBuffInfoOuterClass.java | 342 ++++++++++++++++++ .../StartChallengeStoryInfoOuterClass.java | 283 +++++++++++++++ .../java/emu/lunarcore/GameConstants.java | 1 + .../lunarcore/data/excel/ChallengeExcel.java | 15 +- .../data/excel/ChallengeStoryExtraExcel.java | 28 ++ .../data/excel/ChallengeTargetExcel.java | 4 +- .../emu/lunarcore/game/battle/Battle.java | 4 + .../game/challenge/ChallengeInstance.java | 32 +- .../game/challenge/ChallengeManager.java | 11 +- .../recv/HandlerLeaveChallengeCsReq.java | 10 +- .../recv/HandlerStartChallengeCsReq.java | 3 +- 15 files changed, 1513 insertions(+), 12 deletions(-) create mode 100644 src/generated/main/emu/lunarcore/proto/ChallengeStoryBuffInfoOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/ChallengeStoryInfoOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/StartChallengeStoryBuffInfoOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/StartChallengeStoryInfoOuterClass.java create mode 100644 src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java index b7d60eb..fc43dc7 100644 --- a/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java @@ -38,6 +38,11 @@ public final class ChallengeInfoOuterClass { */ private int extraLineupType; + /** + * optional .ChallengeStoryInfo story_info = 13; + */ + private final ChallengeStoryInfoOuterClass.ChallengeStoryInfo storyInfo = ChallengeStoryInfoOuterClass.ChallengeStoryInfo.newInstance(); + private ChallengeInfo() { } @@ -246,6 +251,63 @@ public final class ChallengeInfoOuterClass { return this; } + /** + * optional .ChallengeStoryInfo story_info = 13; + * @return whether the storyInfo field is set + */ + public boolean hasStoryInfo() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * optional .ChallengeStoryInfo story_info = 13; + * @return this + */ + public ChallengeInfo clearStoryInfo() { + bitField0_ &= ~0x00000010; + storyInfo.clear(); + return this; + } + + /** + * optional .ChallengeStoryInfo story_info = 13; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableStoryInfo()} if you want to modify it. + * + * @return internal storage object for reading + */ + public ChallengeStoryInfoOuterClass.ChallengeStoryInfo getStoryInfo() { + return storyInfo; + } + + /** + * optional .ChallengeStoryInfo story_info = 13; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public ChallengeStoryInfoOuterClass.ChallengeStoryInfo getMutableStoryInfo() { + bitField0_ |= 0x00000010; + return storyInfo; + } + + /** + * optional .ChallengeStoryInfo story_info = 13; + * @param value the storyInfo to set + * @return this + */ + public ChallengeInfo setStoryInfo(final ChallengeStoryInfoOuterClass.ChallengeStoryInfo value) { + bitField0_ |= 0x00000010; + storyInfo.copyFrom(value); + return this; + } + @Override public ChallengeInfo copyFrom(final ChallengeInfo other) { cachedSize = other.cachedSize; @@ -255,6 +317,7 @@ public final class ChallengeInfoOuterClass { roundCount = other.roundCount; status = other.status; extraLineupType = other.extraLineupType; + storyInfo.copyFrom(other.storyInfo); } return this; } @@ -277,6 +340,9 @@ public final class ChallengeInfoOuterClass { if (other.hasExtraLineupType()) { setExtraLineupTypeValue(other.extraLineupType); } + if (other.hasStoryInfo()) { + getMutableStoryInfo().mergeFrom(other.storyInfo); + } return this; } @@ -291,6 +357,7 @@ public final class ChallengeInfoOuterClass { roundCount = 0; status = 0; extraLineupType = 0; + storyInfo.clear(); return this; } @@ -301,6 +368,7 @@ public final class ChallengeInfoOuterClass { } cachedSize = -1; bitField0_ = 0; + storyInfo.clearQuick(); return this; } @@ -317,7 +385,8 @@ public final class ChallengeInfoOuterClass { && (!hasChallengeId() || challengeId == other.challengeId) && (!hasRoundCount() || roundCount == other.roundCount) && (!hasStatus() || status == other.status) - && (!hasExtraLineupType() || extraLineupType == other.extraLineupType); + && (!hasExtraLineupType() || extraLineupType == other.extraLineupType) + && (!hasStoryInfo() || storyInfo.equals(other.storyInfo)); } @Override @@ -338,6 +407,10 @@ public final class ChallengeInfoOuterClass { output.writeRawByte((byte) 120); output.writeEnumNoTag(extraLineupType); } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRawByte((byte) 106); + output.writeMessageNoTag(storyInfo); + } } @Override @@ -355,6 +428,9 @@ public final class ChallengeInfoOuterClass { if ((bitField0_ & 0x00000008) != 0) { size += 1 + ProtoSink.computeEnumSizeNoTag(extraLineupType); } + if ((bitField0_ & 0x00000010) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(storyInfo); + } return size; } @@ -403,6 +479,15 @@ public final class ChallengeInfoOuterClass { bitField0_ |= 0x00000008; } tag = input.readTag(); + if (tag != 106) { + break; + } + } + case 106: { + // storyInfo + input.readMessage(storyInfo); + bitField0_ |= 0x00000010; + tag = input.readTag(); if (tag != 0) { break; } @@ -436,6 +521,9 @@ public final class ChallengeInfoOuterClass { if ((bitField0_ & 0x00000008) != 0) { output.writeEnum(FieldNames.extraLineupType, extraLineupType, ExtraLineupTypeOuterClass.ExtraLineupType.converter()); } + if ((bitField0_ & 0x00000010) != 0) { + output.writeMessage(FieldNames.storyInfo, storyInfo); + } output.endObject(); } @@ -503,6 +591,18 @@ public final class ChallengeInfoOuterClass { } break; } + case 1710116675: + case 1494185400: { + if (input.isAtField(FieldNames.storyInfo)) { + if (!input.trySkipNullValue()) { + input.readMessage(storyInfo); + bitField0_ |= 0x00000010; + } + } else { + input.skipUnknownField(); + } + break; + } default: { input.skipUnknownField(); break; @@ -562,6 +662,8 @@ public final class ChallengeInfoOuterClass { static final FieldName status = FieldName.forField("status"); static final FieldName extraLineupType = FieldName.forField("extraLineupType", "extra_lineup_type"); + + static final FieldName storyInfo = FieldName.forField("storyInfo", "story_info"); } } } diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeStoryBuffInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeStoryBuffInfoOuterClass.java new file mode 100644 index 0000000..f4524fb --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/ChallengeStoryBuffInfoOuterClass.java @@ -0,0 +1,301 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedInt; + +public final class ChallengeStoryBuffInfoOuterClass { + /** + * Protobuf type {@code ChallengeStoryBuffInfo} + */ + public static final class ChallengeStoryBuffInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated uint32 buff_list = 5; + */ + private final RepeatedInt buffList = RepeatedInt.newEmptyInstance(); + + private ChallengeStoryBuffInfo() { + } + + /** + * @return a new empty instance of {@code ChallengeStoryBuffInfo} + */ + public static ChallengeStoryBuffInfo newInstance() { + return new ChallengeStoryBuffInfo(); + } + + /** + * repeated uint32 buff_list = 5; + * @return whether the buffList field is set + */ + public boolean hasBuffList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated uint32 buff_list = 5; + * @return this + */ + public ChallengeStoryBuffInfo clearBuffList() { + bitField0_ &= ~0x00000001; + buffList.clear(); + return this; + } + + /** + * repeated uint32 buff_list = 5; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableBuffList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getBuffList() { + return buffList; + } + + /** + * repeated uint32 buff_list = 5; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedInt getMutableBuffList() { + bitField0_ |= 0x00000001; + return buffList; + } + + /** + * repeated uint32 buff_list = 5; + * @param value the buffList to add + * @return this + */ + public ChallengeStoryBuffInfo addBuffList(final int value) { + bitField0_ |= 0x00000001; + buffList.add(value); + return this; + } + + /** + * repeated uint32 buff_list = 5; + * @param values the buffList to add + * @return this + */ + public ChallengeStoryBuffInfo addAllBuffList(final int... values) { + bitField0_ |= 0x00000001; + buffList.addAll(values); + return this; + } + + @Override + public ChallengeStoryBuffInfo copyFrom(final ChallengeStoryBuffInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + buffList.copyFrom(other.buffList); + } + return this; + } + + @Override + public ChallengeStoryBuffInfo mergeFrom(final ChallengeStoryBuffInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasBuffList()) { + getMutableBuffList().addAll(other.buffList); + } + return this; + } + + @Override + public ChallengeStoryBuffInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + buffList.clear(); + return this; + } + + @Override + public ChallengeStoryBuffInfo clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + buffList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ChallengeStoryBuffInfo)) { + return false; + } + ChallengeStoryBuffInfo other = (ChallengeStoryBuffInfo) o; + return bitField0_ == other.bitField0_ + && (!hasBuffList() || buffList.equals(other.buffList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < buffList.length(); i++) { + output.writeRawByte((byte) 40); + output.writeUInt32NoTag(buffList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * buffList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(buffList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public ChallengeStoryBuffInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 42: { + // buffList [packed=true] + input.readPackedUInt32(buffList, tag); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 40: { + // buffList [packed=false] + tag = input.readRepeatedUInt32(buffList, tag); + bitField0_ |= 0x00000001; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedUInt32(FieldNames.buffList, buffList); + } + output.endObject(); + } + + @Override + public ChallengeStoryBuffInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1522789487: + case 55792906: { + if (input.isAtField(FieldNames.buffList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(buffList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public ChallengeStoryBuffInfo clone() { + return new ChallengeStoryBuffInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static ChallengeStoryBuffInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new ChallengeStoryBuffInfo(), data).checkInitialized(); + } + + public static ChallengeStoryBuffInfo parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new ChallengeStoryBuffInfo(), input).checkInitialized(); + } + + public static ChallengeStoryBuffInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new ChallengeStoryBuffInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating ChallengeStoryBuffInfo messages + */ + public static MessageFactory getFactory() { + return ChallengeStoryBuffInfoFactory.INSTANCE; + } + + private enum ChallengeStoryBuffInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public ChallengeStoryBuffInfo create() { + return ChallengeStoryBuffInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName buffList = FieldName.forField("buffList", "buff_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeStoryInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeStoryInfoOuterClass.java new file mode 100644 index 0000000..e4b8075 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/ChallengeStoryInfoOuterClass.java @@ -0,0 +1,282 @@ +// 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 ChallengeStoryInfoOuterClass { + /** + * Protobuf type {@code ChallengeStoryInfo} + */ + public static final class ChallengeStoryInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 6; + */ + private final ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo curStoryBuffs = ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo.newInstance(); + + private ChallengeStoryInfo() { + } + + /** + * @return a new empty instance of {@code ChallengeStoryInfo} + */ + public static ChallengeStoryInfo newInstance() { + return new ChallengeStoryInfo(); + } + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 6; + * @return whether the curStoryBuffs field is set + */ + public boolean hasCurStoryBuffs() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 6; + * @return this + */ + public ChallengeStoryInfo clearCurStoryBuffs() { + bitField0_ &= ~0x00000001; + curStoryBuffs.clear(); + return this; + } + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 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 #getMutableCurStoryBuffs()} if you want to modify it. + * + * @return internal storage object for reading + */ + public ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo getCurStoryBuffs() { + return curStoryBuffs; + } + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 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 ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo getMutableCurStoryBuffs() { + bitField0_ |= 0x00000001; + return curStoryBuffs; + } + + /** + * optional .ChallengeStoryBuffInfo cur_story_buffs = 6; + * @param value the curStoryBuffs to set + * @return this + */ + public ChallengeStoryInfo setCurStoryBuffs( + final ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo value) { + bitField0_ |= 0x00000001; + curStoryBuffs.copyFrom(value); + return this; + } + + @Override + public ChallengeStoryInfo copyFrom(final ChallengeStoryInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + curStoryBuffs.copyFrom(other.curStoryBuffs); + } + return this; + } + + @Override + public ChallengeStoryInfo mergeFrom(final ChallengeStoryInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasCurStoryBuffs()) { + getMutableCurStoryBuffs().mergeFrom(other.curStoryBuffs); + } + return this; + } + + @Override + public ChallengeStoryInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + curStoryBuffs.clear(); + return this; + } + + @Override + public ChallengeStoryInfo clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + curStoryBuffs.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ChallengeStoryInfo)) { + return false; + } + ChallengeStoryInfo other = (ChallengeStoryInfo) o; + return bitField0_ == other.bitField0_ + && (!hasCurStoryBuffs() || curStoryBuffs.equals(other.curStoryBuffs)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 50); + output.writeMessageNoTag(curStoryBuffs); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(curStoryBuffs); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public ChallengeStoryInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 50: { + // curStoryBuffs + input.readMessage(curStoryBuffs); + 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.writeMessage(FieldNames.curStoryBuffs, curStoryBuffs); + } + output.endObject(); + } + + @Override + public ChallengeStoryInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -587091733: + case -738440393: { + if (input.isAtField(FieldNames.curStoryBuffs)) { + if (!input.trySkipNullValue()) { + input.readMessage(curStoryBuffs); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public ChallengeStoryInfo clone() { + return new ChallengeStoryInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static ChallengeStoryInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new ChallengeStoryInfo(), data).checkInitialized(); + } + + public static ChallengeStoryInfo parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new ChallengeStoryInfo(), input).checkInitialized(); + } + + public static ChallengeStoryInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new ChallengeStoryInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating ChallengeStoryInfo messages + */ + public static MessageFactory getFactory() { + return ChallengeStoryInfoFactory.INSTANCE; + } + + private enum ChallengeStoryInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public ChallengeStoryInfo create() { + return ChallengeStoryInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName curStoryBuffs = FieldName.forField("curStoryBuffs", "cur_story_buffs"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/StartChallengeCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/StartChallengeCsReqOuterClass.java index c77b7f6..9bf148d 100644 --- a/src/generated/main/emu/lunarcore/proto/StartChallengeCsReqOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/StartChallengeCsReqOuterClass.java @@ -23,6 +23,11 @@ public final class StartChallengeCsReqOuterClass { */ private int challengeId; + /** + * optional .StartChallengeStoryInfo story_info = 9; + */ + private final StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo storyInfo = StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo.newInstance(); + private StartChallengeCsReq() { } @@ -70,12 +75,71 @@ public final class StartChallengeCsReqOuterClass { return this; } + /** + * optional .StartChallengeStoryInfo story_info = 9; + * @return whether the storyInfo field is set + */ + public boolean hasStoryInfo() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional .StartChallengeStoryInfo story_info = 9; + * @return this + */ + public StartChallengeCsReq clearStoryInfo() { + bitField0_ &= ~0x00000002; + storyInfo.clear(); + return this; + } + + /** + * optional .StartChallengeStoryInfo story_info = 9; + * + * 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 #getMutableStoryInfo()} if you want to modify it. + * + * @return internal storage object for reading + */ + public StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo getStoryInfo() { + return storyInfo; + } + + /** + * optional .StartChallengeStoryInfo story_info = 9; + * + * 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 StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo getMutableStoryInfo() { + bitField0_ |= 0x00000002; + return storyInfo; + } + + /** + * optional .StartChallengeStoryInfo story_info = 9; + * @param value the storyInfo to set + * @return this + */ + public StartChallengeCsReq setStoryInfo( + final StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo value) { + bitField0_ |= 0x00000002; + storyInfo.copyFrom(value); + return this; + } + @Override public StartChallengeCsReq copyFrom(final StartChallengeCsReq other) { cachedSize = other.cachedSize; if ((bitField0_ | other.bitField0_) != 0) { bitField0_ = other.bitField0_; challengeId = other.challengeId; + storyInfo.copyFrom(other.storyInfo); } return this; } @@ -89,6 +153,9 @@ public final class StartChallengeCsReqOuterClass { if (other.hasChallengeId()) { setChallengeId(other.challengeId); } + if (other.hasStoryInfo()) { + getMutableStoryInfo().mergeFrom(other.storyInfo); + } return this; } @@ -100,6 +167,7 @@ public final class StartChallengeCsReqOuterClass { cachedSize = -1; bitField0_ = 0; challengeId = 0; + storyInfo.clear(); return this; } @@ -110,6 +178,7 @@ public final class StartChallengeCsReqOuterClass { } cachedSize = -1; bitField0_ = 0; + storyInfo.clearQuick(); return this; } @@ -123,7 +192,8 @@ public final class StartChallengeCsReqOuterClass { } StartChallengeCsReq other = (StartChallengeCsReq) o; return bitField0_ == other.bitField0_ - && (!hasChallengeId() || challengeId == other.challengeId); + && (!hasChallengeId() || challengeId == other.challengeId) + && (!hasStoryInfo() || storyInfo.equals(other.storyInfo)); } @Override @@ -132,6 +202,10 @@ public final class StartChallengeCsReqOuterClass { output.writeRawByte((byte) 48); output.writeUInt32NoTag(challengeId); } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 74); + output.writeMessageNoTag(storyInfo); + } } @Override @@ -140,6 +214,9 @@ public final class StartChallengeCsReqOuterClass { if ((bitField0_ & 0x00000001) != 0) { size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId); } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(storyInfo); + } return size; } @@ -155,6 +232,15 @@ public final class StartChallengeCsReqOuterClass { challengeId = input.readUInt32(); bitField0_ |= 0x00000001; tag = input.readTag(); + if (tag != 74) { + break; + } + } + case 74: { + // storyInfo + input.readMessage(storyInfo); + bitField0_ |= 0x00000002; + tag = input.readTag(); if (tag != 0) { break; } @@ -179,6 +265,9 @@ public final class StartChallengeCsReqOuterClass { if ((bitField0_ & 0x00000001) != 0) { output.writeUInt32(FieldNames.challengeId, challengeId); } + if ((bitField0_ & 0x00000002) != 0) { + output.writeMessage(FieldNames.storyInfo, storyInfo); + } output.endObject(); } @@ -201,6 +290,18 @@ public final class StartChallengeCsReqOuterClass { } break; } + case 1710116675: + case 1494185400: { + if (input.isAtField(FieldNames.storyInfo)) { + if (!input.trySkipNullValue()) { + input.readMessage(storyInfo); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } default: { input.skipUnknownField(); break; @@ -255,6 +356,8 @@ public final class StartChallengeCsReqOuterClass { */ static class FieldNames { static final FieldName challengeId = FieldName.forField("challengeId", "challenge_id"); + + static final FieldName storyInfo = FieldName.forField("storyInfo", "story_info"); } } } diff --git a/src/generated/main/emu/lunarcore/proto/StartChallengeStoryBuffInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/StartChallengeStoryBuffInfoOuterClass.java new file mode 100644 index 0000000..fc5547b --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/StartChallengeStoryBuffInfoOuterClass.java @@ -0,0 +1,342 @@ +// 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 StartChallengeStoryBuffInfoOuterClass { + /** + * Protobuf type {@code StartChallengeStoryBuffInfo} + */ + public static final class StartChallengeStoryBuffInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 story_buff_one = 12; + */ + private int storyBuffOne; + + /** + * optional uint32 story_buff_two = 13; + */ + private int storyBuffTwo; + + private StartChallengeStoryBuffInfo() { + } + + /** + * @return a new empty instance of {@code StartChallengeStoryBuffInfo} + */ + public static StartChallengeStoryBuffInfo newInstance() { + return new StartChallengeStoryBuffInfo(); + } + + /** + * optional uint32 story_buff_one = 12; + * @return whether the storyBuffOne field is set + */ + public boolean hasStoryBuffOne() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 story_buff_one = 12; + * @return this + */ + public StartChallengeStoryBuffInfo clearStoryBuffOne() { + bitField0_ &= ~0x00000001; + storyBuffOne = 0; + return this; + } + + /** + * optional uint32 story_buff_one = 12; + * @return the storyBuffOne + */ + public int getStoryBuffOne() { + return storyBuffOne; + } + + /** + * optional uint32 story_buff_one = 12; + * @param value the storyBuffOne to set + * @return this + */ + public StartChallengeStoryBuffInfo setStoryBuffOne(final int value) { + bitField0_ |= 0x00000001; + storyBuffOne = value; + return this; + } + + /** + * optional uint32 story_buff_two = 13; + * @return whether the storyBuffTwo field is set + */ + public boolean hasStoryBuffTwo() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 story_buff_two = 13; + * @return this + */ + public StartChallengeStoryBuffInfo clearStoryBuffTwo() { + bitField0_ &= ~0x00000002; + storyBuffTwo = 0; + return this; + } + + /** + * optional uint32 story_buff_two = 13; + * @return the storyBuffTwo + */ + public int getStoryBuffTwo() { + return storyBuffTwo; + } + + /** + * optional uint32 story_buff_two = 13; + * @param value the storyBuffTwo to set + * @return this + */ + public StartChallengeStoryBuffInfo setStoryBuffTwo(final int value) { + bitField0_ |= 0x00000002; + storyBuffTwo = value; + return this; + } + + @Override + public StartChallengeStoryBuffInfo copyFrom(final StartChallengeStoryBuffInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + storyBuffOne = other.storyBuffOne; + storyBuffTwo = other.storyBuffTwo; + } + return this; + } + + @Override + public StartChallengeStoryBuffInfo mergeFrom(final StartChallengeStoryBuffInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasStoryBuffOne()) { + setStoryBuffOne(other.storyBuffOne); + } + if (other.hasStoryBuffTwo()) { + setStoryBuffTwo(other.storyBuffTwo); + } + return this; + } + + @Override + public StartChallengeStoryBuffInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + storyBuffOne = 0; + storyBuffTwo = 0; + return this; + } + + @Override + public StartChallengeStoryBuffInfo 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 StartChallengeStoryBuffInfo)) { + return false; + } + StartChallengeStoryBuffInfo other = (StartChallengeStoryBuffInfo) o; + return bitField0_ == other.bitField0_ + && (!hasStoryBuffOne() || storyBuffOne == other.storyBuffOne) + && (!hasStoryBuffTwo() || storyBuffTwo == other.storyBuffTwo); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 96); + output.writeUInt32NoTag(storyBuffOne); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 104); + output.writeUInt32NoTag(storyBuffTwo); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffOne); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(storyBuffTwo); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public StartChallengeStoryBuffInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 96: { + // storyBuffOne + storyBuffOne = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 104) { + break; + } + } + case 104: { + // storyBuffTwo + storyBuffTwo = 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.storyBuffOne, storyBuffOne); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.storyBuffTwo, storyBuffTwo); + } + output.endObject(); + } + + @Override + public StartChallengeStoryBuffInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1761423966: + case 1329547396: { + if (input.isAtField(FieldNames.storyBuffOne)) { + if (!input.trySkipNullValue()) { + storyBuffOne = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1761429060: + case 1329552490: { + if (input.isAtField(FieldNames.storyBuffTwo)) { + if (!input.trySkipNullValue()) { + storyBuffTwo = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public StartChallengeStoryBuffInfo clone() { + return new StartChallengeStoryBuffInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static StartChallengeStoryBuffInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new StartChallengeStoryBuffInfo(), data).checkInitialized(); + } + + public static StartChallengeStoryBuffInfo parseFrom(final ProtoSource input) throws + IOException { + return ProtoMessage.mergeFrom(new StartChallengeStoryBuffInfo(), input).checkInitialized(); + } + + public static StartChallengeStoryBuffInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new StartChallengeStoryBuffInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating StartChallengeStoryBuffInfo messages + */ + public static MessageFactory getFactory() { + return StartChallengeStoryBuffInfoFactory.INSTANCE; + } + + private enum StartChallengeStoryBuffInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public StartChallengeStoryBuffInfo create() { + return StartChallengeStoryBuffInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName storyBuffOne = FieldName.forField("storyBuffOne", "story_buff_one"); + + static final FieldName storyBuffTwo = FieldName.forField("storyBuffTwo", "story_buff_two"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/StartChallengeStoryInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/StartChallengeStoryInfoOuterClass.java new file mode 100644 index 0000000..db16bdc --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/StartChallengeStoryInfoOuterClass.java @@ -0,0 +1,283 @@ +// 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 StartChallengeStoryInfoOuterClass { + /** + * Protobuf type {@code StartChallengeStoryInfo} + */ + public static final class StartChallengeStoryInfo extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + */ + private final StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo storyBuffInfo = StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo.newInstance(); + + private StartChallengeStoryInfo() { + } + + /** + * @return a new empty instance of {@code StartChallengeStoryInfo} + */ + public static StartChallengeStoryInfo newInstance() { + return new StartChallengeStoryInfo(); + } + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + * @return whether the storyBuffInfo field is set + */ + public boolean hasStoryBuffInfo() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + * @return this + */ + public StartChallengeStoryInfo clearStoryBuffInfo() { + bitField0_ &= ~0x00000001; + storyBuffInfo.clear(); + return this; + } + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + * + * 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 #getMutableStoryBuffInfo()} if you want to modify it. + * + * @return internal storage object for reading + */ + public StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo getStoryBuffInfo() { + return storyBuffInfo; + } + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + * + * 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 StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo getMutableStoryBuffInfo( + ) { + bitField0_ |= 0x00000001; + return storyBuffInfo; + } + + /** + * optional .StartChallengeStoryBuffInfo story_buff_info = 1; + * @param value the storyBuffInfo to set + * @return this + */ + public StartChallengeStoryInfo setStoryBuffInfo( + final StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo value) { + bitField0_ |= 0x00000001; + storyBuffInfo.copyFrom(value); + return this; + } + + @Override + public StartChallengeStoryInfo copyFrom(final StartChallengeStoryInfo other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + storyBuffInfo.copyFrom(other.storyBuffInfo); + } + return this; + } + + @Override + public StartChallengeStoryInfo mergeFrom(final StartChallengeStoryInfo other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasStoryBuffInfo()) { + getMutableStoryBuffInfo().mergeFrom(other.storyBuffInfo); + } + return this; + } + + @Override + public StartChallengeStoryInfo clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + storyBuffInfo.clear(); + return this; + } + + @Override + public StartChallengeStoryInfo clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + storyBuffInfo.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof StartChallengeStoryInfo)) { + return false; + } + StartChallengeStoryInfo other = (StartChallengeStoryInfo) o; + return bitField0_ == other.bitField0_ + && (!hasStoryBuffInfo() || storyBuffInfo.equals(other.storyBuffInfo)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 10); + output.writeMessageNoTag(storyBuffInfo); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(storyBuffInfo); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public StartChallengeStoryInfo mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // storyBuffInfo + input.readMessage(storyBuffInfo); + 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.writeMessage(FieldNames.storyBuffInfo, storyBuffInfo); + } + output.endObject(); + } + + @Override + public StartChallengeStoryInfo mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1230610506: + case -1733882288: { + if (input.isAtField(FieldNames.storyBuffInfo)) { + if (!input.trySkipNullValue()) { + input.readMessage(storyBuffInfo); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public StartChallengeStoryInfo clone() { + return new StartChallengeStoryInfo().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static StartChallengeStoryInfo parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new StartChallengeStoryInfo(), data).checkInitialized(); + } + + public static StartChallengeStoryInfo parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new StartChallengeStoryInfo(), input).checkInitialized(); + } + + public static StartChallengeStoryInfo parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new StartChallengeStoryInfo(), input).checkInitialized(); + } + + /** + * @return factory for creating StartChallengeStoryInfo messages + */ + public static MessageFactory getFactory() { + return StartChallengeStoryInfoFactory.INSTANCE; + } + + private enum StartChallengeStoryInfoFactory implements MessageFactory { + INSTANCE; + + @Override + public StartChallengeStoryInfo create() { + return StartChallengeStoryInfo.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName storyBuffInfo = FieldName.forField("storyBuffInfo", "story_buff_info"); + } + } +} diff --git a/src/main/java/emu/lunarcore/GameConstants.java b/src/main/java/emu/lunarcore/GameConstants.java index c7df5d1..7af8252 100644 --- a/src/main/java/emu/lunarcore/GameConstants.java +++ b/src/main/java/emu/lunarcore/GameConstants.java @@ -51,6 +51,7 @@ public class GameConstants { // Challenge public static final int CHALLENGE_ENTRANCE = 100000103; + public static final int CHALLENGE_STORY_ENTRANCE = 102020107; // Rogue public static final boolean ENABLE_ROGUE = false; diff --git a/src/main/java/emu/lunarcore/data/excel/ChallengeExcel.java b/src/main/java/emu/lunarcore/data/excel/ChallengeExcel.java index 522205c..914d8a2 100644 --- a/src/main/java/emu/lunarcore/data/excel/ChallengeExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/ChallengeExcel.java @@ -7,7 +7,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; @Getter -@ResourceType(name = {"ChallengeMazeConfig.json"}) +@ResourceType(name = {"ChallengeMazeConfig.json", "ChallengeStoryMazeConfig.json"}) public class ChallengeExcel extends GameResource { private int ID; private int GroupID; @@ -30,11 +30,22 @@ public class ChallengeExcel extends GameResource { private transient Int2ObjectMap challengeMonsters1; private transient Int2ObjectMap challengeMonsters2; + + private transient ChallengeStoryExtraExcel storyExcel; @Override public int getId() { return ID; } + + public boolean isStory() { + return this.storyExcel != null; + } + + public void setStoryExcel(ChallengeStoryExtraExcel storyExcel) { + this.storyExcel = storyExcel; + this.ChallengeCountDown = storyExcel.getTurnLimit(); + } @Override public void onLoad() { @@ -54,7 +65,7 @@ public class ChallengeExcel extends GameResource { var monster = new ChallengeMonsterInfo(ConfigList2[i], NpcMonsterIDList2[i], EventIDList2[i]); this.challengeMonsters2.put(monster.getConfigId(), monster); } - + // Clear arrays to save memory this.ConfigList1 = null; this.NpcMonsterIDList1 = null; diff --git a/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java b/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java new file mode 100644 index 0000000..622ed1f --- /dev/null +++ b/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java @@ -0,0 +1,28 @@ +package emu.lunarcore.data.excel; + +import emu.lunarcore.data.GameData; +import emu.lunarcore.data.GameResource; +import emu.lunarcore.data.ResourceType; +import emu.lunarcore.data.ResourceType.LoadPriority; +import lombok.Getter; + +@Getter +@ResourceType(name = {"ChallengeStoryMazeExtra.json"}, loadPriority = LoadPriority.LOW) +public class ChallengeStoryExtraExcel extends GameResource { + private int ID; + private int TurnLimit; + private int ClearScore; + + @Override + public int getId() { + return ID; + } + + @Override + public void onLoad() { + var challengeExcel = GameData.getChallengeExcelMap().get(this.getId()); + if (challengeExcel != null) { + challengeExcel.setStoryExcel(this); + } + } +} diff --git a/src/main/java/emu/lunarcore/data/excel/ChallengeTargetExcel.java b/src/main/java/emu/lunarcore/data/excel/ChallengeTargetExcel.java index 06a4281..09caf6a 100644 --- a/src/main/java/emu/lunarcore/data/excel/ChallengeTargetExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/ChallengeTargetExcel.java @@ -6,7 +6,7 @@ import emu.lunarcore.data.ResourceType.LoadPriority; import lombok.Getter; @Getter -@ResourceType(name = {"ChallengeTargetConfig.json"}, loadPriority = LoadPriority.HIGH) +@ResourceType(name = {"ChallengeTargetConfig.json", "ChallengeStoryTargetConfig.json"}, loadPriority = LoadPriority.HIGH) public class ChallengeTargetExcel extends GameResource { private int ID; private ChallengeType ChallengeTargetType; @@ -18,6 +18,6 @@ public class ChallengeTargetExcel extends GameResource { } public enum ChallengeType { - None, ROUNDS, DEAD_AVATAR, KILL_MONSTER, AVATAR_BASE_TYPE_MORE, AVATAR_BASE_TYPE_LESS, ROUNDS_LEFT; + None, ROUNDS, DEAD_AVATAR, KILL_MONSTER, AVATAR_BASE_TYPE_MORE, AVATAR_BASE_TYPE_LESS, ROUNDS_LEFT, TOTAL_SCORE; } } diff --git a/src/main/java/emu/lunarcore/game/battle/Battle.java b/src/main/java/emu/lunarcore/game/battle/Battle.java index 665e6d6..fd3c312 100644 --- a/src/main/java/emu/lunarcore/game/battle/Battle.java +++ b/src/main/java/emu/lunarcore/game/battle/Battle.java @@ -137,6 +137,10 @@ public class Battle { // Battle buffs + public MazeBuff addBuff(int buffId) { + return addBuff(buffId, -1, 0xffffffff); + } + public MazeBuff addBuff(int buffId, int ownerIndex) { return addBuff(buffId, ownerIndex, 0xffffffff); } diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java index 0a9ff00..2603fe4 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java @@ -16,7 +16,8 @@ import emu.lunarcore.server.packet.send.PacketChallengeLineupNotify; import emu.lunarcore.server.packet.send.PacketChallengeSettleNotify; import emu.lunarcore.server.packet.send.PacketSyncLineupNotify; import emu.lunarcore.util.Position; - +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; import lombok.Getter; import lombok.Setter; @@ -37,6 +38,8 @@ public class ChallengeInstance { @Setter private int roundsLeft; @Setter private int stars; + private IntList storyBuffs; + @Deprecated // Morphia only public ChallengeInstance() {} @@ -47,7 +50,7 @@ public class ChallengeInstance { this.startPos = new Position(); this.startRot = new Position(); this.currentStage = 1; - this.roundsLeft = excel.getChallengeCountDown(); + this.roundsLeft = getExcel().isStory() ? 5 : excel.getChallengeCountDown(); this.setStatus(ChallengeStatus.CHALLENGE_DOING); this.setCurrentExtraLineup(ExtraLineupType.LINEUP_CHALLENGE); } @@ -76,8 +79,28 @@ public class ChallengeInstance { return status == ChallengeStatus.CHALLENGE_FINISH_VALUE; } + public void addStoryBuff(int storyBuff) { + // Add story buffs + if (storyBuffs == null) { + storyBuffs = new IntArrayList(); + } + + storyBuffs.add(storyBuff); + } + public void onBattleStart(Battle battle) { + // Set cycle limit battle.setRoundsLimit(player.getChallengeInstance().getRoundsLeft()); + + // Add story buffs + if (this.getStoryBuffs() != null) { + battle.addBuff(this.getExcel().getMazeBuffID()); + + int buffId = this.getStoryBuffs().getInt(this.getCurrentStage() - 1); + if (buffId != 0) { + battle.addBuff(buffId); + } + } } public void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatistics stats) { @@ -190,6 +213,11 @@ public class ChallengeInstance { .setRoundCount(this.getRoundsElapsed()) .setExtraLineupTypeValue(this.getCurrentExtraLineup()); + if (this.getStoryBuffs() != null) { + int buffId = this.getStoryBuffs().getInt(this.getCurrentStage() - 1); + proto.getMutableStoryInfo().getMutableCurStoryBuffs().addBuffList(buffId); + } + return proto; } } \ No newline at end of file diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java index 35e80f0..7599a0c 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java @@ -12,6 +12,7 @@ import emu.lunarcore.game.player.BasePlayerManager; import emu.lunarcore.game.player.Player; import emu.lunarcore.game.player.lineup.PlayerLineup; import emu.lunarcore.proto.ExtraLineupTypeOuterClass.ExtraLineupType; +import emu.lunarcore.proto.StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo; import emu.lunarcore.server.packet.send.PacketStartChallengeScRsp; import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; @@ -28,7 +29,7 @@ public class ChallengeManager extends BasePlayerManager { this.takenRewards = new Int2ObjectOpenHashMap<>(); } - public void startChallenge(int challengeId) { + public void startChallenge(int challengeId, StartChallengeStoryBuffInfo storyBuffs) { // Get challenge excel ChallengeExcel excel = GameData.getChallengeExcelMap().get(challengeId); if (excel == null) { @@ -68,7 +69,7 @@ public class ChallengeManager extends BasePlayerManager { // Set challenge data for player ChallengeInstance instance = new ChallengeInstance(getPlayer(), excel); getPlayer().setChallengeInstance(instance); - + // Set first lineup before we enter scenes getPlayer().getLineupManager().setCurrentExtraLineup(instance.getCurrentExtraLineup(), false); @@ -87,6 +88,12 @@ public class ChallengeManager extends BasePlayerManager { instance.getStartPos().set(getPlayer().getPos()); instance.getStartRot().set(getPlayer().getRot()); instance.setSavedMp(getPlayer().getCurrentLineup().getMp()); + + // Set story buffs + if (excel.isStory() && storyBuffs != null) { + instance.addStoryBuff(storyBuffs.getStoryBuffOne()); + instance.addStoryBuff(storyBuffs.getStoryBuffTwo()); + } // Send packet getPlayer().sendPacket(new PacketStartChallengeScRsp(getPlayer(), challengeId)); diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java index 976ed29..656e26e 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerLeaveChallengeCsReq.java @@ -17,9 +17,17 @@ public class HandlerLeaveChallengeCsReq extends PacketHandler { // As of 1.5.0, the server now has to handle the player leaving battle too session.getPlayer().forceQuitBattle(); + // Get entry id + int leaveEntryId = GameConstants.CHALLENGE_ENTRANCE; + if (session.getPlayer().getChallengeInstance() != null) { + if (session.getPlayer().getChallengeInstance().getExcel().isStory()) { + leaveEntryId = GameConstants.CHALLENGE_STORY_ENTRANCE; + } + } + // Leave scene session.getPlayer().getLineupManager().setCurrentExtraLineup(0, false); - session.getPlayer().enterScene(GameConstants.CHALLENGE_ENTRANCE, 0, true); + session.getPlayer().enterScene(leaveEntryId, 0, true); } // Send rsp packet to keep the client happy diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerStartChallengeCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerStartChallengeCsReq.java index 1a774ea..f1a13dc 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerStartChallengeCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerStartChallengeCsReq.java @@ -12,8 +12,9 @@ public class HandlerStartChallengeCsReq extends PacketHandler { @Override public void handle(GameSession session, byte[] data) throws Exception { var req = StartChallengeCsReq.parseFrom(data); + var storyBuffs = req.getMutableStoryInfo().getMutableStoryBuffInfo(); - session.getPlayer().getChallengeManager().startChallenge(req.getChallengeId()); + session.getPlayer().getChallengeManager().startChallenge(req.getChallengeId(), storyBuffs); } }