From b9613cae8bcab874feb9dbb74eab2ddc8845e4f0 Mon Sep 17 00:00:00 2001 From: Melledy <121644117+Melledy@users.noreply.github.com> Date: Mon, 8 Jan 2024 04:32:54 -0800 Subject: [PATCH] Fix pure fiction score counter --- README.md | 1 + .../proto/BattleEndReasonOuterClass.java | 132 +++++ .../proto/BattleStatisticsOuterClass.java | 170 +++++-- .../proto/BattleTargetListOuterClass.java | 295 +++++++++++ .../proto/BattleTargetOuterClass.java | 418 ++++++++++++++++ .../proto/ChallengeInfoOuterClass.java | 209 +++++++- .../lunarcore/proto/ChallengeOuterClass.java | 205 +++++++- .../ChallengeSettleNotifyOuterClass.java | 222 +++++++-- .../proto/SceneBattleInfoOuterClass.java | 463 +++++++++++++++++- .../data/excel/ChallengeStoryExtraExcel.java | 2 + .../emu/lunarcore/game/battle/Battle.java | 39 ++ .../game/challenge/ChallengeHistory.java | 6 + .../game/challenge/ChallengeInstance.java | 100 +++- .../game/challenge/ChallengeManager.java | 3 +- .../send/PacketChallengeSettleNotify.java | 2 + 15 files changed, 2136 insertions(+), 131 deletions(-) create mode 100644 src/generated/main/emu/lunarcore/proto/BattleEndReasonOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/BattleTargetListOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/BattleTargetOuterClass.java diff --git a/README.md b/README.md index b32aee0..b58428d 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ - Mail system - Friend system (Assists are not working yet) - Forgotten hall +- Pure Fiction - ~~Simulated universe (Runs can be finished, but many features are missing)~~ # Running the server and client diff --git a/src/generated/main/emu/lunarcore/proto/BattleEndReasonOuterClass.java b/src/generated/main/emu/lunarcore/proto/BattleEndReasonOuterClass.java new file mode 100644 index 0000000..e5e673a --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/BattleEndReasonOuterClass.java @@ -0,0 +1,132 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import us.hebi.quickbuf.ProtoEnum; +import us.hebi.quickbuf.ProtoUtil; + +public final class BattleEndReasonOuterClass { + /** + * Protobuf enum {@code BattleEndReason} + */ + public enum BattleEndReason implements ProtoEnum { + /** + * BATTLE_END_REASON_NONE = 0; + */ + BATTLE_END_REASON_NONE("BATTLE_END_REASON_NONE", 0), + + /** + * BATTLE_END_REASON_ALL_DIE = 1; + */ + BATTLE_END_REASON_ALL_DIE("BATTLE_END_REASON_ALL_DIE", 1), + + /** + * BATTLE_END_REASON_TURN_LIMIT = 2; + */ + BATTLE_END_REASON_TURN_LIMIT("BATTLE_END_REASON_TURN_LIMIT", 2); + + /** + * BATTLE_END_REASON_NONE = 0; + */ + public static final int BATTLE_END_REASON_NONE_VALUE = 0; + + /** + * BATTLE_END_REASON_ALL_DIE = 1; + */ + public static final int BATTLE_END_REASON_ALL_DIE_VALUE = 1; + + /** + * BATTLE_END_REASON_TURN_LIMIT = 2; + */ + public static final int BATTLE_END_REASON_TURN_LIMIT_VALUE = 2; + + private final String name; + + private final int number; + + private BattleEndReason(String name, int number) { + this.name = name; + this.number = number; + } + + /** + * @return the string representation of enum entry + */ + @Override + public String getName() { + return name; + } + + /** + * @return the numeric wire value of this enum entry + */ + @Override + public int getNumber() { + return number; + } + + /** + * @return a converter that maps between this enum's numeric and text representations + */ + public static ProtoEnum.EnumConverter converter() { + return BattleEndReasonConverter.INSTANCE; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value, or null if unknown. + */ + public static BattleEndReason forNumber(int value) { + return BattleEndReasonConverter.INSTANCE.forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @param other Fallback value in case the value is not known. + * @return The enum associated with the given numeric wire value, or the fallback value if unknown. + */ + public static BattleEndReason forNumberOr(int number, BattleEndReason other) { + BattleEndReason value = forNumber(number); + return value == null ? other : value; + } + + enum BattleEndReasonConverter implements ProtoEnum.EnumConverter { + INSTANCE; + + private static final BattleEndReason[] lookup = new BattleEndReason[3]; + + static { + lookup[0] = BATTLE_END_REASON_NONE; + lookup[1] = BATTLE_END_REASON_ALL_DIE; + lookup[2] = BATTLE_END_REASON_TURN_LIMIT; + } + + @Override + public final BattleEndReason forNumber(final int value) { + if (value >= 0 && value < lookup.length) { + return lookup[value]; + } + return null; + } + + @Override + public final BattleEndReason forName(final CharSequence value) { + if (value.length() == 22) { + if (ProtoUtil.isEqual("BATTLE_END_REASON_NONE", value)) { + return BATTLE_END_REASON_NONE; + } + } + if (value.length() == 25) { + if (ProtoUtil.isEqual("BATTLE_END_REASON_ALL_DIE", value)) { + return BATTLE_END_REASON_ALL_DIE; + } + } + if (value.length() == 28) { + if (ProtoUtil.isEqual("BATTLE_END_REASON_TURN_LIMIT", value)) { + return BATTLE_END_REASON_TURN_LIMIT; + } + } + return null; + } + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/BattleStatisticsOuterClass.java b/src/generated/main/emu/lunarcore/proto/BattleStatisticsOuterClass.java index 4dff76c..162e010 100644 --- a/src/generated/main/emu/lunarcore/proto/BattleStatisticsOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/BattleStatisticsOuterClass.java @@ -76,6 +76,11 @@ public final class BattleStatisticsOuterClass { */ private int challengeScore; + /** + * optional .BattleEndReason end_reason = 19; + */ + private int endReason; + /** * repeated uint32 avatar_id_list = 3; */ @@ -487,12 +492,74 @@ public final class BattleStatisticsOuterClass { return this; } + /** + * optional .BattleEndReason end_reason = 19; + * @return whether the endReason field is set + */ + public boolean hasEndReason() { + return (bitField0_ & 0x00000400) != 0; + } + + /** + * optional .BattleEndReason end_reason = 19; + * @return this + */ + public BattleStatistics clearEndReason() { + bitField0_ &= ~0x00000400; + endReason = 0; + return this; + } + + /** + * optional .BattleEndReason end_reason = 19; + * @return the endReason + */ + public BattleEndReasonOuterClass.BattleEndReason getEndReason() { + return BattleEndReasonOuterClass.BattleEndReason.forNumber(endReason); + } + + /** + * Gets the value of the internal enum store. The result is + * equivalent to {@link BattleStatistics#getEndReason()}.getNumber(). + * + * @return numeric wire representation + */ + public int getEndReasonValue() { + return endReason; + } + + /** + * Sets the value of the internal enum store. This does not + * do any validity checks, so be sure to use appropriate value + * constants from {@link BattleEndReasonOuterClass.BattleEndReason}. Setting an invalid value + * can cause {@link BattleStatistics#getEndReason()} to return null + * + * @param value the numeric wire value to set + * @return this + */ + public BattleStatistics setEndReasonValue(final int value) { + bitField0_ |= 0x00000400; + endReason = value; + return this; + } + + /** + * optional .BattleEndReason end_reason = 19; + * @param value the endReason to set + * @return this + */ + public BattleStatistics setEndReason(final BattleEndReasonOuterClass.BattleEndReason value) { + bitField0_ |= 0x00000400; + endReason = value.getNumber(); + return this; + } + /** * repeated uint32 avatar_id_list = 3; * @return whether the avatarIdList field is set */ public boolean hasAvatarIdList() { - return (bitField0_ & 0x00000400) != 0; + return (bitField0_ & 0x00000800) != 0; } /** @@ -500,7 +567,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics clearAvatarIdList() { - bitField0_ &= ~0x00000400; + bitField0_ &= ~0x00000800; avatarIdList.clear(); return this; } @@ -529,7 +596,7 @@ public final class BattleStatisticsOuterClass { * @return internal storage object for modifications */ public RepeatedInt getMutableAvatarIdList() { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; return avatarIdList; } @@ -539,7 +606,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics addAvatarIdList(final int value) { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; avatarIdList.add(value); return this; } @@ -550,7 +617,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics addAllAvatarIdList(final int... values) { - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; avatarIdList.addAll(values); return this; } @@ -560,7 +627,7 @@ public final class BattleStatisticsOuterClass { * @return whether the battleAvatarList field is set */ public boolean hasBattleAvatarList() { - return (bitField0_ & 0x00000800) != 0; + return (bitField0_ & 0x00001000) != 0; } /** @@ -568,7 +635,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics clearBattleAvatarList() { - bitField0_ &= ~0x00000800; + bitField0_ &= ~0x00001000; battleAvatarList.clear(); return this; } @@ -598,7 +665,7 @@ public final class BattleStatisticsOuterClass { */ public RepeatedMessage getMutableBattleAvatarList( ) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; return battleAvatarList; } @@ -609,7 +676,7 @@ public final class BattleStatisticsOuterClass { */ public BattleStatistics addBattleAvatarList( final AvatarBattleInfoOuterClass.AvatarBattleInfo value) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; battleAvatarList.add(value); return this; } @@ -621,7 +688,7 @@ public final class BattleStatisticsOuterClass { */ public BattleStatistics addAllBattleAvatarList( final AvatarBattleInfoOuterClass.AvatarBattleInfo... values) { - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; battleAvatarList.addAll(values); return this; } @@ -631,7 +698,7 @@ public final class BattleStatisticsOuterClass { * @return whether the customValues field is set */ public boolean hasCustomValues() { - return (bitField0_ & 0x00001000) != 0; + return (bitField0_ & 0x00002000) != 0; } /** @@ -639,7 +706,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics clearCustomValues() { - bitField0_ &= ~0x00001000; + bitField0_ &= ~0x00002000; customValues.clear(); return this; } @@ -668,7 +735,7 @@ public final class BattleStatisticsOuterClass { * @return internal storage object for modifications */ public RepeatedMessage getMutableCustomValues() { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; return customValues; } @@ -678,7 +745,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics addCustomValues(final CustomValuesEntry value) { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; customValues.add(value); return this; } @@ -689,7 +756,7 @@ public final class BattleStatisticsOuterClass { * @return this */ public BattleStatistics addAllCustomValues(final CustomValuesEntry... values) { - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; customValues.addAll(values); return this; } @@ -709,6 +776,7 @@ public final class BattleStatisticsOuterClass { avatarBattleTurns = other.avatarBattleTurns; monsterBattleTurns = other.monsterBattleTurns; challengeScore = other.challengeScore; + endReason = other.endReason; avatarIdList.copyFrom(other.avatarIdList); battleAvatarList.copyFrom(other.battleAvatarList); customValues.copyFrom(other.customValues); @@ -752,6 +820,9 @@ public final class BattleStatisticsOuterClass { if (other.hasChallengeScore()) { setChallengeScore(other.challengeScore); } + if (other.hasEndReason()) { + setEndReasonValue(other.endReason); + } if (other.hasAvatarIdList()) { getMutableAvatarIdList().addAll(other.avatarIdList); } @@ -781,6 +852,7 @@ public final class BattleStatisticsOuterClass { avatarBattleTurns = 0; monsterBattleTurns = 0; challengeScore = 0; + endReason = 0; avatarIdList.clear(); battleAvatarList.clear(); customValues.clear(); @@ -820,6 +892,7 @@ public final class BattleStatisticsOuterClass { && (!hasAvatarBattleTurns() || avatarBattleTurns == other.avatarBattleTurns) && (!hasMonsterBattleTurns() || monsterBattleTurns == other.monsterBattleTurns) && (!hasChallengeScore() || challengeScore == other.challengeScore) + && (!hasEndReason() || endReason == other.endReason) && (!hasAvatarIdList() || avatarIdList.equals(other.avatarIdList)) && (!hasBattleAvatarList() || battleAvatarList.equals(other.battleAvatarList)) && (!hasCustomValues() || customValues.equals(other.customValues)); @@ -868,18 +941,22 @@ public final class BattleStatisticsOuterClass { output.writeUInt32NoTag(challengeScore); } if ((bitField0_ & 0x00000400) != 0) { + output.writeRawLittleEndian16((short) 408); + output.writeEnumNoTag(endReason); + } + if ((bitField0_ & 0x00000800) != 0) { for (int i = 0; i < avatarIdList.length(); i++) { output.writeRawByte((byte) 24); output.writeUInt32NoTag(avatarIdList.array()[i]); } } - if ((bitField0_ & 0x00000800) != 0) { + if ((bitField0_ & 0x00001000) != 0) { for (int i = 0; i < battleAvatarList.length(); i++) { output.writeRawByte((byte) 58); output.writeMessageNoTag(battleAvatarList.get(i)); } } - if ((bitField0_ & 0x00001000) != 0) { + if ((bitField0_ & 0x00002000) != 0) { for (int i = 0; i < customValues.length(); i++) { output.writeRawByte((byte) 106); output.writeMessageNoTag(customValues.get(i)); @@ -921,12 +998,15 @@ public final class BattleStatisticsOuterClass { size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeScore); } if ((bitField0_ & 0x00000400) != 0) { - size += (1 * avatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(avatarIdList); + size += 2 + ProtoSink.computeEnumSizeNoTag(endReason); } if ((bitField0_ & 0x00000800) != 0) { - size += (1 * battleAvatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleAvatarList); + size += (1 * avatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(avatarIdList); } if ((bitField0_ & 0x00001000) != 0) { + size += (1 * battleAvatarList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleAvatarList); + } + if ((bitField0_ & 0x00002000) != 0) { size += (1 * customValues.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(customValues); } return size; @@ -1025,6 +1105,18 @@ public final class BattleStatisticsOuterClass { challengeScore = input.readUInt32(); bitField0_ |= 0x00000200; tag = input.readTag(); + if (tag != 152) { + break; + } + } + case 152: { + // endReason + final int value = input.readInt32(); + if (BattleEndReasonOuterClass.BattleEndReason.forNumber(value) != null) { + endReason = value; + bitField0_ |= 0x00000400; + } + tag = input.readTag(); if (tag != 26) { break; } @@ -1032,7 +1124,7 @@ public final class BattleStatisticsOuterClass { case 26: { // avatarIdList [packed=true] input.readPackedUInt32(avatarIdList, tag); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; tag = input.readTag(); if (tag != 58) { break; @@ -1041,7 +1133,7 @@ public final class BattleStatisticsOuterClass { case 58: { // battleAvatarList tag = input.readRepeatedMessage(battleAvatarList, tag); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; if (tag != 106) { break; } @@ -1049,7 +1141,7 @@ public final class BattleStatisticsOuterClass { case 106: { // customValues tag = input.readRepeatedMessage(customValues, tag); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; if (tag != 0) { break; } @@ -1067,7 +1159,7 @@ public final class BattleStatisticsOuterClass { case 24: { // avatarIdList [packed=false] tag = input.readRepeatedUInt32(avatarIdList, tag); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; break; } } @@ -1108,12 +1200,15 @@ public final class BattleStatisticsOuterClass { output.writeUInt32(FieldNames.challengeScore, challengeScore); } if ((bitField0_ & 0x00000400) != 0) { - output.writeRepeatedUInt32(FieldNames.avatarIdList, avatarIdList); + output.writeEnum(FieldNames.endReason, endReason, BattleEndReasonOuterClass.BattleEndReason.converter()); } if ((bitField0_ & 0x00000800) != 0) { - output.writeRepeatedMessage(FieldNames.battleAvatarList, battleAvatarList); + output.writeRepeatedUInt32(FieldNames.avatarIdList, avatarIdList); } if ((bitField0_ & 0x00001000) != 0) { + output.writeRepeatedMessage(FieldNames.battleAvatarList, battleAvatarList); + } + if ((bitField0_ & 0x00002000) != 0) { output.writeRepeatedMessage(FieldNames.customValues, customValues); } output.endObject(); @@ -1246,12 +1341,29 @@ public final class BattleStatisticsOuterClass { } break; } + case 1566226175: + case 336357928: { + if (input.isAtField(FieldNames.endReason)) { + if (!input.trySkipNullValue()) { + final BattleEndReasonOuterClass.BattleEndReason value = input.readEnum(BattleEndReasonOuterClass.BattleEndReason.converter()); + if (value != null) { + endReason = value.getNumber(); + bitField0_ |= 0x00000400; + } else { + input.skipUnknownEnumValue(); + } + } + } else { + input.skipUnknownField(); + } + break; + } case -1214270702: case 1824281692: { if (input.isAtField(FieldNames.avatarIdList)) { if (!input.trySkipNullValue()) { input.readRepeatedUInt32(avatarIdList); - bitField0_ |= 0x00000400; + bitField0_ |= 0x00000800; } } else { input.skipUnknownField(); @@ -1263,7 +1375,7 @@ public final class BattleStatisticsOuterClass { if (input.isAtField(FieldNames.battleAvatarList)) { if (!input.trySkipNullValue()) { input.readRepeatedMessage(battleAvatarList); - bitField0_ |= 0x00000800; + bitField0_ |= 0x00001000; } } else { input.skipUnknownField(); @@ -1275,7 +1387,7 @@ public final class BattleStatisticsOuterClass { if (input.isAtField(FieldNames.customValues)) { if (!input.trySkipNullValue()) { input.readRepeatedMessage(customValues); - bitField0_ |= 0x00001000; + bitField0_ |= 0x00002000; } } else { input.skipUnknownField(); @@ -1709,6 +1821,8 @@ public final class BattleStatisticsOuterClass { static final FieldName challengeScore = FieldName.forField("challengeScore", "challenge_score"); + static final FieldName endReason = FieldName.forField("endReason", "end_reason"); + static final FieldName avatarIdList = FieldName.forField("avatarIdList", "avatar_id_list"); static final FieldName battleAvatarList = FieldName.forField("battleAvatarList", "battle_avatar_list"); diff --git a/src/generated/main/emu/lunarcore/proto/BattleTargetListOuterClass.java b/src/generated/main/emu/lunarcore/proto/BattleTargetListOuterClass.java new file mode 100644 index 0000000..1baa2b0 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/BattleTargetListOuterClass.java @@ -0,0 +1,295 @@ +// 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.RepeatedMessage; + +public final class BattleTargetListOuterClass { + /** + * Protobuf type {@code BattleTargetList} + */ + public static final class BattleTargetList extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated .BattleTarget battle_target_list = 1; + */ + private final RepeatedMessage battleTargetList = RepeatedMessage.newEmptyInstance(BattleTargetOuterClass.BattleTarget.getFactory()); + + private BattleTargetList() { + } + + /** + * @return a new empty instance of {@code BattleTargetList} + */ + public static BattleTargetList newInstance() { + return new BattleTargetList(); + } + + /** + * repeated .BattleTarget battle_target_list = 1; + * @return whether the battleTargetList field is set + */ + public boolean hasBattleTargetList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated .BattleTarget battle_target_list = 1; + * @return this + */ + public BattleTargetList clearBattleTargetList() { + bitField0_ &= ~0x00000001; + battleTargetList.clear(); + return this; + } + + /** + * repeated .BattleTarget battle_target_list = 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 #getMutableBattleTargetList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getBattleTargetList() { + return battleTargetList; + } + + /** + * repeated .BattleTarget battle_target_list = 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 RepeatedMessage getMutableBattleTargetList() { + bitField0_ |= 0x00000001; + return battleTargetList; + } + + /** + * repeated .BattleTarget battle_target_list = 1; + * @param value the battleTargetList to add + * @return this + */ + public BattleTargetList addBattleTargetList(final BattleTargetOuterClass.BattleTarget value) { + bitField0_ |= 0x00000001; + battleTargetList.add(value); + return this; + } + + /** + * repeated .BattleTarget battle_target_list = 1; + * @param values the battleTargetList to add + * @return this + */ + public BattleTargetList addAllBattleTargetList( + final BattleTargetOuterClass.BattleTarget... values) { + bitField0_ |= 0x00000001; + battleTargetList.addAll(values); + return this; + } + + @Override + public BattleTargetList copyFrom(final BattleTargetList other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + battleTargetList.copyFrom(other.battleTargetList); + } + return this; + } + + @Override + public BattleTargetList mergeFrom(final BattleTargetList other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasBattleTargetList()) { + getMutableBattleTargetList().addAll(other.battleTargetList); + } + return this; + } + + @Override + public BattleTargetList clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + battleTargetList.clear(); + return this; + } + + @Override + public BattleTargetList clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + battleTargetList.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof BattleTargetList)) { + return false; + } + BattleTargetList other = (BattleTargetList) o; + return bitField0_ == other.bitField0_ + && (!hasBattleTargetList() || battleTargetList.equals(other.battleTargetList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < battleTargetList.length(); i++) { + output.writeRawByte((byte) 10); + output.writeMessageNoTag(battleTargetList.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * battleTargetList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleTargetList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public BattleTargetList mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // battleTargetList + tag = input.readRepeatedMessage(battleTargetList, tag); + bitField0_ |= 0x00000001; + 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.writeRepeatedMessage(FieldNames.battleTargetList, battleTargetList); + } + output.endObject(); + } + + @Override + public BattleTargetList mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1658064039: + case 2141562245: { + if (input.isAtField(FieldNames.battleTargetList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(battleTargetList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public BattleTargetList clone() { + return new BattleTargetList().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static BattleTargetList parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new BattleTargetList(), data).checkInitialized(); + } + + public static BattleTargetList parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTargetList(), input).checkInitialized(); + } + + public static BattleTargetList parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTargetList(), input).checkInitialized(); + } + + /** + * @return factory for creating BattleTargetList messages + */ + public static MessageFactory getFactory() { + return BattleTargetListFactory.INSTANCE; + } + + private enum BattleTargetListFactory implements MessageFactory { + INSTANCE; + + @Override + public BattleTargetList create() { + return BattleTargetList.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName battleTargetList = FieldName.forField("battleTargetList", "battle_target_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/BattleTargetOuterClass.java b/src/generated/main/emu/lunarcore/proto/BattleTargetOuterClass.java new file mode 100644 index 0000000..965eb7d --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/BattleTargetOuterClass.java @@ -0,0 +1,418 @@ +// 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 BattleTargetOuterClass { + /** + * Protobuf type {@code BattleTarget} + */ + public static final class BattleTarget extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 id = 1; + */ + private int id; + + /** + * optional uint32 progress = 2; + */ + private int progress; + + /** + * optional uint32 CDLKMKKOGLL = 3; + */ + private int cDLKMKKOGLL; + + private BattleTarget() { + } + + /** + * @return a new empty instance of {@code BattleTarget} + */ + public static BattleTarget newInstance() { + return new BattleTarget(); + } + + /** + * optional uint32 id = 1; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 id = 1; + * @return this + */ + public BattleTarget clearId() { + bitField0_ &= ~0x00000001; + id = 0; + return this; + } + + /** + * optional uint32 id = 1; + * @return the id + */ + public int getId() { + return id; + } + + /** + * optional uint32 id = 1; + * @param value the id to set + * @return this + */ + public BattleTarget setId(final int value) { + bitField0_ |= 0x00000001; + id = value; + return this; + } + + /** + * optional uint32 progress = 2; + * @return whether the progress field is set + */ + public boolean hasProgress() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 progress = 2; + * @return this + */ + public BattleTarget clearProgress() { + bitField0_ &= ~0x00000002; + progress = 0; + return this; + } + + /** + * optional uint32 progress = 2; + * @return the progress + */ + public int getProgress() { + return progress; + } + + /** + * optional uint32 progress = 2; + * @param value the progress to set + * @return this + */ + public BattleTarget setProgress(final int value) { + bitField0_ |= 0x00000002; + progress = value; + return this; + } + + /** + * optional uint32 CDLKMKKOGLL = 3; + * @return whether the cDLKMKKOGLL field is set + */ + public boolean hasCDLKMKKOGLL() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 CDLKMKKOGLL = 3; + * @return this + */ + public BattleTarget clearCDLKMKKOGLL() { + bitField0_ &= ~0x00000004; + cDLKMKKOGLL = 0; + return this; + } + + /** + * optional uint32 CDLKMKKOGLL = 3; + * @return the cDLKMKKOGLL + */ + public int getCDLKMKKOGLL() { + return cDLKMKKOGLL; + } + + /** + * optional uint32 CDLKMKKOGLL = 3; + * @param value the cDLKMKKOGLL to set + * @return this + */ + public BattleTarget setCDLKMKKOGLL(final int value) { + bitField0_ |= 0x00000004; + cDLKMKKOGLL = value; + return this; + } + + @Override + public BattleTarget copyFrom(final BattleTarget other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + id = other.id; + progress = other.progress; + cDLKMKKOGLL = other.cDLKMKKOGLL; + } + return this; + } + + @Override + public BattleTarget mergeFrom(final BattleTarget other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasId()) { + setId(other.id); + } + if (other.hasProgress()) { + setProgress(other.progress); + } + if (other.hasCDLKMKKOGLL()) { + setCDLKMKKOGLL(other.cDLKMKKOGLL); + } + return this; + } + + @Override + public BattleTarget clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id = 0; + progress = 0; + cDLKMKKOGLL = 0; + return this; + } + + @Override + public BattleTarget 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 BattleTarget)) { + return false; + } + BattleTarget other = (BattleTarget) o; + return bitField0_ == other.bitField0_ + && (!hasId() || id == other.id) + && (!hasProgress() || progress == other.progress) + && (!hasCDLKMKKOGLL() || cDLKMKKOGLL == other.cDLKMKKOGLL); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt32NoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 16); + output.writeUInt32NoTag(progress); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 24); + output.writeUInt32NoTag(cDLKMKKOGLL); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(id); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(progress); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(cDLKMKKOGLL); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public BattleTarget mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 8: { + // id + id = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 16) { + break; + } + } + case 16: { + // progress + progress = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 24) { + break; + } + } + case 24: { + // cDLKMKKOGLL + cDLKMKKOGLL = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.id, id); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.progress, progress); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.cDLKMKKOGLL, cDLKMKKOGLL); + } + output.endObject(); + } + + @Override + public BattleTarget mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1001078227: { + if (input.isAtField(FieldNames.progress)) { + if (!input.trySkipNullValue()) { + progress = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1138288731: { + if (input.isAtField(FieldNames.cDLKMKKOGLL)) { + if (!input.trySkipNullValue()) { + cDLKMKKOGLL = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public BattleTarget clone() { + return new BattleTarget().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static BattleTarget parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new BattleTarget(), data).checkInitialized(); + } + + public static BattleTarget parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTarget(), input).checkInitialized(); + } + + public static BattleTarget parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTarget(), input).checkInitialized(); + } + + /** + * @return factory for creating BattleTarget messages + */ + public static MessageFactory getFactory() { + return BattleTargetFactory.INSTANCE; + } + + private enum BattleTargetFactory implements MessageFactory { + INSTANCE; + + @Override + public BattleTarget create() { + return BattleTarget.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName id = FieldName.forField("id"); + + static final FieldName progress = FieldName.forField("progress"); + + static final FieldName cDLKMKKOGLL = FieldName.forField("CDLKMKKOGLL"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java index fc43dc7..6c79e65 100644 --- a/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/ChallengeInfoOuterClass.java @@ -28,6 +28,16 @@ public final class ChallengeInfoOuterClass { */ private int roundCount; + /** + * optional uint32 score = 8; + */ + private int score; + + /** + * optional uint32 score_two = 10; + */ + private int scoreTwo; + /** * optional .ChallengeStatus status = 6; */ @@ -127,12 +137,86 @@ public final class ChallengeInfoOuterClass { return this; } + /** + * optional uint32 score = 8; + * @return whether the score field is set + */ + public boolean hasScore() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 score = 8; + * @return this + */ + public ChallengeInfo clearScore() { + bitField0_ &= ~0x00000004; + score = 0; + return this; + } + + /** + * optional uint32 score = 8; + * @return the score + */ + public int getScore() { + return score; + } + + /** + * optional uint32 score = 8; + * @param value the score to set + * @return this + */ + public ChallengeInfo setScore(final int value) { + bitField0_ |= 0x00000004; + score = value; + return this; + } + + /** + * optional uint32 score_two = 10; + * @return whether the scoreTwo field is set + */ + public boolean hasScoreTwo() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional uint32 score_two = 10; + * @return this + */ + public ChallengeInfo clearScoreTwo() { + bitField0_ &= ~0x00000008; + scoreTwo = 0; + return this; + } + + /** + * optional uint32 score_two = 10; + * @return the scoreTwo + */ + public int getScoreTwo() { + return scoreTwo; + } + + /** + * optional uint32 score_two = 10; + * @param value the scoreTwo to set + * @return this + */ + public ChallengeInfo setScoreTwo(final int value) { + bitField0_ |= 0x00000008; + scoreTwo = value; + return this; + } + /** * optional .ChallengeStatus status = 6; * @return whether the status field is set */ public boolean hasStatus() { - return (bitField0_ & 0x00000004) != 0; + return (bitField0_ & 0x00000010) != 0; } /** @@ -140,7 +224,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo clearStatus() { - bitField0_ &= ~0x00000004; + bitField0_ &= ~0x00000010; status = 0; return this; } @@ -173,7 +257,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo setStatusValue(final int value) { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; status = value; return this; } @@ -184,7 +268,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo setStatus(final ChallengeStatusOuterClass.ChallengeStatus value) { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; status = value.getNumber(); return this; } @@ -194,7 +278,7 @@ public final class ChallengeInfoOuterClass { * @return whether the extraLineupType field is set */ public boolean hasExtraLineupType() { - return (bitField0_ & 0x00000008) != 0; + return (bitField0_ & 0x00000020) != 0; } /** @@ -202,7 +286,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo clearExtraLineupType() { - bitField0_ &= ~0x00000008; + bitField0_ &= ~0x00000020; extraLineupType = 0; return this; } @@ -235,7 +319,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo setExtraLineupTypeValue(final int value) { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; extraLineupType = value; return this; } @@ -246,7 +330,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo setExtraLineupType(final ExtraLineupTypeOuterClass.ExtraLineupType value) { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; extraLineupType = value.getNumber(); return this; } @@ -256,7 +340,7 @@ public final class ChallengeInfoOuterClass { * @return whether the storyInfo field is set */ public boolean hasStoryInfo() { - return (bitField0_ & 0x00000010) != 0; + return (bitField0_ & 0x00000040) != 0; } /** @@ -264,7 +348,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo clearStoryInfo() { - bitField0_ &= ~0x00000010; + bitField0_ &= ~0x00000040; storyInfo.clear(); return this; } @@ -293,7 +377,7 @@ public final class ChallengeInfoOuterClass { * @return internal storage object for modifications */ public ChallengeStoryInfoOuterClass.ChallengeStoryInfo getMutableStoryInfo() { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; return storyInfo; } @@ -303,7 +387,7 @@ public final class ChallengeInfoOuterClass { * @return this */ public ChallengeInfo setStoryInfo(final ChallengeStoryInfoOuterClass.ChallengeStoryInfo value) { - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; storyInfo.copyFrom(value); return this; } @@ -315,6 +399,8 @@ public final class ChallengeInfoOuterClass { bitField0_ = other.bitField0_; challengeId = other.challengeId; roundCount = other.roundCount; + score = other.score; + scoreTwo = other.scoreTwo; status = other.status; extraLineupType = other.extraLineupType; storyInfo.copyFrom(other.storyInfo); @@ -334,6 +420,12 @@ public final class ChallengeInfoOuterClass { if (other.hasRoundCount()) { setRoundCount(other.roundCount); } + if (other.hasScore()) { + setScore(other.score); + } + if (other.hasScoreTwo()) { + setScoreTwo(other.scoreTwo); + } if (other.hasStatus()) { setStatusValue(other.status); } @@ -355,6 +447,8 @@ public final class ChallengeInfoOuterClass { bitField0_ = 0; challengeId = 0; roundCount = 0; + score = 0; + scoreTwo = 0; status = 0; extraLineupType = 0; storyInfo.clear(); @@ -384,6 +478,8 @@ public final class ChallengeInfoOuterClass { return bitField0_ == other.bitField0_ && (!hasChallengeId() || challengeId == other.challengeId) && (!hasRoundCount() || roundCount == other.roundCount) + && (!hasScore() || score == other.score) + && (!hasScoreTwo() || scoreTwo == other.scoreTwo) && (!hasStatus() || status == other.status) && (!hasExtraLineupType() || extraLineupType == other.extraLineupType) && (!hasStoryInfo() || storyInfo.equals(other.storyInfo)); @@ -400,14 +496,22 @@ public final class ChallengeInfoOuterClass { output.writeUInt32NoTag(roundCount); } if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 64); + output.writeUInt32NoTag(score); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 80); + output.writeUInt32NoTag(scoreTwo); + } + if ((bitField0_ & 0x00000010) != 0) { output.writeRawByte((byte) 48); output.writeEnumNoTag(status); } - if ((bitField0_ & 0x00000008) != 0) { + if ((bitField0_ & 0x00000020) != 0) { output.writeRawByte((byte) 120); output.writeEnumNoTag(extraLineupType); } - if ((bitField0_ & 0x00000010) != 0) { + if ((bitField0_ & 0x00000040) != 0) { output.writeRawByte((byte) 106); output.writeMessageNoTag(storyInfo); } @@ -423,12 +527,18 @@ public final class ChallengeInfoOuterClass { size += 1 + ProtoSink.computeUInt32SizeNoTag(roundCount); } if ((bitField0_ & 0x00000004) != 0) { - size += 1 + ProtoSink.computeEnumSizeNoTag(status); + size += 1 + ProtoSink.computeUInt32SizeNoTag(score); } if ((bitField0_ & 0x00000008) != 0) { - size += 1 + ProtoSink.computeEnumSizeNoTag(extraLineupType); + size += 1 + ProtoSink.computeUInt32SizeNoTag(scoreTwo); } if ((bitField0_ & 0x00000010) != 0) { + size += 1 + ProtoSink.computeEnumSizeNoTag(status); + } + if ((bitField0_ & 0x00000020) != 0) { + size += 1 + ProtoSink.computeEnumSizeNoTag(extraLineupType); + } + if ((bitField0_ & 0x00000040) != 0) { size += 1 + ProtoSink.computeMessageSizeNoTag(storyInfo); } return size; @@ -455,6 +565,24 @@ public final class ChallengeInfoOuterClass { roundCount = input.readUInt32(); bitField0_ |= 0x00000002; tag = input.readTag(); + if (tag != 64) { + break; + } + } + case 64: { + // score + score = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 80) { + break; + } + } + case 80: { + // scoreTwo + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000008; + tag = input.readTag(); if (tag != 48) { break; } @@ -464,7 +592,7 @@ public final class ChallengeInfoOuterClass { final int value = input.readInt32(); if (ChallengeStatusOuterClass.ChallengeStatus.forNumber(value) != null) { status = value; - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; } tag = input.readTag(); if (tag != 120) { @@ -476,7 +604,7 @@ public final class ChallengeInfoOuterClass { final int value = input.readInt32(); if (ExtraLineupTypeOuterClass.ExtraLineupType.forNumber(value) != null) { extraLineupType = value; - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; } tag = input.readTag(); if (tag != 106) { @@ -486,7 +614,7 @@ public final class ChallengeInfoOuterClass { case 106: { // storyInfo input.readMessage(storyInfo); - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; tag = input.readTag(); if (tag != 0) { break; @@ -516,12 +644,18 @@ public final class ChallengeInfoOuterClass { output.writeUInt32(FieldNames.roundCount, roundCount); } if ((bitField0_ & 0x00000004) != 0) { - output.writeEnum(FieldNames.status, status, ChallengeStatusOuterClass.ChallengeStatus.converter()); + output.writeUInt32(FieldNames.score, score); } if ((bitField0_ & 0x00000008) != 0) { - output.writeEnum(FieldNames.extraLineupType, extraLineupType, ExtraLineupTypeOuterClass.ExtraLineupType.converter()); + output.writeUInt32(FieldNames.scoreTwo, scoreTwo); } if ((bitField0_ & 0x00000010) != 0) { + output.writeEnum(FieldNames.status, status, ChallengeStatusOuterClass.ChallengeStatus.converter()); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeEnum(FieldNames.extraLineupType, extraLineupType, ExtraLineupTypeOuterClass.ExtraLineupType.converter()); + } + if ((bitField0_ & 0x00000040) != 0) { output.writeMessage(FieldNames.storyInfo, storyInfo); } output.endObject(); @@ -558,13 +692,36 @@ public final class ChallengeInfoOuterClass { } break; } + case 109264530: { + if (input.isAtField(FieldNames.score)) { + if (!input.trySkipNullValue()) { + score = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case -485512614: + case 2129303327: { + if (input.isAtField(FieldNames.scoreTwo)) { + if (!input.trySkipNullValue()) { + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } case -892481550: { if (input.isAtField(FieldNames.status)) { if (!input.trySkipNullValue()) { final ChallengeStatusOuterClass.ChallengeStatus value = input.readEnum(ChallengeStatusOuterClass.ChallengeStatus.converter()); if (value != null) { status = value.getNumber(); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; } else { input.skipUnknownEnumValue(); } @@ -581,7 +738,7 @@ public final class ChallengeInfoOuterClass { final ExtraLineupTypeOuterClass.ExtraLineupType value = input.readEnum(ExtraLineupTypeOuterClass.ExtraLineupType.converter()); if (value != null) { extraLineupType = value.getNumber(); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; } else { input.skipUnknownEnumValue(); } @@ -596,7 +753,7 @@ public final class ChallengeInfoOuterClass { if (input.isAtField(FieldNames.storyInfo)) { if (!input.trySkipNullValue()) { input.readMessage(storyInfo); - bitField0_ |= 0x00000010; + bitField0_ |= 0x00000040; } } else { input.skipUnknownField(); @@ -659,6 +816,10 @@ public final class ChallengeInfoOuterClass { static final FieldName roundCount = FieldName.forField("roundCount", "round_count"); + static final FieldName score = FieldName.forField("score"); + + static final FieldName scoreTwo = FieldName.forField("scoreTwo", "score_two"); + static final FieldName status = FieldName.forField("status"); static final FieldName extraLineupType = FieldName.forField("extraLineupType", "extra_lineup_type"); diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeOuterClass.java index 8b291ce..9d14434 100644 --- a/src/generated/main/emu/lunarcore/proto/ChallengeOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/ChallengeOuterClass.java @@ -18,6 +18,11 @@ public final class ChallengeOuterClass { public static final class Challenge extends ProtoMessage implements Cloneable { private static final long serialVersionUID = 0L; + /** + * optional uint32 score_two = 5; + */ + private int scoreTwo; + /** * optional uint32 stars = 10; */ @@ -33,6 +38,11 @@ public final class ChallengeOuterClass { */ private int takenReward; + /** + * optional uint32 score = 15; + */ + private int score; + private Challenge() { } @@ -43,12 +53,49 @@ public final class ChallengeOuterClass { return new Challenge(); } + /** + * optional uint32 score_two = 5; + * @return whether the scoreTwo field is set + */ + public boolean hasScoreTwo() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 score_two = 5; + * @return this + */ + public Challenge clearScoreTwo() { + bitField0_ &= ~0x00000001; + scoreTwo = 0; + return this; + } + + /** + * optional uint32 score_two = 5; + * @return the scoreTwo + */ + public int getScoreTwo() { + return scoreTwo; + } + + /** + * optional uint32 score_two = 5; + * @param value the scoreTwo to set + * @return this + */ + public Challenge setScoreTwo(final int value) { + bitField0_ |= 0x00000001; + scoreTwo = value; + return this; + } + /** * optional uint32 stars = 10; * @return whether the stars field is set */ public boolean hasStars() { - return (bitField0_ & 0x00000001) != 0; + return (bitField0_ & 0x00000002) != 0; } /** @@ -56,7 +103,7 @@ public final class ChallengeOuterClass { * @return this */ public Challenge clearStars() { - bitField0_ &= ~0x00000001; + bitField0_ &= ~0x00000002; stars = 0; return this; } @@ -75,7 +122,7 @@ public final class ChallengeOuterClass { * @return this */ public Challenge setStars(final int value) { - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; stars = value; return this; } @@ -85,7 +132,7 @@ public final class ChallengeOuterClass { * @return whether the challengeId field is set */ public boolean hasChallengeId() { - return (bitField0_ & 0x00000002) != 0; + return (bitField0_ & 0x00000004) != 0; } /** @@ -93,7 +140,7 @@ public final class ChallengeOuterClass { * @return this */ public Challenge clearChallengeId() { - bitField0_ &= ~0x00000002; + bitField0_ &= ~0x00000004; challengeId = 0; return this; } @@ -112,7 +159,7 @@ public final class ChallengeOuterClass { * @return this */ public Challenge setChallengeId(final int value) { - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000004; challengeId = value; return this; } @@ -122,7 +169,7 @@ public final class ChallengeOuterClass { * @return whether the takenReward field is set */ public boolean hasTakenReward() { - return (bitField0_ & 0x00000004) != 0; + return (bitField0_ & 0x00000008) != 0; } /** @@ -130,7 +177,7 @@ public final class ChallengeOuterClass { * @return this */ public Challenge clearTakenReward() { - bitField0_ &= ~0x00000004; + bitField0_ &= ~0x00000008; takenReward = 0; return this; } @@ -149,19 +196,58 @@ public final class ChallengeOuterClass { * @return this */ public Challenge setTakenReward(final int value) { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000008; takenReward = value; return this; } + /** + * optional uint32 score = 15; + * @return whether the score field is set + */ + public boolean hasScore() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * optional uint32 score = 15; + * @return this + */ + public Challenge clearScore() { + bitField0_ &= ~0x00000010; + score = 0; + return this; + } + + /** + * optional uint32 score = 15; + * @return the score + */ + public int getScore() { + return score; + } + + /** + * optional uint32 score = 15; + * @param value the score to set + * @return this + */ + public Challenge setScore(final int value) { + bitField0_ |= 0x00000010; + score = value; + return this; + } + @Override public Challenge copyFrom(final Challenge other) { cachedSize = other.cachedSize; if ((bitField0_ | other.bitField0_) != 0) { bitField0_ = other.bitField0_; + scoreTwo = other.scoreTwo; stars = other.stars; challengeId = other.challengeId; takenReward = other.takenReward; + score = other.score; } return this; } @@ -172,6 +258,9 @@ public final class ChallengeOuterClass { return this; } cachedSize = -1; + if (other.hasScoreTwo()) { + setScoreTwo(other.scoreTwo); + } if (other.hasStars()) { setStars(other.stars); } @@ -181,6 +270,9 @@ public final class ChallengeOuterClass { if (other.hasTakenReward()) { setTakenReward(other.takenReward); } + if (other.hasScore()) { + setScore(other.score); + } return this; } @@ -191,9 +283,11 @@ public final class ChallengeOuterClass { } cachedSize = -1; bitField0_ = 0; + scoreTwo = 0; stars = 0; challengeId = 0; takenReward = 0; + score = 0; return this; } @@ -217,39 +311,55 @@ public final class ChallengeOuterClass { } Challenge other = (Challenge) o; return bitField0_ == other.bitField0_ + && (!hasScoreTwo() || scoreTwo == other.scoreTwo) && (!hasStars() || stars == other.stars) && (!hasChallengeId() || challengeId == other.challengeId) - && (!hasTakenReward() || takenReward == other.takenReward); + && (!hasTakenReward() || takenReward == other.takenReward) + && (!hasScore() || score == other.score); } @Override public void writeTo(final ProtoSink output) throws IOException { if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 40); + output.writeUInt32NoTag(scoreTwo); + } + if ((bitField0_ & 0x00000002) != 0) { output.writeRawByte((byte) 80); output.writeUInt32NoTag(stars); } - if ((bitField0_ & 0x00000002) != 0) { + if ((bitField0_ & 0x00000004) != 0) { output.writeRawByte((byte) 104); output.writeUInt32NoTag(challengeId); } - if ((bitField0_ & 0x00000004) != 0) { + if ((bitField0_ & 0x00000008) != 0) { output.writeRawByte((byte) 112); output.writeUInt32NoTag(takenReward); } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRawByte((byte) 120); + output.writeUInt32NoTag(score); + } } @Override protected int computeSerializedSize() { int size = 0; if ((bitField0_ & 0x00000001) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(stars); + size += 1 + ProtoSink.computeUInt32SizeNoTag(scoreTwo); } if ((bitField0_ & 0x00000002) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId); + size += 1 + ProtoSink.computeUInt32SizeNoTag(stars); } if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId); + } + if ((bitField0_ & 0x00000008) != 0) { size += 1 + ProtoSink.computeUInt32SizeNoTag(takenReward); } + if ((bitField0_ & 0x00000010) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(score); + } return size; } @@ -260,10 +370,19 @@ public final class ChallengeOuterClass { int tag = input.readTag(); while (true) { switch (tag) { + case 40: { + // scoreTwo + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 80) { + break; + } + } case 80: { // stars stars = input.readUInt32(); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; tag = input.readTag(); if (tag != 104) { break; @@ -272,7 +391,7 @@ public final class ChallengeOuterClass { case 104: { // challengeId challengeId = input.readUInt32(); - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000004; tag = input.readTag(); if (tag != 112) { break; @@ -281,7 +400,16 @@ public final class ChallengeOuterClass { case 112: { // takenReward takenReward = input.readUInt32(); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000008; + tag = input.readTag(); + if (tag != 120) { + break; + } + } + case 120: { + // score + score = input.readUInt32(); + bitField0_ |= 0x00000010; tag = input.readTag(); if (tag != 0) { break; @@ -305,14 +433,20 @@ public final class ChallengeOuterClass { public void writeTo(final JsonSink output) throws IOException { output.beginObject(); if ((bitField0_ & 0x00000001) != 0) { - output.writeUInt32(FieldNames.stars, stars); + output.writeUInt32(FieldNames.scoreTwo, scoreTwo); } if ((bitField0_ & 0x00000002) != 0) { - output.writeUInt32(FieldNames.challengeId, challengeId); + output.writeUInt32(FieldNames.stars, stars); } if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.challengeId, challengeId); + } + if ((bitField0_ & 0x00000008) != 0) { output.writeUInt32(FieldNames.takenReward, takenReward); } + if ((bitField0_ & 0x00000010) != 0) { + output.writeUInt32(FieldNames.score, score); + } output.endObject(); } @@ -323,11 +457,23 @@ public final class ChallengeOuterClass { } while (!input.isAtEnd()) { switch (input.readFieldHash()) { + case -485512614: + case 2129303327: { + if (input.isAtField(FieldNames.scoreTwo)) { + if (!input.trySkipNullValue()) { + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } case 109757537: { if (input.isAtField(FieldNames.stars)) { if (!input.trySkipNullValue()) { stars = input.readUInt32(); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; } } else { input.skipUnknownField(); @@ -339,7 +485,7 @@ public final class ChallengeOuterClass { if (input.isAtField(FieldNames.challengeId)) { if (!input.trySkipNullValue()) { challengeId = input.readUInt32(); - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000004; } } else { input.skipUnknownField(); @@ -351,7 +497,18 @@ public final class ChallengeOuterClass { if (input.isAtField(FieldNames.takenReward)) { if (!input.trySkipNullValue()) { takenReward = input.readUInt32(); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + case 109264530: { + if (input.isAtField(FieldNames.score)) { + if (!input.trySkipNullValue()) { + score = input.readUInt32(); + bitField0_ |= 0x00000010; } } else { input.skipUnknownField(); @@ -410,11 +567,15 @@ public final class ChallengeOuterClass { * Contains name constants used for serializing JSON */ static class FieldNames { + static final FieldName scoreTwo = FieldName.forField("scoreTwo", "score_two"); + static final FieldName stars = FieldName.forField("stars"); static final FieldName challengeId = FieldName.forField("challengeId", "challenge_id"); static final FieldName takenReward = FieldName.forField("takenReward", "taken_reward"); + + static final FieldName score = FieldName.forField("score"); } } } diff --git a/src/generated/main/emu/lunarcore/proto/ChallengeSettleNotifyOuterClass.java b/src/generated/main/emu/lunarcore/proto/ChallengeSettleNotifyOuterClass.java index 1ffab97..406bea2 100644 --- a/src/generated/main/emu/lunarcore/proto/ChallengeSettleNotifyOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/ChallengeSettleNotifyOuterClass.java @@ -18,11 +18,21 @@ public final class ChallengeSettleNotifyOuterClass { public static final class ChallengeSettleNotify extends ProtoMessage implements Cloneable { private static final long serialVersionUID = 0L; + /** + * optional uint32 score_two = 6; + */ + private int scoreTwo; + /** * optional uint32 challenge_id = 9; */ private int challengeId; + /** + * optional uint32 challenge_score = 11; + */ + private int challengeScore; + /** * optional uint32 stars = 15; */ @@ -48,12 +58,49 @@ public final class ChallengeSettleNotifyOuterClass { return new ChallengeSettleNotify(); } + /** + * optional uint32 score_two = 6; + * @return whether the scoreTwo field is set + */ + public boolean hasScoreTwo() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 score_two = 6; + * @return this + */ + public ChallengeSettleNotify clearScoreTwo() { + bitField0_ &= ~0x00000001; + scoreTwo = 0; + return this; + } + + /** + * optional uint32 score_two = 6; + * @return the scoreTwo + */ + public int getScoreTwo() { + return scoreTwo; + } + + /** + * optional uint32 score_two = 6; + * @param value the scoreTwo to set + * @return this + */ + public ChallengeSettleNotify setScoreTwo(final int value) { + bitField0_ |= 0x00000001; + scoreTwo = value; + return this; + } + /** * optional uint32 challenge_id = 9; * @return whether the challengeId field is set */ public boolean hasChallengeId() { - return (bitField0_ & 0x00000001) != 0; + return (bitField0_ & 0x00000002) != 0; } /** @@ -61,7 +108,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify clearChallengeId() { - bitField0_ &= ~0x00000001; + bitField0_ &= ~0x00000002; challengeId = 0; return this; } @@ -80,17 +127,54 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify setChallengeId(final int value) { - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; challengeId = value; return this; } + /** + * optional uint32 challenge_score = 11; + * @return whether the challengeScore field is set + */ + public boolean hasChallengeScore() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 challenge_score = 11; + * @return this + */ + public ChallengeSettleNotify clearChallengeScore() { + bitField0_ &= ~0x00000004; + challengeScore = 0; + return this; + } + + /** + * optional uint32 challenge_score = 11; + * @return the challengeScore + */ + public int getChallengeScore() { + return challengeScore; + } + + /** + * optional uint32 challenge_score = 11; + * @param value the challengeScore to set + * @return this + */ + public ChallengeSettleNotify setChallengeScore(final int value) { + bitField0_ |= 0x00000004; + challengeScore = value; + return this; + } + /** * optional uint32 stars = 15; * @return whether the stars field is set */ public boolean hasStars() { - return (bitField0_ & 0x00000002) != 0; + return (bitField0_ & 0x00000008) != 0; } /** @@ -98,7 +182,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify clearStars() { - bitField0_ &= ~0x00000002; + bitField0_ &= ~0x00000008; stars = 0; return this; } @@ -117,7 +201,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify setStars(final int value) { - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000008; stars = value; return this; } @@ -127,7 +211,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return whether the isWin field is set */ public boolean hasIsWin() { - return (bitField0_ & 0x00000004) != 0; + return (bitField0_ & 0x00000010) != 0; } /** @@ -135,7 +219,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify clearIsWin() { - bitField0_ &= ~0x00000004; + bitField0_ &= ~0x00000010; isWin = false; return this; } @@ -154,7 +238,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify setIsWin(final boolean value) { - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; isWin = value; return this; } @@ -164,7 +248,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return whether the reward field is set */ public boolean hasReward() { - return (bitField0_ & 0x00000008) != 0; + return (bitField0_ & 0x00000020) != 0; } /** @@ -172,7 +256,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify clearReward() { - bitField0_ &= ~0x00000008; + bitField0_ &= ~0x00000020; reward.clear(); return this; } @@ -201,7 +285,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return internal storage object for modifications */ public ItemListOuterClass.ItemList getMutableReward() { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; return reward; } @@ -211,7 +295,7 @@ public final class ChallengeSettleNotifyOuterClass { * @return this */ public ChallengeSettleNotify setReward(final ItemListOuterClass.ItemList value) { - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; reward.copyFrom(value); return this; } @@ -221,7 +305,9 @@ public final class ChallengeSettleNotifyOuterClass { cachedSize = other.cachedSize; if ((bitField0_ | other.bitField0_) != 0) { bitField0_ = other.bitField0_; + scoreTwo = other.scoreTwo; challengeId = other.challengeId; + challengeScore = other.challengeScore; stars = other.stars; isWin = other.isWin; reward.copyFrom(other.reward); @@ -235,9 +321,15 @@ public final class ChallengeSettleNotifyOuterClass { return this; } cachedSize = -1; + if (other.hasScoreTwo()) { + setScoreTwo(other.scoreTwo); + } if (other.hasChallengeId()) { setChallengeId(other.challengeId); } + if (other.hasChallengeScore()) { + setChallengeScore(other.challengeScore); + } if (other.hasStars()) { setStars(other.stars); } @@ -257,7 +349,9 @@ public final class ChallengeSettleNotifyOuterClass { } cachedSize = -1; bitField0_ = 0; + scoreTwo = 0; challengeId = 0; + challengeScore = 0; stars = 0; isWin = false; reward.clear(); @@ -285,7 +379,9 @@ public final class ChallengeSettleNotifyOuterClass { } ChallengeSettleNotify other = (ChallengeSettleNotify) o; return bitField0_ == other.bitField0_ + && (!hasScoreTwo() || scoreTwo == other.scoreTwo) && (!hasChallengeId() || challengeId == other.challengeId) + && (!hasChallengeScore() || challengeScore == other.challengeScore) && (!hasStars() || stars == other.stars) && (!hasIsWin() || isWin == other.isWin) && (!hasReward() || reward.equals(other.reward)); @@ -294,18 +390,26 @@ public final class ChallengeSettleNotifyOuterClass { @Override public void writeTo(final ProtoSink output) throws IOException { if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 48); + output.writeUInt32NoTag(scoreTwo); + } + if ((bitField0_ & 0x00000002) != 0) { output.writeRawByte((byte) 72); output.writeUInt32NoTag(challengeId); } - if ((bitField0_ & 0x00000002) != 0) { + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 88); + output.writeUInt32NoTag(challengeScore); + } + if ((bitField0_ & 0x00000008) != 0) { output.writeRawByte((byte) 120); output.writeUInt32NoTag(stars); } - if ((bitField0_ & 0x00000004) != 0) { + if ((bitField0_ & 0x00000010) != 0) { output.writeRawByte((byte) 104); output.writeBoolNoTag(isWin); } - if ((bitField0_ & 0x00000008) != 0) { + if ((bitField0_ & 0x00000020) != 0) { output.writeRawByte((byte) 66); output.writeMessageNoTag(reward); } @@ -315,15 +419,21 @@ public final class ChallengeSettleNotifyOuterClass { protected int computeSerializedSize() { int size = 0; if ((bitField0_ & 0x00000001) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId); + size += 1 + ProtoSink.computeUInt32SizeNoTag(scoreTwo); } if ((bitField0_ & 0x00000002) != 0) { - size += 1 + ProtoSink.computeUInt32SizeNoTag(stars); + size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeId); } if ((bitField0_ & 0x00000004) != 0) { - size += 2; + size += 1 + ProtoSink.computeUInt32SizeNoTag(challengeScore); } if ((bitField0_ & 0x00000008) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(stars); + } + if ((bitField0_ & 0x00000010) != 0) { + size += 2; + } + if ((bitField0_ & 0x00000020) != 0) { size += 1 + ProtoSink.computeMessageSizeNoTag(reward); } return size; @@ -336,10 +446,28 @@ public final class ChallengeSettleNotifyOuterClass { int tag = input.readTag(); while (true) { switch (tag) { + case 48: { + // scoreTwo + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 72) { + break; + } + } case 72: { // challengeId challengeId = input.readUInt32(); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 88) { + break; + } + } + case 88: { + // challengeScore + challengeScore = input.readUInt32(); + bitField0_ |= 0x00000004; tag = input.readTag(); if (tag != 120) { break; @@ -348,7 +476,7 @@ public final class ChallengeSettleNotifyOuterClass { case 120: { // stars stars = input.readUInt32(); - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000008; tag = input.readTag(); if (tag != 104) { break; @@ -357,7 +485,7 @@ public final class ChallengeSettleNotifyOuterClass { case 104: { // isWin isWin = input.readBool(); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; tag = input.readTag(); if (tag != 66) { break; @@ -366,7 +494,7 @@ public final class ChallengeSettleNotifyOuterClass { case 66: { // reward input.readMessage(reward); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; tag = input.readTag(); if (tag != 0) { break; @@ -390,15 +518,21 @@ public final class ChallengeSettleNotifyOuterClass { public void writeTo(final JsonSink output) throws IOException { output.beginObject(); if ((bitField0_ & 0x00000001) != 0) { - output.writeUInt32(FieldNames.challengeId, challengeId); + output.writeUInt32(FieldNames.scoreTwo, scoreTwo); } if ((bitField0_ & 0x00000002) != 0) { - output.writeUInt32(FieldNames.stars, stars); + output.writeUInt32(FieldNames.challengeId, challengeId); } if ((bitField0_ & 0x00000004) != 0) { - output.writeBool(FieldNames.isWin, isWin); + output.writeUInt32(FieldNames.challengeScore, challengeScore); } if ((bitField0_ & 0x00000008) != 0) { + output.writeUInt32(FieldNames.stars, stars); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeBool(FieldNames.isWin, isWin); + } + if ((bitField0_ & 0x00000020) != 0) { output.writeMessage(FieldNames.reward, reward); } output.endObject(); @@ -411,12 +545,36 @@ public final class ChallengeSettleNotifyOuterClass { } while (!input.isAtEnd()) { switch (input.readFieldHash()) { + case -485512614: + case 2129303327: { + if (input.isAtField(FieldNames.scoreTwo)) { + if (!input.trySkipNullValue()) { + scoreTwo = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } case -689112866: case 112359031: { if (input.isAtField(FieldNames.challengeId)) { if (!input.trySkipNullValue()) { challengeId = input.readUInt32(); - bitField0_ |= 0x00000001; + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 591599599: + case 1517684662: { + if (input.isAtField(FieldNames.challengeScore)) { + if (!input.trySkipNullValue()) { + challengeScore = input.readUInt32(); + bitField0_ |= 0x00000004; } } else { input.skipUnknownField(); @@ -427,7 +585,7 @@ public final class ChallengeSettleNotifyOuterClass { if (input.isAtField(FieldNames.stars)) { if (!input.trySkipNullValue()) { stars = input.readUInt32(); - bitField0_ |= 0x00000002; + bitField0_ |= 0x00000008; } } else { input.skipUnknownField(); @@ -439,7 +597,7 @@ public final class ChallengeSettleNotifyOuterClass { if (input.isAtField(FieldNames.isWin)) { if (!input.trySkipNullValue()) { isWin = input.readBool(); - bitField0_ |= 0x00000004; + bitField0_ |= 0x00000010; } } else { input.skipUnknownField(); @@ -450,7 +608,7 @@ public final class ChallengeSettleNotifyOuterClass { if (input.isAtField(FieldNames.reward)) { if (!input.trySkipNullValue()) { input.readMessage(reward); - bitField0_ |= 0x00000008; + bitField0_ |= 0x00000020; } } else { input.skipUnknownField(); @@ -510,8 +668,12 @@ public final class ChallengeSettleNotifyOuterClass { * Contains name constants used for serializing JSON */ static class FieldNames { + static final FieldName scoreTwo = FieldName.forField("scoreTwo", "score_two"); + static final FieldName challengeId = FieldName.forField("challengeId", "challenge_id"); + static final FieldName challengeScore = FieldName.forField("challengeScore", "challenge_score"); + static final FieldName stars = FieldName.forField("stars"); static final FieldName isWin = FieldName.forField("isWin", "is_win"); diff --git a/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java index c22af6d..2eec0ab 100644 --- a/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java @@ -64,6 +64,11 @@ public final class SceneBattleInfoOuterClass { */ private final RepeatedMessage eventBattleInfoList = RepeatedMessage.newEmptyInstance(BattleEventBattleInfoOuterClass.BattleEventBattleInfo.getFactory()); + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + */ + private final RepeatedMessage battleTargetInfo = RepeatedMessage.newEmptyInstance(BattleTargetInfoEntry.getFactory()); + private SceneBattleInfo() { } @@ -539,6 +544,74 @@ public final class SceneBattleInfoOuterClass { return this; } + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * @return whether the battleTargetInfo field is set + */ + public boolean hasBattleTargetInfo() { + return (bitField0_ & 0x00000200) != 0; + } + + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * @return this + */ + public SceneBattleInfo clearBattleTargetInfo() { + bitField0_ &= ~0x00000200; + battleTargetInfo.clear(); + return this; + } + + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * + * 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 #getMutableBattleTargetInfo()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getBattleTargetInfo() { + return battleTargetInfo; + } + + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * + * 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 RepeatedMessage getMutableBattleTargetInfo() { + bitField0_ |= 0x00000200; + return battleTargetInfo; + } + + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * @param value the battleTargetInfo to add + * @return this + */ + public SceneBattleInfo addBattleTargetInfo(final BattleTargetInfoEntry value) { + bitField0_ |= 0x00000200; + battleTargetInfo.add(value); + return this; + } + + /** + * repeated .SceneBattleInfo.BattleTargetInfoEntry battle_target_info = 1857; + * @param values the battleTargetInfo to add + * @return this + */ + public SceneBattleInfo addAllBattleTargetInfo(final BattleTargetInfoEntry... values) { + bitField0_ |= 0x00000200; + battleTargetInfo.addAll(values); + return this; + } + @Override public SceneBattleInfo copyFrom(final SceneBattleInfo other) { cachedSize = other.cachedSize; @@ -553,6 +626,7 @@ public final class SceneBattleInfoOuterClass { buffList.copyFrom(other.buffList); battleAvatarList.copyFrom(other.battleAvatarList); eventBattleInfoList.copyFrom(other.eventBattleInfoList); + battleTargetInfo.copyFrom(other.battleTargetInfo); } return this; } @@ -590,6 +664,9 @@ public final class SceneBattleInfoOuterClass { if (other.hasEventBattleInfoList()) { getMutableEventBattleInfoList().addAll(other.eventBattleInfoList); } + if (other.hasBattleTargetInfo()) { + getMutableBattleTargetInfo().addAll(other.battleTargetInfo); + } return this; } @@ -609,6 +686,7 @@ public final class SceneBattleInfoOuterClass { buffList.clear(); battleAvatarList.clear(); eventBattleInfoList.clear(); + battleTargetInfo.clear(); return this; } @@ -623,6 +701,7 @@ public final class SceneBattleInfoOuterClass { buffList.clearQuick(); battleAvatarList.clearQuick(); eventBattleInfoList.clearQuick(); + battleTargetInfo.clearQuick(); return this; } @@ -644,7 +723,8 @@ public final class SceneBattleInfoOuterClass { && (!hasMonsterWaveList() || monsterWaveList.equals(other.monsterWaveList)) && (!hasBuffList() || buffList.equals(other.buffList)) && (!hasBattleAvatarList() || battleAvatarList.equals(other.battleAvatarList)) - && (!hasEventBattleInfoList() || eventBattleInfoList.equals(other.eventBattleInfoList)); + && (!hasEventBattleInfoList() || eventBattleInfoList.equals(other.eventBattleInfoList)) + && (!hasBattleTargetInfo() || battleTargetInfo.equals(other.battleTargetInfo)); } @Override @@ -693,6 +773,12 @@ public final class SceneBattleInfoOuterClass { output.writeMessageNoTag(eventBattleInfoList.get(i)); } } + if ((bitField0_ & 0x00000200) != 0) { + for (int i = 0; i < battleTargetInfo.length(); i++) { + output.writeRawLittleEndian16((short) 29834); + output.writeMessageNoTag(battleTargetInfo.get(i)); + } + } } @Override @@ -725,6 +811,9 @@ public final class SceneBattleInfoOuterClass { if ((bitField0_ & 0x00000100) != 0) { size += (2 * eventBattleInfoList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(eventBattleInfoList); } + if ((bitField0_ & 0x00000200) != 0) { + size += (2 * battleTargetInfo.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(battleTargetInfo); + } return size; } @@ -808,6 +897,14 @@ public final class SceneBattleInfoOuterClass { // eventBattleInfoList tag = input.readRepeatedMessage(eventBattleInfoList, tag); bitField0_ |= 0x00000100; + if (tag != 14858) { + break; + } + } + case 14858: { + // battleTargetInfo + tag = input.readRepeatedMessage(battleTargetInfo, tag); + bitField0_ |= 0x00000200; if (tag != 0) { break; } @@ -856,6 +953,9 @@ public final class SceneBattleInfoOuterClass { if ((bitField0_ & 0x00000100) != 0) { output.writeRepeatedMessage(FieldNames.eventBattleInfoList, eventBattleInfoList); } + if ((bitField0_ & 0x00000200) != 0) { + output.writeRepeatedMessage(FieldNames.battleTargetInfo, battleTargetInfo); + } output.endObject(); } @@ -974,6 +1074,18 @@ public final class SceneBattleInfoOuterClass { } break; } + case 1657979063: + case 2141477269: { + if (input.isAtField(FieldNames.battleTargetInfo)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(battleTargetInfo); + bitField0_ |= 0x00000200; + } + } else { + input.skipUnknownField(); + } + break; + } default: { input.skipUnknownField(); break; @@ -1014,6 +1126,353 @@ public final class SceneBattleInfoOuterClass { return SceneBattleInfoFactory.INSTANCE; } + /** + * Protobuf type {@code BattleTargetInfoEntry} + */ + public static final class BattleTargetInfoEntry extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 key = 1; + */ + private int key; + + /** + * optional .BattleTargetList value = 2; + */ + private final BattleTargetListOuterClass.BattleTargetList value_ = BattleTargetListOuterClass.BattleTargetList.newInstance(); + + private BattleTargetInfoEntry() { + } + + /** + * @return a new empty instance of {@code BattleTargetInfoEntry} + */ + public static BattleTargetInfoEntry newInstance() { + return new BattleTargetInfoEntry(); + } + + /** + * optional uint32 key = 1; + * @return whether the key field is set + */ + public boolean hasKey() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 key = 1; + * @return this + */ + public BattleTargetInfoEntry clearKey() { + bitField0_ &= ~0x00000001; + key = 0; + return this; + } + + /** + * optional uint32 key = 1; + * @return the key + */ + public int getKey() { + return key; + } + + /** + * optional uint32 key = 1; + * @param value the key to set + * @return this + */ + public BattleTargetInfoEntry setKey(final int value) { + bitField0_ |= 0x00000001; + key = value; + return this; + } + + /** + * optional .BattleTargetList value = 2; + * @return whether the value_ field is set + */ + public boolean hasValue() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional .BattleTargetList value = 2; + * @return this + */ + public BattleTargetInfoEntry clearValue() { + bitField0_ &= ~0x00000002; + value_.clear(); + return this; + } + + /** + * optional .BattleTargetList value = 2; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableValue()} if you want to modify it. + * + * @return internal storage object for reading + */ + public BattleTargetListOuterClass.BattleTargetList getValue() { + return value_; + } + + /** + * optional .BattleTargetList value = 2; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public BattleTargetListOuterClass.BattleTargetList getMutableValue() { + bitField0_ |= 0x00000002; + return value_; + } + + /** + * optional .BattleTargetList value = 2; + * @param value the value_ to set + * @return this + */ + public BattleTargetInfoEntry setValue( + final BattleTargetListOuterClass.BattleTargetList value) { + bitField0_ |= 0x00000002; + value_.copyFrom(value); + return this; + } + + @Override + public BattleTargetInfoEntry copyFrom(final BattleTargetInfoEntry other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + key = other.key; + value_.copyFrom(other.value_); + } + return this; + } + + @Override + public BattleTargetInfoEntry mergeFrom(final BattleTargetInfoEntry other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasKey()) { + setKey(other.key); + } + if (other.hasValue()) { + getMutableValue().mergeFrom(other.value_); + } + return this; + } + + @Override + public BattleTargetInfoEntry clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + key = 0; + value_.clear(); + return this; + } + + @Override + public BattleTargetInfoEntry clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + value_.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof BattleTargetInfoEntry)) { + return false; + } + BattleTargetInfoEntry other = (BattleTargetInfoEntry) o; + return bitField0_ == other.bitField0_ + && (!hasKey() || key == other.key) + && (!hasValue() || value_.equals(other.value_)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt32NoTag(key); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 18); + output.writeMessageNoTag(value_); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(key); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(value_); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public BattleTargetInfoEntry mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 8: { + // key + key = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 18) { + break; + } + } + case 18: { + // value_ + input.readMessage(value_); + 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.key, key); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeMessage(FieldNames.value_, value_); + } + output.endObject(); + } + + @Override + public BattleTargetInfoEntry mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 106079: { + if (input.isAtField(FieldNames.key)) { + if (!input.trySkipNullValue()) { + key = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 111972721: { + if (input.isAtField(FieldNames.value_)) { + if (!input.trySkipNullValue()) { + input.readMessage(value_); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public BattleTargetInfoEntry clone() { + return new BattleTargetInfoEntry().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static BattleTargetInfoEntry parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), data).checkInitialized(); + } + + public static BattleTargetInfoEntry parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), input).checkInitialized(); + } + + public static BattleTargetInfoEntry parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new BattleTargetInfoEntry(), input).checkInitialized(); + } + + /** + * @return factory for creating BattleTargetInfoEntry messages + */ + public static MessageFactory getFactory() { + return BattleTargetInfoEntryFactory.INSTANCE; + } + + private enum BattleTargetInfoEntryFactory implements MessageFactory { + INSTANCE; + + @Override + public BattleTargetInfoEntry create() { + return BattleTargetInfoEntry.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName key = FieldName.forField("key"); + + static final FieldName value_ = FieldName.forField("value"); + } + } + private enum SceneBattleInfoFactory implements MessageFactory { INSTANCE; @@ -1044,6 +1503,8 @@ public final class SceneBattleInfoOuterClass { static final FieldName battleAvatarList = FieldName.forField("battleAvatarList", "battle_avatar_list"); static final FieldName eventBattleInfoList = FieldName.forField("eventBattleInfoList", "event_battle_info_list"); + + static final FieldName battleTargetInfo = FieldName.forField("battleTargetInfo", "battle_target_info"); } } } diff --git a/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java b/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java index 622ed1f..4869537 100644 --- a/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/ChallengeStoryExtraExcel.java @@ -4,6 +4,7 @@ import emu.lunarcore.data.GameData; import emu.lunarcore.data.GameResource; import emu.lunarcore.data.ResourceType; import emu.lunarcore.data.ResourceType.LoadPriority; +import it.unimi.dsi.fastutil.ints.IntArrayList; import lombok.Getter; @Getter @@ -12,6 +13,7 @@ public class ChallengeStoryExtraExcel extends GameResource { private int ID; private int TurnLimit; private int ClearScore; + private IntArrayList BattleTargetID; @Override public int getId() { diff --git a/src/main/java/emu/lunarcore/game/battle/Battle.java b/src/main/java/emu/lunarcore/game/battle/Battle.java index 8537316..96d5be6 100644 --- a/src/main/java/emu/lunarcore/game/battle/Battle.java +++ b/src/main/java/emu/lunarcore/game/battle/Battle.java @@ -16,8 +16,13 @@ import emu.lunarcore.game.scene.entity.EntityMonster; import emu.lunarcore.proto.BattleEndStatusOuterClass.BattleEndStatus; import emu.lunarcore.proto.BattleEventBattleInfoOuterClass.BattleEventBattleInfo; import emu.lunarcore.proto.BattleStatisticsOuterClass.BattleStatistics; +import emu.lunarcore.proto.BattleTargetListOuterClass.BattleTargetList; +import emu.lunarcore.proto.BattleTargetOuterClass.BattleTarget; import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo; +import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo.BattleTargetInfoEntry; import emu.lunarcore.util.Utils; +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import lombok.Getter; @@ -36,6 +41,7 @@ public class Battle { private StageExcel stage; // Main battle stage private IntList battleEvents; // TODO maybe turn it into a map? + private Int2ObjectMap battleTargets; // TODO use custom battle target object as value type in case we need to save battles to the db // Internal battle data @Setter private BattleEndStatus result; @@ -144,6 +150,22 @@ public class Battle { return this.battleEvents; } + public Int2ObjectMap getBattleTargets() { + if (this.battleTargets == null) { + this.battleTargets = new Int2ObjectOpenHashMap<>(); + } + return this.battleTargets; + } + + public void addBattleTarget(int key, int targetId, int progress) { + var list = getBattleTargets().computeIfAbsent(key, i -> BattleTargetList.newInstance()); + var battleTarget = BattleTarget.newInstance() + .setId(targetId) + .setProgress(progress); + + list.addBattleTargetList(battleTarget); + } + public void setCustomLevel(int level) { for (var wave : this.getWaves()) { wave.setCustomLevel(level); @@ -245,6 +267,23 @@ public class Battle { } } + // Battle target map + if (this.battleTargets != null) { + // Build battle target map + for (int i = 1; i <= 5; i++) { + var battleTargetList = this.battleTargets.get(i); + var battleTargetEntry = BattleTargetInfoEntry.newInstance().setKey(i); + + if (battleTargetList == null) { + battleTargetEntry.getMutableValue(); + } else { + battleTargetEntry.setValue(battleTargetList); + } + + proto.addBattleTargetInfo(battleTargetEntry); + } + } + return proto; } } diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeHistory.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeHistory.java index 1f7164a..b67bd69 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeHistory.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeHistory.java @@ -24,6 +24,7 @@ public class ChallengeHistory { private int groupId; private int takenReward; private int stars; + private int score; @Deprecated // Morphia public ChallengeHistory() {} @@ -45,10 +46,15 @@ public class ChallengeHistory { return total; } + public void setScore(int score) { + this.score = score; + } + public Challenge toProto() { var proto = Challenge.newInstance() .setChallengeId(this.getChallengeId()) .setTakenReward(this.getTakenReward()) + .setScore(this.getScore()) .setStars(this.getStars()); return proto; diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java index 258efe7..b5f0cb9 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeInstance.java @@ -7,6 +7,7 @@ import emu.lunarcore.game.battle.Battle; import emu.lunarcore.game.player.Player; import emu.lunarcore.game.scene.Scene; import emu.lunarcore.game.scene.entity.EntityMonster; +import emu.lunarcore.proto.BattleEndReasonOuterClass.BattleEndReason; import emu.lunarcore.proto.BattleEndStatusOuterClass.BattleEndStatus; import emu.lunarcore.proto.BattleStatisticsOuterClass.BattleStatistics; import emu.lunarcore.proto.ChallengeInfoOuterClass.ChallengeInfo; @@ -37,6 +38,8 @@ public class ChallengeInstance { @Setter private int savedMp; @Setter private int roundsLeft; @Setter private int stars; + @Setter private int scoreStage1; + @Setter private int scoreStage2; private IntList storyBuffs; @@ -63,6 +66,10 @@ public class ChallengeInstance { return this.getExcel().getId(); } + public boolean isStory() { + return this.excel.isStory(); + } + private void setStatus(ChallengeStatus status) { this.status = status.getNumber(); } @@ -74,6 +81,10 @@ public class ChallengeInstance { private int getRoundsElapsed() { return getExcel().getChallengeCountDown() - this.roundsLeft; } + + public int getTotalScore() { + return this.scoreStage1 + this.scoreStage2; + } public boolean isWin() { return status == ChallengeStatus.CHALLENGE_FINISH_VALUE; @@ -101,9 +112,32 @@ public class ChallengeInstance { battle.addBuff(buffId); } } + + // Add story battle targets + if (this.getExcel().getStoryExcel() != null) { + // Add base score counter + battle.addBattleTarget(1, 10001, this.getTotalScore()); + // Add battle targets from story excel + for (int id : getExcel().getStoryExcel().getBattleTargetID()) { + battle.addBattleTarget(5, id, this.getTotalScore()); + } + } } public void onBattleFinish(Battle battle, BattleEndStatus result, BattleStatistics stats) { + // Add challenge score + if (this.isStory()) { + // Calculate score for current stage + int stageScore = stats.getChallengeScore() - this.getTotalScore(); + // Set score + if (this.getCurrentStage() == 1) { + this.scoreStage1 = stageScore; + } else { + this.scoreStage2 = stageScore; + } + } + + // Handle result switch (result) { case BATTLE_END_WIN: // Check if any avatar in the lineup has died @@ -117,28 +151,7 @@ public class ChallengeInstance { long monsters = player.getScene().getEntities().values().stream().filter(e -> e instanceof EntityMonster).count(); if (monsters == 0) { - // Progress to the next stage - if (this.currentStage >= excel.getStageNum()) { - // Last stage - this.setStatus(ChallengeStatus.CHALLENGE_FINISH); - this.stars = this.calculateStars(); - // Save history - player.getChallengeManager().addHistory(this.getChallengeId(), this.getStars()); - // Send challenge result data - player.sendPacket(new PacketChallengeSettleNotify(this)); - } else { - // Increment and reset stage - this.currentStage++; - // Load scene group for stage 2 - this.getScene().loadGroup(excel.getMazeGroupID2()); - // Change player line up - this.setCurrentExtraLineup(ExtraLineupType.LINEUP_CHALLENGE_2); - player.getLineupManager().setCurrentExtraLineup(this.getCurrentExtraLineup(), true); - player.sendPacket(new PacketChallengeLineupNotify(this.getCurrentExtraLineup())); - this.savedMp = player.getCurrentLineup().getMp(); - // Move player - player.moveTo(this.getStartPos(), this.getStartRot()); - } + this.advanceStage(); } // Calculate rounds left @@ -155,11 +168,41 @@ public class ChallengeInstance { player.sendPacket(new PacketSyncLineupNotify(lineup)); break; default: - // Fail challenge - this.setStatus(ChallengeStatus.CHALLENGE_FAILED); + // Determine challenge result + if (this.isStory() && stats.getEndReason() == BattleEndReason.BATTLE_END_REASON_TURN_LIMIT) { + this.advanceStage(); + } else { + // Fail challenge + this.setStatus(ChallengeStatus.CHALLENGE_FAILED); + // Send challenge result data + player.sendPacket(new PacketChallengeSettleNotify(this)); + } + break; + } + } + + private void advanceStage() { + // Progress to the next stage + if (this.currentStage >= excel.getStageNum()) { + // Last stage + this.setStatus(ChallengeStatus.CHALLENGE_FINISH); + this.stars = this.calculateStars(); + // Save history + player.getChallengeManager().addHistory(this.getChallengeId(), this.getStars(), this.getTotalScore()); // Send challenge result data player.sendPacket(new PacketChallengeSettleNotify(this)); - break; + } else { + // Increment and reset stage + this.currentStage++; + // Load scene group for stage 2 + this.getScene().loadGroup(excel.getMazeGroupID2()); + // Change player line up + this.setCurrentExtraLineup(ExtraLineupType.LINEUP_CHALLENGE_2); + player.getLineupManager().setCurrentExtraLineup(this.getCurrentExtraLineup(), true); + player.sendPacket(new PacketChallengeLineupNotify(this.getCurrentExtraLineup())); + this.savedMp = player.getCurrentLineup().getMp(); + // Move player + player.moveTo(this.getStartPos(), this.getStartRot()); } } @@ -189,6 +232,11 @@ public class ChallengeInstance { stars += (1 << i); } break; + case TOTAL_SCORE: + if (this.getTotalScore() >= target.getChallengeTargetParam1()) { + stars += (1 << i); + } + break; default: break; } @@ -212,6 +260,8 @@ public class ChallengeInstance { var proto = ChallengeInfo.newInstance() .setChallengeId(this.getExcel().getId()) .setStatusValue(this.getStatus()) + .setScore(this.getScoreStage1()) + .setScoreTwo(this.getScoreStage2()) .setRoundCount(this.getRoundsElapsed()) .setExtraLineupTypeValue(this.getCurrentExtraLineup()); diff --git a/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java b/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java index 110593d..2635bdd 100644 --- a/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java +++ b/src/main/java/emu/lunarcore/game/challenge/ChallengeManager.java @@ -106,7 +106,7 @@ public class ChallengeManager extends BasePlayerManager { getPlayer().sendPacket(new PacketStartChallengeScRsp(getPlayer(), challengeId)); } - public synchronized void addHistory(int challengeId, int stars) { + public synchronized void addHistory(int challengeId, int stars, int score) { // Dont write challenge history if the player didnt get any stars if (stars <= 0) return; @@ -115,6 +115,7 @@ public class ChallengeManager extends BasePlayerManager { // Set info.setStars(stars); + info.setScore(score); info.save(); } diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java b/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java index 4be3384..1bba0f2 100644 --- a/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketChallengeSettleNotify.java @@ -13,6 +13,8 @@ public class PacketChallengeSettleNotify extends BasePacket { var data = ChallengeSettleNotify.newInstance() .setChallengeId(challenge.getExcel().getId()) .setIsWin(challenge.isWin()) + .setChallengeScore(challenge.getScoreStage1()) + .setScoreTwo(challenge.getScoreStage2()) .setStars(challenge.getStars()); // Set empty rewards