From ec3cdc040f9066b4798b165ecc823d94ece38ea4 Mon Sep 17 00:00:00 2001 From: hamusuke Date: Wed, 12 Oct 2022 20:44:25 +0900 Subject: [PATCH] fix: Solar Isotoma Elevator doesn't work in multiplayer mode (#1848) --- .../HandlerUpdateAbilityCreatedMovingPlatformNotify.java | 8 ++++---- .../packet/send/PacketPlatformStartRouteNotify.java | 4 ++-- .../server/packet/send/PacketPlatformStopRouteNotify.java | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUpdateAbilityCreatedMovingPlatformNotify.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUpdateAbilityCreatedMovingPlatformNotify.java index ba8a9771d..906485ea6 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerUpdateAbilityCreatedMovingPlatformNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerUpdateAbilityCreatedMovingPlatformNotify.java @@ -4,7 +4,6 @@ import emu.grasscutter.game.entity.platform.EntityPlatform; import emu.grasscutter.net.packet.Opcodes; import emu.grasscutter.net.packet.PacketHandler; import emu.grasscutter.net.packet.PacketOpcodes; -import emu.grasscutter.net.proto.PacketHeadOuterClass; import emu.grasscutter.net.proto.UpdateAbilityCreatedMovingPlatformNotifyOuterClass; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketPlatformStartRouteNotify; @@ -14,7 +13,6 @@ import emu.grasscutter.server.packet.send.PacketPlatformStopRouteNotify; public class HandlerUpdateAbilityCreatedMovingPlatformNotify extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - var sequence = PacketHeadOuterClass.PacketHead.parseFrom(header).getClientSequenceId(); var notify = UpdateAbilityCreatedMovingPlatformNotifyOuterClass.UpdateAbilityCreatedMovingPlatformNotify.parseFrom(payload); var entity = session.getPlayer().getScene().getEntityById(notify.getEntityId()); @@ -22,9 +20,11 @@ public class HandlerUpdateAbilityCreatedMovingPlatformNotify extends PacketHandl return; } + var scene = ((EntityPlatform) entity).getOwner().getScene(); + switch (notify.getOpType()) { - case OP_TYPE_ACTIVATE -> session.send(new PacketPlatformStartRouteNotify(sequence, (EntityPlatform) entity, session.getPlayer().getScene())); - case OP_TYPE_DEACTIVATE -> session.send(new PacketPlatformStopRouteNotify(sequence, (EntityPlatform) entity, session.getPlayer().getScene())); + case OP_TYPE_ACTIVATE -> scene.broadcastPacket(new PacketPlatformStartRouteNotify((EntityPlatform) entity, scene)); + case OP_TYPE_DEACTIVATE -> scene.broadcastPacket(new PacketPlatformStopRouteNotify((EntityPlatform) entity, scene)); } } } diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStartRouteNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStartRouteNotify.java index 3aad31f4d..802de977a 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStartRouteNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStartRouteNotify.java @@ -7,8 +7,8 @@ import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlatformStartRouteNotifyOuterClass; public class PacketPlatformStartRouteNotify extends BasePacket { - public PacketPlatformStartRouteNotify(int clientSequence, EntityPlatform entity, Scene scene) { - super(PacketOpcodes.PlatformStartRouteNotify, clientSequence); + public PacketPlatformStartRouteNotify(EntityPlatform entity, Scene scene) { + super(PacketOpcodes.PlatformStartRouteNotify); var notify = PlatformStartRouteNotifyOuterClass.PlatformStartRouteNotify.newBuilder() .setEntityId(entity.getId()) diff --git a/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStopRouteNotify.java b/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStopRouteNotify.java index baa50f201..7b74a2379 100644 --- a/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStopRouteNotify.java +++ b/src/main/java/emu/grasscutter/server/packet/send/PacketPlatformStopRouteNotify.java @@ -7,8 +7,8 @@ import emu.grasscutter.net.packet.PacketOpcodes; import emu.grasscutter.net.proto.PlatformStopRouteNotifyOuterClass; public class PacketPlatformStopRouteNotify extends BasePacket { - public PacketPlatformStopRouteNotify(int clientSequence, EntityPlatform entity, Scene scene) { - super(PacketOpcodes.PlatformStopRouteNotify, clientSequence); + public PacketPlatformStopRouteNotify(EntityPlatform entity, Scene scene) { + super(PacketOpcodes.PlatformStopRouteNotify); var notify = PlatformStopRouteNotifyOuterClass.PlatformStopRouteNotify.newBuilder() .setPlatform(entity.onStopRoute())