mirror of
https://github.com/Anime-Game-Servers/Grasscutter-Quests.git
synced 2024-11-23 12:39:49 +00:00
fix: Solar Isotoma Elevator doesn't work in multiplayer mode (#1848)
This commit is contained in:
parent
ef55e5515c
commit
ec3cdc040f
@ -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())
|
||||
|
Loading…
Reference in New Issue
Block a user