diff --git a/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java b/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java index 1ea2a46fa..41c10fcf2 100644 --- a/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java +++ b/src/main/java/emu/grasscutter/net/packet/PacketOpcodes.java @@ -471,6 +471,12 @@ public class PacketOpcodes { public static final int FinishedParentQuestUpdateNotify = 432; public static final int FinishMainCoopReq = 1978; public static final int FinishMainCoopRsp = 1953; + public static final int FireworkReq = 6068; + public static final int FireworkNotify = 6079; + public static final int FireworkRsp = 5918; + public static final int FireworkSetReq = 6099; + public static final int FireworkSetNotify = 5934; + public static final int FireworkSetRsp = 5969; public static final int FishAttractNotify = 5846; public static final int FishBaitGoneNotify = 5827; public static final int FishBattleBeginReq = 5802; @@ -909,6 +915,11 @@ public class PacketOpcodes { public static final int MusicGameSettleRsp = 8288; public static final int MusicGameStartReq = 8927; public static final int MusicGameStartRsp = 8101; + public static final int MusicCustomReq = 6318; + public static final int MusicCustomRsp = 6309; + public static final int MusicGameStoreSubmitReq = 6326; + public static final int MusicGameStoreSubmitRsp = 6347; + public static final int MusicGameStoreSubmitNotify = 6337; public static final int MusicGameStartToPlayOthersBeatmapReq = 6302; public static final int MusicGameStartToPlayOthersBeatmapRsp = 6313; public static final int NavMeshStatsNotify = 2387; diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireWorkReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireWorkReq.java new file mode 100644 index 000000000..aa7ea26e2 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireWorkReq.java @@ -0,0 +1,21 @@ +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.FireWorkReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketFireworkNotify; +import emu.grasscutter.server.packet.send.PacketFireworkRsp; + +@Opcodes(PacketOpcodes.FireworkReq) +public class HandlerFireWorkReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + + var req + = FireWorkReqOuterClass.FireWorkReq.parseFrom(payload); + session.send(new PacketFireworkNotify(req.getFireWorkData())); + session.send(new PacketFireworkRsp()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireworkSetReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireworkSetReq.java new file mode 100644 index 000000000..ade4f4ced --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerFireworkSetReq.java @@ -0,0 +1,23 @@ +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.FireworkSetReqOuterClass; +import emu.grasscutter.server.game.GameSession; +import emu.grasscutter.server.packet.send.PacketFireworkSetNotify; +import emu.grasscutter.server.packet.send.PacketFireworkSetRsp; + +@Opcodes(PacketOpcodes.FireworkSetReq) +public class HandlerFireworkSetReq extends PacketHandler { + @Override + public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { + + var req + = FireworkSetReqOuterClass.FireworkSetReq.parseFrom(payload); + + + session.send(new PacketFireworkSetNotify(req.getData())); + session.send(new PacketFireworkSetRsp()); + } +} diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java index c73f98fbd..bdf3a2d21 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerWidgetDoBagReq.java @@ -1,17 +1,14 @@ package emu.grasscutter.server.packet.recv; -import emu.grasscutter.Grasscutter; import emu.grasscutter.data.GameData; import emu.grasscutter.data.excels.GadgetData; import emu.grasscutter.game.entity.EntityVehicle; import emu.grasscutter.game.entity.GameEntity; -import emu.grasscutter.game.props.LifeState; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; -import emu.grasscutter.net.proto.*; +import emu.grasscutter.net.proto.WidgetDoBagReqOuterClass; import emu.grasscutter.server.game.GameSession; -import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify; import emu.grasscutter.server.packet.send.PacketWidgetCoolDownNotify; import emu.grasscutter.server.packet.send.PacketWidgetDoBagRsp; import emu.grasscutter.server.packet.send.PacketWidgetGadgetDataNotify; @@ -41,12 +38,31 @@ public class HandlerWidgetDoBagReq extends PacketHandler { session.getPlayer().getScene().addEntity(entity); - session.send(new PacketWidgetGadgetDataNotify(70500025, List.of(entity.getId()))); // ??? + session.send(new PacketWidgetGadgetDataNotify(70500025, entity.getId())); // ??? session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true)); session.send(new PacketWidgetCoolDownNotify(15, System.currentTimeMillis() + 5000L, true)); // Send twice, and I don't know why, Ask mhy session.send(new PacketWidgetDoBagRsp()); } + case 220047 -> { + GadgetData gadgetData = GameData.getGadgetDataMap().get(70800058); + Position pos = new Position(req.getWidgetCreatorInfo().getLocationInfo().getPos()); + Position rot = new Position(req.getWidgetCreatorInfo().getLocationInfo().getRot()); + GameEntity entity = new EntityVehicle( + session.getPlayer().getScene(), + session.getPlayer(), + gadgetData.getId(), + 0, + pos, + rot + ); + + session.getPlayer().getScene().addEntity(entity); + + session.send(new PacketWidgetGadgetDataNotify(70800058, entity.getId())); // ??? + // Send twice, and I don't know why, Ask mhy + session.send(new PacketWidgetDoBagRsp()); + } default -> { session.send(new PacketWidgetDoBagRsp()); } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkNotify.java new file mode 100644 index 000000000..059194b02 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkNotify.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.FireWorkNotifyOuterClass; +import emu.grasscutter.net.proto.FireWorkDataOuterClass; + +public class PacketFireworkNotify extends BasePacket { + + public PacketFireworkNotify(FireWorkDataOuterClass.FireWorkData pinfo) { + super(PacketOpcodes.FireworkNotify); + + var proto + = FireWorkNotifyOuterClass.FireWorkNotify.newBuilder(); + + proto.addFireWorkData(pinfo); + + setData(proto.build()); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkRsp.java new file mode 100644 index 000000000..e5c7b3498 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkRsp.java @@ -0,0 +1,12 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; + +public class PacketFireworkRsp extends BasePacket { + + public PacketFireworkRsp() { + super(PacketOpcodes.FireworkRsp); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetNotify.java new file mode 100644 index 000000000..678573380 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetNotify.java @@ -0,0 +1,21 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; +import emu.grasscutter.net.proto.FireworkSetNotifyOuterClass; +import emu.grasscutter.net.proto.FireworkSetDataOuterClass; + +public class PacketFireworkSetNotify extends BasePacket { + + public PacketFireworkSetNotify(FireworkSetDataOuterClass.FireworkSetData notify) { + super(PacketOpcodes.FireworkSetNotify); + + var proto + = FireworkSetNotifyOuterClass.FireworkSetNotify.newBuilder(); + + proto.setCode(1).addData(notify); + + setData(proto.build()); + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetRsp.java b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetRsp.java new file mode 100644 index 000000000..aad309164 --- /dev/null +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketFireworkSetRsp.java @@ -0,0 +1,13 @@ +package emu.grasscutter.server.packet.send; + +import emu.grasscutter.net.packet.BasePacket; +import emu.grasscutter.net.packet.PacketOpcodes; + +public class PacketFireworkSetRsp extends BasePacket { + + public PacketFireworkSetRsp() { + super(PacketOpcodes.FireworkSetRsp); + + } + +} diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketWidgetGadgetDataNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketWidgetGadgetDataNotify.java index f94c6c10e..b8c777b85 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketWidgetGadgetDataNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketWidgetGadgetDataNotify.java @@ -9,6 +9,7 @@ import java.io.IOException; import java.util.List; public class PacketWidgetGadgetDataNotify extends BasePacket { + public PacketWidgetGadgetDataNotify(int gadgetId, List gadgetEntityIdList) throws IOException { super(PacketOpcodes.WidgetGadgetDataNotify); @@ -23,4 +24,19 @@ public class PacketWidgetGadgetDataNotify extends BasePacket { this.setData(proto); } + + public PacketWidgetGadgetDataNotify(int gadgetId, int gadgetEntityIdList) throws IOException { + super(PacketOpcodes.WidgetGadgetDataNotify); + + WidgetGadgetDataNotifyOuterClass.WidgetGadgetDataNotify proto = WidgetGadgetDataNotifyOuterClass.WidgetGadgetDataNotify.newBuilder() + .setWidgetGadgetData( + WidgetGadgetDataOuterClass.WidgetGadgetData.newBuilder() + .setGadgetId(gadgetId) + .addGadgetEntityIdList(gadgetEntityIdList) + .build() + ) + .build(); + + this.setData(proto); + } }