61 lines
2.0 KiB
C#
61 lines
2.0 KiB
C#
using cfg.ActorCfg;
|
|
using cfg.CharacterCfg;
|
|
using Framework;
|
|
using Gameplay.Common;
|
|
using Gameplay.Net;
|
|
using NLDPB;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Gameplay
|
|
{
|
|
public partial class CommonUtils
|
|
{
|
|
public static uint GetItemCount(int id)
|
|
{
|
|
return Actor.Instance.Item.GetItemCount(id);
|
|
}
|
|
|
|
public static string GetItemName(int id)
|
|
{
|
|
return GetLocalizeText(TableManager.Instance.Tables.Item.Get(id).NameLocal);
|
|
}
|
|
public static string GetItemPath(int id)
|
|
{
|
|
return TableManager.Instance.Tables.Item.Get(id).IconPath;
|
|
}
|
|
|
|
public static readonly List<ItemSource> ItemSourceNotShowInItemWindow = new List<ItemSource>
|
|
{ ItemSource.LevelPassNormal, ItemSource.LevelPassFirst, ItemSource.LevelPassStar1,
|
|
ItemSource.LevelPassStar2, ItemSource.LevelPassStar2, ItemSource.LevelPassStar3,
|
|
ItemSource.ChapterStar,ItemSource.MailItem,ItemSource.Raffle,ItemSource.Task,
|
|
};
|
|
|
|
public static int GetItemCharacterCfgId(int id)
|
|
{
|
|
DataItem item = TableManager.Instance.Tables.Item.Get(id);
|
|
if(item==null)
|
|
{
|
|
DebugUtil.Log("item表格id为{0}的物品不存在",id);
|
|
return 0;
|
|
}
|
|
if(item.Type!=ItemType.Character)
|
|
{
|
|
DebugUtil.Log("item表格id为{0}的物品不是角色物品", id);
|
|
return 0;
|
|
}
|
|
DataCharacterAttri dataCharacterAttri=TableManager.Instance.Tables.CharacterAttri.Get(item.Param1);
|
|
if(dataCharacterAttri==null)
|
|
{
|
|
DebugUtil.Log("item表格id为{0}的物品角色id没有配");
|
|
return 0;
|
|
}
|
|
return item.Param1;
|
|
|
|
}
|
|
public static ItemType GetItemType(int id)
|
|
{
|
|
DataItem item = TableManager.Instance.Tables.Item.Get(id);
|
|
return item.Type;
|
|
}
|
|
}
|
|
} |