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
94a75cf9
Commit
94a75cf9
authored
Apr 24, 2022
by
Benjamin Elsdon
Browse files
THE MAILBOX ACTUALLY WORKS CORRECTLY NOW
parent
f556bff3
Changes
2
Show whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/game/Mail.java
View file @
94a75cf9
...
@@ -47,7 +47,7 @@ public class Mail {
...
@@ -47,7 +47,7 @@ public class Mail {
this
.
_id
=
_id
;
this
.
_id
=
_id
;
this
.
mailContent
=
mailContent
;
this
.
mailContent
=
mailContent
;
this
.
itemList
=
itemList
;
this
.
itemList
=
itemList
;
this
.
sendTime
=
(
int
)
Instant
.
now
().
EPOCH
.
getEpochSecond
();
this
.
sendTime
=
(
int
)
Instant
.
now
().
getEpochSecond
();
this
.
expireTime
=
expireTime
;
this
.
expireTime
=
expireTime
;
this
.
importance
=
importance
;
this
.
importance
=
importance
;
this
.
isRead
=
false
;
this
.
isRead
=
false
;
...
...
src/main/java/emu/grasscutter/server/packet/send/PacketGetAllMailRsp.java
View file @
94a75cf9
...
@@ -11,7 +11,9 @@ import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
...
@@ -11,7 +11,9 @@ import emu.grasscutter.net.proto.GetAllMailRspOuterClass.GetAllMailRsp;
import
emu.grasscutter.net.proto.MailDataOuterClass.MailData
;
import
emu.grasscutter.net.proto.MailDataOuterClass.MailData
;
import
emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent
;
import
emu.grasscutter.net.proto.MailTextContentOuterClass.MailTextContent
;
import
javax.swing.*
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Base64
;
import
java.util.List
;
import
java.util.List
;
public
class
PacketGetAllMailRsp
extends
GenshinPacket
{
public
class
PacketGetAllMailRsp
extends
GenshinPacket
{
...
@@ -20,20 +22,32 @@ public class PacketGetAllMailRsp extends GenshinPacket {
...
@@ -20,20 +22,32 @@ public class PacketGetAllMailRsp extends GenshinPacket {
super
(
PacketOpcodes
.
GetAllMailRsp
);
super
(
PacketOpcodes
.
GetAllMailRsp
);
Grasscutter
.
getLogger
().
info
(
String
.
valueOf
(
isGiftMail
));
Grasscutter
.
getLogger
().
info
(
String
.
valueOf
(
isGiftMail
));
GetAllMailRsp
.
Builder
proto
=
GetAllMailRsp
.
newBuilder
();
if
(
isGiftMail
)
{
// TODO: Gift Mail
// Make sure to send the stupid empty packet
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
byte
[]
rsp
=
decoder
.
decode
(
"IAE="
);
try
{
GetAllMailRsp
var
=
GetAllMailRsp
.
parseFrom
(
rsp
);
this
.
setData
(
var
.
toBuilder
().
build
());
}
catch
(
Exception
e
)
{
}
}
else
{
if
(
player
.
getMail
().
size
()
!=
0
)
{
// Make sure the player has mail
GetAllMailRsp
.
Builder
proto
=
GetAllMailRsp
.
newBuilder
();
List
<
MailData
>
mailDataList
=
new
ArrayList
<
MailData
>();
List
<
MailData
>
mailDataList
=
new
ArrayList
<
MailData
>();
// Dummy data.
for
(
Mail
message
:
player
.
getMail
())
{
for
(
Mail
message
:
player
.
getMail
())
{
if
(
message
.
stateValue
==
1
)
{
//Make sure it isn't a gift
MailTextContent
.
Builder
mailTextContent
=
MailTextContent
.
newBuilder
();
MailTextContent
.
Builder
mailTextContent
=
MailTextContent
.
newBuilder
();
mailTextContent
.
setTitle
(
message
.
mailContent
.
title
);
mailTextContent
.
setTitle
(
message
.
mailContent
.
title
);
mailTextContent
.
setContent
(
message
.
mailContent
.
content
);
mailTextContent
.
setContent
(
message
.
mailContent
.
content
);
mailTextContent
.
setSender
(
message
.
mailContent
.
sender
);
mailTextContent
.
setSender
(
message
.
mailContent
.
sender
);
List
<
MailItemOuterClass
.
MailItem
>
mailItems
=
new
ArrayList
<
MailItemOuterClass
.
MailItem
>();
List
<
MailItemOuterClass
.
MailItem
>
mailItems
=
new
ArrayList
<>();
for
(
Mail
.
MailItem
item
:
message
.
itemList
)
{
for
(
Mail
.
MailItem
item
:
message
.
itemList
)
{
MailItemOuterClass
.
MailItem
.
Builder
mailItem
=
MailItemOuterClass
.
MailItem
.
newBuilder
();
MailItemOuterClass
.
MailItem
.
Builder
mailItem
=
MailItemOuterClass
.
MailItem
.
newBuilder
();
ItemParamOuterClass
.
ItemParam
.
Builder
itemParam
=
ItemParamOuterClass
.
ItemParam
.
newBuilder
();
ItemParamOuterClass
.
ItemParam
.
Builder
itemParam
=
ItemParamOuterClass
.
ItemParam
.
newBuilder
();
itemParam
.
setItemId
(
item
.
itemId
);
itemParam
.
setItemId
(
item
.
itemId
);
...
@@ -47,21 +61,30 @@ public class PacketGetAllMailRsp extends GenshinPacket {
...
@@ -47,21 +61,30 @@ public class PacketGetAllMailRsp extends GenshinPacket {
mailData
.
setMailId
(
message
.
_id
);
mailData
.
setMailId
(
message
.
_id
);
mailData
.
setMailTextContent
(
mailTextContent
.
build
());
mailData
.
setMailTextContent
(
mailTextContent
.
build
());
mailData
.
addAllItemList
(
mailItems
);
mailData
.
addAllItemList
(
mailItems
);
mailData
.
setSendTime
((
int
)
message
.
sendTime
);
mailData
.
setSendTime
((
int
)
message
.
sendTime
);
mailData
.
setExpireTime
((
int
)
message
.
expireTime
);
mailData
.
setExpireTime
((
int
)
message
.
expireTime
);
mailData
.
setImportance
(
message
.
importance
);
mailData
.
setImportance
(
message
.
importance
);
mailData
.
setIsRead
(
message
.
isRead
);
mailData
.
setIsRead
(
message
.
isRead
);
mailData
.
setIsAttachmentGot
(
message
.
isAttachmentGot
);
mailData
.
setIsAttachmentGot
(
message
.
isAttachmentGot
);
mailData
.
setStateValue
(
message
.
stateValue
);
mailData
.
setStateValue
(
1
);
mailDataList
.
add
(
mailData
.
build
());
mailDataList
.
add
(
mailData
.
build
());
}
}
}
proto
.
addAllMailList
(
mailDataList
);
proto
.
addAllMailList
(
mailDataList
);
//proto.setIsTruncated(true);
proto
.
setIsTruncated
(
true
);
Grasscutter
.
getLogger
().
info
(
Grasscutter
.
getDispatchServer
().
getGsonFactory
().
toJson
(
proto
.
build
()));
this
.
setData
(
proto
.
build
());
this
.
setData
(
proto
.
build
());
}
else
{
// Make sure to send the stupid empty packet
Base64
.
Decoder
decoder
=
Base64
.
getDecoder
();
byte
[]
rsp
=
decoder
.
decode
(
"IAE="
);
try
{
GetAllMailRsp
var
=
GetAllMailRsp
.
parseFrom
(
rsp
);
this
.
setData
(
var
.
toBuilder
().
build
());
}
catch
(
Exception
e
)
{}
}
}
}
}
}
}
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