mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-26 05:04:20 +00:00
fix SetPlayerBirthdayRsp
This commit is contained in:
parent
b6801cf427
commit
122568ad27
@ -1,38 +1,33 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.SetPlayerBirthdayReqOuterClass.SetPlayerBirthdayReq;
|
||||
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;
|
||||
|
||||
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.proto.SetPlayerBirthdayReqOuterClass.SetPlayerBirthdayReq;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@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));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,16 @@
|
||||
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())
|
||||
.setBirthday(player.getBirthday().toProto())
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
|
Loading…
Reference in New Issue
Block a user