mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-25 03:12:52 +08:00
Fix sitting in chairs
This commit is contained in:
parent
2f39aff4a6
commit
c67e324a2e
@ -355,6 +355,8 @@ public class PacketOpcodes {
|
||||
public static final int EvtAvatarSitDownNotify = 392;
|
||||
public static final int EvtAvatarStandUpNotify = 358;
|
||||
public static final int EvtAvatarUpdateFocusNotify = 365;
|
||||
public static final int EvtAvatarLockChairReq = 354;
|
||||
public static final int EvtAvatarLockChairRsp = 335;
|
||||
public static final int EvtBeingHitNotify = 360;
|
||||
public static final int EvtBeingHitsCombineNotify = 381;
|
||||
public static final int EvtBulletDeactiveNotify = 388;
|
||||
|
@ -0,0 +1,25 @@
|
||||
package emu.grasscutter.server.packet.recv;
|
||||
|
||||
import emu.grasscutter.game.entity.EntityAvatar;
|
||||
import emu.grasscutter.net.packet.Opcodes;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.EvtAvatarLockChairReqOuterClass.EvtAvatarLockChairReq;
|
||||
import emu.grasscutter.net.proto.PacketHeadOuterClass.PacketHead;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketEvtAvatarLockChairRsp;
|
||||
|
||||
@Opcodes(PacketOpcodes.EvtAvatarLockChairReq)
|
||||
public class HandlerEvtAvatarLockChairReq extends PacketHandler {
|
||||
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
PacketHead head = PacketHead.parseFrom(header);
|
||||
EvtAvatarLockChairReq lockChairReq = EvtAvatarLockChairReq.parseFrom(payload);
|
||||
|
||||
EntityAvatar entityAvatar = session.getPlayer().getTeamManager().getCurrentAvatarEntity();
|
||||
|
||||
session.send(new PacketEvtAvatarLockChairRsp(head.getClientSequenceId(), entityAvatar, lockChairReq));
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
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.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify;
|
||||
import emu.grasscutter.net.packet.PacketHandler;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketEvtAvatarSitDownNotify;
|
||||
|
||||
@ -14,7 +14,7 @@ public class HandlerEvtAvatarSitDownNotify extends PacketHandler {
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
EvtAvatarSitDownNotify notify = EvtAvatarSitDownNotify.parseFrom(payload);
|
||||
|
||||
session.send(new PacketEvtAvatarSitDownNotify(notify));
|
||||
session.getPlayer().getScene().broadcastPacket(new PacketEvtAvatarSitDownNotify(notify));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,20 @@
|
||||
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.EvtAvatarStandUpNotifyOuterClass.EvtAvatarStandUpNotify;
|
||||
import emu.grasscutter.server.game.GameSession;
|
||||
import emu.grasscutter.server.packet.send.PacketEvtAvatarStandUpNotify;
|
||||
|
||||
@Opcodes(PacketOpcodes.EvtAvatarStandUpNotify)
|
||||
public class HandlerEvtAvatarStandUpNotify extends PacketHandler {
|
||||
|
||||
@Override
|
||||
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||
EvtAvatarStandUpNotify notify = EvtAvatarStandUpNotify.parseFrom(payload);
|
||||
|
||||
session.getPlayer().getScene().broadcastPacket(new PacketEvtAvatarStandUpNotify(notify));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package emu.grasscutter.server.packet.send;
|
||||
|
||||
import emu.grasscutter.game.entity.EntityAvatar;
|
||||
import emu.grasscutter.net.packet.BasePacket;
|
||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||
import emu.grasscutter.net.proto.EvtAvatarLockChairReqOuterClass.EvtAvatarLockChairReq;
|
||||
import emu.grasscutter.net.proto.EvtAvatarLockChairRspOuterClass.EvtAvatarLockChairRsp;
|
||||
import emu.grasscutter.net.proto.RetcodeOuterClass;
|
||||
|
||||
public class PacketEvtAvatarLockChairRsp extends BasePacket {
|
||||
public PacketEvtAvatarLockChairRsp(int clientSequence, EntityAvatar entityAvatar, EvtAvatarLockChairReq lockChairReq) {
|
||||
super(PacketOpcodes.EvtAvatarLockChairRsp);
|
||||
|
||||
EvtAvatarLockChairRsp p = EvtAvatarLockChairRsp.newBuilder()
|
||||
.setRetcode(RetcodeOuterClass.Retcode.RET_SUCC_VALUE)
|
||||
.setEntityId(entityAvatar.getId())
|
||||
.setPosition(lockChairReq.getPosition())
|
||||
.setChairId(lockChairReq.getChairId())
|
||||
.build();
|
||||
|
||||
this.setData(p);
|
||||
}
|
||||
}
|
@ -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.EvtAvatarStandUpNotifyOuterClass.EvtAvatarStandUpNotify;
|
||||
|
||||
public class PacketEvtAvatarStandUpNotify extends BasePacket {
|
||||
|
||||
public PacketEvtAvatarStandUpNotify(EvtAvatarStandUpNotify notify) {
|
||||
super(PacketOpcodes.EvtAvatarStandUpNotify);
|
||||
|
||||
EvtAvatarStandUpNotify proto = EvtAvatarStandUpNotify.newBuilder()
|
||||
.setEntityId(notify.getEntityId())
|
||||
.setDirection(notify.getDirection())
|
||||
.setPerformID(notify.getPerformID())
|
||||
.setChairId(notify.getChairId())
|
||||
.build();
|
||||
|
||||
this.setData(proto);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user