mirror of
https://github.com/rafi1212122/PemukulPaku
synced 2025-12-12 19:24:34 +01:00
35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using Common.Database;
|
|
using Common.Resources.Proto;
|
|
|
|
namespace PemukulPaku.GameServer.Handlers
|
|
{
|
|
[PacketCmdId(CmdId.SetDressReq)]
|
|
internal class SetDressReqHandler : IPacketHandler
|
|
{
|
|
public void Handle(Session session, Packet packet)
|
|
{
|
|
SetDressReq Data = packet.GetDecodedBody<SetDressReq>();
|
|
SetDressRsp Rsp = new() { retcode = SetDressRsp.Retcode.Succ };
|
|
AvatarScheme? avatar = session.Player.AvatarList.Where(x => x.AvatarId == Data.AvatarId).FirstOrDefault();
|
|
if (avatar is not null)
|
|
{
|
|
if (avatar.DressLists.Contains(Data.DressId))
|
|
{
|
|
avatar.SetDress(Data.DressId);
|
|
session.ProcessPacket(Packet.FromProto(new GetAvatarDataReq() { AvatarIdLists = new uint[] { avatar.AvatarId } }, CmdId.GetAvatarDataReq));
|
|
}
|
|
else
|
|
{
|
|
Rsp.retcode = SetDressRsp.Retcode.DressNotExist;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Rsp.retcode = SetDressRsp.Retcode.AvatarNotExist;
|
|
}
|
|
|
|
session.Send(Packet.FromProto(Rsp, CmdId.SetDressRsp));
|
|
}
|
|
}
|
|
}
|