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
122568ad
Commit
122568ad
authored
Apr 25, 2022
by
Asnxthaony
Committed by
Melledy
Apr 25, 2022
Browse files
fix SetPlayerBirthdayRsp
parent
b6801cf4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/packet/recv/HandlerSetPlayerBirthdayReq.java
View file @
122568ad
package
emu.grasscutter.server.packet.recv
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerSocialDetailRsp
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerBirthdayRsp
;
import
emu.grasscutter.net.packet.Opcodes
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.packet.PacketHandler
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SetPlayerBirthdayReqOuterClass.SetPlayerBirthdayReq
;
import
com.google.gson.Gson
;
import
emu.grasscutter.net.proto.SocialDetailOuterClass.SocialDetail
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketGetPlayerSocialDetailRsp
;
import
emu.grasscutter.server.packet.send.PacketSetPlayerBirthdayRsp
;
@Opcodes
(
PacketOpcodes
.
SetPlayerBirthdayReq
)
public
class
HandlerSetPlayerBirthdayReq
extends
PacketHandler
{
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetPlayerBirthdayReq
req
=
SetPlayerBirthdayReq
.
parseFrom
(
payload
);
@Override
public
void
handle
(
GameSession
session
,
byte
[]
header
,
byte
[]
payload
)
throws
Exception
{
SetPlayerBirthdayReq
req
=
SetPlayerBirthdayReq
.
parseFrom
(
payload
);
if
(
req
.
getBirth
()
!=
null
&&
req
.
getBirth
().
getDay
()
>
0
&&
req
.
getBirth
().
getMonth
()
>
0
)
{
int
day
=
req
.
getBirth
().
getDay
();
int
month
=
req
.
getBirth
().
getMonth
();
if
(
req
.
getBirthday
().
getDay
()
>
0
&&
req
.
getBirthday
().
getMonth
()
>
0
)
{
int
day
=
req
.
getBirthday
().
getDay
();
int
month
=
req
.
getBirthday
().
getMonth
();
// Update birthday value
session
.
getPlayer
().
setBirthday
(
day
,
month
);
// Update birthday value
session
.
getPlayer
().
setBirthday
(
day
,
month
);
// Save birthday month and day
session
.
getPlayer
().
save
();
SocialDetail
.
Builder
detail
=
session
.
getPlayer
().
getSocialDetail
();
// Save birthday month and day
session
.
getPlayer
().
save
();
SocialDetail
.
Builder
detail
=
session
.
getPlayer
().
getSocialDetail
();
session
.
send
(
new
PacketSetPlayerBirthdayRsp
(
session
.
getPlayer
()));
session
.
send
(
new
PacketGetPlayerSocialDetailRsp
(
detail
));
}
}
session
.
send
(
new
PacketSetPlayerBirthdayRsp
(
session
.
getPlayer
()));
session
.
send
(
new
PacketGetPlayerSocialDetailRsp
(
detail
));
}
}
}
src/main/java/emu/grasscutter/server/packet/send/PacketSetPlayerBirthdayRsp.java
View file @
122568ad
package
emu.grasscutter.server.packet.send
;
import
emu.grasscutter.Grasscutter
;
import
emu.grasscutter.game.GenshinPlayer
;
import
emu.grasscutter.net.packet.GenshinPacket
;
import
emu.grasscutter.net.packet.PacketOpcodes
;
import
emu.grasscutter.net.proto.SetPlayerBirthdayRspOuterClass.SetPlayerBirthdayRsp
;
import
emu.grasscutter.net.proto.BirthdayOuterClass.Birthday
;
public
class
PacketSetPlayerBirthdayRsp
extends
GenshinPacket
{
public
PacketSetPlayerBirthdayRsp
(
GenshinPlayer
player
)
{
super
(
PacketOpcodes
.
SetPlayerBirthdayRsp
);
SetPlayerBirthdayRsp
proto
=
SetPlayerBirthdayRsp
.
newBuilder
()
.
setBirth
(
player
.
getBirthday
().
toProto
())
.
setBirth
day
(
player
.
getBirthday
().
toProto
())
.
build
();
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