Commit 346652cf authored by Benjamin Elsdon's avatar Benjamin Elsdon
Browse files

Initial work on mail

parent caa1829b
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()));
}
}
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);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment