CTT/Server/Hotfix/Game/Handler/UI/Bag/C2M_GetStarSoulBagHandler.cs

46 lines
1.5 KiB
C#
Raw Normal View History

2021-05-01 22:06:12 +08:00
using System;
using System.Collections.Generic;
using Cal;
namespace ET
{
[ActorMessageHandler]
public class C2M_GetStarSoulBagHandler: AMActorLocationRpcHandler<Unit, C2M_GetStarSoulBag, M2C_GetStarSoulBag>
{
protected override async ETTask Run(Unit unit, C2M_GetStarSoulBag request, M2C_GetStarSoulBag response, Action reply)
{
StarSoulBag bag = unit.GetComponent<StarSoulBag>();
foreach (var kv in bag.itemDic)
{
try
{
StarSoulNetItem netItem = new();
StarSoulItem item = kv.Value;
netItem.Id = item.Id;
netItem.level = item.level;
netItem.exp = item.exp;
netItem.quality = (int) item.quality;
netItem.posType = (int) item.posType;
netItem.typeId = item.typeId;
netItem.isUsed = item.isUsed;
netItem.main = item.mainId;
foreach (int id in item.viceIds)
{
netItem.vice.Add(id);
}foreach (float id in item.viceAdd)
{
netItem.viceAdd.Add(id);
}
response.itemList.Add(netItem);
}
catch (Exception e)
{
Log.Error(e);
}
}
reply();
await ETTask.CompletedTask;
}
}
}