EquipPutOnRequest now support sites

This commit is contained in:
rfi 2023-12-08 14:34:08 +07:00
parent fb8538954c
commit 5ac52d3dd1
1 changed files with 10 additions and 5 deletions

View File

@ -180,11 +180,16 @@ namespace AscNet.GameServer.Handlers
public static void EquipPutOnRequestHandler(Session session, Packet.Request packet) public static void EquipPutOnRequestHandler(Session session, Packet.Request packet)
{ {
EquipPutOnRequest request = packet.Deserialize<EquipPutOnRequest>(); EquipPutOnRequest request = packet.Deserialize<EquipPutOnRequest>();
var prevEquip = session.character.Equips.Find(x => x.CharacterId == request.CharacterId);
var prevEquip = session.character.Equips.Find(x => x.CharacterId == request.CharacterId && TableReaderV2.Parse<EquipTable>().Find(t => t.Id == x.TemplateId)?.Site == request.Site);
var toEquip = session.character.Equips.Find(x => x.Id == request.EquipId); var toEquip = session.character.Equips.Find(x => x.Id == request.EquipId);
if (prevEquip is not null && toEquip is not null) if (prevEquip is not null && toEquip is not null)
{ {
prevEquip.CharacterId = 0; prevEquip.CharacterId = 0;
}
if (toEquip is not null)
{
toEquip.CharacterId = request.CharacterId; toEquip.CharacterId = request.CharacterId;
} }
else else
@ -194,10 +199,10 @@ namespace AscNet.GameServer.Handlers
return; return;
} }
NotifyEquipDataList notifyEquipData = new() NotifyEquipDataList notifyEquipData = new();
{ notifyEquipData.EquipDataList.Add(toEquip);
EquipDataList = { prevEquip, toEquip } if (prevEquip is not null)
}; notifyEquipData.EquipDataList.Add(prevEquip);
session.SendPush(notifyEquipData); session.SendPush(notifyEquipData);
session.SendResponse(new EquipPutOnResponse(), packet.Id); session.SendResponse(new EquipPutOnResponse(), packet.Id);