CTT/Server/Hotfix/Game/Handler/GM/C2M_GetOtherUserBagHandler.cs

39 lines
1.2 KiB
C#

using System;
namespace ET
{
[ActorMessageHandler]
public class C2M_GetOtherUserBagHandler: AMActorLocationRpcHandler<Unit, C2M_GetOtherUserBag, M2C_GetOtherUserBag>
{
protected override async ETTask Run(Unit unit, C2M_GetOtherUserBag request, M2C_GetOtherUserBag response, Action reply)
{
if (!AppConfig.inst.whiteIds.Contains(unit.Id))
{
response.Message = "对不起,您没有权限!";
reply();
return;
}
int zone = unit.DomainZone();
Bag bag = await UnitHelper.Query<Bag>(zone,request.userId);
foreach (Item item in bag.ItemDic.Values)
{
if (item.IsEmpty) continue;
BagMap bagMap = new BagMap
{
Index = item.index,
NetItem = new NetItem(item)
};
if (item.ItemType == ItemType.EquipItem)
{
bagMap.EquipTransMessage = new EquipTransMessage(item.data.As<EquipItem>());
}
response.BagMapList.Add(bagMap);
}
reply();
await ETTask.CompletedTask;
}
}
}