mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-24 03:38:04 +00:00
Initial work on mail
This commit is contained in:
parent
af4086b4d9
commit
1c6a5d4835
@ -0,0 +1,23 @@
|
|||||||
|
package emu.grasscutter.server.packet.recv;
|
||||||
|
|
||||||
|
import emu.grasscutter.Grasscutter;
|
||||||
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.packet.PacketHandler;
|
||||||
|
import emu.grasscutter.net.proto.GetAllMailReqOuterClass;
|
||||||
|
import emu.grasscutter.net.proto.GetPlayerTokenReqOuterClass;
|
||||||
|
import emu.grasscutter.server.game.GameSession;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketGetAllMailRsp;
|
||||||
|
import emu.grasscutter.server.packet.send.PacketGetGachaInfoRsp;
|
||||||
|
|
||||||
|
@Opcodes(PacketOpcodes.GetAllMailReq)
|
||||||
|
public class HandlerGetAllMailReq extends PacketHandler {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
|
Grasscutter.getLogger().info("Mail Req");
|
||||||
|
GetAllMailReqOuterClass.GetAllMailReq req = GetAllMailReqOuterClass.GetAllMailReq.parseFrom(payload);
|
||||||
|
session.send(new PacketGetAllMailRsp(session.getPlayer(), req.getIsGiftMail()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package emu.grasscutter.server.packet.send;
|
||||||
|
|
||||||
|
import emu.grasscutter.game.GenshinPlayer;
|
||||||
|
import emu.grasscutter.net.packet.GenshinPacket;
|
||||||
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
|
import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
|
||||||
|
import emu.grasscutter.net.proto.MailDataOuterClass.MailData;
|
||||||
|
import emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent;
|
||||||
|
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
public class PacketGetAllMailRsp extends GenshinPacket {
|
||||||
|
|
||||||
|
public PacketGetAllMailRsp(GenshinPlayer player, boolean isGiftMail) {
|
||||||
|
super(PacketOpcodes.GetAllMailRsp);
|
||||||
|
|
||||||
|
GetAllMailRsp.Builder proto = GetAllMailRsp.newBuilder();
|
||||||
|
|
||||||
|
MailTextContent.Builder mailTextContent = MailTextContent.newBuilder();
|
||||||
|
mailTextContent.setTitle("System Message");
|
||||||
|
mailTextContent.setContent("I'm going to kill you...");
|
||||||
|
mailTextContent.setSender("YOU");
|
||||||
|
|
||||||
|
MailData.Builder mailData = MailData.newBuilder();
|
||||||
|
mailData.setMailId(0);
|
||||||
|
mailData.setMailTextContent(mailTextContent.build());
|
||||||
|
mailData.setSendTime((int) Instant.now().getEpochSecond());
|
||||||
|
mailData.setExpireTime(999999999);
|
||||||
|
mailData.setImportance(1);
|
||||||
|
mailData.setIsRead(false);
|
||||||
|
mailData.setIsAttachmentGot(false);
|
||||||
|
maildata.
|
||||||
|
|
||||||
|
proto.addMailList(mailData.build());
|
||||||
|
proto.setIsTruncated(false);
|
||||||
|
|
||||||
|
this.setData(proto);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user