From e32fcefcd9d73b5ad3c2540144bdbcf34483df3d Mon Sep 17 00:00:00 2001 From: zhaodice <63996691+zhaodice@users.noreply.github.com> Date: Sun, 26 Jun 2022 13:19:59 +0800 Subject: [PATCH] Lunch Support (#1373) * PacketSetUpLunchBoxWidgetRsp * HandlerSetUpLunchBoxWidgetReq --- .../recv/HandlerSetUpLunchBoxWidgetReq.java | 19 +++++++++++++++++++ .../send/PacketSetUpLunchBoxWidgetRsp.java | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerSetUpLunchBoxWidgetReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketSetUpLunchBoxWidgetRsp.java diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetUpLunchBoxWidgetReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetUpLunchBoxWidgetReq.java new file mode 100644 index 000000000..a7d3e3c06 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerSetUpLunchBoxWidgetReq.java @@ -0,0 +1,19 @@ +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.SetUpLunchBoxWidgetReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketSetUpLunchBoxWidgetRsp; + +@Opcodes(PacketOpcodes.SetUpLunchBoxWidgetReq) +public class HandlerSetUpLunchBoxWidgetReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + var req + = SetUpLunchBoxWidgetReqOuterClass.SetUpLunchBoxWidgetReq.parseFrom(payload); + + session.send(new PacketSetUpLunchBoxWidgetRsp(req.getLunchBoxData())); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpLunchBoxWidgetRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpLunchBoxWidgetRsp.java new file mode 100644 index 000000000..c282aae5e --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketSetUpLunchBoxWidgetRsp.java @@ -0,0 +1,18 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.LunchBoxDataOuterClass; +import emu.grasscutter.net.proto.SetUpLunchBoxWidgetRspOuterClass; + +public class PacketSetUpLunchBoxWidgetRsp extends BasePacket { + + public PacketSetUpLunchBoxWidgetRsp(LunchBoxDataOuterClass.LunchBoxData lunchBoxData) { + super(PacketOpcodes.SetUpLunchBoxWidgetRsp); + var rsp + = SetUpLunchBoxWidgetRspOuterClass.SetUpLunchBoxWidgetRsp.newBuilder(); + rsp.setLunchBoxData(lunchBoxData); + + setData(rsp.build()); + } +}