54 lines
2.0 KiB
C#
Executable File
54 lines
2.0 KiB
C#
Executable File
using Cal.DataTable;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace ET
|
|
{
|
|
public class AddGoodsEffect : GoodsEffect
|
|
{
|
|
public override string Init(Unit unit, GoodsBase goodsBase, bool isLock = false)
|
|
{
|
|
base.unit = unit;
|
|
GoodsBase = goodsBase;
|
|
IsLock = isLock;
|
|
Execute().Coroutine();
|
|
return string.Empty;
|
|
}
|
|
public override async ETVoid Execute()
|
|
{
|
|
for (int i = 0; i < GoodsBase.EquipArr.Length; i++)
|
|
{
|
|
GoodsBase.Equip equip = GoodsBase.EquipArr[i];
|
|
if (equip.Equip_Id == 0) continue;
|
|
if (MathHelper.IsHit(equip.Equip_Probability))
|
|
{
|
|
ItemComponent.Instance.AddItem(unit, equip.Equip_Id, 1,isLock: IsLock,getSource:GoodsBase.Name);
|
|
}
|
|
}
|
|
for (int i = 0; i < GoodsBase.GoodsArr.Length; i++)
|
|
{
|
|
GoodsBase.Goods goods = GoodsBase.GoodsArr[i];
|
|
if (goods.Goods_Id == 0) continue;
|
|
if (MathHelper.IsHit(goods.Goods_Probability))
|
|
{
|
|
ItemComponent.Instance.AddItem(unit, goods.Goods_Id, goods.Goods_Count, isLock: IsLock,getSource:GoodsBase.Name);
|
|
}
|
|
}
|
|
for (int i = 0; i < GoodsBase.MaterialsArr.Length; i++)
|
|
{
|
|
GoodsBase.Materials materials = GoodsBase.MaterialsArr[i];
|
|
if (materials.Materials_Id == 0) continue;
|
|
if (MathHelper.IsHit(materials.Materials_Probability))
|
|
{
|
|
ItemComponent.Instance.AddItem(unit, materials.Materials_Id, materials.Materials_Count, isLock: IsLock,getSource:GoodsBase.Name);
|
|
}
|
|
}
|
|
M2C_SendBag ret = new M2C_SendBag();
|
|
BagHelper.GetBagInfo(unit, ret.BagMapList);
|
|
MessageHelper.SendActor(unit, ret);
|
|
await ETTask.CompletedTask;
|
|
}
|
|
}
|
|
}
|