Commit c67e324a authored by LDA's avatar LDA Committed by memetrollsXD
Browse files

Fix sitting in chairs

parent 2f39aff4
......@@ -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;
......
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));
}
}
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));
}
}
......
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));
}
}
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);
}
}
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);
}
}
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