Basic implementation of challenge stories

This commit is contained in:
Melledy
2024-01-01 07:29:20 -08:00
parent 6da87a4a1f
commit 90456b2a91
15 changed files with 1513 additions and 12 deletions

View File

@@ -38,6 +38,11 @@ public final class ChallengeInfoOuterClass {
*/
private int extraLineupType;
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</code>
*/
private final ChallengeStoryInfoOuterClass.ChallengeStoryInfo storyInfo = ChallengeStoryInfoOuterClass.ChallengeStoryInfo.newInstance();
private ChallengeInfo() {
}
@@ -246,6 +251,63 @@ public final class ChallengeInfoOuterClass {
return this;
}
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</code>
* @return whether the storyInfo field is set
*/
public boolean hasStoryInfo() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</code>
* @return this
*/
public ChallengeInfo clearStoryInfo() {
bitField0_ &= ~0x00000010;
storyInfo.clear();
return this;
}
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</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 #getMutableStoryInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public ChallengeStoryInfoOuterClass.ChallengeStoryInfo getStoryInfo() {
return storyInfo;
}
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</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 ChallengeStoryInfoOuterClass.ChallengeStoryInfo getMutableStoryInfo() {
bitField0_ |= 0x00000010;
return storyInfo;
}
/**
* <code>optional .ChallengeStoryInfo story_info = 13;</code>
* @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");
}
}
}

View File

@@ -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<ChallengeStoryBuffInfo> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated uint32 buff_list = 5;</code>
*/
private final RepeatedInt buffList = RepeatedInt.newEmptyInstance();
private ChallengeStoryBuffInfo() {
}
/**
* @return a new empty instance of {@code ChallengeStoryBuffInfo}
*/
public static ChallengeStoryBuffInfo newInstance() {
return new ChallengeStoryBuffInfo();
}
/**
* <code>repeated uint32 buff_list = 5;</code>
* @return whether the buffList field is set
*/
public boolean hasBuffList() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated uint32 buff_list = 5;</code>
* @return this
*/
public ChallengeStoryBuffInfo clearBuffList() {
bitField0_ &= ~0x00000001;
buffList.clear();
return this;
}
/**
* <code>repeated uint32 buff_list = 5;</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 #getMutableBuffList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getBuffList() {
return buffList;
}
/**
* <code>repeated uint32 buff_list = 5;</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 RepeatedInt getMutableBuffList() {
bitField0_ |= 0x00000001;
return buffList;
}
/**
* <code>repeated uint32 buff_list = 5;</code>
* @param value the buffList to add
* @return this
*/
public ChallengeStoryBuffInfo addBuffList(final int value) {
bitField0_ |= 0x00000001;
buffList.add(value);
return this;
}
/**
* <code>repeated uint32 buff_list = 5;</code>
* @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<ChallengeStoryBuffInfo> getFactory() {
return ChallengeStoryBuffInfoFactory.INSTANCE;
}
private enum ChallengeStoryBuffInfoFactory implements MessageFactory<ChallengeStoryBuffInfo> {
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");
}
}
}

View File

@@ -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<ChallengeStoryInfo> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</code>
*/
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();
}
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</code>
* @return whether the curStoryBuffs field is set
*/
public boolean hasCurStoryBuffs() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</code>
* @return this
*/
public ChallengeStoryInfo clearCurStoryBuffs() {
bitField0_ &= ~0x00000001;
curStoryBuffs.clear();
return this;
}
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</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 #getMutableCurStoryBuffs()} if you want to modify it.
*
* @return internal storage object for reading
*/
public ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo getCurStoryBuffs() {
return curStoryBuffs;
}
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</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 ChallengeStoryBuffInfoOuterClass.ChallengeStoryBuffInfo getMutableCurStoryBuffs() {
bitField0_ |= 0x00000001;
return curStoryBuffs;
}
/**
* <code>optional .ChallengeStoryBuffInfo cur_story_buffs = 6;</code>
* @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<ChallengeStoryInfo> getFactory() {
return ChallengeStoryInfoFactory.INSTANCE;
}
private enum ChallengeStoryInfoFactory implements MessageFactory<ChallengeStoryInfo> {
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");
}
}
}

View File

@@ -23,6 +23,11 @@ public final class StartChallengeCsReqOuterClass {
*/
private int challengeId;
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</code>
*/
private final StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo storyInfo = StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo.newInstance();
private StartChallengeCsReq() {
}
@@ -70,12 +75,71 @@ public final class StartChallengeCsReqOuterClass {
return this;
}
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</code>
* @return whether the storyInfo field is set
*/
public boolean hasStoryInfo() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</code>
* @return this
*/
public StartChallengeCsReq clearStoryInfo() {
bitField0_ &= ~0x00000002;
storyInfo.clear();
return this;
}
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</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 #getMutableStoryInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo getStoryInfo() {
return storyInfo;
}
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</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 StartChallengeStoryInfoOuterClass.StartChallengeStoryInfo getMutableStoryInfo() {
bitField0_ |= 0x00000002;
return storyInfo;
}
/**
* <code>optional .StartChallengeStoryInfo story_info = 9;</code>
* @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");
}
}
}

View File

@@ -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<StartChallengeStoryBuffInfo> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 story_buff_one = 12;</code>
*/
private int storyBuffOne;
/**
* <code>optional uint32 story_buff_two = 13;</code>
*/
private int storyBuffTwo;
private StartChallengeStoryBuffInfo() {
}
/**
* @return a new empty instance of {@code StartChallengeStoryBuffInfo}
*/
public static StartChallengeStoryBuffInfo newInstance() {
return new StartChallengeStoryBuffInfo();
}
/**
* <code>optional uint32 story_buff_one = 12;</code>
* @return whether the storyBuffOne field is set
*/
public boolean hasStoryBuffOne() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 story_buff_one = 12;</code>
* @return this
*/
public StartChallengeStoryBuffInfo clearStoryBuffOne() {
bitField0_ &= ~0x00000001;
storyBuffOne = 0;
return this;
}
/**
* <code>optional uint32 story_buff_one = 12;</code>
* @return the storyBuffOne
*/
public int getStoryBuffOne() {
return storyBuffOne;
}
/**
* <code>optional uint32 story_buff_one = 12;</code>
* @param value the storyBuffOne to set
* @return this
*/
public StartChallengeStoryBuffInfo setStoryBuffOne(final int value) {
bitField0_ |= 0x00000001;
storyBuffOne = value;
return this;
}
/**
* <code>optional uint32 story_buff_two = 13;</code>
* @return whether the storyBuffTwo field is set
*/
public boolean hasStoryBuffTwo() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 story_buff_two = 13;</code>
* @return this
*/
public StartChallengeStoryBuffInfo clearStoryBuffTwo() {
bitField0_ &= ~0x00000002;
storyBuffTwo = 0;
return this;
}
/**
* <code>optional uint32 story_buff_two = 13;</code>
* @return the storyBuffTwo
*/
public int getStoryBuffTwo() {
return storyBuffTwo;
}
/**
* <code>optional uint32 story_buff_two = 13;</code>
* @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<StartChallengeStoryBuffInfo> getFactory() {
return StartChallengeStoryBuffInfoFactory.INSTANCE;
}
private enum StartChallengeStoryBuffInfoFactory implements MessageFactory<StartChallengeStoryBuffInfo> {
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");
}
}
}

View File

@@ -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<StartChallengeStoryInfo> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</code>
*/
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();
}
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</code>
* @return whether the storyBuffInfo field is set
*/
public boolean hasStoryBuffInfo() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</code>
* @return this
*/
public StartChallengeStoryInfo clearStoryBuffInfo() {
bitField0_ &= ~0x00000001;
storyBuffInfo.clear();
return this;
}
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</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 #getMutableStoryBuffInfo()} if you want to modify it.
*
* @return internal storage object for reading
*/
public StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo getStoryBuffInfo() {
return storyBuffInfo;
}
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</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 StartChallengeStoryBuffInfoOuterClass.StartChallengeStoryBuffInfo getMutableStoryBuffInfo(
) {
bitField0_ |= 0x00000001;
return storyBuffInfo;
}
/**
* <code>optional .StartChallengeStoryBuffInfo story_buff_info = 1;</code>
* @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<StartChallengeStoryInfo> getFactory() {
return StartChallengeStoryInfoFactory.INSTANCE;
}
private enum StartChallengeStoryInfoFactory implements MessageFactory<StartChallengeStoryInfo> {
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");
}
}
}

View File

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

View File

@@ -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<ChallengeMonsterInfo> challengeMonsters1;
private transient Int2ObjectMap<ChallengeMonsterInfo> 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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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

View File

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