mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-03-13 07:37:18 +08:00
Fix sitting in chairs
This commit is contained in:
parent
edda944ae5
commit
90dfe30caf
19
proto/EvtAvatarLockChairReq.proto
Normal file
19
proto/EvtAvatarLockChairReq.proto
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option java_package = "emu.grasscutter.net.proto";
|
||||||
|
|
||||||
|
import "Vector.proto";
|
||||||
|
|
||||||
|
message EvtAvatarLockChairReq {
|
||||||
|
enum CmdId {
|
||||||
|
option allow_alias = true;
|
||||||
|
ENET_CHANNEL_ID = 0;
|
||||||
|
NONE = 0;
|
||||||
|
ENET_IS_RELIABLE = 1;
|
||||||
|
IS_ALLOW_CLIENT = 1;
|
||||||
|
CMD_ID = 341;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64 chair_id = 1;
|
||||||
|
Vector position = 2;
|
||||||
|
}
|
20
proto/EvtAvatarLockChairRsp.proto
Normal file
20
proto/EvtAvatarLockChairRsp.proto
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
syntax = "proto3";
|
||||||
|
|
||||||
|
option java_package = "emu.grasscutter.net.proto";
|
||||||
|
|
||||||
|
import "Vector.proto";
|
||||||
|
|
||||||
|
message EvtAvatarLockChairRsp {
|
||||||
|
enum CmdId {
|
||||||
|
option allow_alias = true;
|
||||||
|
NONE = 0;
|
||||||
|
ENET_CHANNEL_ID = 0;
|
||||||
|
ENET_IS_RELIABLE = 1;
|
||||||
|
CMD_ID = 305;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 retcode = 1;
|
||||||
|
uint32 entity_id = 2;
|
||||||
|
Vector position = 3;
|
||||||
|
uint64 chair_id = 4;
|
||||||
|
}
|
@ -355,6 +355,8 @@ public class PacketOpcodes {
|
|||||||
public static final int EvtAvatarSitDownNotify = 392;
|
public static final int EvtAvatarSitDownNotify = 392;
|
||||||
public static final int EvtAvatarStandUpNotify = 358;
|
public static final int EvtAvatarStandUpNotify = 358;
|
||||||
public static final int EvtAvatarUpdateFocusNotify = 365;
|
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 EvtBeingHitNotify = 360;
|
||||||
public static final int EvtBeingHitsCombineNotify = 381;
|
public static final int EvtBeingHitsCombineNotify = 381;
|
||||||
public static final int EvtBulletDeactiveNotify = 388;
|
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;
|
package emu.grasscutter.server.packet.recv;
|
||||||
|
|
||||||
import emu.grasscutter.net.packet.Opcodes;
|
import emu.grasscutter.net.packet.Opcodes;
|
||||||
|
import emu.grasscutter.net.packet.PacketHandler;
|
||||||
import emu.grasscutter.net.packet.PacketOpcodes;
|
import emu.grasscutter.net.packet.PacketOpcodes;
|
||||||
import emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify;
|
import emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify;
|
||||||
import emu.grasscutter.net.packet.PacketHandler;
|
|
||||||
import emu.grasscutter.server.game.GameSession;
|
import emu.grasscutter.server.game.GameSession;
|
||||||
import emu.grasscutter.server.packet.send.PacketEvtAvatarSitDownNotify;
|
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 {
|
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
|
||||||
EvtAvatarSitDownNotify notify = EvtAvatarSitDownNotify.parseFrom(payload);
|
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…
x
Reference in New Issue
Block a user