2022-04-23 23:07:18 +08:00
|
|
|
package emu.grasscutter.game;
|
|
|
|
|
2022-04-24 18:17:08 +08:00
|
|
|
import dev.morphia.annotations.Entity;
|
|
|
|
|
2022-04-23 23:07:18 +08:00
|
|
|
import java.time.Instant;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
|
2022-04-24 18:17:08 +08:00
|
|
|
@Entity
|
2022-04-23 23:07:18 +08:00
|
|
|
public class Mail {
|
|
|
|
|
|
|
|
public MailContent mailContent;
|
|
|
|
public List<MailItem> itemList;
|
|
|
|
public long sendTime;
|
|
|
|
public long expireTime;
|
|
|
|
public int importance;
|
|
|
|
public boolean isRead;
|
|
|
|
public boolean isAttachmentGot;
|
|
|
|
public int stateValue;
|
|
|
|
|
|
|
|
public Mail() {
|
2022-04-25 21:53:10 +08:00
|
|
|
this(new MailContent(), new ArrayList<MailItem>(), (int) Instant.now().getEpochSecond() + 604800); // TODO: add expire time to send mail command
|
2022-04-23 23:07:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime) {
|
2022-04-25 14:30:56 +08:00
|
|
|
this(mailContent, itemList, expireTime, 0);
|
2022-04-23 23:07:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime, int importance) {
|
|
|
|
this(mailContent, itemList, expireTime, importance, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
public Mail(MailContent mailContent, List<MailItem> itemList, long expireTime, int importance, int state) {
|
|
|
|
this.mailContent = mailContent;
|
|
|
|
this.itemList = itemList;
|
2022-04-24 19:06:52 +08:00
|
|
|
this.sendTime = (int) Instant.now().getEpochSecond();
|
2022-04-23 23:07:18 +08:00
|
|
|
this.expireTime = expireTime;
|
2022-04-25 21:53:10 +08:00
|
|
|
this.importance = importance; // Starred mail, 0 = No star, 1 = Star.
|
2022-04-23 23:07:18 +08:00
|
|
|
this.isRead = false;
|
|
|
|
this.isAttachmentGot = false;
|
2022-04-25 21:53:10 +08:00
|
|
|
this.stateValue = state; // Different mailboxes, 1 = Default, 3 = Gift-box.
|
2022-04-23 23:07:18 +08:00
|
|
|
}
|
|
|
|
|
2022-04-24 18:17:08 +08:00
|
|
|
@Entity
|
2022-04-23 23:07:18 +08:00
|
|
|
public static class MailContent {
|
|
|
|
public String title;
|
|
|
|
public String content;
|
|
|
|
public String sender;
|
|
|
|
|
|
|
|
public MailContent() {
|
|
|
|
this.title = "";
|
|
|
|
this.content = "loading...";
|
|
|
|
this.sender = "loading";
|
|
|
|
}
|
|
|
|
|
|
|
|
public MailContent(String title, String content) {
|
|
|
|
this(title, content, "Server");
|
|
|
|
}
|
|
|
|
|
|
|
|
public MailContent(String title, String content, GenshinPlayer sender) {
|
|
|
|
this(title, content, sender.getNickname());
|
|
|
|
}
|
|
|
|
|
|
|
|
public MailContent(String title, String content, String sender) {
|
|
|
|
this.title = title;
|
|
|
|
this.content = content;
|
|
|
|
this.sender = sender;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-24 18:17:08 +08:00
|
|
|
@Entity
|
2022-04-23 23:07:18 +08:00
|
|
|
public static class MailItem {
|
|
|
|
public int itemId;
|
|
|
|
public int itemCount;
|
2022-04-25 14:30:56 +08:00
|
|
|
public int itemLevel;
|
2022-04-23 23:07:18 +08:00
|
|
|
|
|
|
|
public MailItem() {
|
|
|
|
this.itemId = 11101;
|
|
|
|
this.itemCount = 1;
|
2022-04-25 14:30:56 +08:00
|
|
|
this.itemLevel = 1;
|
2022-04-23 23:07:18 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
public MailItem(int itemId) {
|
|
|
|
this(itemId, 1);
|
|
|
|
}
|
|
|
|
|
2022-04-25 14:30:56 +08:00
|
|
|
public MailItem(int itemId, int itemCount) { this(itemId, itemCount, 1); }
|
|
|
|
|
|
|
|
public MailItem(int itemId, int itemCount, int itemLevel) {
|
2022-04-23 23:07:18 +08:00
|
|
|
this.itemId = itemId;
|
|
|
|
this.itemCount = itemCount;
|
2022-04-25 14:30:56 +08:00
|
|
|
this.itemLevel = itemLevel;
|
2022-04-23 23:07:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|