diff --git a/src/generated/main/emu/lunarcore/proto/ClientMailOuterClass.java b/src/generated/main/emu/lunarcore/proto/ClientMailOuterClass.java new file mode 100644 index 0000000..08ee2ea --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/ClientMailOuterClass.java @@ -0,0 +1,1239 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedString; +import us.hebi.quickbuf.Utf8String; + +public final class ClientMailOuterClass { + /** + * Protobuf type {@code ClientMail} + */ + public static final class ClientMail extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional int64 expire_time = 2; + */ + private long expireTime; + + /** + * optional int64 time = 14; + */ + private long time; + + /** + * optional uint32 id = 4; + */ + private int id; + + /** + * optional uint32 template_id = 11; + */ + private int templateId; + + /** + * optional .MailType mail_type = 3; + */ + private int mailType; + + /** + * optional bool is_read = 9; + */ + private boolean isRead; + + /** + * optional .ItemList attachment = 10; + */ + private final ItemListOuterClass.ItemList attachment = ItemListOuterClass.ItemList.newInstance(); + + /** + * optional string title = 5; + */ + private final Utf8String title = Utf8String.newEmptyInstance(); + + /** + * optional string sender = 6; + */ + private final Utf8String sender = Utf8String.newEmptyInstance(); + + /** + * optional string content = 7; + */ + private final Utf8String content = Utf8String.newEmptyInstance(); + + /** + * repeated string para_list = 1; + */ + private final RepeatedString paraList = RepeatedString.newEmptyInstance(); + + private ClientMail() { + } + + /** + * @return a new empty instance of {@code ClientMail} + */ + public static ClientMail newInstance() { + return new ClientMail(); + } + + /** + * optional int64 expire_time = 2; + * @return whether the expireTime field is set + */ + public boolean hasExpireTime() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional int64 expire_time = 2; + * @return this + */ + public ClientMail clearExpireTime() { + bitField0_ &= ~0x00000001; + expireTime = 0L; + return this; + } + + /** + * optional int64 expire_time = 2; + * @return the expireTime + */ + public long getExpireTime() { + return expireTime; + } + + /** + * optional int64 expire_time = 2; + * @param value the expireTime to set + * @return this + */ + public ClientMail setExpireTime(final long value) { + bitField0_ |= 0x00000001; + expireTime = value; + return this; + } + + /** + * optional int64 time = 14; + * @return whether the time field is set + */ + public boolean hasTime() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional int64 time = 14; + * @return this + */ + public ClientMail clearTime() { + bitField0_ &= ~0x00000002; + time = 0L; + return this; + } + + /** + * optional int64 time = 14; + * @return the time + */ + public long getTime() { + return time; + } + + /** + * optional int64 time = 14; + * @param value the time to set + * @return this + */ + public ClientMail setTime(final long value) { + bitField0_ |= 0x00000002; + time = value; + return this; + } + + /** + * optional uint32 id = 4; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 id = 4; + * @return this + */ + public ClientMail clearId() { + bitField0_ &= ~0x00000004; + id = 0; + return this; + } + + /** + * optional uint32 id = 4; + * @return the id + */ + public int getId() { + return id; + } + + /** + * optional uint32 id = 4; + * @param value the id to set + * @return this + */ + public ClientMail setId(final int value) { + bitField0_ |= 0x00000004; + id = value; + return this; + } + + /** + * optional uint32 template_id = 11; + * @return whether the templateId field is set + */ + public boolean hasTemplateId() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional uint32 template_id = 11; + * @return this + */ + public ClientMail clearTemplateId() { + bitField0_ &= ~0x00000008; + templateId = 0; + return this; + } + + /** + * optional uint32 template_id = 11; + * @return the templateId + */ + public int getTemplateId() { + return templateId; + } + + /** + * optional uint32 template_id = 11; + * @param value the templateId to set + * @return this + */ + public ClientMail setTemplateId(final int value) { + bitField0_ |= 0x00000008; + templateId = value; + return this; + } + + /** + * optional .MailType mail_type = 3; + * @return whether the mailType field is set + */ + public boolean hasMailType() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * optional .MailType mail_type = 3; + * @return this + */ + public ClientMail clearMailType() { + bitField0_ &= ~0x00000010; + mailType = 0; + return this; + } + + /** + * optional .MailType mail_type = 3; + * @return the mailType + */ + public MailTypeOuterClass.MailType getMailType() { + return MailTypeOuterClass.MailType.forNumber(mailType); + } + + /** + * Gets the value of the internal enum store. The result is + * equivalent to {@link ClientMail#getMailType()}.getNumber(). + * + * @return numeric wire representation + */ + public int getMailTypeValue() { + return mailType; + } + + /** + * Sets the value of the internal enum store. This does not + * do any validity checks, so be sure to use appropriate value + * constants from {@link MailTypeOuterClass.MailType}. Setting an invalid value + * can cause {@link ClientMail#getMailType()} to return null + * + * @param value the numeric wire value to set + * @return this + */ + public ClientMail setMailTypeValue(final int value) { + bitField0_ |= 0x00000010; + mailType = value; + return this; + } + + /** + * optional .MailType mail_type = 3; + * @param value the mailType to set + * @return this + */ + public ClientMail setMailType(final MailTypeOuterClass.MailType value) { + bitField0_ |= 0x00000010; + mailType = value.getNumber(); + return this; + } + + /** + * optional bool is_read = 9; + * @return whether the isRead field is set + */ + public boolean hasIsRead() { + return (bitField0_ & 0x00000020) != 0; + } + + /** + * optional bool is_read = 9; + * @return this + */ + public ClientMail clearIsRead() { + bitField0_ &= ~0x00000020; + isRead = false; + return this; + } + + /** + * optional bool is_read = 9; + * @return the isRead + */ + public boolean getIsRead() { + return isRead; + } + + /** + * optional bool is_read = 9; + * @param value the isRead to set + * @return this + */ + public ClientMail setIsRead(final boolean value) { + bitField0_ |= 0x00000020; + isRead = value; + return this; + } + + /** + * optional .ItemList attachment = 10; + * @return whether the attachment field is set + */ + public boolean hasAttachment() { + return (bitField0_ & 0x00000040) != 0; + } + + /** + * optional .ItemList attachment = 10; + * @return this + */ + public ClientMail clearAttachment() { + bitField0_ &= ~0x00000040; + attachment.clear(); + return this; + } + + /** + * optional .ItemList attachment = 10; + * + * 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 #getMutableAttachment()} if you want to modify it. + * + * @return internal storage object for reading + */ + public ItemListOuterClass.ItemList getAttachment() { + return attachment; + } + + /** + * optional .ItemList attachment = 10; + * + * 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 ItemListOuterClass.ItemList getMutableAttachment() { + bitField0_ |= 0x00000040; + return attachment; + } + + /** + * optional .ItemList attachment = 10; + * @param value the attachment to set + * @return this + */ + public ClientMail setAttachment(final ItemListOuterClass.ItemList value) { + bitField0_ |= 0x00000040; + attachment.copyFrom(value); + return this; + } + + /** + * optional string title = 5; + * @return whether the title field is set + */ + public boolean hasTitle() { + return (bitField0_ & 0x00000080) != 0; + } + + /** + * optional string title = 5; + * @return this + */ + public ClientMail clearTitle() { + bitField0_ &= ~0x00000080; + title.clear(); + return this; + } + + /** + * optional string title = 5; + * @return the title + */ + public String getTitle() { + return title.getString(); + } + + /** + * optional string title = 5; + * @return internal {@code Utf8String} representation of title for reading + */ + public Utf8String getTitleBytes() { + return this.title; + } + + /** + * optional string title = 5; + * @return internal {@code Utf8String} representation of title for modifications + */ + public Utf8String getMutableTitleBytes() { + bitField0_ |= 0x00000080; + return this.title; + } + + /** + * optional string title = 5; + * @param value the title to set + * @return this + */ + public ClientMail setTitle(final CharSequence value) { + bitField0_ |= 0x00000080; + title.copyFrom(value); + return this; + } + + /** + * optional string title = 5; + * @param value the title to set + * @return this + */ + public ClientMail setTitle(final Utf8String value) { + bitField0_ |= 0x00000080; + title.copyFrom(value); + return this; + } + + /** + * optional string sender = 6; + * @return whether the sender field is set + */ + public boolean hasSender() { + return (bitField0_ & 0x00000100) != 0; + } + + /** + * optional string sender = 6; + * @return this + */ + public ClientMail clearSender() { + bitField0_ &= ~0x00000100; + sender.clear(); + return this; + } + + /** + * optional string sender = 6; + * @return the sender + */ + public String getSender() { + return sender.getString(); + } + + /** + * optional string sender = 6; + * @return internal {@code Utf8String} representation of sender for reading + */ + public Utf8String getSenderBytes() { + return this.sender; + } + + /** + * optional string sender = 6; + * @return internal {@code Utf8String} representation of sender for modifications + */ + public Utf8String getMutableSenderBytes() { + bitField0_ |= 0x00000100; + return this.sender; + } + + /** + * optional string sender = 6; + * @param value the sender to set + * @return this + */ + public ClientMail setSender(final CharSequence value) { + bitField0_ |= 0x00000100; + sender.copyFrom(value); + return this; + } + + /** + * optional string sender = 6; + * @param value the sender to set + * @return this + */ + public ClientMail setSender(final Utf8String value) { + bitField0_ |= 0x00000100; + sender.copyFrom(value); + return this; + } + + /** + * optional string content = 7; + * @return whether the content field is set + */ + public boolean hasContent() { + return (bitField0_ & 0x00000200) != 0; + } + + /** + * optional string content = 7; + * @return this + */ + public ClientMail clearContent() { + bitField0_ &= ~0x00000200; + content.clear(); + return this; + } + + /** + * optional string content = 7; + * @return the content + */ + public String getContent() { + return content.getString(); + } + + /** + * optional string content = 7; + * @return internal {@code Utf8String} representation of content for reading + */ + public Utf8String getContentBytes() { + return this.content; + } + + /** + * optional string content = 7; + * @return internal {@code Utf8String} representation of content for modifications + */ + public Utf8String getMutableContentBytes() { + bitField0_ |= 0x00000200; + return this.content; + } + + /** + * optional string content = 7; + * @param value the content to set + * @return this + */ + public ClientMail setContent(final CharSequence value) { + bitField0_ |= 0x00000200; + content.copyFrom(value); + return this; + } + + /** + * optional string content = 7; + * @param value the content to set + * @return this + */ + public ClientMail setContent(final Utf8String value) { + bitField0_ |= 0x00000200; + content.copyFrom(value); + return this; + } + + /** + * repeated string para_list = 1; + * @return whether the paraList field is set + */ + public boolean hasParaList() { + return (bitField0_ & 0x00000400) != 0; + } + + /** + * repeated string para_list = 1; + * @return this + */ + public ClientMail clearParaList() { + bitField0_ &= ~0x00000400; + paraList.clear(); + return this; + } + + /** + * repeated string para_list = 1; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableParaList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedString getParaList() { + return paraList; + } + + /** + * repeated string para_list = 1; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedString getMutableParaList() { + bitField0_ |= 0x00000400; + return paraList; + } + + /** + * repeated string para_list = 1; + * @param value the paraList to add + * @return this + */ + public ClientMail addParaList(final CharSequence value) { + bitField0_ |= 0x00000400; + paraList.add(value); + return this; + } + + /** + * repeated string para_list = 1; + * @param values the paraList to add + * @return this + */ + public ClientMail addAllParaList(final CharSequence... values) { + bitField0_ |= 0x00000400; + paraList.addAll(values); + return this; + } + + @Override + public ClientMail copyFrom(final ClientMail other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + expireTime = other.expireTime; + time = other.time; + id = other.id; + templateId = other.templateId; + mailType = other.mailType; + isRead = other.isRead; + attachment.copyFrom(other.attachment); + title.copyFrom(other.title); + sender.copyFrom(other.sender); + content.copyFrom(other.content); + paraList.copyFrom(other.paraList); + } + return this; + } + + @Override + public ClientMail mergeFrom(final ClientMail other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasExpireTime()) { + setExpireTime(other.expireTime); + } + if (other.hasTime()) { + setTime(other.time); + } + if (other.hasId()) { + setId(other.id); + } + if (other.hasTemplateId()) { + setTemplateId(other.templateId); + } + if (other.hasMailType()) { + setMailTypeValue(other.mailType); + } + if (other.hasIsRead()) { + setIsRead(other.isRead); + } + if (other.hasAttachment()) { + getMutableAttachment().mergeFrom(other.attachment); + } + if (other.hasTitle()) { + getMutableTitleBytes().copyFrom(other.title); + } + if (other.hasSender()) { + getMutableSenderBytes().copyFrom(other.sender); + } + if (other.hasContent()) { + getMutableContentBytes().copyFrom(other.content); + } + if (other.hasParaList()) { + getMutableParaList().addAll(other.paraList); + } + return this; + } + + @Override + public ClientMail clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + expireTime = 0L; + time = 0L; + id = 0; + templateId = 0; + mailType = 0; + isRead = false; + attachment.clear(); + title.clear(); + sender.clear(); + content.clear(); + paraList.clear(); + return this; + } + + @Override + public ClientMail clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + attachment.clearQuick(); + title.clear(); + sender.clear(); + content.clear(); + paraList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof ClientMail)) { + return false; + } + ClientMail other = (ClientMail) o; + return bitField0_ == other.bitField0_ + && (!hasExpireTime() || expireTime == other.expireTime) + && (!hasTime() || time == other.time) + && (!hasId() || id == other.id) + && (!hasTemplateId() || templateId == other.templateId) + && (!hasMailType() || mailType == other.mailType) + && (!hasIsRead() || isRead == other.isRead) + && (!hasAttachment() || attachment.equals(other.attachment)) + && (!hasTitle() || title.equals(other.title)) + && (!hasSender() || sender.equals(other.sender)) + && (!hasContent() || content.equals(other.content)) + && (!hasParaList() || paraList.equals(other.paraList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 16); + output.writeInt64NoTag(expireTime); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 112); + output.writeInt64NoTag(time); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 32); + output.writeUInt32NoTag(id); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 88); + output.writeUInt32NoTag(templateId); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRawByte((byte) 24); + output.writeEnumNoTag(mailType); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeRawByte((byte) 72); + output.writeBoolNoTag(isRead); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeRawByte((byte) 82); + output.writeMessageNoTag(attachment); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeRawByte((byte) 42); + output.writeStringNoTag(title); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeRawByte((byte) 50); + output.writeStringNoTag(sender); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeRawByte((byte) 58); + output.writeStringNoTag(content); + } + if ((bitField0_ & 0x00000400) != 0) { + for (int i = 0; i < paraList.length(); i++) { + output.writeRawByte((byte) 10); + output.writeStringNoTag(paraList.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeInt64SizeNoTag(expireTime); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeInt64SizeNoTag(time); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(id); + } + if ((bitField0_ & 0x00000008) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(templateId); + } + if ((bitField0_ & 0x00000010) != 0) { + size += 1 + ProtoSink.computeEnumSizeNoTag(mailType); + } + if ((bitField0_ & 0x00000020) != 0) { + size += 2; + } + if ((bitField0_ & 0x00000040) != 0) { + size += 1 + ProtoSink.computeMessageSizeNoTag(attachment); + } + if ((bitField0_ & 0x00000080) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(title); + } + if ((bitField0_ & 0x00000100) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(sender); + } + if ((bitField0_ & 0x00000200) != 0) { + size += 1 + ProtoSink.computeStringSizeNoTag(content); + } + if ((bitField0_ & 0x00000400) != 0) { + size += (1 * paraList.length()) + ProtoSink.computeRepeatedStringSizeNoTag(paraList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public ClientMail mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 16: { + // expireTime + expireTime = input.readInt64(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 112) { + break; + } + } + case 112: { + // time + time = input.readInt64(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 32) { + break; + } + } + case 32: { + // id + id = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 88) { + break; + } + } + case 88: { + // templateId + templateId = input.readUInt32(); + bitField0_ |= 0x00000008; + tag = input.readTag(); + if (tag != 24) { + break; + } + } + case 24: { + // mailType + final int value = input.readInt32(); + if (MailTypeOuterClass.MailType.forNumber(value) != null) { + mailType = value; + bitField0_ |= 0x00000010; + } + tag = input.readTag(); + if (tag != 72) { + break; + } + } + case 72: { + // isRead + isRead = input.readBool(); + bitField0_ |= 0x00000020; + tag = input.readTag(); + if (tag != 82) { + break; + } + } + case 82: { + // attachment + input.readMessage(attachment); + bitField0_ |= 0x00000040; + tag = input.readTag(); + if (tag != 42) { + break; + } + } + case 42: { + // title + input.readString(title); + bitField0_ |= 0x00000080; + tag = input.readTag(); + if (tag != 50) { + break; + } + } + case 50: { + // sender + input.readString(sender); + bitField0_ |= 0x00000100; + tag = input.readTag(); + if (tag != 58) { + break; + } + } + case 58: { + // content + input.readString(content); + bitField0_ |= 0x00000200; + tag = input.readTag(); + if (tag != 10) { + break; + } + } + case 10: { + // paraList + tag = input.readRepeatedString(paraList, tag); + bitField0_ |= 0x00000400; + 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.writeInt64(FieldNames.expireTime, expireTime); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeInt64(FieldNames.time, time); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.id, id); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeUInt32(FieldNames.templateId, templateId); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeEnum(FieldNames.mailType, mailType, MailTypeOuterClass.MailType.converter()); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeBool(FieldNames.isRead, isRead); + } + if ((bitField0_ & 0x00000040) != 0) { + output.writeMessage(FieldNames.attachment, attachment); + } + if ((bitField0_ & 0x00000080) != 0) { + output.writeString(FieldNames.title, title); + } + if ((bitField0_ & 0x00000100) != 0) { + output.writeString(FieldNames.sender, sender); + } + if ((bitField0_ & 0x00000200) != 0) { + output.writeString(FieldNames.content, content); + } + if ((bitField0_ & 0x00000400) != 0) { + output.writeRepeatedString(FieldNames.paraList, paraList); + } + output.endObject(); + } + + @Override + public ClientMail mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -834724724: + case -96179731: { + if (input.isAtField(FieldNames.expireTime)) { + if (!input.trySkipNullValue()) { + expireTime = input.readInt64(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3560141: { + if (input.isAtField(FieldNames.time)) { + if (!input.trySkipNullValue()) { + time = input.readInt64(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1304010549: + case 1769642752: { + if (input.isAtField(FieldNames.templateId)) { + if (!input.trySkipNullValue()) { + templateId = input.readUInt32(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + case -10267247: + case -308265790: { + if (input.isAtField(FieldNames.mailType)) { + if (!input.trySkipNullValue()) { + final MailTypeOuterClass.MailType value = input.readEnum(MailTypeOuterClass.MailType.converter()); + if (value != null) { + mailType = value.getNumber(); + bitField0_ |= 0x00000010; + } else { + input.skipUnknownEnumValue(); + } + } + } else { + input.skipUnknownField(); + } + break; + } + case -1180158496: + case 2082189195: { + if (input.isAtField(FieldNames.isRead)) { + if (!input.trySkipNullValue()) { + isRead = input.readBool(); + bitField0_ |= 0x00000020; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1963501277: { + if (input.isAtField(FieldNames.attachment)) { + if (!input.trySkipNullValue()) { + input.readMessage(attachment); + bitField0_ |= 0x00000040; + } + } else { + input.skipUnknownField(); + } + break; + } + case 110371416: { + if (input.isAtField(FieldNames.title)) { + if (!input.trySkipNullValue()) { + input.readString(title); + bitField0_ |= 0x00000080; + } + } else { + input.skipUnknownField(); + } + break; + } + case -905962955: { + if (input.isAtField(FieldNames.sender)) { + if (!input.trySkipNullValue()) { + input.readString(sender); + bitField0_ |= 0x00000100; + } + } else { + input.skipUnknownField(); + } + break; + } + case 951530617: { + if (input.isAtField(FieldNames.content)) { + if (!input.trySkipNullValue()) { + input.readString(content); + bitField0_ |= 0x00000200; + } + } else { + input.skipUnknownField(); + } + break; + } + case 1170446494: + case 1941729693: { + if (input.isAtField(FieldNames.paraList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedString(paraList); + bitField0_ |= 0x00000400; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public ClientMail clone() { + return new ClientMail().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static ClientMail parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new ClientMail(), data).checkInitialized(); + } + + public static ClientMail parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientMail(), input).checkInitialized(); + } + + public static ClientMail parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new ClientMail(), input).checkInitialized(); + } + + /** + * @return factory for creating ClientMail messages + */ + public static MessageFactory getFactory() { + return ClientMailFactory.INSTANCE; + } + + private enum ClientMailFactory implements MessageFactory { + INSTANCE; + + @Override + public ClientMail create() { + return ClientMail.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName expireTime = FieldName.forField("expireTime", "expire_time"); + + static final FieldName time = FieldName.forField("time"); + + static final FieldName id = FieldName.forField("id"); + + static final FieldName templateId = FieldName.forField("templateId", "template_id"); + + static final FieldName mailType = FieldName.forField("mailType", "mail_type"); + + static final FieldName isRead = FieldName.forField("isRead", "is_read"); + + static final FieldName attachment = FieldName.forField("attachment"); + + static final FieldName title = FieldName.forField("title"); + + static final FieldName sender = FieldName.forField("sender"); + + static final FieldName content = FieldName.forField("content"); + + static final FieldName paraList = FieldName.forField("paraList", "para_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/DelMailCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/DelMailCsReqOuterClass.java new file mode 100644 index 0000000..fe622de --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/DelMailCsReqOuterClass.java @@ -0,0 +1,300 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedInt; + +public final class DelMailCsReqOuterClass { + /** + * Protobuf type {@code DelMailCsReq} + */ + public static final class DelMailCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated uint32 id_list = 13; + */ + private final RepeatedInt idList = RepeatedInt.newEmptyInstance(); + + private DelMailCsReq() { + } + + /** + * @return a new empty instance of {@code DelMailCsReq} + */ + public static DelMailCsReq newInstance() { + return new DelMailCsReq(); + } + + /** + * repeated uint32 id_list = 13; + * @return whether the idList field is set + */ + public boolean hasIdList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated uint32 id_list = 13; + * @return this + */ + public DelMailCsReq clearIdList() { + bitField0_ &= ~0x00000001; + idList.clear(); + return this; + } + + /** + * repeated uint32 id_list = 13; + * + * 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 #getMutableIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getIdList() { + return idList; + } + + /** + * repeated uint32 id_list = 13; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedInt getMutableIdList() { + bitField0_ |= 0x00000001; + return idList; + } + + /** + * repeated uint32 id_list = 13; + * @param value the idList to add + * @return this + */ + public DelMailCsReq addIdList(final int value) { + bitField0_ |= 0x00000001; + idList.add(value); + return this; + } + + /** + * repeated uint32 id_list = 13; + * @param values the idList to add + * @return this + */ + public DelMailCsReq addAllIdList(final int... values) { + bitField0_ |= 0x00000001; + idList.addAll(values); + return this; + } + + @Override + public DelMailCsReq copyFrom(final DelMailCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + idList.copyFrom(other.idList); + } + return this; + } + + @Override + public DelMailCsReq mergeFrom(final DelMailCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasIdList()) { + getMutableIdList().addAll(other.idList); + } + return this; + } + + @Override + public DelMailCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + idList.clear(); + return this; + } + + @Override + public DelMailCsReq clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + idList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DelMailCsReq)) { + return false; + } + DelMailCsReq other = (DelMailCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasIdList() || idList.equals(other.idList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < idList.length(); i++) { + output.writeRawByte((byte) 104); + output.writeUInt32NoTag(idList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * idList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(idList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public DelMailCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 106: { + // idList [packed=true] + input.readPackedUInt32(idList, tag); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 104: { + // idList [packed=false] + tag = input.readRepeatedUInt32(idList, tag); + bitField0_ |= 0x00000001; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedUInt32(FieldNames.idList, idList); + } + output.endObject(); + } + + @Override + public DelMailCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1194185639: + case 1652577602: { + if (input.isAtField(FieldNames.idList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(idList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public DelMailCsReq clone() { + return new DelMailCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static DelMailCsReq parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new DelMailCsReq(), data).checkInitialized(); + } + + public static DelMailCsReq parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new DelMailCsReq(), input).checkInitialized(); + } + + public static DelMailCsReq parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new DelMailCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating DelMailCsReq messages + */ + public static MessageFactory getFactory() { + return DelMailCsReqFactory.INSTANCE; + } + + private enum DelMailCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public DelMailCsReq create() { + return DelMailCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName idList = FieldName.forField("idList", "id_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/DelMailScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/DelMailScRspOuterClass.java new file mode 100644 index 0000000..bcfcd3e --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/DelMailScRspOuterClass.java @@ -0,0 +1,380 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedInt; + +public final class DelMailScRspOuterClass { + /** + * Protobuf type {@code DelMailScRsp} + */ + public static final class DelMailScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 10; + */ + private int retcode; + + /** + * repeated uint32 id_list = 14; + */ + private final RepeatedInt idList = RepeatedInt.newEmptyInstance(); + + private DelMailScRsp() { + } + + /** + * @return a new empty instance of {@code DelMailScRsp} + */ + public static DelMailScRsp newInstance() { + return new DelMailScRsp(); + } + + /** + * optional uint32 retcode = 10; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 10; + * @return this + */ + public DelMailScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 10; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 10; + * @param value the retcode to set + * @return this + */ + public DelMailScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + * repeated uint32 id_list = 14; + * @return whether the idList field is set + */ + public boolean hasIdList() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * repeated uint32 id_list = 14; + * @return this + */ + public DelMailScRsp clearIdList() { + bitField0_ &= ~0x00000002; + idList.clear(); + return this; + } + + /** + * repeated uint32 id_list = 14; + * + * 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 #getMutableIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getIdList() { + return idList; + } + + /** + * repeated uint32 id_list = 14; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedInt getMutableIdList() { + bitField0_ |= 0x00000002; + return idList; + } + + /** + * repeated uint32 id_list = 14; + * @param value the idList to add + * @return this + */ + public DelMailScRsp addIdList(final int value) { + bitField0_ |= 0x00000002; + idList.add(value); + return this; + } + + /** + * repeated uint32 id_list = 14; + * @param values the idList to add + * @return this + */ + public DelMailScRsp addAllIdList(final int... values) { + bitField0_ |= 0x00000002; + idList.addAll(values); + return this; + } + + @Override + public DelMailScRsp copyFrom(final DelMailScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + idList.copyFrom(other.idList); + } + return this; + } + + @Override + public DelMailScRsp mergeFrom(final DelMailScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasIdList()) { + getMutableIdList().addAll(other.idList); + } + return this; + } + + @Override + public DelMailScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + idList.clear(); + return this; + } + + @Override + public DelMailScRsp clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + idList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof DelMailScRsp)) { + return false; + } + DelMailScRsp other = (DelMailScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasIdList() || idList.equals(other.idList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 80); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + for (int i = 0; i < idList.length(); i++) { + output.writeRawByte((byte) 112); + output.writeUInt32NoTag(idList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += (1 * idList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(idList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public DelMailScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 80: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 114) { + break; + } + } + case 114: { + // idList [packed=true] + input.readPackedUInt32(idList, tag); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 112: { + // idList [packed=false] + tag = input.readRepeatedUInt32(idList, tag); + bitField0_ |= 0x00000002; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeUInt32(FieldNames.retcode, retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRepeatedUInt32(FieldNames.idList, idList); + } + output.endObject(); + } + + @Override + public DelMailScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1097936398: { + if (input.isAtField(FieldNames.retcode)) { + if (!input.trySkipNullValue()) { + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -1194185639: + case 1652577602: { + if (input.isAtField(FieldNames.idList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(idList); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public DelMailScRsp clone() { + return new DelMailScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static DelMailScRsp parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new DelMailScRsp(), data).checkInitialized(); + } + + public static DelMailScRsp parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new DelMailScRsp(), input).checkInitialized(); + } + + public static DelMailScRsp parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new DelMailScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating DelMailScRsp messages + */ + public static MessageFactory getFactory() { + return DelMailScRspFactory.INSTANCE; + } + + private enum DelMailScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public DelMailScRsp create() { + return DelMailScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName idList = FieldName.forField("idList", "id_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/GetMailScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/GetMailScRspOuterClass.java new file mode 100644 index 0000000..4412009 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/GetMailScRspOuterClass.java @@ -0,0 +1,729 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedMessage; + +public final class GetMailScRspOuterClass { + /** + * Protobuf type {@code GetMailScRsp} + */ + public static final class GetMailScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 6; + */ + private int retcode; + + /** + * optional uint32 total_num = 10; + */ + private int totalNum; + + /** + * optional uint32 start = 13; + */ + private int start; + + /** + * optional bool is_end = 1; + */ + private boolean isEnd; + + /** + * repeated .ClientMail mail_list = 5; + */ + private final RepeatedMessage mailList = RepeatedMessage.newEmptyInstance(ClientMailOuterClass.ClientMail.getFactory()); + + /** + * repeated .ClientMail notice_mail_list = 15; + */ + private final RepeatedMessage noticeMailList = RepeatedMessage.newEmptyInstance(ClientMailOuterClass.ClientMail.getFactory()); + + private GetMailScRsp() { + } + + /** + * @return a new empty instance of {@code GetMailScRsp} + */ + public static GetMailScRsp newInstance() { + return new GetMailScRsp(); + } + + /** + * optional uint32 retcode = 6; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 6; + * @return this + */ + public GetMailScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 6; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 6; + * @param value the retcode to set + * @return this + */ + public GetMailScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + * optional uint32 total_num = 10; + * @return whether the totalNum field is set + */ + public boolean hasTotalNum() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 total_num = 10; + * @return this + */ + public GetMailScRsp clearTotalNum() { + bitField0_ &= ~0x00000002; + totalNum = 0; + return this; + } + + /** + * optional uint32 total_num = 10; + * @return the totalNum + */ + public int getTotalNum() { + return totalNum; + } + + /** + * optional uint32 total_num = 10; + * @param value the totalNum to set + * @return this + */ + public GetMailScRsp setTotalNum(final int value) { + bitField0_ |= 0x00000002; + totalNum = value; + return this; + } + + /** + * optional uint32 start = 13; + * @return whether the start field is set + */ + public boolean hasStart() { + return (bitField0_ & 0x00000004) != 0; + } + + /** + * optional uint32 start = 13; + * @return this + */ + public GetMailScRsp clearStart() { + bitField0_ &= ~0x00000004; + start = 0; + return this; + } + + /** + * optional uint32 start = 13; + * @return the start + */ + public int getStart() { + return start; + } + + /** + * optional uint32 start = 13; + * @param value the start to set + * @return this + */ + public GetMailScRsp setStart(final int value) { + bitField0_ |= 0x00000004; + start = value; + return this; + } + + /** + * optional bool is_end = 1; + * @return whether the isEnd field is set + */ + public boolean hasIsEnd() { + return (bitField0_ & 0x00000008) != 0; + } + + /** + * optional bool is_end = 1; + * @return this + */ + public GetMailScRsp clearIsEnd() { + bitField0_ &= ~0x00000008; + isEnd = false; + return this; + } + + /** + * optional bool is_end = 1; + * @return the isEnd + */ + public boolean getIsEnd() { + return isEnd; + } + + /** + * optional bool is_end = 1; + * @param value the isEnd to set + * @return this + */ + public GetMailScRsp setIsEnd(final boolean value) { + bitField0_ |= 0x00000008; + isEnd = value; + return this; + } + + /** + * repeated .ClientMail mail_list = 5; + * @return whether the mailList field is set + */ + public boolean hasMailList() { + return (bitField0_ & 0x00000010) != 0; + } + + /** + * repeated .ClientMail mail_list = 5; + * @return this + */ + public GetMailScRsp clearMailList() { + bitField0_ &= ~0x00000010; + mailList.clear(); + return this; + } + + /** + * repeated .ClientMail mail_list = 5; + * + * 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 #getMutableMailList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getMailList() { + return mailList; + } + + /** + * repeated .ClientMail mail_list = 5; + * + * 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 getMutableMailList() { + bitField0_ |= 0x00000010; + return mailList; + } + + /** + * repeated .ClientMail mail_list = 5; + * @param value the mailList to add + * @return this + */ + public GetMailScRsp addMailList(final ClientMailOuterClass.ClientMail value) { + bitField0_ |= 0x00000010; + mailList.add(value); + return this; + } + + /** + * repeated .ClientMail mail_list = 5; + * @param values the mailList to add + * @return this + */ + public GetMailScRsp addAllMailList(final ClientMailOuterClass.ClientMail... values) { + bitField0_ |= 0x00000010; + mailList.addAll(values); + return this; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * @return whether the noticeMailList field is set + */ + public boolean hasNoticeMailList() { + return (bitField0_ & 0x00000020) != 0; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * @return this + */ + public GetMailScRsp clearNoticeMailList() { + bitField0_ &= ~0x00000020; + noticeMailList.clear(); + return this; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * + * 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 #getMutableNoticeMailList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedMessage getNoticeMailList() { + return noticeMailList; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * + * 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 getMutableNoticeMailList() { + bitField0_ |= 0x00000020; + return noticeMailList; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * @param value the noticeMailList to add + * @return this + */ + public GetMailScRsp addNoticeMailList(final ClientMailOuterClass.ClientMail value) { + bitField0_ |= 0x00000020; + noticeMailList.add(value); + return this; + } + + /** + * repeated .ClientMail notice_mail_list = 15; + * @param values the noticeMailList to add + * @return this + */ + public GetMailScRsp addAllNoticeMailList(final ClientMailOuterClass.ClientMail... values) { + bitField0_ |= 0x00000020; + noticeMailList.addAll(values); + return this; + } + + @Override + public GetMailScRsp copyFrom(final GetMailScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + totalNum = other.totalNum; + start = other.start; + isEnd = other.isEnd; + mailList.copyFrom(other.mailList); + noticeMailList.copyFrom(other.noticeMailList); + } + return this; + } + + @Override + public GetMailScRsp mergeFrom(final GetMailScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasTotalNum()) { + setTotalNum(other.totalNum); + } + if (other.hasStart()) { + setStart(other.start); + } + if (other.hasIsEnd()) { + setIsEnd(other.isEnd); + } + if (other.hasMailList()) { + getMutableMailList().addAll(other.mailList); + } + if (other.hasNoticeMailList()) { + getMutableNoticeMailList().addAll(other.noticeMailList); + } + return this; + } + + @Override + public GetMailScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + totalNum = 0; + start = 0; + isEnd = false; + mailList.clear(); + noticeMailList.clear(); + return this; + } + + @Override + public GetMailScRsp clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mailList.clearQuick(); + noticeMailList.clearQuick(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof GetMailScRsp)) { + return false; + } + GetMailScRsp other = (GetMailScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasTotalNum() || totalNum == other.totalNum) + && (!hasStart() || start == other.start) + && (!hasIsEnd() || isEnd == other.isEnd) + && (!hasMailList() || mailList.equals(other.mailList)) + && (!hasNoticeMailList() || noticeMailList.equals(other.noticeMailList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 48); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 80); + output.writeUInt32NoTag(totalNum); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeRawByte((byte) 104); + output.writeUInt32NoTag(start); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeRawByte((byte) 8); + output.writeBoolNoTag(isEnd); + } + if ((bitField0_ & 0x00000010) != 0) { + for (int i = 0; i < mailList.length(); i++) { + output.writeRawByte((byte) 42); + output.writeMessageNoTag(mailList.get(i)); + } + } + if ((bitField0_ & 0x00000020) != 0) { + for (int i = 0; i < noticeMailList.length(); i++) { + output.writeRawByte((byte) 122); + output.writeMessageNoTag(noticeMailList.get(i)); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(totalNum); + } + if ((bitField0_ & 0x00000004) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(start); + } + if ((bitField0_ & 0x00000008) != 0) { + size += 2; + } + if ((bitField0_ & 0x00000010) != 0) { + size += (1 * mailList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(mailList); + } + if ((bitField0_ & 0x00000020) != 0) { + size += (1 * noticeMailList.length()) + ProtoSink.computeRepeatedMessageSizeNoTag(noticeMailList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public GetMailScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 48: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 80) { + break; + } + } + case 80: { + // totalNum + totalNum = input.readUInt32(); + bitField0_ |= 0x00000002; + tag = input.readTag(); + if (tag != 104) { + break; + } + } + case 104: { + // start + start = input.readUInt32(); + bitField0_ |= 0x00000004; + tag = input.readTag(); + if (tag != 8) { + break; + } + } + case 8: { + // isEnd + isEnd = input.readBool(); + bitField0_ |= 0x00000008; + tag = input.readTag(); + if (tag != 42) { + break; + } + } + case 42: { + // mailList + tag = input.readRepeatedMessage(mailList, tag); + bitField0_ |= 0x00000010; + if (tag != 122) { + break; + } + } + case 122: { + // noticeMailList + tag = input.readRepeatedMessage(noticeMailList, tag); + bitField0_ |= 0x00000020; + 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.retcode, retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.totalNum, totalNum); + } + if ((bitField0_ & 0x00000004) != 0) { + output.writeUInt32(FieldNames.start, start); + } + if ((bitField0_ & 0x00000008) != 0) { + output.writeBool(FieldNames.isEnd, isEnd); + } + if ((bitField0_ & 0x00000010) != 0) { + output.writeRepeatedMessage(FieldNames.mailList, mailList); + } + if ((bitField0_ & 0x00000020) != 0) { + output.writeRepeatedMessage(FieldNames.noticeMailList, noticeMailList); + } + output.endObject(); + } + + @Override + public GetMailScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1097936398: { + if (input.isAtField(FieldNames.retcode)) { + if (!input.trySkipNullValue()) { + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case -849911390: + case -576949237: { + if (input.isAtField(FieldNames.totalNum)) { + if (!input.trySkipNullValue()) { + totalNum = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + case 109757538: { + if (input.isAtField(FieldNames.start)) { + if (!input.trySkipNullValue()) { + start = input.readUInt32(); + bitField0_ |= 0x00000004; + } + } else { + input.skipUnknownField(); + } + break; + } + case 100465489: + case -1179770810: { + if (input.isAtField(FieldNames.isEnd)) { + if (!input.trySkipNullValue()) { + isEnd = input.readBool(); + bitField0_ |= 0x00000008; + } + } else { + input.skipUnknownField(); + } + break; + } + case -10520843: + case -308519386: { + if (input.isAtField(FieldNames.mailList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(mailList); + bitField0_ |= 0x00000010; + } + } else { + input.skipUnknownField(); + } + break; + } + case 17373677: + case 1540899199: { + if (input.isAtField(FieldNames.noticeMailList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedMessage(noticeMailList); + bitField0_ |= 0x00000020; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public GetMailScRsp clone() { + return new GetMailScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static GetMailScRsp parseFrom(final byte[] data) throws InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new GetMailScRsp(), data).checkInitialized(); + } + + public static GetMailScRsp parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetMailScRsp(), input).checkInitialized(); + } + + public static GetMailScRsp parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new GetMailScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating GetMailScRsp messages + */ + public static MessageFactory getFactory() { + return GetMailScRspFactory.INSTANCE; + } + + private enum GetMailScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public GetMailScRsp create() { + return GetMailScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName totalNum = FieldName.forField("totalNum", "total_num"); + + static final FieldName start = FieldName.forField("start"); + + static final FieldName isEnd = FieldName.forField("isEnd", "is_end"); + + static final FieldName mailList = FieldName.forField("mailList", "mail_list"); + + static final FieldName noticeMailList = FieldName.forField("noticeMailList", "notice_mail_list"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/MailTypeOuterClass.java b/src/generated/main/emu/lunarcore/proto/MailTypeOuterClass.java new file mode 100644 index 0000000..455b2d6 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/MailTypeOuterClass.java @@ -0,0 +1,116 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import us.hebi.quickbuf.ProtoEnum; +import us.hebi.quickbuf.ProtoUtil; + +public final class MailTypeOuterClass { + /** + * Protobuf enum {@code MailType} + */ + public enum MailType implements ProtoEnum { + /** + * MAIL_TYPE_NORMAL = 0; + */ + MAIL_TYPE_NORMAL("MAIL_TYPE_NORMAL", 0), + + /** + * MAIL_TYPE_STAR = 1; + */ + MAIL_TYPE_STAR("MAIL_TYPE_STAR", 1); + + /** + * MAIL_TYPE_NORMAL = 0; + */ + public static final int MAIL_TYPE_NORMAL_VALUE = 0; + + /** + * MAIL_TYPE_STAR = 1; + */ + public static final int MAIL_TYPE_STAR_VALUE = 1; + + private final String name; + + private final int number; + + private MailType(String name, int number) { + this.name = name; + this.number = number; + } + + /** + * @return the string representation of enum entry + */ + @Override + public String getName() { + return name; + } + + /** + * @return the numeric wire value of this enum entry + */ + @Override + public int getNumber() { + return number; + } + + /** + * @return a converter that maps between this enum's numeric and text representations + */ + public static ProtoEnum.EnumConverter converter() { + return MailTypeConverter.INSTANCE; + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @return The enum associated with the given numeric wire value, or null if unknown. + */ + public static MailType forNumber(int value) { + return MailTypeConverter.INSTANCE.forNumber(value); + } + + /** + * @param value The numeric wire value of the corresponding enum entry. + * @param other Fallback value in case the value is not known. + * @return The enum associated with the given numeric wire value, or the fallback value if unknown. + */ + public static MailType forNumberOr(int number, MailType other) { + MailType value = forNumber(number); + return value == null ? other : value; + } + + enum MailTypeConverter implements ProtoEnum.EnumConverter { + INSTANCE; + + private static final MailType[] lookup = new MailType[2]; + + static { + lookup[0] = MAIL_TYPE_NORMAL; + lookup[1] = MAIL_TYPE_STAR; + } + + @Override + public final MailType forNumber(final int value) { + if (value >= 0 && value < lookup.length) { + return lookup[value]; + } + return null; + } + + @Override + public final MailType forName(final CharSequence value) { + if (value.length() == 14) { + if (ProtoUtil.isEqual("MAIL_TYPE_STAR", value)) { + return MAIL_TYPE_STAR; + } + } + if (value.length() == 16) { + if (ProtoUtil.isEqual("MAIL_TYPE_NORMAL", value)) { + return MAIL_TYPE_NORMAL; + } + } + return null; + } + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/MarkReadMailCsReqOuterClass.java b/src/generated/main/emu/lunarcore/proto/MarkReadMailCsReqOuterClass.java new file mode 100644 index 0000000..1df62d7 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/MarkReadMailCsReqOuterClass.java @@ -0,0 +1,259 @@ +// 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 MarkReadMailCsReqOuterClass { + /** + * Protobuf type {@code MarkReadMailCsReq} + */ + public static final class MarkReadMailCsReq extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 id = 12; + */ + private int id; + + private MarkReadMailCsReq() { + } + + /** + * @return a new empty instance of {@code MarkReadMailCsReq} + */ + public static MarkReadMailCsReq newInstance() { + return new MarkReadMailCsReq(); + } + + /** + * optional uint32 id = 12; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 id = 12; + * @return this + */ + public MarkReadMailCsReq clearId() { + bitField0_ &= ~0x00000001; + id = 0; + return this; + } + + /** + * optional uint32 id = 12; + * @return the id + */ + public int getId() { + return id; + } + + /** + * optional uint32 id = 12; + * @param value the id to set + * @return this + */ + public MarkReadMailCsReq setId(final int value) { + bitField0_ |= 0x00000001; + id = value; + return this; + } + + @Override + public MarkReadMailCsReq copyFrom(final MarkReadMailCsReq other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + id = other.id; + } + return this; + } + + @Override + public MarkReadMailCsReq mergeFrom(final MarkReadMailCsReq other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasId()) { + setId(other.id); + } + return this; + } + + @Override + public MarkReadMailCsReq clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + id = 0; + return this; + } + + @Override + public MarkReadMailCsReq 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 MarkReadMailCsReq)) { + return false; + } + MarkReadMailCsReq other = (MarkReadMailCsReq) o; + return bitField0_ == other.bitField0_ + && (!hasId() || id == other.id); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 96); + output.writeUInt32NoTag(id); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(id); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public MarkReadMailCsReq mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 96: { + // id + id = input.readUInt32(); + 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.writeUInt32(FieldNames.id, id); + } + output.endObject(); + } + + @Override + public MarkReadMailCsReq mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public MarkReadMailCsReq clone() { + return new MarkReadMailCsReq().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static MarkReadMailCsReq parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new MarkReadMailCsReq(), data).checkInitialized(); + } + + public static MarkReadMailCsReq parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new MarkReadMailCsReq(), input).checkInitialized(); + } + + public static MarkReadMailCsReq parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new MarkReadMailCsReq(), input).checkInitialized(); + } + + /** + * @return factory for creating MarkReadMailCsReq messages + */ + public static MessageFactory getFactory() { + return MarkReadMailCsReqFactory.INSTANCE; + } + + private enum MarkReadMailCsReqFactory implements MessageFactory { + INSTANCE; + + @Override + public MarkReadMailCsReq create() { + return MarkReadMailCsReq.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName id = FieldName.forField("id"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/MarkReadMailScRspOuterClass.java b/src/generated/main/emu/lunarcore/proto/MarkReadMailScRspOuterClass.java new file mode 100644 index 0000000..8361315 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/MarkReadMailScRspOuterClass.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 MarkReadMailScRspOuterClass { + /** + * Protobuf type {@code MarkReadMailScRsp} + */ + public static final class MarkReadMailScRsp extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * optional uint32 retcode = 2; + */ + private int retcode; + + /** + * optional uint32 id = 13; + */ + private int id; + + private MarkReadMailScRsp() { + } + + /** + * @return a new empty instance of {@code MarkReadMailScRsp} + */ + public static MarkReadMailScRsp newInstance() { + return new MarkReadMailScRsp(); + } + + /** + * optional uint32 retcode = 2; + * @return whether the retcode field is set + */ + public boolean hasRetcode() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * optional uint32 retcode = 2; + * @return this + */ + public MarkReadMailScRsp clearRetcode() { + bitField0_ &= ~0x00000001; + retcode = 0; + return this; + } + + /** + * optional uint32 retcode = 2; + * @return the retcode + */ + public int getRetcode() { + return retcode; + } + + /** + * optional uint32 retcode = 2; + * @param value the retcode to set + * @return this + */ + public MarkReadMailScRsp setRetcode(final int value) { + bitField0_ |= 0x00000001; + retcode = value; + return this; + } + + /** + * optional uint32 id = 13; + * @return whether the id field is set + */ + public boolean hasId() { + return (bitField0_ & 0x00000002) != 0; + } + + /** + * optional uint32 id = 13; + * @return this + */ + public MarkReadMailScRsp clearId() { + bitField0_ &= ~0x00000002; + id = 0; + return this; + } + + /** + * optional uint32 id = 13; + * @return the id + */ + public int getId() { + return id; + } + + /** + * optional uint32 id = 13; + * @param value the id to set + * @return this + */ + public MarkReadMailScRsp setId(final int value) { + bitField0_ |= 0x00000002; + id = value; + return this; + } + + @Override + public MarkReadMailScRsp copyFrom(final MarkReadMailScRsp other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + retcode = other.retcode; + id = other.id; + } + return this; + } + + @Override + public MarkReadMailScRsp mergeFrom(final MarkReadMailScRsp other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasRetcode()) { + setRetcode(other.retcode); + } + if (other.hasId()) { + setId(other.id); + } + return this; + } + + @Override + public MarkReadMailScRsp clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + retcode = 0; + id = 0; + return this; + } + + @Override + public MarkReadMailScRsp 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 MarkReadMailScRsp)) { + return false; + } + MarkReadMailScRsp other = (MarkReadMailScRsp) o; + return bitField0_ == other.bitField0_ + && (!hasRetcode() || retcode == other.retcode) + && (!hasId() || id == other.id); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + output.writeRawByte((byte) 16); + output.writeUInt32NoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeRawByte((byte) 104); + output.writeUInt32NoTag(id); + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + size += 1 + ProtoSink.computeUInt32SizeNoTag(id); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public MarkReadMailScRsp mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 16: { + // retcode + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 104) { + break; + } + } + case 104: { + // id + id = 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.retcode, retcode); + } + if ((bitField0_ & 0x00000002) != 0) { + output.writeUInt32(FieldNames.id, id); + } + output.endObject(); + } + + @Override + public MarkReadMailScRsp mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case 1097936398: { + if (input.isAtField(FieldNames.retcode)) { + if (!input.trySkipNullValue()) { + retcode = input.readUInt32(); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + case 3355: { + if (input.isAtField(FieldNames.id)) { + if (!input.trySkipNullValue()) { + id = input.readUInt32(); + bitField0_ |= 0x00000002; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public MarkReadMailScRsp clone() { + return new MarkReadMailScRsp().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static MarkReadMailScRsp parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new MarkReadMailScRsp(), data).checkInitialized(); + } + + public static MarkReadMailScRsp parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new MarkReadMailScRsp(), input).checkInitialized(); + } + + public static MarkReadMailScRsp parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new MarkReadMailScRsp(), input).checkInitialized(); + } + + /** + * @return factory for creating MarkReadMailScRsp messages + */ + public static MessageFactory getFactory() { + return MarkReadMailScRspFactory.INSTANCE; + } + + private enum MarkReadMailScRspFactory implements MessageFactory { + INSTANCE; + + @Override + public MarkReadMailScRsp create() { + return MarkReadMailScRsp.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName retcode = FieldName.forField("retcode"); + + static final FieldName id = FieldName.forField("id"); + } + } +} diff --git a/src/generated/main/emu/lunarcore/proto/NewMailScNotifyOuterClass.java b/src/generated/main/emu/lunarcore/proto/NewMailScNotifyOuterClass.java new file mode 100644 index 0000000..d8888d0 --- /dev/null +++ b/src/generated/main/emu/lunarcore/proto/NewMailScNotifyOuterClass.java @@ -0,0 +1,301 @@ +// Code generated by protocol buffer compiler. Do not edit! +package emu.lunarcore.proto; + +import java.io.IOException; +import us.hebi.quickbuf.FieldName; +import us.hebi.quickbuf.InvalidProtocolBufferException; +import us.hebi.quickbuf.JsonSink; +import us.hebi.quickbuf.JsonSource; +import us.hebi.quickbuf.MessageFactory; +import us.hebi.quickbuf.ProtoMessage; +import us.hebi.quickbuf.ProtoSink; +import us.hebi.quickbuf.ProtoSource; +import us.hebi.quickbuf.RepeatedInt; + +public final class NewMailScNotifyOuterClass { + /** + * Protobuf type {@code NewMailScNotify} + */ + public static final class NewMailScNotify extends ProtoMessage implements Cloneable { + private static final long serialVersionUID = 0L; + + /** + * repeated uint32 mail_id_list = 1; + */ + private final RepeatedInt mailIdList = RepeatedInt.newEmptyInstance(); + + private NewMailScNotify() { + } + + /** + * @return a new empty instance of {@code NewMailScNotify} + */ + public static NewMailScNotify newInstance() { + return new NewMailScNotify(); + } + + /** + * repeated uint32 mail_id_list = 1; + * @return whether the mailIdList field is set + */ + public boolean hasMailIdList() { + return (bitField0_ & 0x00000001) != 0; + } + + /** + * repeated uint32 mail_id_list = 1; + * @return this + */ + public NewMailScNotify clearMailIdList() { + bitField0_ &= ~0x00000001; + mailIdList.clear(); + return this; + } + + /** + * repeated uint32 mail_id_list = 1; + * + * This method returns the internal storage object without modifying any has state. + * The returned object should not be modified and be treated as read-only. + * + * Use {@link #getMutableMailIdList()} if you want to modify it. + * + * @return internal storage object for reading + */ + public RepeatedInt getMailIdList() { + return mailIdList; + } + + /** + * repeated uint32 mail_id_list = 1; + * + * This method returns the internal storage object and sets the corresponding + * has state. The returned object will become part of this message and its + * contents may be modified as long as the has state is not cleared. + * + * @return internal storage object for modifications + */ + public RepeatedInt getMutableMailIdList() { + bitField0_ |= 0x00000001; + return mailIdList; + } + + /** + * repeated uint32 mail_id_list = 1; + * @param value the mailIdList to add + * @return this + */ + public NewMailScNotify addMailIdList(final int value) { + bitField0_ |= 0x00000001; + mailIdList.add(value); + return this; + } + + /** + * repeated uint32 mail_id_list = 1; + * @param values the mailIdList to add + * @return this + */ + public NewMailScNotify addAllMailIdList(final int... values) { + bitField0_ |= 0x00000001; + mailIdList.addAll(values); + return this; + } + + @Override + public NewMailScNotify copyFrom(final NewMailScNotify other) { + cachedSize = other.cachedSize; + if ((bitField0_ | other.bitField0_) != 0) { + bitField0_ = other.bitField0_; + mailIdList.copyFrom(other.mailIdList); + } + return this; + } + + @Override + public NewMailScNotify mergeFrom(final NewMailScNotify other) { + if (other.isEmpty()) { + return this; + } + cachedSize = -1; + if (other.hasMailIdList()) { + getMutableMailIdList().addAll(other.mailIdList); + } + return this; + } + + @Override + public NewMailScNotify clear() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mailIdList.clear(); + return this; + } + + @Override + public NewMailScNotify clearQuick() { + if (isEmpty()) { + return this; + } + cachedSize = -1; + bitField0_ = 0; + mailIdList.clear(); + return this; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (!(o instanceof NewMailScNotify)) { + return false; + } + NewMailScNotify other = (NewMailScNotify) o; + return bitField0_ == other.bitField0_ + && (!hasMailIdList() || mailIdList.equals(other.mailIdList)); + } + + @Override + public void writeTo(final ProtoSink output) throws IOException { + if ((bitField0_ & 0x00000001) != 0) { + for (int i = 0; i < mailIdList.length(); i++) { + output.writeRawByte((byte) 8); + output.writeUInt32NoTag(mailIdList.array()[i]); + } + } + } + + @Override + protected int computeSerializedSize() { + int size = 0; + if ((bitField0_ & 0x00000001) != 0) { + size += (1 * mailIdList.length()) + ProtoSink.computeRepeatedUInt32SizeNoTag(mailIdList); + } + return size; + } + + @Override + @SuppressWarnings("fallthrough") + public NewMailScNotify mergeFrom(final ProtoSource input) throws IOException { + // Enabled Fall-Through Optimization (QuickBuffers) + int tag = input.readTag(); + while (true) { + switch (tag) { + case 10: { + // mailIdList [packed=true] + input.readPackedUInt32(mailIdList, tag); + bitField0_ |= 0x00000001; + tag = input.readTag(); + if (tag != 0) { + break; + } + } + case 0: { + return this; + } + default: { + if (!input.skipField(tag)) { + return this; + } + tag = input.readTag(); + break; + } + case 8: { + // mailIdList [packed=false] + tag = input.readRepeatedUInt32(mailIdList, tag); + bitField0_ |= 0x00000001; + break; + } + } + } + } + + @Override + public void writeTo(final JsonSink output) throws IOException { + output.beginObject(); + if ((bitField0_ & 0x00000001) != 0) { + output.writeRepeatedUInt32(FieldNames.mailIdList, mailIdList); + } + output.endObject(); + } + + @Override + public NewMailScNotify mergeFrom(final JsonSource input) throws IOException { + if (!input.beginObject()) { + return this; + } + while (!input.isAtEnd()) { + switch (input.readFieldHash()) { + case -1612269328: + case 1599691450: { + if (input.isAtField(FieldNames.mailIdList)) { + if (!input.trySkipNullValue()) { + input.readRepeatedUInt32(mailIdList); + bitField0_ |= 0x00000001; + } + } else { + input.skipUnknownField(); + } + break; + } + default: { + input.skipUnknownField(); + break; + } + } + } + input.endObject(); + return this; + } + + @Override + public NewMailScNotify clone() { + return new NewMailScNotify().copyFrom(this); + } + + @Override + public boolean isEmpty() { + return ((bitField0_) == 0); + } + + public static NewMailScNotify parseFrom(final byte[] data) throws + InvalidProtocolBufferException { + return ProtoMessage.mergeFrom(new NewMailScNotify(), data).checkInitialized(); + } + + public static NewMailScNotify parseFrom(final ProtoSource input) throws IOException { + return ProtoMessage.mergeFrom(new NewMailScNotify(), input).checkInitialized(); + } + + public static NewMailScNotify parseFrom(final JsonSource input) throws IOException { + return ProtoMessage.mergeFrom(new NewMailScNotify(), input).checkInitialized(); + } + + /** + * @return factory for creating NewMailScNotify messages + */ + public static MessageFactory getFactory() { + return NewMailScNotifyFactory.INSTANCE; + } + + private enum NewMailScNotifyFactory implements MessageFactory { + INSTANCE; + + @Override + public NewMailScNotify create() { + return NewMailScNotify.newInstance(); + } + } + + /** + * Contains name constants used for serializing JSON + */ + static class FieldNames { + static final FieldName mailIdList = FieldName.forField("mailIdList", "mail_id_list"); + } + } +} diff --git a/src/main/java/emu/lunarcore/command/commands/MailCommand.java b/src/main/java/emu/lunarcore/command/commands/MailCommand.java new file mode 100644 index 0000000..e529fc2 --- /dev/null +++ b/src/main/java/emu/lunarcore/command/commands/MailCommand.java @@ -0,0 +1,28 @@ +package emu.lunarcore.command.commands; + +import emu.lunarcore.command.Command; +import emu.lunarcore.command.CommandArgs; +import emu.lunarcore.command.CommandHandler; +import emu.lunarcore.game.mail.Mail; +import emu.lunarcore.game.player.Player; + +@Command(label = "mail", aliases = {"m"}, permission = "player.mail", desc = "/mail [content]. Sends the targeted player a system mail.") +public class MailCommand implements CommandHandler { + + @Override + public void execute(Player sender, CommandArgs args) { + // Check target + if (args.getTarget() == null) { + this.sendMessage(sender, "Error: Targeted player not found or offline"); + return; + } + + String content = String.join(" ", args.getList()); + Mail mail = new Mail("Test", "System Mail", content); + + args.getTarget().getMailbox().sendMail(mail); + + sender.sendMessage("Sending mail to " + args.getTarget().getName()); + } + +} diff --git a/src/main/java/emu/lunarcore/game/mail/Mail.java b/src/main/java/emu/lunarcore/game/mail/Mail.java new file mode 100644 index 0000000..a487c1d --- /dev/null +++ b/src/main/java/emu/lunarcore/game/mail/Mail.java @@ -0,0 +1,83 @@ +package emu.lunarcore.game.mail; + +import java.util.List; +import java.util.concurrent.TimeUnit; + +import org.bson.types.ObjectId; + +import dev.morphia.annotations.Entity; +import dev.morphia.annotations.Id; +import dev.morphia.annotations.Indexed; +import emu.lunarcore.LunarRail; +import emu.lunarcore.game.inventory.GameItem; +import emu.lunarcore.game.player.Player; +import emu.lunarcore.proto.ClientMailOuterClass.ClientMail; +import emu.lunarcore.proto.ItemListOuterClass.ItemList; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Entity(value = "mail", useDiscriminator = false) +public class Mail { + @Id private ObjectId id; + @Indexed private int ownerUid; // Uid of player that this mail belongs to + + @Setter + private transient int uniqueId; + + private String title; + private String sender; + private String content; + private long time; + private long expiry; + private boolean isRead; + private List attachments; + + @Deprecated // Morphia only! + public Mail() {} + + public Mail(String title, String sender, String content) { + this.title = title; + this.sender = sender; + this.content = content; + this.time = System.currentTimeMillis() / 1000; + this.expiry = this.time + TimeUnit.DAYS.toSeconds(30); + } + + public void setOwner(Player player) { + this.ownerUid = player.getUid(); + } + + public void setRead() { + if (!this.isRead) { + this.isRead = true; + this.save(); + } + } + + // Database + + public void save() { + LunarRail.getGameDatabase().save(this); + } + + public void delete() { + LunarRail.getGameDatabase().delete(this); + } + + // Proto + + public ClientMail toProto() { + var proto = ClientMail.newInstance() + .setId(this.getUniqueId()) + .setTitle(this.getTitle()) + .setContent(this.getContent()) + .setSender(this.getSender()) + .setTime(this.getTime()) + .setExpireTime(this.getExpiry()) + .setIsRead(this.isRead()) + .setAttachment(ItemList.newInstance()); + + return proto; + } +} \ No newline at end of file diff --git a/src/main/java/emu/lunarcore/game/mail/Mailbox.java b/src/main/java/emu/lunarcore/game/mail/Mailbox.java new file mode 100644 index 0000000..d0f054b --- /dev/null +++ b/src/main/java/emu/lunarcore/game/mail/Mailbox.java @@ -0,0 +1,94 @@ +package emu.lunarcore.game.mail; + +import java.util.Iterator; +import java.util.stream.Stream; + +import emu.lunarcore.LunarRail; +import emu.lunarcore.game.player.BasePlayerManager; +import emu.lunarcore.game.player.Player; +import emu.lunarcore.server.packet.send.PacketNewMailScNotify; + +import it.unimi.dsi.fastutil.ints.Int2ObjectMap; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntList; + +import lombok.AccessLevel; +import lombok.Getter; +import us.hebi.quickbuf.RepeatedInt; + +@Getter(AccessLevel.PRIVATE) +public class Mailbox extends BasePlayerManager implements Iterable { + private final Int2ObjectMap map; + private int lastMailId; + + public Mailbox(Player player) { + super(player); + + this.map = new Int2ObjectOpenHashMap<>(); + } + + private int getNextMailId() { + return ++lastMailId; + } + + public synchronized int size() { + return getMap().size(); + } + + public synchronized void readMail(int id) { + Mail mail = getMap().get(id); + if (mail != null) { + mail.setRead(); + } + } + + public synchronized void sendMail(Mail mail) { + // Set owner for mail first before we save + mail.setOwner(this.getPlayer()); + + // Put mail into our backing hash map + this.putMail(mail); + + // Save mail to database + mail.save(); + + // Send packet + this.getPlayer().sendPacket(new PacketNewMailScNotify(mail)); + } + + public synchronized IntList deleteMail(RepeatedInt idList) { + IntList deleteList = new IntArrayList(); + + for (int id : idList) { + Mail mail = getMap().remove(id); + if (mail != null) { + // Delete from database + mail.delete(); + // Add to delete result list + deleteList.add(mail.getUniqueId()); + } + } + + return deleteList; + } + + // Internal method to put mail into the hash map + private void putMail(Mail mail) { + mail.setUniqueId(this.getNextMailId()); + getMap().put(mail.getUniqueId(), mail); + } + + @Override + public synchronized Iterator iterator() { + return getMap().values().iterator(); + } + + // Database + + public void loadFromDatabase() { + Stream stream = LunarRail.getGameDatabase().getObjects(Mail.class, "ownerUid", this.getPlayer().getUid()); + + stream.forEach(this::putMail); + } +} diff --git a/src/main/java/emu/lunarcore/game/player/Player.java b/src/main/java/emu/lunarcore/game/player/Player.java index 14f7f0c..d05a597 100644 --- a/src/main/java/emu/lunarcore/game/player/Player.java +++ b/src/main/java/emu/lunarcore/game/player/Player.java @@ -27,6 +27,7 @@ import emu.lunarcore.game.chat.ChatMessage; import emu.lunarcore.game.enums.PropState; import emu.lunarcore.game.gacha.PlayerGachaInfo; import emu.lunarcore.game.inventory.Inventory; +import emu.lunarcore.game.mail.Mailbox; import emu.lunarcore.game.scene.Scene; import emu.lunarcore.game.scene.entity.EntityProp; import emu.lunarcore.game.scene.entity.GameEntity; @@ -81,6 +82,7 @@ public class Player { private transient final AvatarStorage avatars; private transient final Inventory inventory; private transient final ChatManager chatManager; + private transient final Mailbox mailbox; private transient final ChallengeManager challengeManager; // Database persistent data @@ -101,6 +103,7 @@ public class Player { this.avatars = new AvatarStorage(this); this.inventory = new Inventory(this); this.chatManager = new ChatManager(this); + this.mailbox = new Mailbox(this); this.challengeManager = new ChallengeManager(this); } @@ -515,6 +518,7 @@ public class Player { // Load avatars and inventory first this.getAvatars().loadFromDatabase(); this.getInventory().loadFromDatabase(); + this.getMailbox().loadFromDatabase(); this.getChallengeManager().loadFromDatabase(); // Load Etc diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerDelMailCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerDelMailCsReq.java new file mode 100644 index 0000000..254b793 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerDelMailCsReq.java @@ -0,0 +1,23 @@ +package emu.lunarcore.server.packet.recv; + +import emu.lunarcore.proto.DelMailCsReqOuterClass.DelMailCsReq; +import emu.lunarcore.server.game.GameSession; +import emu.lunarcore.server.packet.CmdId; +import emu.lunarcore.server.packet.Opcodes; +import emu.lunarcore.server.packet.PacketHandler; +import emu.lunarcore.server.packet.send.PacketDelMailScRsp; +import it.unimi.dsi.fastutil.ints.IntList; + +@Opcodes(CmdId.DelMailCsReq) +public class HandlerDelMailCsReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] data) throws Exception { + var req = DelMailCsReq.parseFrom(data); + + IntList deleted = session.getPlayer().getMailbox().deleteMail(req.getIdList()); + + session.send(new PacketDelMailScRsp(deleted)); + } + +} diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMailCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMailCsReq.java index 753c65f..605cc1f 100644 --- a/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMailCsReq.java +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerGetMailCsReq.java @@ -4,13 +4,14 @@ import emu.lunarcore.server.game.GameSession; import emu.lunarcore.server.packet.CmdId; import emu.lunarcore.server.packet.Opcodes; import emu.lunarcore.server.packet.PacketHandler; +import emu.lunarcore.server.packet.send.PacketGetMailScRsp; @Opcodes(CmdId.GetMailCsReq) public class HandlerGetMailCsReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] data) throws Exception { - session.send(CmdId.GetMailScRsp); + session.send(new PacketGetMailScRsp(session.getPlayer())); } } diff --git a/src/main/java/emu/lunarcore/server/packet/recv/HandlerMarkReadMailCsReq.java b/src/main/java/emu/lunarcore/server/packet/recv/HandlerMarkReadMailCsReq.java new file mode 100644 index 0000000..a1d877d --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/recv/HandlerMarkReadMailCsReq.java @@ -0,0 +1,20 @@ +package emu.lunarcore.server.packet.recv; + +import emu.lunarcore.proto.MarkReadMailCsReqOuterClass.MarkReadMailCsReq; +import emu.lunarcore.server.game.GameSession; +import emu.lunarcore.server.packet.CmdId; +import emu.lunarcore.server.packet.Opcodes; +import emu.lunarcore.server.packet.PacketHandler; + +@Opcodes(CmdId.MarkReadMailCsReq) +public class HandlerMarkReadMailCsReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] data) throws Exception { + var req = MarkReadMailCsReq.parseFrom(data); + + session.getPlayer().getMailbox().readMail(req.getId()); + session.send(CmdId.MarkReadMailScRsp); + } + +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketDelMailScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketDelMailScRsp.java new file mode 100644 index 0000000..5d17a28 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketDelMailScRsp.java @@ -0,0 +1,19 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.proto.DelMailScRspOuterClass.DelMailScRsp; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; +import it.unimi.dsi.fastutil.ints.IntList; + +public class PacketDelMailScRsp extends BasePacket { + + public PacketDelMailScRsp(IntList deleteList) { + super(CmdId.DelMailScRsp); + + var data = DelMailScRsp.newInstance(); + + deleteList.forEach(data::addIdList); + + this.setData(data); + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketGetMailScRsp.java b/src/main/java/emu/lunarcore/server/packet/send/PacketGetMailScRsp.java new file mode 100644 index 0000000..4f79a46 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketGetMailScRsp.java @@ -0,0 +1,24 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.game.mail.Mail; +import emu.lunarcore.game.player.Player; +import emu.lunarcore.proto.GetMailScRspOuterClass.GetMailScRsp; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; + +public class PacketGetMailScRsp extends BasePacket { + + public PacketGetMailScRsp(Player player) { + super(CmdId.GetMailScRsp); + + var data = GetMailScRsp.newInstance() + .setIsEnd(true) + .setTotalNum(player.getMailbox().size()); + + for (Mail mail : player.getMailbox()) { + data.addMailList(mail.toProto()); + } + + this.setData(data); + } +} diff --git a/src/main/java/emu/lunarcore/server/packet/send/PacketNewMailScNotify.java b/src/main/java/emu/lunarcore/server/packet/send/PacketNewMailScNotify.java new file mode 100644 index 0000000..3c0ac55 --- /dev/null +++ b/src/main/java/emu/lunarcore/server/packet/send/PacketNewMailScNotify.java @@ -0,0 +1,18 @@ +package emu.lunarcore.server.packet.send; + +import emu.lunarcore.game.mail.Mail; +import emu.lunarcore.proto.NewMailScNotifyOuterClass.NewMailScNotify; +import emu.lunarcore.server.packet.BasePacket; +import emu.lunarcore.server.packet.CmdId; + +public class PacketNewMailScNotify extends BasePacket { + + public PacketNewMailScNotify(Mail mail) { + super(CmdId.NewMailScNotify); + + var data = NewMailScNotify.newInstance() + .addMailIdList(mail.getUniqueId()); + + this.setData(data); + } +}