Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
346652cf
Commit
346652cf
authored
Apr 22, 2022
by
Benjamin Elsdon
Browse files
Initial work on mail
parent
caa1829b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerGetAllMailReq.java
0 → 100644
View file @
346652cf
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
()));
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java
0 → 100644
View file @
346652cf
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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment