Implement basic mail system

This commit is contained in:
Melledy
2023-10-17 11:02:58 -07:00
parent cde7b37707
commit 0bbd30eb17
18 changed files with 3978 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -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<DelMailCsReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated uint32 id_list = 13;</code>
*/
private final RepeatedInt idList = RepeatedInt.newEmptyInstance();
private DelMailCsReq() {
}
/**
* @return a new empty instance of {@code DelMailCsReq}
*/
public static DelMailCsReq newInstance() {
return new DelMailCsReq();
}
/**
* <code>repeated uint32 id_list = 13;</code>
* @return whether the idList field is set
*/
public boolean hasIdList() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated uint32 id_list = 13;</code>
* @return this
*/
public DelMailCsReq clearIdList() {
bitField0_ &= ~0x00000001;
idList.clear();
return this;
}
/**
* <code>repeated uint32 id_list = 13;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getIdList() {
return idList;
}
/**
* <code>repeated uint32 id_list = 13;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedInt getMutableIdList() {
bitField0_ |= 0x00000001;
return idList;
}
/**
* <code>repeated uint32 id_list = 13;</code>
* @param value the idList to add
* @return this
*/
public DelMailCsReq addIdList(final int value) {
bitField0_ |= 0x00000001;
idList.add(value);
return this;
}
/**
* <code>repeated uint32 id_list = 13;</code>
* @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<DelMailCsReq> getFactory() {
return DelMailCsReqFactory.INSTANCE;
}
private enum DelMailCsReqFactory implements MessageFactory<DelMailCsReq> {
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");
}
}
}

View File

@@ -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<DelMailScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 retcode = 10;</code>
*/
private int retcode;
/**
* <code>repeated uint32 id_list = 14;</code>
*/
private final RepeatedInt idList = RepeatedInt.newEmptyInstance();
private DelMailScRsp() {
}
/**
* @return a new empty instance of {@code DelMailScRsp}
*/
public static DelMailScRsp newInstance() {
return new DelMailScRsp();
}
/**
* <code>optional uint32 retcode = 10;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 retcode = 10;</code>
* @return this
*/
public DelMailScRsp clearRetcode() {
bitField0_ &= ~0x00000001;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 10;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 10;</code>
* @param value the retcode to set
* @return this
*/
public DelMailScRsp setRetcode(final int value) {
bitField0_ |= 0x00000001;
retcode = value;
return this;
}
/**
* <code>repeated uint32 id_list = 14;</code>
* @return whether the idList field is set
*/
public boolean hasIdList() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>repeated uint32 id_list = 14;</code>
* @return this
*/
public DelMailScRsp clearIdList() {
bitField0_ &= ~0x00000002;
idList.clear();
return this;
}
/**
* <code>repeated uint32 id_list = 14;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getIdList() {
return idList;
}
/**
* <code>repeated uint32 id_list = 14;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedInt getMutableIdList() {
bitField0_ |= 0x00000002;
return idList;
}
/**
* <code>repeated uint32 id_list = 14;</code>
* @param value the idList to add
* @return this
*/
public DelMailScRsp addIdList(final int value) {
bitField0_ |= 0x00000002;
idList.add(value);
return this;
}
/**
* <code>repeated uint32 id_list = 14;</code>
* @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<DelMailScRsp> getFactory() {
return DelMailScRspFactory.INSTANCE;
}
private enum DelMailScRspFactory implements MessageFactory<DelMailScRsp> {
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");
}
}
}

View File

@@ -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<GetMailScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 retcode = 6;</code>
*/
private int retcode;
/**
* <code>optional uint32 total_num = 10;</code>
*/
private int totalNum;
/**
* <code>optional uint32 start = 13;</code>
*/
private int start;
/**
* <code>optional bool is_end = 1;</code>
*/
private boolean isEnd;
/**
* <code>repeated .ClientMail mail_list = 5;</code>
*/
private final RepeatedMessage<ClientMailOuterClass.ClientMail> mailList = RepeatedMessage.newEmptyInstance(ClientMailOuterClass.ClientMail.getFactory());
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
*/
private final RepeatedMessage<ClientMailOuterClass.ClientMail> noticeMailList = RepeatedMessage.newEmptyInstance(ClientMailOuterClass.ClientMail.getFactory());
private GetMailScRsp() {
}
/**
* @return a new empty instance of {@code GetMailScRsp}
*/
public static GetMailScRsp newInstance() {
return new GetMailScRsp();
}
/**
* <code>optional uint32 retcode = 6;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 retcode = 6;</code>
* @return this
*/
public GetMailScRsp clearRetcode() {
bitField0_ &= ~0x00000001;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 6;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 6;</code>
* @param value the retcode to set
* @return this
*/
public GetMailScRsp setRetcode(final int value) {
bitField0_ |= 0x00000001;
retcode = value;
return this;
}
/**
* <code>optional uint32 total_num = 10;</code>
* @return whether the totalNum field is set
*/
public boolean hasTotalNum() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 total_num = 10;</code>
* @return this
*/
public GetMailScRsp clearTotalNum() {
bitField0_ &= ~0x00000002;
totalNum = 0;
return this;
}
/**
* <code>optional uint32 total_num = 10;</code>
* @return the totalNum
*/
public int getTotalNum() {
return totalNum;
}
/**
* <code>optional uint32 total_num = 10;</code>
* @param value the totalNum to set
* @return this
*/
public GetMailScRsp setTotalNum(final int value) {
bitField0_ |= 0x00000002;
totalNum = value;
return this;
}
/**
* <code>optional uint32 start = 13;</code>
* @return whether the start field is set
*/
public boolean hasStart() {
return (bitField0_ & 0x00000004) != 0;
}
/**
* <code>optional uint32 start = 13;</code>
* @return this
*/
public GetMailScRsp clearStart() {
bitField0_ &= ~0x00000004;
start = 0;
return this;
}
/**
* <code>optional uint32 start = 13;</code>
* @return the start
*/
public int getStart() {
return start;
}
/**
* <code>optional uint32 start = 13;</code>
* @param value the start to set
* @return this
*/
public GetMailScRsp setStart(final int value) {
bitField0_ |= 0x00000004;
start = value;
return this;
}
/**
* <code>optional bool is_end = 1;</code>
* @return whether the isEnd field is set
*/
public boolean hasIsEnd() {
return (bitField0_ & 0x00000008) != 0;
}
/**
* <code>optional bool is_end = 1;</code>
* @return this
*/
public GetMailScRsp clearIsEnd() {
bitField0_ &= ~0x00000008;
isEnd = false;
return this;
}
/**
* <code>optional bool is_end = 1;</code>
* @return the isEnd
*/
public boolean getIsEnd() {
return isEnd;
}
/**
* <code>optional bool is_end = 1;</code>
* @param value the isEnd to set
* @return this
*/
public GetMailScRsp setIsEnd(final boolean value) {
bitField0_ |= 0x00000008;
isEnd = value;
return this;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
* @return whether the mailList field is set
*/
public boolean hasMailList() {
return (bitField0_ & 0x00000010) != 0;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
* @return this
*/
public GetMailScRsp clearMailList() {
bitField0_ &= ~0x00000010;
mailList.clear();
return this;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableMailList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<ClientMailOuterClass.ClientMail> getMailList() {
return mailList;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<ClientMailOuterClass.ClientMail> getMutableMailList() {
bitField0_ |= 0x00000010;
return mailList;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
* @param value the mailList to add
* @return this
*/
public GetMailScRsp addMailList(final ClientMailOuterClass.ClientMail value) {
bitField0_ |= 0x00000010;
mailList.add(value);
return this;
}
/**
* <code>repeated .ClientMail mail_list = 5;</code>
* @param values the mailList to add
* @return this
*/
public GetMailScRsp addAllMailList(final ClientMailOuterClass.ClientMail... values) {
bitField0_ |= 0x00000010;
mailList.addAll(values);
return this;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
* @return whether the noticeMailList field is set
*/
public boolean hasNoticeMailList() {
return (bitField0_ & 0x00000020) != 0;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
* @return this
*/
public GetMailScRsp clearNoticeMailList() {
bitField0_ &= ~0x00000020;
noticeMailList.clear();
return this;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableNoticeMailList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedMessage<ClientMailOuterClass.ClientMail> getNoticeMailList() {
return noticeMailList;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedMessage<ClientMailOuterClass.ClientMail> getMutableNoticeMailList() {
bitField0_ |= 0x00000020;
return noticeMailList;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
* @param value the noticeMailList to add
* @return this
*/
public GetMailScRsp addNoticeMailList(final ClientMailOuterClass.ClientMail value) {
bitField0_ |= 0x00000020;
noticeMailList.add(value);
return this;
}
/**
* <code>repeated .ClientMail notice_mail_list = 15;</code>
* @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<GetMailScRsp> getFactory() {
return GetMailScRspFactory.INSTANCE;
}
private enum GetMailScRspFactory implements MessageFactory<GetMailScRsp> {
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");
}
}
}

View File

@@ -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<MailType> {
/**
* <code>MAIL_TYPE_NORMAL = 0;</code>
*/
MAIL_TYPE_NORMAL("MAIL_TYPE_NORMAL", 0),
/**
* <code>MAIL_TYPE_STAR = 1;</code>
*/
MAIL_TYPE_STAR("MAIL_TYPE_STAR", 1);
/**
* <code>MAIL_TYPE_NORMAL = 0;</code>
*/
public static final int MAIL_TYPE_NORMAL_VALUE = 0;
/**
* <code>MAIL_TYPE_STAR = 1;</code>
*/
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<MailType> 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<MailType> {
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;
}
}
}
}

View File

@@ -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<MarkReadMailCsReq> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 id = 12;</code>
*/
private int id;
private MarkReadMailCsReq() {
}
/**
* @return a new empty instance of {@code MarkReadMailCsReq}
*/
public static MarkReadMailCsReq newInstance() {
return new MarkReadMailCsReq();
}
/**
* <code>optional uint32 id = 12;</code>
* @return whether the id field is set
*/
public boolean hasId() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 id = 12;</code>
* @return this
*/
public MarkReadMailCsReq clearId() {
bitField0_ &= ~0x00000001;
id = 0;
return this;
}
/**
* <code>optional uint32 id = 12;</code>
* @return the id
*/
public int getId() {
return id;
}
/**
* <code>optional uint32 id = 12;</code>
* @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<MarkReadMailCsReq> getFactory() {
return MarkReadMailCsReqFactory.INSTANCE;
}
private enum MarkReadMailCsReqFactory implements MessageFactory<MarkReadMailCsReq> {
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");
}
}
}

View File

@@ -0,0 +1,339 @@
// Code generated by protocol buffer compiler. Do not edit!
package emu.lunarcore.proto;
import java.io.IOException;
import us.hebi.quickbuf.FieldName;
import us.hebi.quickbuf.InvalidProtocolBufferException;
import us.hebi.quickbuf.JsonSink;
import us.hebi.quickbuf.JsonSource;
import us.hebi.quickbuf.MessageFactory;
import us.hebi.quickbuf.ProtoMessage;
import us.hebi.quickbuf.ProtoSink;
import us.hebi.quickbuf.ProtoSource;
public final class MarkReadMailScRspOuterClass {
/**
* Protobuf type {@code MarkReadMailScRsp}
*/
public static final class MarkReadMailScRsp extends ProtoMessage<MarkReadMailScRsp> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>optional uint32 retcode = 2;</code>
*/
private int retcode;
/**
* <code>optional uint32 id = 13;</code>
*/
private int id;
private MarkReadMailScRsp() {
}
/**
* @return a new empty instance of {@code MarkReadMailScRsp}
*/
public static MarkReadMailScRsp newInstance() {
return new MarkReadMailScRsp();
}
/**
* <code>optional uint32 retcode = 2;</code>
* @return whether the retcode field is set
*/
public boolean hasRetcode() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>optional uint32 retcode = 2;</code>
* @return this
*/
public MarkReadMailScRsp clearRetcode() {
bitField0_ &= ~0x00000001;
retcode = 0;
return this;
}
/**
* <code>optional uint32 retcode = 2;</code>
* @return the retcode
*/
public int getRetcode() {
return retcode;
}
/**
* <code>optional uint32 retcode = 2;</code>
* @param value the retcode to set
* @return this
*/
public MarkReadMailScRsp setRetcode(final int value) {
bitField0_ |= 0x00000001;
retcode = value;
return this;
}
/**
* <code>optional uint32 id = 13;</code>
* @return whether the id field is set
*/
public boolean hasId() {
return (bitField0_ & 0x00000002) != 0;
}
/**
* <code>optional uint32 id = 13;</code>
* @return this
*/
public MarkReadMailScRsp clearId() {
bitField0_ &= ~0x00000002;
id = 0;
return this;
}
/**
* <code>optional uint32 id = 13;</code>
* @return the id
*/
public int getId() {
return id;
}
/**
* <code>optional uint32 id = 13;</code>
* @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<MarkReadMailScRsp> getFactory() {
return MarkReadMailScRspFactory.INSTANCE;
}
private enum MarkReadMailScRspFactory implements MessageFactory<MarkReadMailScRsp> {
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");
}
}
}

View File

@@ -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<NewMailScNotify> implements Cloneable {
private static final long serialVersionUID = 0L;
/**
* <code>repeated uint32 mail_id_list = 1;</code>
*/
private final RepeatedInt mailIdList = RepeatedInt.newEmptyInstance();
private NewMailScNotify() {
}
/**
* @return a new empty instance of {@code NewMailScNotify}
*/
public static NewMailScNotify newInstance() {
return new NewMailScNotify();
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
* @return whether the mailIdList field is set
*/
public boolean hasMailIdList() {
return (bitField0_ & 0x00000001) != 0;
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
* @return this
*/
public NewMailScNotify clearMailIdList() {
bitField0_ &= ~0x00000001;
mailIdList.clear();
return this;
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
*
* This method returns the internal storage object without modifying any has state.
* The returned object should not be modified and be treated as read-only.
*
* Use {@link #getMutableMailIdList()} if you want to modify it.
*
* @return internal storage object for reading
*/
public RepeatedInt getMailIdList() {
return mailIdList;
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
*
* This method returns the internal storage object and sets the corresponding
* has state. The returned object will become part of this message and its
* contents may be modified as long as the has state is not cleared.
*
* @return internal storage object for modifications
*/
public RepeatedInt getMutableMailIdList() {
bitField0_ |= 0x00000001;
return mailIdList;
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
* @param value the mailIdList to add
* @return this
*/
public NewMailScNotify addMailIdList(final int value) {
bitField0_ |= 0x00000001;
mailIdList.add(value);
return this;
}
/**
* <code>repeated uint32 mail_id_list = 1;</code>
* @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<NewMailScNotify> getFactory() {
return NewMailScNotifyFactory.INSTANCE;
}
private enum NewMailScNotifyFactory implements MessageFactory<NewMailScNotify> {
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");
}
}
}

View File

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

View File

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

View File

@@ -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<Mail> {
private final Int2ObjectMap<Mail> 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<Mail> iterator() {
return getMap().values().iterator();
}
// Database
public void loadFromDatabase() {
Stream<Mail> stream = LunarRail.getGameDatabase().getObjects(Mail.class, "ownerUid", this.getPlayer().getUid());
stream.forEach(this::putMail);
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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