diff --git a/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotOuterClass.java b/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotOuterClass.java new file mode 100644 index 0000000..9d97d0e --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotOuterClass.java @@ -0,0 +1,362 @@ +// 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 ClientTurnSnapshotOuterClass { + /** + * Protobuf type {@code ClientTurnSnapshot} + */ + public static final class ClientTurnSnapshot extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 battle_event_id = 1; + */ + private int battleEventId; + + /** + * optional .ClientTurnSnapshotStatus status = 2; + */ + private final ClientTurnSnapshotStatusOuterClass.ClientTurnSnapshotStatus status = ClientTurnSnapshotStatusOuterClass.ClientTurnSnapshotStatus.newInstance(); + + private ClientTurnSnapshot() { + } + + /** + * @return a new empty instance of {@code ClientTurnSnapshot} + */ + public static ClientTurnSnapshot newInstance() { + return new ClientTurnSnapshot(); + } + + /** + * optional uint32 battle_event_id = 1; + * @return whether the battleEventId field is set + */ + public boolean hasBattleEventId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 battle_event_id = 1; + * @return this + */ + public ClientTurnSnapshot clearBattleEventId() { + bitField0_ &= ~0x00000001; + battleEventId = 0; + return this; + } + + /** + * optional uint32 battle_event_id = 1; + * @return the battleEventId + */ + public int getBattleEventId() { + return battleEventId; + } + + /** + * optional uint32 battle_event_id = 1; + * @param value the battleEventId to set + * @return this + */ + public ClientTurnSnapshot setBattleEventId(final int value) { + bitField0_ |= 0x00000001; + battleEventId = value; + return this; + } + + /** + * optional .ClientTurnSnapshotStatus status = 2; + * @return whether the status field is set + */ + public boolean hasStatus() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional .ClientTurnSnapshotStatus status = 2; + * @return this + */ + public ClientTurnSnapshot clearStatus() { + bitField0_ &= ~0x00000002; + status.clear(); + return this; + } + + /** + * optional .ClientTurnSnapshotStatus status = 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 #getMutableStatus()} if you want to modify it. + * + * @return internal storage object for reading + */ + public ClientTurnSnapshotStatusOuterClass.ClientTurnSnapshotStatus getStatus() { + return status; + } + + /** + * optional .ClientTurnSnapshotStatus status = 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 ClientTurnSnapshotStatusOuterClass.ClientTurnSnapshotStatus getMutableStatus() { + bitField0_ |= 0x00000002; + return status; + } + + /** + * optional .ClientTurnSnapshotStatus status = 2; + * @param value the status to set + * @return this + */ + public ClientTurnSnapshot setStatus( + final ClientTurnSnapshotStatusOuterClass.ClientTurnSnapshotStatus value) { + bitField0_ |= 0x00000002; + status.copyFrom(value); + return this; + } + + @Override + public ClientTurnSnapshot copyFrom(final ClientTurnSnapshot other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + battleEventId = other.battleEventId; + status.copyFrom(other.status); + } + return this; + } + + @Override + public ClientTurnSnapshot mergeFrom(final ClientTurnSnapshot other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasBattleEventId()) { + setBattleEventId(other.battleEventId); + } + if (other.hasStatus()) { + getMutableStatus().mergeFrom(other.status); + } + return this; + } + + @Override + public ClientTurnSnapshot clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + battleEventId = 0; + status.clear(); + return this; + } + + @Override + public ClientTurnSnapshot clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + status.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ClientTurnSnapshot)) { + return false; + } + ClientTurnSnapshot other = (ClientTurnSnapshot) o; + return bitField0_ == other.bitField0_ + && (!hasBattleEventId() || battleEventId == other.battleEventId) + && (!hasStatus() || status.equals(other.status)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 8); + output.writeUInt32NoTag(battleEventId); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 18); + output.writeMessageNoTag(status); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(battleEventId); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(status); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public ClientTurnSnapshot mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 8: { + // battleEventId + battleEventId = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 18) { + break; + } + } + case 18: { + // status + input.readMessage(status); + 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.battleEventId, battleEventId); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeMessage(FieldNames.status, status); + } + output.endObject(); + } + + @Override + public ClientTurnSnapshot mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -79510147: + case -766250873: { + if (input.isAtField(FieldNames.battleEventId)) { + if (!input.trySkipNullValue()) { + battleEventId = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -892481550: { + if (input.isAtField(FieldNames.status)) { + if (!input.trySkipNullValue()) { + input.readMessage(status); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public ClientTurnSnapshot clone() { + return new ClientTurnSnapshot().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static ClientTurnSnapshot parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshot(), data).checkInitialized(); + } + + public static ClientTurnSnapshot parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshot(), input).checkInitialized(); + } + + public static ClientTurnSnapshot parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshot(), input).checkInitialized(); + } + + /** + * @return factory for creating ClientTurnSnapshot messages + */ + public static MessageFactory getFactory() { + return ClientTurnSnapshotFactory.INSTANCE; + } + + private enum ClientTurnSnapshotFactory implements MessageFactory { + INSTANCE; + + @Override + public ClientTurnSnapshot create() { + return ClientTurnSnapshot.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName battleEventId = FieldName.forField("battleEventId", "battle_event_id"); + + static final FieldName status = FieldName.forField("status"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotStatusOuterClass.java b/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotStatusOuterClass.java new file mode 100644 index 0000000..6d9f8cb --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/ClientTurnSnapshotStatusOuterClass.java @@ -0,0 +1,281 @@ +// 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 ClientTurnSnapshotStatusOuterClass { + /** + * Protobuf type {@code ClientTurnSnapshotStatus} + */ + public static final class ClientTurnSnapshotStatus extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional .SpBarInfo sp_bar = 2; + */ + private final SpBarInfoOuterClass.SpBarInfo spBar = SpBarInfoOuterClass.SpBarInfo.newInstance(); + + private ClientTurnSnapshotStatus() { + } + + /** + * @return a new empty instance of {@code ClientTurnSnapshotStatus} + */ + public static ClientTurnSnapshotStatus newInstance() { + return new ClientTurnSnapshotStatus(); + } + + /** + * optional .SpBarInfo sp_bar = 2; + * @return whether the spBar field is set + */ + public boolean hasSpBar() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional .SpBarInfo sp_bar = 2; + * @return this + */ + public ClientTurnSnapshotStatus clearSpBar() { + bitField0_ &= ~0x00000001; + spBar.clear(); + return this; + } + + /** + * optional .SpBarInfo sp_bar = 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 #getMutableSpBar()} if you want to modify it. + * + * @return internal storage object for reading + */ + public SpBarInfoOuterClass.SpBarInfo getSpBar() { + return spBar; + } + + /** + * optional .SpBarInfo sp_bar = 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 SpBarInfoOuterClass.SpBarInfo getMutableSpBar() { + bitField0_ |= 0x00000001; + return spBar; + } + + /** + * optional .SpBarInfo sp_bar = 2; + * @param value the spBar to set + * @return this + */ + public ClientTurnSnapshotStatus setSpBar(final SpBarInfoOuterClass.SpBarInfo value) { + bitField0_ |= 0x00000001; + spBar.copyFrom(value); + return this; + } + + @Override + public ClientTurnSnapshotStatus copyFrom(final ClientTurnSnapshotStatus other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + spBar.copyFrom(other.spBar); + } + return this; + } + + @Override + public ClientTurnSnapshotStatus mergeFrom(final ClientTurnSnapshotStatus other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasSpBar()) { + getMutableSpBar().mergeFrom(other.spBar); + } + return this; + } + + @Override + public ClientTurnSnapshotStatus clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + spBar.clear(); + return this; + } + + @Override + public ClientTurnSnapshotStatus clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + spBar.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ClientTurnSnapshotStatus)) { + return false; + } + ClientTurnSnapshotStatus other = (ClientTurnSnapshotStatus) o; + return bitField0_ == other.bitField0_ + && (!hasSpBar() || spBar.equals(other.spBar)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 18); + output.writeMessageNoTag(spBar); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(spBar); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public ClientTurnSnapshotStatus mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 18: { + // spBar + input.readMessage(spBar); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeMessage(FieldNames.spBar, spBar); + } + output.endObject(); + } + + @Override + public ClientTurnSnapshotStatus mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 109608054: + case -896253135: { + if (input.isAtField(FieldNames.spBar)) { + if (!input.trySkipNullValue()) { + input.readMessage(spBar); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public ClientTurnSnapshotStatus clone() { + return new ClientTurnSnapshotStatus().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static ClientTurnSnapshotStatus parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshotStatus(), data).checkInitialized(); + } + + public static ClientTurnSnapshotStatus parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshotStatus(), input).checkInitialized(); + } + + public static ClientTurnSnapshotStatus parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientTurnSnapshotStatus(), input).checkInitialized(); + } + + /** + * @return factory for creating ClientTurnSnapshotStatus messages + */ + public static MessageFactory getFactory() { + return ClientTurnSnapshotStatusFactory.INSTANCE; + } + + private enum ClientTurnSnapshotStatusFactory implements MessageFactory { + INSTANCE; + + @Override + public ClientTurnSnapshotStatus create() { + return ClientTurnSnapshotStatus.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName spBar = FieldName.forField("spBar", "sp_bar"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java b/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java index 7434357..9a57c87 100644 --- a/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/SceneBattleInfoOuterClass.java @@ -59,6 +59,11 @@ public final class SceneBattleInfoOuterClass { */ private final RepeatedMessage buffList = RepeatedMessage.newEmptyInstance(BattleBuffOuterClass.BattleBuff.getFactory()); + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + */ + private final RepeatedMessage turnSnapshotList = RepeatedMessage.newEmptyInstance(ClientTurnSnapshotOuterClass.ClientTurnSnapshot.getFactory()); + private SceneBattleInfo() { } @@ -462,6 +467,77 @@ public final class SceneBattleInfoOuterClass { return this; } + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * @return whether the turnSnapshotList field is set + */ + public boolean hasTurnSnapshotList() { + return (bitField0_ & 0x00000100) != 0; + } + + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * @return this + */ + public SceneBattleInfo clearTurnSnapshotList() { + bitField0_ &= ~0x00000100; + turnSnapshotList.clear(); + return this; + } + + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * + * 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 #getMutableTurnSnapshotList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getTurnSnapshotList() { + return turnSnapshotList; + } + + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * + * 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 getMutableTurnSnapshotList( + ) { + bitField0_ |= 0x00000100; + return turnSnapshotList; + } + + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * @param value the turnSnapshotList to add + * @return this + */ + public SceneBattleInfo addTurnSnapshotList( + final ClientTurnSnapshotOuterClass.ClientTurnSnapshot value) { + bitField0_ |= 0x00000100; + turnSnapshotList.add(value); + return this; + } + + /** + * repeated .ClientTurnSnapshot turn_snapshot_list = 219; + * @param values the turnSnapshotList to add + * @return this + */ + public SceneBattleInfo addAllTurnSnapshotList( + final ClientTurnSnapshotOuterClass.ClientTurnSnapshot... values) { + bitField0_ |= 0x00000100; + turnSnapshotList.addAll(values); + return this; + } + @Override public SceneBattleInfo copyFrom(final SceneBattleInfo other) { cachedSize = other.cachedSize; @@ -475,6 +551,7 @@ public final class SceneBattleInfoOuterClass { battleAvatarList.copyFrom(other.battleAvatarList); monsterWaveList.copyFrom(other.monsterWaveList); buffList.copyFrom(other.buffList); + turnSnapshotList.copyFrom(other.turnSnapshotList); } return this; } @@ -509,6 +586,9 @@ public final class SceneBattleInfoOuterClass { if (other.hasBuffList()) { getMutableBuffList().addAll(other.buffList); } + if (other.hasTurnSnapshotList()) { + getMutableTurnSnapshotList().addAll(other.turnSnapshotList); + } return this; } @@ -527,6 +607,7 @@ public final class SceneBattleInfoOuterClass { battleAvatarList.clear(); monsterWaveList.clear(); buffList.clear(); + turnSnapshotList.clear(); return this; } @@ -540,6 +621,7 @@ public final class SceneBattleInfoOuterClass { battleAvatarList.clearQuick(); monsterWaveList.clearQuick(); buffList.clearQuick(); + turnSnapshotList.clearQuick(); return this; } @@ -560,7 +642,8 @@ public final class SceneBattleInfoOuterClass { && (!hasBattleId() || battleId == other.battleId) && (!hasBattleAvatarList() || battleAvatarList.equals(other.battleAvatarList)) && (!hasMonsterWaveList() || monsterWaveList.equals(other.monsterWaveList)) - && (!hasBuffList() || buffList.equals(other.buffList)); + && (!hasBuffList() || buffList.equals(other.buffList)) + && (!hasTurnSnapshotList() || turnSnapshotList.equals(other.turnSnapshotList)); } @Override @@ -603,6 +686,12 @@ public final class SceneBattleInfoOuterClass { output.writeMessageNoTag(buffList.get(i)); } } + if ((bitField0_ & 0x00000100) != 0) { + for (int i = 0; i < turnSnapshotList.length(); i++) { + output.writeRawLittleEndian16((short) 3546); + output.writeMessageNoTag(turnSnapshotList.get(i)); + } + } } @Override @@ -632,6 +721,9 @@ public final class SceneBattleInfoOuterClass { if ((bitField0_ & 0x00000080) != 0) { size += (1 * buffList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(buffList); } + if ((bitField0_ & 0x00000100) != 0) { + size += (2 * turnSnapshotList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(turnSnapshotList); + } return size; } @@ -707,6 +799,14 @@ public final class SceneBattleInfoOuterClass { // buffList tag = input.readRepeatedMessage(buffList, tag); bitField0_ |= 0x00000080; + if (tag != 1754) { + break; + } + } + case 1754: { + // turnSnapshotList + tag = input.readRepeatedMessage(turnSnapshotList, tag); + bitField0_ |= 0x00000100; if (tag != 0) { break; } @@ -752,6 +852,9 @@ public final class SceneBattleInfoOuterClass { if ((bitField0_ & 0x00000080) != 0) { output.writeRepeatedMessage(FieldNames.buffList, buffList); } + if ((bitField0_ & 0x00000100) != 0) { + output.writeRepeatedMessage(FieldNames.turnSnapshotList, turnSnapshotList); + } output.endObject(); } @@ -858,6 +961,18 @@ public final class SceneBattleInfoOuterClass { } break; } + case 716339615: + case 397197815: { + if (input.isAtField(FieldNames.turnSnapshotList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(turnSnapshotList); + bitField0_ |= 0x00000100; + } + } else { + input.skipUnknownField(); + } + break; + } default: { input.skipUnknownField(); break; @@ -926,6 +1041,8 @@ public final class SceneBattleInfoOuterClass { static final FieldName monsterWaveList = FieldName.forField("monsterWaveList", "monster_wave_list"); static final FieldName buffList = FieldName.forField("buffList", "buff_list"); + + static final FieldName turnSnapshotList = FieldName.forField("turnSnapshotList", "turn_snapshot_list"); } } } diff --git a/src/main/java/emu/lunarcore/data/GameData.java b/src/main/java/emu/lunarcore/data/GameData.java index 63bd0b4..1113d77 100644 --- a/src/main/java/emu/lunarcore/data/GameData.java +++ b/src/main/java/emu/lunarcore/data/GameData.java @@ -24,7 +24,7 @@ public class GameData { @Getter private static Int2ObjectMap equipExcelMap = new Int2ObjectOpenHashMap<>(); @Getter private static Int2ObjectMap relicExcelMap = new Int2ObjectOpenHashMap<>(); @Getter private static Int2ObjectMap propExcelMap = new Int2ObjectOpenHashMap<>(); - @Getter private static Int2ObjectMap npcExcelMap = new Int2ObjectOpenHashMap<>(); + @Getter private static Int2ObjectMap npcExcelMap = new Int2ObjectOpenHashMap<>(); @Getter private static Int2ObjectMap npcMonsterExcelMap = new Int2ObjectOpenHashMap<>(); @Getter private static Int2ObjectMap stageExcelMap = new Int2ObjectOpenHashMap<>(); @Getter private static Int2ObjectMap mazePlaneExcelMap = new Int2ObjectOpenHashMap<>(); diff --git a/src/main/java/emu/lunarcore/data/excel/BattleEventDataExcel.java b/src/main/java/emu/lunarcore/data/excel/BattleEventDataExcel.java new file mode 100644 index 0000000..5f76050 --- /dev/null +++ b/src/main/java/emu/lunarcore/data/excel/BattleEventDataExcel.java @@ -0,0 +1,42 @@ +package emu.lunarcore.data.excel; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import emu.lunarcore.data.GameResource; +import emu.lunarcore.data.ResourceType; +import emu.lunarcore.game.rogue.RogueBuffType; +import emu.lunarcore.util.Utils; +import lombok.Getter; + +@Getter +@ResourceType(name = {"BattleEventData.json"}) +public class BattleEventDataExcel extends GameResource { + private int BattleEventID; + private String Config; + + private static final Pattern roguePattern = Pattern.compile("(?<=Avatar_RogueBattleevent)(.*?)(?=_Config.json)"); + + @Override + public int getId() { + return BattleEventID; + } + + @Override + public void onLoad() { + try { + Matcher matcher = roguePattern.matcher(this.Config); + + if (matcher.find()) { + int rogueBuffType = Utils.parseSafeInt(matcher.group(0)); + var type = RogueBuffType.getById(rogueBuffType); + + if (type != null) { + type.setBattleEventSkill(this.BattleEventID); + } + } + } catch (Exception e) { + // Ignored + } + } +} diff --git a/src/main/java/emu/lunarcore/game/battle/Battle.java b/src/main/java/emu/lunarcore/game/battle/Battle.java index 6c6f2de..f16a8ee 100644 --- a/src/main/java/emu/lunarcore/game/battle/Battle.java +++ b/src/main/java/emu/lunarcore/game/battle/Battle.java @@ -13,11 +13,12 @@ import emu.lunarcore.game.inventory.GameItem; import emu.lunarcore.game.player.Player; import emu.lunarcore.game.player.lineup.PlayerLineup; import emu.lunarcore.game.scene.entity.EntityMonster; +import emu.lunarcore.proto.ClientTurnSnapshotOuterClass.ClientTurnSnapshot; import emu.lunarcore.proto.SceneBattleInfoOuterClass.SceneBattleInfo; import emu.lunarcore.proto.SceneMonsterOuterClass.SceneMonster; import emu.lunarcore.proto.SceneMonsterWaveOuterClass.SceneMonsterWave; import emu.lunarcore.util.Utils; - +import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntList; import lombok.Getter; import lombok.Setter; @@ -33,6 +34,8 @@ public class Battle { private final List drops; private final long timestamp; + private IntList turnSnapshotList; // TODO maybe turn it into a map? + @Setter private int staminaCost; @Setter private int levelOverride; @Setter private int roundsLimit; @@ -58,6 +61,13 @@ public class Battle { this.stages.addAll(stages); } + public IntList getTurnSnapshotList() { + if (this.turnSnapshotList == null) { + this.turnSnapshotList = new IntArrayList(); + } + return this.turnSnapshotList; + } + public StageType getStageType() { StageExcel stage = this.getFirstStage(); if (stage != null) { @@ -180,6 +190,21 @@ public class Battle { proto.addBuffList(buff.toProto()); } + // Client turn snapshots + if (this.turnSnapshotList != null) { + for (int id : this.turnSnapshotList) { + var snapshot = ClientTurnSnapshot.newInstance() + .setBattleEventId(id); + + // Temp solution + snapshot.getMutableStatus().getMutableSpBar() + .setCurSp(10000) + .setMaxSp(10000); + + proto.addTurnSnapshotList(snapshot); + } + } + return proto; } } diff --git a/src/main/java/emu/lunarcore/game/rogue/RogueBuffData.java b/src/main/java/emu/lunarcore/game/rogue/RogueBuffData.java index e1478d4..8cb9355 100644 --- a/src/main/java/emu/lunarcore/game/rogue/RogueBuffData.java +++ b/src/main/java/emu/lunarcore/game/rogue/RogueBuffData.java @@ -27,7 +27,7 @@ public class RogueBuffData { } public MazeBuff toMazeBuff() { - return new MazeBuff(id, level, 0, 0xffffffff); + return new MazeBuff(id, level, 0xffffffff, 0xffffffff); } public RogueBuff toProto() { diff --git a/src/main/java/emu/lunarcore/game/rogue/RogueBuffType.java b/src/main/java/emu/lunarcore/game/rogue/RogueBuffType.java index e23d213..2098b8b 100644 --- a/src/main/java/emu/lunarcore/game/rogue/RogueBuffType.java +++ b/src/main/java/emu/lunarcore/game/rogue/RogueBuffType.java @@ -1,6 +1,11 @@ package emu.lunarcore.game.rogue; +import java.util.Arrays; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import lombok.Getter; +import lombok.Setter; @Getter public enum RogueBuffType { @@ -15,8 +20,19 @@ public enum RogueBuffType { Propagation (127); private final int val; + @Setter private int battleEventSkill; + + private static final Int2ObjectMap map = new Int2ObjectOpenHashMap<>(); + + static { + Arrays.stream(values()).forEach(type -> map.put(type.getVal(), type)); + } private RogueBuffType(int val) { this.val = val; } + + public static RogueBuffType getById(int id) { + return map.get(id); + } } diff --git a/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java b/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java index dc47b6d..d237422 100644 --- a/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java +++ b/src/main/java/emu/lunarcore/game/rogue/RogueInstance.java @@ -8,6 +8,7 @@ import emu.lunarcore.data.excel.RogueAeonExcel; import emu.lunarcore.data.excel.RogueAreaExcel; import emu.lunarcore.data.excel.RogueMapExcel; import emu.lunarcore.game.battle.Battle; +import emu.lunarcore.game.enums.RogueBuffAeonType; import emu.lunarcore.game.player.Player; import emu.lunarcore.game.player.lineup.PlayerLineup; import emu.lunarcore.proto.AvatarTypeOuterClass.AvatarType; @@ -74,7 +75,7 @@ public class RogueInstance { if (aeonExcel != null) { this.aeonId = aeonExcel.getAeonID(); - this.aeonBuffType = aeonExcel.getRogueBuffType(); + this.aeonBuffType = aeonExcel.getRogueBuffType(); } this.initRooms(); @@ -300,7 +301,7 @@ public class RogueInstance { this.roomScore = this.getExcel().getScoreMap().get(completedRooms); this.earnedTalentCoin = this.roomScore / 10; - // Add + // Add coins to player if (this.earnedTalentCoin > 0) { this.getPlayer().addTalentPoints(this.earnedTalentCoin); this.getPlayer().save(); @@ -309,7 +310,7 @@ public class RogueInstance { // Dialogue stuff - public void selectDialogue(int dialogueEventId) { + public void onSelectDialogue(int dialogueEventId) { } @@ -318,7 +319,15 @@ public class RogueInstance { public synchronized void onBattleStart(Battle battle) { // Add rogue blessings as battle buffs for (var buff : this.getBuffs().values()) { + // Convert blessing to battle buff battle.addBuff(buff.toMazeBuff()); + // Set battle buff energy to max + if (buff.getExcel().getBattleEventBuffType() == RogueBuffAeonType.BattleEventBuff) { + RogueBuffType type = RogueBuffType.getById(getAeonBuffType()); + if (type != null && type.getBattleEventSkill() != 0) { + battle.getTurnSnapshotList().add(type.getBattleEventSkill()); + } + } } // Set monster level for battle RogueMapExcel mapExcel = GameData.getRogueMapExcel(this.getExcel().getMapId(), this.getCurrentSiteId()); diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java index cc32d37..b694617 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerSelectRogueDialogueEventCsReq.java @@ -15,7 +15,7 @@ public class HandlerSelectRogueDialogueEventCsReq extends PacketHandler { var req = SelectRogueDialogueEventCsReq.parseFrom(data); if (session.getPlayer().getRogueInstance() != null) { - session.getPlayer().getRogueInstance().selectDialogue(req.getDialogueEventId()); + session.getPlayer().getRogueInstance().onSelectDialogue(req.getDialogueEventId()); } session.send(new PacketSelectRogueDialogueEventScRsp(req.getDialogueEventId()));