Implemented sitting

This commit is contained in:
yarik0chka 2022-04-22 23:24:51 +05:00
parent 12c6020b71
commit 3ca181e76d
5 changed files with 88 additions and 1 deletions

View File

@ -1034,6 +1034,8 @@ public class PacketOpcodes {
public static final int ShowTemplateReminderNotify = 3164;
public static final int SignInInfoReq = 2510;
public static final int SignInInfoRsp = 2515;
public static final int SitReq = 354;
public static final int SitRsp = 335;
public static final int SocialDataNotify = 4063;
public static final int SpringUseReq = 1720;
public static final int SpringUseRsp = 1727;
@ -1208,5 +1210,4 @@ public class PacketOpcodes {
public static final int WorldRoutineChangeNotify = 3548;
public static final int WorldRoutineTypeCloseNotify = 3513;
public static final int WorldRoutineTypeRefreshNotify = 3545;
}

View File

@ -0,0 +1,21 @@
package emu.grasscutter.server.packet.recv;
import emu.grasscutter.net.packet.Opcodes;
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;
@Opcodes(PacketOpcodes.EvtAvatarSitDownNotify)
public class HandleEvtAvatarSitDownNotify extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
EvtAvatarSitDownNotify notify = EvtAvatarSitDownNotify.parseFrom(payload);
session.send(new PacketEvtAvatarSitDownNotify(notify));
}
}

View File

@ -0,0 +1,24 @@
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.SitReqOuterClass;
import emu.grasscutter.server.game.GameSession;
import emu.grasscutter.server.packet.send.PacketSitRsp;
import emu.grasscutter.utils.Position;
@Opcodes(PacketOpcodes.SitReq)
public class HandleSitReq extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
SitReqOuterClass.SitReq req = SitReqOuterClass.SitReq.parseFrom(payload);
float x = req.getPosition().getX();
float y = req.getPosition().getY();
float z = req.getPosition().getZ();
session.send(new PacketSitRsp(req.getChairId(), new Position(x, y, z), session.getPlayer().getTeamManager().getCurrentAvatarEntity().getId()));
}
}

View File

@ -0,0 +1,20 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.EvtAvatarSitDownNotifyOuterClass.EvtAvatarSitDownNotify;
public class PacketEvtAvatarSitDownNotify extends GenshinPacket {
public PacketEvtAvatarSitDownNotify(EvtAvatarSitDownNotify notify) {
super(PacketOpcodes.EvtAvatarSitDownNotify);
EvtAvatarSitDownNotify proto = EvtAvatarSitDownNotify.newBuilder()
.setEntityId(notify.getEntityId())
.setPosition(notify.getPosition())
.setChairId(notify.getChairId())
.build();
this.setData(proto);
}
}

View File

@ -0,0 +1,21 @@
package emu.grasscutter.server.packet.send;
import emu.grasscutter.net.packet.GenshinPacket;
import emu.grasscutter.net.packet.PacketOpcodes;
import emu.grasscutter.net.proto.SitRspOuterClass.SitRsp;
import emu.grasscutter.utils.Position;
public class PacketSitRsp extends GenshinPacket {
public PacketSitRsp(long chairId, Position pos, int EntityId) {
super(PacketOpcodes.SitRsp);
SitRsp proto = SitRsp.newBuilder()
.setEntityId(EntityId)
.setPosition(pos.toProto())
.setChairId(chairId)
.build();
this.setData(proto);
}
}