58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
|
using Cal.DataTable;
|
|||
|
|
|||
|
namespace ET
|
|||
|
{
|
|||
|
public class StrengthEquipToL17GoodsEffect : GoodsEffect
|
|||
|
{
|
|||
|
|
|||
|
public override string Init(Unit unit, GoodsBase goodsBase,bool isLock =false)
|
|||
|
{
|
|||
|
base.unit = unit;
|
|||
|
this.GoodsBase = goodsBase;
|
|||
|
return this.Run();
|
|||
|
}
|
|||
|
|
|||
|
private string Run()
|
|||
|
{
|
|||
|
Bag bag = this.unit.GetComponent<Bag>();
|
|||
|
if (!bag.ItemDic.TryGetValueByKey1(0, out Item item))
|
|||
|
{
|
|||
|
Log.Error($"【{UserComponent.Instance.Get(this.unit.Id)?.NickName} ({this.unit.Id})】背包中没有物品Index ={0}");
|
|||
|
return "系统错误";
|
|||
|
}
|
|||
|
|
|||
|
if (item.IsEmpty)
|
|||
|
{
|
|||
|
Log.Error($"【{UserComponent.Instance.Get(this.unit.Id)?.NickName} ({this.unit.Id})】背包中物品Index ={0}是空物品");
|
|||
|
return "系统错误,强化的是空格子";
|
|||
|
}
|
|||
|
|
|||
|
if (item.ItemType != ItemType.EquipItem)
|
|||
|
{
|
|||
|
Log.Error($"【{UserComponent.Instance.Get(this.unit.Id)?.NickName} ({this.unit.Id})】背包中物品Index ={0}不是装备:{item.ItemType}");
|
|||
|
return "系统错误,不是装备";
|
|||
|
}
|
|||
|
EquipItem equipItem = item.data.As<EquipItem>();
|
|||
|
if (equipItem.equipLevel >= ConstDefine.EquipMaxLevel)
|
|||
|
{
|
|||
|
return "已经达到最大等级,无法强化!";
|
|||
|
}
|
|||
|
RunAsync(bag,equipItem).Coroutine();
|
|||
|
return string.Empty;
|
|||
|
}
|
|||
|
|
|||
|
private async ETTask RunAsync(Bag bag, EquipItem equipItem)
|
|||
|
{
|
|||
|
|
|||
|
await ItemComponentSystem.SucceedStrengthEquip(this.unit, equipItem, 17);
|
|||
|
|
|||
|
UnitHelper.SaveComponenet(bag);
|
|||
|
}
|
|||
|
|
|||
|
public override async ETVoid Execute()
|
|||
|
{
|
|||
|
await ETTask.CompletedTask;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|