Unverified Commit ec3cdc04 authored by hamusuke's avatar hamusuke Committed by GitHub
Browse files

fix: Solar Isotoma Elevator doesn't work in multiplayer mode (#1848)

parent ef55e551
......@@ -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));
}
}
}
......@@ -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())
......
......@@ -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())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment