fix Archive

This commit is contained in:
Hiro
2023-11-28 10:54:17 +02:00
parent 9f40c17cb6
commit 55ff4c18b1
8 changed files with 1013 additions and 1 deletions

View File

@@ -11,6 +11,7 @@ import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink; import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource; import us.hebi.quickbuf.ProtoSource;
import us.hebi.quickbuf.RepeatedInt; import us.hebi.quickbuf.RepeatedInt;
import us.hebi.quickbuf.RepeatedMessage;
public final class ArchiveDataOuterClass { public final class ArchiveDataOuterClass {
/** /**
@@ -29,6 +30,16 @@ public final class ArchiveDataOuterClass {
*/ */
private final RepeatedInt archiveAvatarIdList = RepeatedInt.newEmptyInstance(); private final RepeatedInt archiveAvatarIdList = RepeatedInt.newEmptyInstance();
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
*/
private final RepeatedMessage<MonsterArchiveOuterClass.MonsterArchive> archiveMonsterIdList = RepeatedMessage.newEmptyInstance(MonsterArchiveOuterClass.MonsterArchive.getFactory());
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
*/
private final RepeatedMessage<RelicArchiveOuterClass.RelicArchive> archiveRelicList = RepeatedMessage.newEmptyInstance(RelicArchiveOuterClass.RelicArchive.getFactory());
private ArchiveData() { private ArchiveData() {
} }
@@ -175,6 +186,145 @@ public final class ArchiveDataOuterClass {
return this; return this;
} }
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
* @return whether the archiveMonsterIdList field is set
*/
public boolean hasArchiveMonsterIdList() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
* @return this
*/
public ArchiveData clearArchiveMonsterIdList() {
bitField0_ &= ~0x00000004;
archiveMonsterIdList.clear();
return this;
}
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableArchiveMonsterIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<MonsterArchiveOuterClass.MonsterArchive> getArchiveMonsterIdList() {
return archiveMonsterIdList;
}
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<MonsterArchiveOuterClass.MonsterArchive> getMutableArchiveMonsterIdList(
) {
bitField0_ |= 0x00000004;
return archiveMonsterIdList;
}
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
* @param value the archiveMonsterIdList to add
* @return this
*/
public ArchiveData addArchiveMonsterIdList(
final MonsterArchiveOuterClass.MonsterArchive value) {
bitField0_ |= 0x00000004;
archiveMonsterIdList.add(value);
return this;
}
/**
* <code>repeated .MonsterArchive archive_monster_id_list = 7;</code>
* @param values the archiveMonsterIdList to add
* @return this
*/
public ArchiveData addAllArchiveMonsterIdList(
final MonsterArchiveOuterClass.MonsterArchive... values) {
bitField0_ |= 0x00000004;
archiveMonsterIdList.addAll(values);
return this;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
* @return whether the archiveRelicList field is set
*/
public boolean hasArchiveRelicList() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
* @return this
*/
public ArchiveData clearArchiveRelicList() {
bitField0_ &= ~0x00000008;
archiveRelicList.clear();
return this;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableArchiveRelicList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<RelicArchiveOuterClass.RelicArchive> getArchiveRelicList() {
return archiveRelicList;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<RelicArchiveOuterClass.RelicArchive> getMutableArchiveRelicList() {
bitField0_ |= 0x00000008;
return archiveRelicList;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
* @param value the archiveRelicList to add
* @return this
*/
public ArchiveData addArchiveRelicList(final RelicArchiveOuterClass.RelicArchive value) {
bitField0_ |= 0x00000008;
archiveRelicList.add(value);
return this;
}
/**
* <code>repeated .RelicArchive archive_relic_list = 11;</code>
* @param values the archiveRelicList to add
* @return this
*/
public ArchiveData addAllArchiveRelicList(final RelicArchiveOuterClass.RelicArchive... values) {
bitField0_ |= 0x00000008;
archiveRelicList.addAll(values);
return this;
}
@Override @Override
public ArchiveData copyFrom(final ArchiveData other) { public ArchiveData copyFrom(final ArchiveData other) {
cachedSize = other.cachedSize; cachedSize = other.cachedSize;
@@ -182,6 +332,8 @@ public final class ArchiveDataOuterClass {
bitField0_ = other.bitField0_; bitField0_ = other.bitField0_;
archiveEquipmentIdList.copyFrom(other.archiveEquipmentIdList); archiveEquipmentIdList.copyFrom(other.archiveEquipmentIdList);
archiveAvatarIdList.copyFrom(other.archiveAvatarIdList); archiveAvatarIdList.copyFrom(other.archiveAvatarIdList);
archiveMonsterIdList.copyFrom(other.archiveMonsterIdList);
archiveRelicList.copyFrom(other.archiveRelicList);
} }
return this; return this;
} }
@@ -198,6 +350,12 @@ public final class ArchiveDataOuterClass {
if (other.hasArchiveAvatarIdList()) { if (other.hasArchiveAvatarIdList()) {
getMutableArchiveAvatarIdList().addAll(other.archiveAvatarIdList); getMutableArchiveAvatarIdList().addAll(other.archiveAvatarIdList);
} }
if (other.hasArchiveMonsterIdList()) {
getMutableArchiveMonsterIdList().addAll(other.archiveMonsterIdList);
}
if (other.hasArchiveRelicList()) {
getMutableArchiveRelicList().addAll(other.archiveRelicList);
}
return this; return this;
} }
@@ -210,6 +368,8 @@ public final class ArchiveDataOuterClass {
bitField0_ = 0; bitField0_ = 0;
archiveEquipmentIdList.clear(); archiveEquipmentIdList.clear();
archiveAvatarIdList.clear(); archiveAvatarIdList.clear();
archiveMonsterIdList.clear();
archiveRelicList.clear();
return this; return this;
} }
@@ -222,6 +382,8 @@ public final class ArchiveDataOuterClass {
bitField0_ = 0; bitField0_ = 0;
archiveEquipmentIdList.clear(); archiveEquipmentIdList.clear();
archiveAvatarIdList.clear(); archiveAvatarIdList.clear();
archiveMonsterIdList.clearQuick();
archiveRelicList.clearQuick();
return this; return this;
} }
@@ -236,7 +398,9 @@ public final class ArchiveDataOuterClass {
ArchiveData other = (ArchiveData) o; ArchiveData other = (ArchiveData) o;
return bitField0_ == other.bitField0_ return bitField0_ == other.bitField0_
&& (!hasArchiveEquipmentIdList() || archiveEquipmentIdList.equals(other.archiveEquipmentIdList)) && (!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 @Override
@@ -253,6 +417,18 @@ public final class ArchiveDataOuterClass {
output.writeUInt32NoTag(archiveAvatarIdList.array()[i]); 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 @Override
@@ -264,6 +440,12 @@ public final class ArchiveDataOuterClass {
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
size += (1 * archiveAvatarIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(archiveAvatarIdList); 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; return size;
} }
@@ -288,6 +470,22 @@ public final class ArchiveDataOuterClass {
input.readPackedUInt32(archiveAvatarIdList, tag); input.readPackedUInt32(archiveAvatarIdList, tag);
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
tag = input.readTag(); 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) { if (tag != 0) {
break; break;
} }
@@ -327,6 +525,12 @@ public final class ArchiveDataOuterClass {
if ((bitField0_ & 0x00000002) != 0) { if ((bitField0_ & 0x00000002) != 0) {
output.writeRepeatedUInt32(FieldNames.archiveAvatarIdList, archiveAvatarIdList); 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(); output.endObject();
} }
@@ -361,6 +565,30 @@ public final class ArchiveDataOuterClass {
} }
break; 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: { default: {
input.skipUnknownField(); input.skipUnknownField();
break; break;
@@ -416,6 +644,10 @@ public final class ArchiveDataOuterClass {
static final FieldName archiveEquipmentIdList = FieldName.forField("archiveEquipmentIdList", "archive_equipment_id_list"); 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 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");
} }
} }
} }

View File

@@ -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<MonsterArchive> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 num = 9;</code>
*/
private int num;
/**
* <code>optional uint32 monster_id = 11;</code>
*/
private int monsterId;
private MonsterArchive() {
}
/**
* @return a new empty instance of {@code MonsterArchive}
*/
public static MonsterArchive newInstance() {
return new MonsterArchive();
}
/**
* <code>optional uint32 num = 9;</code>
* @return whether the num field is set
*/
public boolean hasNum() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 num = 9;</code>
* @return this
*/
public MonsterArchive clearNum() {
bitField0_ &= ~0x00000001;
num = 0;
return this;
}
/**
* <code>optional uint32 num = 9;</code>
* @return the num
*/
public int getNum() {
return num;
}
/**
* <code>optional uint32 num = 9;</code>
* @param value the num to set
* @return this
*/
public MonsterArchive setNum(final int value) {
bitField0_ |= 0x00000001;
num = value;
return this;
}
/**
* <code>optional uint32 monster_id = 11;</code>
* @return whether the monsterId field is set
*/
public boolean hasMonsterId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 monster_id = 11;</code>
* @return this
*/
public MonsterArchive clearMonsterId() {
bitField0_ &= ~0x00000002;
monsterId = 0;
return this;
}
/**
* <code>optional uint32 monster_id = 11;</code>
* @return the monsterId
*/
public int getMonsterId() {
return monsterId;
}
/**
* <code>optional uint32 monster_id = 11;</code>
* @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<MonsterArchive> getFactory() {
return MonsterArchiveFactory.INSTANCE;
}
private enum MonsterArchiveFactory implements MessageFactory<MonsterArchive> {
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");
}
}
}

View File

@@ -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<RelicArchive> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 type = 6;</code>
*/
private int type;
/**
* <code>optional uint32 relic_id = 8;</code>
*/
private int relicId;
private RelicArchive() {
}
/**
* @return a new empty instance of {@code RelicArchive}
*/
public static RelicArchive newInstance() {
return new RelicArchive();
}
/**
* <code>optional uint32 type = 6;</code>
* @return whether the type field is set
*/
public boolean hasType() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 type = 6;</code>
* @return this
*/
public RelicArchive clearType() {
bitField0_ &= ~0x00000001;
type = 0;
return this;
}
/**
* <code>optional uint32 type = 6;</code>
* @return the type
*/
public int getType() {
return type;
}
/**
* <code>optional uint32 type = 6;</code>
* @param value the type to set
* @return this
*/
public RelicArchive setType(final int value) {
bitField0_ |= 0x00000001;
type = value;
return this;
}
/**
* <code>optional uint32 relic_id = 8;</code>
* @return whether the relicId field is set
*/
public boolean hasRelicId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 relic_id = 8;</code>
* @return this
*/
public RelicArchive clearRelicId() {
bitField0_ &= ~0x00000002;
relicId = 0;
return this;
}
/**
* <code>optional uint32 relic_id = 8;</code>
* @return the relicId
*/
public int getRelicId() {
return relicId;
}
/**
* <code>optional uint32 relic_id = 8;</code>
* @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<RelicArchive> getFactory() {
return RelicArchiveFactory.INSTANCE;
}
private enum RelicArchiveFactory implements MessageFactory<RelicArchive> {
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");
}
}
}

View File

@@ -58,6 +58,7 @@ public class GameData {
private static Int2ObjectMap<ChatBubbleExcel> chatBubbleExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<ChatBubbleExcel> chatBubbleExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<PhoneThemeExcel> phoneThemeExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<PhoneThemeExcel> phoneThemeExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<MonsterDropExcel> monsterDropExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<MonsterDropExcel> monsterDropExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<MonsterExcel> monsterExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<PlayerLevelExcel> playerLevelExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<PlayerLevelExcel> playerLevelExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<ExpTypeExcel> expTypeExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<ExpTypeExcel> expTypeExcelMap = new Int2ObjectOpenHashMap<>();
@@ -66,6 +67,7 @@ public class GameData {
private static Int2ObjectMap<RelicMainAffixExcel> relicMainAffixExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<RelicMainAffixExcel> relicMainAffixExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<RelicSubAffixExcel> relicSubAffixExcelMap = new Int2ObjectOpenHashMap<>(); private static Int2ObjectMap<RelicSubAffixExcel> relicSubAffixExcelMap = new Int2ObjectOpenHashMap<>();
private static Int2ObjectMap<RelicSetExcel> relicSetExcelMap = new Int2ObjectOpenHashMap<>();
// Configs (Bin) // Configs (Bin)
@Getter private static Object2ObjectMap<String, FloorInfo> floorInfos = new Object2ObjectOpenHashMap<>(); @Getter private static Object2ObjectMap<String, FloorInfo> floorInfos = new Object2ObjectOpenHashMap<>();
@@ -98,6 +100,35 @@ public class GameData {
return allIds; return allIds;
} }
public static List<Integer> getAllRelicIds() {
List<Integer> allIds = new ArrayList<>();
for (Int2ObjectMap.Entry<RelicExcel> 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<Integer> getAllMusicIds() { public static List<Integer> getAllMusicIds() {
List<Integer> allIds = new ArrayList<>(); List<Integer> allIds = new ArrayList<>();
@@ -109,6 +140,17 @@ public class GameData {
return allIds; return allIds;
} }
public static List<Integer> getAllMonsterIds() {
List<Integer> allIds = new ArrayList<>();
for (Int2ObjectMap.Entry<MonsterExcel> entry : monsterExcelMap.int2ObjectEntrySet()) {
MonsterExcel monsterExcel = entry.getValue();
allIds.add(monsterExcel.getId());
}
return allIds;
}
public static int getMusicGroupId(int musicId) { public static int getMusicGroupId(int musicId) {
var excel = backGroundMusicExcelMap.get(musicId); var excel = backGroundMusicExcelMap.get(musicId);
return excel != null ? excel.getGroupId() : 0; return excel != null ? excel.getGroupId() : 0;

View File

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

View File

@@ -26,6 +26,9 @@ public class RelicExcel extends GameResource {
public int getId() { public int getId() {
return ID; return ID;
} }
public int getSetId() {
return SetID;
}
@Override @Override
public void onLoad() { public void onLoad() {

View File

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

View File

@@ -2,6 +2,8 @@ package emu.lunarcore.server.packet.send;
import emu.lunarcore.data.GameData; import emu.lunarcore.data.GameData;
import emu.lunarcore.proto.GetArchiveDataScRspOuterClass.GetArchiveDataScRsp; 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.BasePacket;
import emu.lunarcore.server.packet.CmdId; import emu.lunarcore.server.packet.CmdId;
@@ -16,6 +18,22 @@ public class PacketGetArchiveDataScRsp extends BasePacket {
for (var avatarExcel : GameData.getAvatarExcelMap().values()) { for (var avatarExcel : GameData.getAvatarExcelMap().values()) {
data.getMutableArchiveData().addArchiveAvatarIdList(avatarExcel.getAvatarID()); 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()) { for (var itemExcel : GameData.getItemExcelMap().values()) {
if (!itemExcel.isEquipment()) continue; if (!itemExcel.isEquipment()) continue;