From 716b6df2ecc5cba5c5d0b35cbde9f0b1873598a7 Mon Sep 17 00:00:00 2001 From: w4123 <1840686745@qq.com> Date: Wed, 20 Apr 2022 12:25:38 +0800 Subject: [PATCH] Implement stub NpcTalk packets --- .../server/packet/recv/HandlerNpcTalkReq.java | 21 +++++++++++++++++++ .../server/packet/send/PacketNpcTalkRsp.java | 19 +++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java create mode 100644 src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java new file mode 100644 index 000000000..588e1c4e1 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerNpcTalkReq.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.recv; + +import emu.grasscutter.game.inventory.GenshinItem; +import emu.grasscutter.net.packet.Opcodes; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.NpcTalkReqOuterClass.NpcTalkReq; +import emu.grasscutter.net.packet.PacketHandler; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketNpcTalkRsp; + +@Opcodes(PacketOpcodes.NpcTalkReq) +public class HandlerNpcTalkReq extends PacketHandler { + + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + NpcTalkReq req = NpcTalkReq.parseFrom(payload); + + session.send(new PacketNpcTalkRsp(req.getNpcEntityId(), req.getTalkId(), req.getEntityId())); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java new file mode 100644 index 000000000..b447a19eb --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketNpcTalkRsp.java @@ -0,0 +1,19 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.GenshinPacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.NpcTalkRspOuterClass.NpcTalkRsp; + +public class PacketNpcTalkRsp extends GenshinPacket { + public PacketNpcTalkRsp(int npcEntityId, int curTalkId, int entityId) { + super(PacketOpcodes.NpcTalkRsp); + + NpcTalkRsp p = NpcTalkRsp.newBuilder() + .setNpcEntityId(npcEntityId) + .setCurTalkId(curTalkId) + .setEntityId(entityId) + .build(); + + this.setData(p); + } +}