Main/Assets/Code/Logic/Item/ItemLingPo.cs
2025-01-25 04:38:09 +08:00

109 lines
2.6 KiB
C#

//**********************************************//
//作者:#王圣#
//日期:#2020.07.14#
//简述:#灵魄#
//*********************************************//
using Thousandto.Cfg.Data;
using MSG_backpack;
using Thousandto.Code.Global;
using Thousandto.Code.Center;
using Thousandto.Plugins.Common;
namespace Thousandto.Code.Logic
{
public class ItemLingPo : ItemBase
{
#region //私有变量
private DeclareItem _item;
#endregion
#region //属性
public DeclareItem ItemInfo
{
get
{
return _item;
}
}
#endregion
#region //公共方法
public ItemLingPo(ItemInfo info) :
base(info)
{
Initialization();
}
public ItemLingPo(int cfgId, ulong dbid = 0) :
base(cfgId, dbid)
{
Initialization();
}
//是否有效
public override bool IsValid()
{
return _item != null;
}
public override int GetItemType()
{
var ret = ItemType.UnDefine;
if (ItemInfo != null)
ret = ItemInfo.Type;
return ret;
}
public override int GetQuality()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Color;
return ret;
}
public override string GetName()
{
if (null != ItemInfo)
{
int length = ItemInfo.Name.LastIndexOf("_");
if (length == -1)
{
length = ItemInfo.Name.Length;
}
else
{
length += 1;
}
string realName = ItemInfo.Name.Substring(0, length);
return realName;
}
else
{
return null;
}
}
public override int GetEffect()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Effect;
return ret;
}
public override int GetIcon()
{
int ret = -1;
if (ItemInfo != null)
ret = ItemInfo.Icon;
return ret;
}
#endregion
#region private methods
public override bool Initialization()
{
base.Initialization();
_item = DeclareItem.Get(CfgID);
return ItemInfo != null;
}
#endregion
}
}