From 212a03fb1b9bba9a52f866b3df731e37e1a80370 Mon Sep 17 00:00:00 2001 From: memetrollsXD Date: Thu, 4 Aug 2022 12:02:04 +0200 Subject: [PATCH] implement changing weapons --- src/server/packets/DressAvatarCsReq.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/server/packets/DressAvatarCsReq.ts diff --git a/src/server/packets/DressAvatarCsReq.ts b/src/server/packets/DressAvatarCsReq.ts new file mode 100644 index 0000000..d804bba --- /dev/null +++ b/src/server/packets/DressAvatarCsReq.ts @@ -0,0 +1,16 @@ +import { DressAvatarCsReq, DressAvatarScRsp } from "../../data/proto/StarRail"; +import Avatar from "../../db/Avatar"; +import Packet from "../kcp/Packet"; +import Session from "../kcp/Session"; + +export default async function handle(session: Session, packet: Packet) { + const body = packet.body as DressAvatarCsReq; + + let avatar = await Avatar.loadAvatarForPlayer(session.player, body.baseAvatarId); + + avatar.db.equipmentUniqueId = body.equipmentUniqueId; + await avatar.save(); + + session.send(DressAvatarScRsp, { retcode: 0 }); + session.sync(); +} \ No newline at end of file