2024-01-18 13:57:01 +08:00
|
|
|
|
using cfg.ActorCfg;
|
2024-01-19 13:24:37 +08:00
|
|
|
|
using cfg.CharacterCfg;
|
2024-01-18 13:57:01 +08:00
|
|
|
|
using Framework;
|
2024-01-08 13:13:35 +08:00
|
|
|
|
using Gameplay.Common;
|
2024-01-04 19:14:18 +08:00
|
|
|
|
using Gameplay.Net;
|
2024-01-16 18:42:57 +08:00
|
|
|
|
using NLDPB;
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-01-04 19:14:18 +08:00
|
|
|
|
|
|
|
|
|
|
namespace Gameplay
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class CommonUtils
|
|
|
|
|
|
{
|
|
|
|
|
|
public static uint GetItemCount(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return Actor.Instance.Item.GetItemCount(id);
|
|
|
|
|
|
}
|
2024-01-19 13:24:37 +08:00
|
|
|
|
|
2024-01-08 13:13:35 +08:00
|
|
|
|
public static string GetItemName(int id)
|
|
|
|
|
|
{
|
2024-03-08 17:09:17 +08:00
|
|
|
|
return GetLocalizeText(TableManager.Instance.Tables.Item.Get(id).NameLocal);
|
2024-01-08 13:13:35 +08:00
|
|
|
|
}
|
2024-01-15 14:16:30 +08:00
|
|
|
|
public static string GetItemPath(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
return TableManager.Instance.Tables.Item.Get(id).IconPath;
|
|
|
|
|
|
}
|
2024-01-16 18:42:57 +08:00
|
|
|
|
|
|
|
|
|
|
public static readonly List<ItemSource> ItemSourceNotShowInItemWindow = new List<ItemSource>
|
|
|
|
|
|
{ ItemSource.LevelPassNormal, ItemSource.LevelPassFirst, ItemSource.LevelPassStar1,
|
|
|
|
|
|
ItemSource.LevelPassStar2, ItemSource.LevelPassStar2, ItemSource.LevelPassStar3,
|
2024-07-12 16:09:19 +08:00
|
|
|
|
ItemSource.ChapterStar,ItemSource.MailItem,ItemSource.Raffle,
|
2024-01-16 18:42:57 +08:00
|
|
|
|
};
|
2024-01-18 13:57:01 +08:00
|
|
|
|
|
|
|
|
|
|
public static int GetItemCharacterCfgId(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataItem item = TableManager.Instance.Tables.Item.Get(id);
|
|
|
|
|
|
if(item==null)
|
|
|
|
|
|
{
|
2024-01-19 13:24:37 +08:00
|
|
|
|
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没有配");
|
2024-01-18 13:57:01 +08:00
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
return item.Param1;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2024-01-19 13:24:37 +08:00
|
|
|
|
public static ItemType GetItemType(int id)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataItem item = TableManager.Instance.Tables.Item.Get(id);
|
|
|
|
|
|
return item.Type;
|
|
|
|
|
|
}
|
2024-04-25 16:21:20 +08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 道具是否溢出
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="id"></param>
|
|
|
|
|
|
/// <param name="count"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public static bool IsItemOverflow(int id, int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
DataItem item = TableManager.Instance.Tables.Item.Get(id);
|
|
|
|
|
|
if (item == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"获取道具配置失败,道具id:{id}");
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (item.MaxCount == 0)
|
|
|
|
|
|
return count > TableManager.Instance.Tables.GlobalConfig.ItemMaxDefault;
|
|
|
|
|
|
|
|
|
|
|
|
return count > item.MaxCount;
|
|
|
|
|
|
}
|
2024-01-04 19:14:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|