From 55ff4c18b1fb03b61a3a3f0f660e36b6ba80fa8d Mon Sep 17 00:00:00 2001 From: Hiro Date: Tue, 28 Nov 2023 10:54:17 +0200 Subject: [PATCH] fix Archive --- .../proto/ArchiveDataOuterClass.java | 234 +++++++++++- .../proto/MonsterArchiveOuterClass.java | 340 ++++++++++++++++++ .../proto/RelicArchiveOuterClass.java | 339 +++++++++++++++++ .../java/emu/lunarcore/data/GameData.java | 42 +++ .../lunarcore/data/excel/MonsterExcel.java | 19 + .../emu/lunarcore/data/excel/RelicExcel.java | 3 + .../lunarcore/data/excel/RelicSetExcel.java | 19 + .../send/PacketGetArchiveDataScRsp.java | 18 + 8 files changed, 1013 insertions(+), 1 deletion(-) create mode 100644 src/generated/main/emu/lunarcore/proto/MonsterArchiveOuterClass.java create mode 100644 src/generated/main/emu/lunarcore/proto/RelicArchiveOuterClass.java create mode 100644 src/main/java/emu/lunarcore/data/excel/MonsterExcel.java create mode 100644 src/main/java/emu/lunarcore/data/excel/RelicSetExcel.java diff --git a/src/generated/main/emu/lunarcore/proto/ArchiveDataOuterClass.java b/src/generated/main/emu/lunarcore/proto/ArchiveDataOuterClass.java index 5b4c70c..3d60196 100644 --- a/src/generated/main/emu/lunarcore/proto/ArchiveDataOuterClass.java +++ b/src/generated/main/emu/lunarcore/proto/ArchiveDataOuterClass.java @@ -11,6 +11,7 @@ import us.hebi.quickbuf.ProtoMessage; import us.hebi.quickbuf.ProtoSink; import us.hebi.quickbuf.ProtoSource; import us.hebi.quickbuf.RepeatedInt; +import us.hebi.quickbuf.RepeatedMessage; public final class ArchiveDataOuterClass { /** @@ -29,6 +30,16 @@ public final class ArchiveDataOuterClass { */ private final RepeatedInt archiveAvatarIdList = RepeatedInt.newEmptyInstance(); + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + */ + private final RepeatedMessage archiveMonsterIdList = RepeatedMessage.newEmptyInstance(MonsterArchiveOuterClass.MonsterArchive.getFactory()); + + /** + * repeated .RelicArchive archive_relic_list = 11; + */ + private final RepeatedMessage archiveRelicList = RepeatedMessage.newEmptyInstance(RelicArchiveOuterClass.RelicArchive.getFactory()); + private ArchiveData() { } @@ -175,6 +186,145 @@ public final class ArchiveDataOuterClass { return this; } + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * @return whether the archiveMonsterIdList field is set + */ + public boolean hasArchiveMonsterIdList() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * @return this + */ + public ArchiveData clearArchiveMonsterIdList() { + bitField0_ &= ~0x00000004; + archiveMonsterIdList.clear(); + return this; + } + + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * + * 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 #getMutableArchiveMonsterIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getArchiveMonsterIdList() { + return archiveMonsterIdList; + } + + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * + * 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 getMutableArchiveMonsterIdList( + ) { + bitField0_ |= 0x00000004; + return archiveMonsterIdList; + } + + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * @param value the archiveMonsterIdList to add + * @return this + */ + public ArchiveData addArchiveMonsterIdList( + final MonsterArchiveOuterClass.MonsterArchive value) { + bitField0_ |= 0x00000004; + archiveMonsterIdList.add(value); + return this; + } + + /** + * repeated .MonsterArchive archive_monster_id_list = 7; + * @param values the archiveMonsterIdList to add + * @return this + */ + public ArchiveData addAllArchiveMonsterIdList( + final MonsterArchiveOuterClass.MonsterArchive... values) { + bitField0_ |= 0x00000004; + archiveMonsterIdList.addAll(values); + return this; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * @return whether the archiveRelicList field is set + */ + public boolean hasArchiveRelicList() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * @return this + */ + public ArchiveData clearArchiveRelicList() { + bitField0_ &= ~0x00000008; + archiveRelicList.clear(); + return this; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * + * 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 #getMutableArchiveRelicList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getArchiveRelicList() { + return archiveRelicList; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * + * 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 getMutableArchiveRelicList() { + bitField0_ |= 0x00000008; + return archiveRelicList; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * @param value the archiveRelicList to add + * @return this + */ + public ArchiveData addArchiveRelicList(final RelicArchiveOuterClass.RelicArchive value) { + bitField0_ |= 0x00000008; + archiveRelicList.add(value); + return this; + } + + /** + * repeated .RelicArchive archive_relic_list = 11; + * @param values the archiveRelicList to add + * @return this + */ + public ArchiveData addAllArchiveRelicList(final RelicArchiveOuterClass.RelicArchive... values) { + bitField0_ |= 0x00000008; + archiveRelicList.addAll(values); + return this; + } + @Override public ArchiveData copyFrom(final ArchiveData other) { cachedSize = other.cachedSize; @@ -182,6 +332,8 @@ public final class ArchiveDataOuterClass { bitField0_ = other.bitField0_; archiveEquipmentIdList.copyFrom(other.archiveEquipmentIdList); archiveAvatarIdList.copyFrom(other.archiveAvatarIdList); + archiveMonsterIdList.copyFrom(other.archiveMonsterIdList); + archiveRelicList.copyFrom(other.archiveRelicList); } return this; } @@ -198,6 +350,12 @@ public final class ArchiveDataOuterClass { if (other.hasArchiveAvatarIdList()) { getMutableArchiveAvatarIdList().addAll(other.archiveAvatarIdList); } + if (other.hasArchiveMonsterIdList()) { + getMutableArchiveMonsterIdList().addAll(other.archiveMonsterIdList); + } + if (other.hasArchiveRelicList()) { + getMutableArchiveRelicList().addAll(other.archiveRelicList); + } return this; } @@ -210,6 +368,8 @@ public final class ArchiveDataOuterClass { bitField0_ = 0; archiveEquipmentIdList.clear(); archiveAvatarIdList.clear(); + archiveMonsterIdList.clear(); + archiveRelicList.clear(); return this; } @@ -222,6 +382,8 @@ public final class ArchiveDataOuterClass { bitField0_ = 0; archiveEquipmentIdList.clear(); archiveAvatarIdList.clear(); + archiveMonsterIdList.clearQuick(); + archiveRelicList.clearQuick(); return this; } @@ -236,7 +398,9 @@ public final class ArchiveDataOuterClass { ArchiveData other = (ArchiveData) o; return bitField0_ == other.bitField0_ && (!hasArchiveEquipmentIdList() || archiveEquipmentIdList.equals(other.archiveEquipmentIdList)) - && (!hasArchiveAvatarIdList() || archiveAvatarIdList.equals(other.archiveAvatarIdList)); + && (!hasArchiveAvatarIdList() || archiveAvatarIdList.equals(other.archiveAvatarIdList)) + && (!hasArchiveMonsterIdList() || archiveMonsterIdList.equals(other.archiveMonsterIdList)) + && (!hasArchiveRelicList() || archiveRelicList.equals(other.archiveRelicList)); } @Override @@ -253,6 +417,18 @@ public final class ArchiveDataOuterClass { output.writeUInt32NoTag(archiveAvatarIdList.array()[i]); } } + if ((bitField0_ & 0x00000004) != 0) { + for (int i = 0; i < archiveMonsterIdList.length(); i++) { + output.writeRawByte((byte) 58); + output.writeMessageNoTag(archiveMonsterIdList.get(i)); + } + } + if ((bitField0_ & 0x00000008) != 0) { + for (int i = 0; i < archiveRelicList.length(); i++) { + output.writeRawByte((byte) 90); + output.writeMessageNoTag(archiveRelicList.get(i)); + } + } } @Override @@ -264,6 +440,12 @@ public final class ArchiveDataOuterClass { if ((bitField0_ & 0x00000002) != 0) { size += (1 * archiveAvatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(archiveAvatarIdList); } + if ((bitField0_ & 0x00000004) != 0) { + size += (1 * archiveMonsterIdList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(archiveMonsterIdList); + } + if ((bitField0_ & 0x00000008) != 0) { + size += (1 * archiveRelicList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(archiveRelicList); + } return size; } @@ -288,6 +470,22 @@ public final class ArchiveDataOuterClass { input.readPackedUInt32(archiveAvatarIdList, tag); bitField0_ |= 0x00000002; tag = input.readTag(); + if (tag != 58) { + break; + } + } + case 58: { + // archiveMonsterIdList + tag = input.readRepeatedMessage(archiveMonsterIdList, tag); + bitField0_ |= 0x00000004; + if (tag != 90) { + break; + } + } + case 90: { + // archiveRelicList + tag = input.readRepeatedMessage(archiveRelicList, tag); + bitField0_ |= 0x00000008; if (tag != 0) { break; } @@ -327,6 +525,12 @@ public final class ArchiveDataOuterClass { if ((bitField0_ & 0x00000002) != 0) { output.writeRepeatedUInt32(FieldNames.archiveAvatarIdList, archiveAvatarIdList); } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRepeatedMessage(FieldNames.archiveMonsterIdList, archiveMonsterIdList); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRepeatedMessage(FieldNames.archiveRelicList, archiveRelicList); + } output.endObject(); } @@ -361,6 +565,30 @@ public final class ArchiveDataOuterClass { } break; } + case 912174897: + case 1817787488: { + if (input.isAtField(FieldNames.archiveMonsterIdList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(archiveMonsterIdList); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1742876687: + case 2101828999: { + if (input.isAtField(FieldNames.archiveRelicList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(archiveRelicList); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } default: { input.skipUnknownField(); break; @@ -416,6 +644,10 @@ public final class ArchiveDataOuterClass { static final FieldName archiveEquipmentIdList = FieldName.forField("archiveEquipmentIdList", "archive_equipment_id_list"); static final FieldName archiveAvatarIdList = FieldName.forField("archiveAvatarIdList", "archive_avatar_id_list"); + + static final FieldName archiveMonsterIdList = FieldName.forField("archiveMonsterIdList", "archive_monster_id_list"); + + static final FieldName archiveRelicList = FieldName.forField("archiveRelicList", "archive_relic_list"); } } } diff --git a/src/generated/main/emu/lunarcore/proto/MonsterArchiveOuterClass.java b/src/generated/main/emu/lunarcore/proto/MonsterArchiveOuterClass.java new file mode 100644 index 0000000..c3d1840 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/MonsterArchiveOuterClass.java @@ -0,0 +1,340 @@ +// 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 MonsterArchiveOuterClass { + /** + * Protobuf type {@code MonsterArchive} + */ + public static final class MonsterArchive extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 num = 9; + */ + private int num; + + /** + * optional uint32 monster_id = 11; + */ + private int monsterId; + + private MonsterArchive() { + } + + /** + * @return a new empty instance of {@code MonsterArchive} + */ + public static MonsterArchive newInstance() { + return new MonsterArchive(); + } + + /** + * optional uint32 num = 9; + * @return whether the num field is set + */ + public boolean hasNum() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 num = 9; + * @return this + */ + public MonsterArchive clearNum() { + bitField0_ &= ~0x00000001; + num = 0; + return this; + } + + /** + * optional uint32 num = 9; + * @return the num + */ + public int getNum() { + return num; + } + + /** + * optional uint32 num = 9; + * @param value the num to set + * @return this + */ + public MonsterArchive setNum(final int value) { + bitField0_ |= 0x00000001; + num = value; + return this; + } + + /** + * optional uint32 monster_id = 11; + * @return whether the monsterId field is set + */ + public boolean hasMonsterId() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 monster_id = 11; + * @return this + */ + public MonsterArchive clearMonsterId() { + bitField0_ &= ~0x00000002; + monsterId = 0; + return this; + } + + /** + * optional uint32 monster_id = 11; + * @return the monsterId + */ + public int getMonsterId() { + return monsterId; + } + + /** + * optional uint32 monster_id = 11; + * @param value the monsterId to set + * @return this + */ + public MonsterArchive setMonsterId(final int value) { + bitField0_ |= 0x00000002; + monsterId = value; + return this; + } + + @Override + public MonsterArchive copyFrom(final MonsterArchive other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + num = other.num; + monsterId = other.monsterId; + } + return this; + } + + @Override + public MonsterArchive mergeFrom(final MonsterArchive other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasNum()) { + setNum(other.num); + } + if (other.hasMonsterId()) { + setMonsterId(other.monsterId); + } + return this; + } + + @Override + public MonsterArchive clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + num = 0; + monsterId = 0; + return this; + } + + @Override + public MonsterArchive 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 MonsterArchive)) { + return false; + } + MonsterArchive other = (MonsterArchive) o; + return bitField0_ == other.bitField0_ + && (!hasNum() || num == other.num) + && (!hasMonsterId() || monsterId == other.monsterId); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 72); + output.writeUInt32NoTag(num); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 88); + output.writeUInt32NoTag(monsterId); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(num); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(monsterId); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public MonsterArchive mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 72: { + // num + num = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 88) { + break; + } + } + case 88: { + // monsterId + monsterId = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.num, num); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.monsterId, monsterId); + } + output.endObject(); + } + + @Override + public MonsterArchive mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 109446: { + if (input.isAtField(FieldNames.num)) { + if (!input.trySkipNullValue()) { + num = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1316830571: + case 2127946656: { + if (input.isAtField(FieldNames.monsterId)) { + if (!input.trySkipNullValue()) { + monsterId = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public MonsterArchive clone() { + return new MonsterArchive().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static MonsterArchive parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new MonsterArchive(), data).checkInitialized(); + } + + public static MonsterArchive parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new MonsterArchive(), input).checkInitialized(); + } + + public static MonsterArchive parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new MonsterArchive(), input).checkInitialized(); + } + + /** + * @return factory for creating MonsterArchive messages + */ + public static MessageFactory getFactory() { + return MonsterArchiveFactory.INSTANCE; + } + + private enum MonsterArchiveFactory implements MessageFactory { + INSTANCE; + + @Override + public MonsterArchive create() { + return MonsterArchive.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName num = FieldName.forField("num"); + + static final FieldName monsterId = FieldName.forField("monsterId", "monster_id"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/RelicArchiveOuterClass.java b/src/generated/main/emu/lunarcore/proto/RelicArchiveOuterClass.java new file mode 100644 index 0000000..56712d5 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/RelicArchiveOuterClass.java @@ -0,0 +1,339 @@ +// 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 RelicArchiveOuterClass { + /** + * Protobuf type {@code RelicArchive} + */ + public static final class RelicArchive extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 type = 6; + */ + private int type; + + /** + * optional uint32 relic_id = 8; + */ + private int relicId; + + private RelicArchive() { + } + + /** + * @return a new empty instance of {@code RelicArchive} + */ + public static RelicArchive newInstance() { + return new RelicArchive(); + } + + /** + * optional uint32 type = 6; + * @return whether the type field is set + */ + public boolean hasType() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 type = 6; + * @return this + */ + public RelicArchive clearType() { + bitField0_ &= ~0x00000001; + type = 0; + return this; + } + + /** + * optional uint32 type = 6; + * @return the type + */ + public int getType() { + return type; + } + + /** + * optional uint32 type = 6; + * @param value the type to set + * @return this + */ + public RelicArchive setType(final int value) { + bitField0_ |= 0x00000001; + type = value; + return this; + } + + /** + * optional uint32 relic_id = 8; + * @return whether the relicId field is set + */ + public boolean hasRelicId() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 relic_id = 8; + * @return this + */ + public RelicArchive clearRelicId() { + bitField0_ &= ~0x00000002; + relicId = 0; + return this; + } + + /** + * optional uint32 relic_id = 8; + * @return the relicId + */ + public int getRelicId() { + return relicId; + } + + /** + * optional uint32 relic_id = 8; + * @param value the relicId to set + * @return this + */ + public RelicArchive setRelicId(final int value) { + bitField0_ |= 0x00000002; + relicId = value; + return this; + } + + @Override + public RelicArchive copyFrom(final RelicArchive other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + type = other.type; + relicId = other.relicId; + } + return this; + } + + @Override + public RelicArchive mergeFrom(final RelicArchive other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasType()) { + setType(other.type); + } + if (other.hasRelicId()) { + setRelicId(other.relicId); + } + return this; + } + + @Override + public RelicArchive clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + type = 0; + relicId = 0; + return this; + } + + @Override + public RelicArchive 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 RelicArchive)) { + return false; + } + RelicArchive other = (RelicArchive) o; + return bitField0_ == other.bitField0_ + && (!hasType() || type == other.type) + && (!hasRelicId() || relicId == other.relicId); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 48); + output.writeUInt32NoTag(type); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 64); + output.writeUInt32NoTag(relicId); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(type); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(relicId); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public RelicArchive mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 48: { + // type + type = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 64) { + break; + } + } + case 64: { + // relicId + relicId = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.type, type); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.relicId, relicId); + } + output.endObject(); + } + + @Override + public RelicArchive mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3575610: { + if (input.isAtField(FieldNames.type)) { + if (!input.trySkipNullValue()) { + type = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1090714606: + case -547564185: { + if (input.isAtField(FieldNames.relicId)) { + if (!input.trySkipNullValue()) { + relicId = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public RelicArchive clone() { + return new RelicArchive().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static RelicArchive parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new RelicArchive(), data).checkInitialized(); + } + + public static RelicArchive parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new RelicArchive(), input).checkInitialized(); + } + + public static RelicArchive parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new RelicArchive(), input).checkInitialized(); + } + + /** + * @return factory for creating RelicArchive messages + */ + public static MessageFactory getFactory() { + return RelicArchiveFactory.INSTANCE; + } + + private enum RelicArchiveFactory implements MessageFactory { + INSTANCE; + + @Override + public RelicArchive create() { + return RelicArchive.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName type = FieldName.forField("type"); + + static final FieldName relicId = FieldName.forField("relicId", "relic_id"); + } + } +} diff --git a/src/main/java/emu/lunarcore/data/GameData.java b/src/main/java/emu/lunarcore/data/GameData.java index 38a003b..4d17eb2 100644 --- a/src/main/java/emu/lunarcore/data/GameData.java +++ b/src/main/java/emu/lunarcore/data/GameData.java @@ -58,6 +58,7 @@ public class GameData { private static Int2ObjectMap chatBubbleExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap phoneThemeExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap monsterDropExcelMap = new Int2ObjectOpenHashMap<>(); + private static Int2ObjectMap monsterExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap playerLevelExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap expTypeExcelMap = new Int2ObjectOpenHashMap<>(); @@ -66,6 +67,7 @@ public class GameData { private static Int2ObjectMap relicMainAffixExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap relicSubAffixExcelMap = new Int2ObjectOpenHashMap<>(); + private static Int2ObjectMap relicSetExcelMap = new Int2ObjectOpenHashMap<>(); // Configs (Bin) @Getter private static Object2ObjectMap floorInfos = new Object2ObjectOpenHashMap<>(); @@ -98,6 +100,35 @@ public class GameData { return allIds; } + public static List getAllRelicIds() { + List allIds = new ArrayList<>(); + + for (Int2ObjectMap.Entry entry : relicExcelMap.int2ObjectEntrySet()) { + RelicExcel relicExcel = entry.getValue(); + allIds.add(relicExcel.getId()); + } + + return allIds; + } + + public static int getRelicSetFromId(int relicId) { + RelicExcel relicExcel = GameData.getRelicExcelMap().get(relicId); + + if (relicExcel == null) { + return 0; + } + return relicExcel.getSetId(); + } + + public static int getRelicTypeFromId(int relicId) { + RelicExcel relicExcel = GameData.getRelicExcelMap().get(relicId); + + if (relicExcel == null) { + return 0; + } + return relicExcel.getType().getVal(); + } + public static List getAllMusicIds() { List allIds = new ArrayList<>(); @@ -109,6 +140,17 @@ public class GameData { return allIds; } + public static List getAllMonsterIds() { + List allIds = new ArrayList<>(); + + for (Int2ObjectMap.Entry entry : monsterExcelMap.int2ObjectEntrySet()) { + MonsterExcel monsterExcel = entry.getValue(); + allIds.add(monsterExcel.getId()); + } + + return allIds; + } + public static int getMusicGroupId(int musicId) { var excel = backGroundMusicExcelMap.get(musicId); return excel != null ? excel.getGroupId() : 0; diff --git a/src/main/java/emu/lunarcore/data/excel/MonsterExcel.java b/src/main/java/emu/lunarcore/data/excel/MonsterExcel.java new file mode 100644 index 0000000..ad96d45 --- /dev/null +++ b/src/main/java/emu/lunarcore/data/excel/MonsterExcel.java @@ -0,0 +1,19 @@ +package emu.lunarcore.data.excel; + +import java.util.List; + +import emu.lunarcore.data.GameResource; +import emu.lunarcore.data.ResourceType; +import emu.lunarcore.data.common.ItemParam; +import lombok.Getter; + +@Getter +@ResourceType(name = {"MonsterConfig.json"}) +public class MonsterExcel extends GameResource { + private int MonsterID; + + @Override + public int getId() { + return MonsterID; + } +} diff --git a/src/main/java/emu/lunarcore/data/excel/RelicExcel.java b/src/main/java/emu/lunarcore/data/excel/RelicExcel.java index d535e30..4cd8a8e 100644 --- a/src/main/java/emu/lunarcore/data/excel/RelicExcel.java +++ b/src/main/java/emu/lunarcore/data/excel/RelicExcel.java @@ -26,6 +26,9 @@ public class RelicExcel extends GameResource { public int getId() { return ID; } + public int getSetId() { + return SetID; + } @Override public void onLoad() { diff --git a/src/main/java/emu/lunarcore/data/excel/RelicSetExcel.java b/src/main/java/emu/lunarcore/data/excel/RelicSetExcel.java new file mode 100644 index 0000000..4429447 --- /dev/null +++ b/src/main/java/emu/lunarcore/data/excel/RelicSetExcel.java @@ -0,0 +1,19 @@ +package emu.lunarcore.data.excel; + +import emu.lunarcore.data.GameDepot; +import emu.lunarcore.data.GameResource; +import emu.lunarcore.data.ResourceType; +import emu.lunarcore.data.ResourceType.LoadPriority; +import emu.lunarcore.game.enums.AvatarPropertyType; +import lombok.Getter; + +@Getter +@ResourceType(name = {"RelicSetConfig.json"}, loadPriority = LoadPriority.NORMAL) +public class RelicSetExcel extends GameResource { + private int SetID; + + @Override + public int getId() { + return SetID; + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetArchiveDataScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetArchiveDataScRsp.java index b73c7be..45cbf84 100644 --- a/src/main/java/emu/lunarcore/server/packet/send/PacketGetArchiveDataScRsp.java +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetArchiveDataScRsp.java @@ -2,6 +2,8 @@ package emu.lunarcore.server.packet.send; import emu.lunarcore.data.GameData; import emu.lunarcore.proto.GetArchiveDataScRspOuterClass.GetArchiveDataScRsp; +import emu.lunarcore.proto.MonsterArchiveOuterClass.MonsterArchive; +import emu.lunarcore.proto.RelicArchiveOuterClass.RelicArchive; import emu.lunarcore.server.packet.BasePacket; import emu.lunarcore.server.packet.CmdId; @@ -16,6 +18,22 @@ public class PacketGetArchiveDataScRsp extends BasePacket { for (var avatarExcel : GameData.getAvatarExcelMap().values()) { data.getMutableArchiveData().addArchiveAvatarIdList(avatarExcel.getAvatarID()); } + + for (var MonsterId : GameData.getAllMonsterIds()) { + MonsterArchive monsterinfo = MonsterArchive.newInstance() + .setMonsterId(MonsterId) + .setNum(1); // todo: add to db + + data.getMutableArchiveData().addArchiveMonsterIdList(monsterinfo); + } + + for (var RelicId : GameData.getAllRelicIds()) { + RelicArchive relicInfo = RelicArchive.newInstance() + .setType(GameData.getRelicTypeFromId(RelicId)) + .setRelicId(GameData.getRelicSetFromId(RelicId)); // todo: add to db + + data.getMutableArchiveData().addArchiveRelicList(relicInfo); + } for (var itemExcel : GameData.getItemExcelMap().values()) { if (!itemExcel.isEquipment()) continue;