using System.Collections.Generic;
|
using System.Text;
|
|
public partial class ItemConfig : IConfigPostProcess
|
{
|
private static Dictionary<int, ItemConfig> m_GemCfgs = new Dictionary<int, ItemConfig>();
|
|
//因为加载顺序的原因 这里写死需要缓存的装备类型数据
|
//筛选条件 装备位,阶级,颜色(品质),职业限制
|
//该逻辑表格还有个问题,比如展示用的物品莲台合并和GM装备 也会被搜索到,服务端是用是否掉落做区分的, 客户端暂时用ID大小屏蔽
|
static List<int> equipPlaceArr = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8 };
|
//阶级+装备位:【物品ID】
|
static Dictionary<Int2, List<int>> itemIDsDict = new Dictionary<Int2, List<int>>();
|
|
|
public void OnConfigParseCompleted()
|
{
|
//暂只有筛选装备位1-8
|
if (ID < 1000000) return;
|
if (equipPlaceArr.Contains(EquipPlace))
|
{
|
Int2 key = new Int2(LV, EquipPlace);
|
if (!itemIDsDict.ContainsKey(key))
|
{
|
itemIDsDict[key] = new List<int>();
|
}
|
itemIDsDict[key].Add(ID);
|
}
|
}
|
|
//筛选条件 装备位,阶级,颜色(品质),职业限制
|
//获得装备物品表数据
|
public static ItemConfig GetEquipConfig(int lv, int place, int itemColor, int jobLimit)
|
{
|
List<int> itemIDs = null;
|
if (itemIDsDict.TryGetValue(new Int2(lv, place), out itemIDs))
|
{
|
for (int i = 0; i < itemIDs.Count; i++)
|
{
|
var config = Get(itemIDs[i]);
|
if (config.ItemColor == itemColor && config.JobLimit == jobLimit)
|
{
|
return config;
|
}
|
}
|
}
|
return null;
|
}
|
|
public static void GemItemInit()
|
{
|
GemItemConfig.Init(true);
|
var keys = GemItemConfig.GetKeys();
|
foreach (var key in keys)
|
{
|
var config = ItemConfig.Get(key);
|
m_GemCfgs.Add(config.EffectValueB1 * 1000 + config.EffectValueA1, config);
|
}
|
}
|
|
/// <summary>
|
/// 根据宝石等级以及类型取到宝石数据
|
/// </summary>
|
/// <param name="level"></param>
|
/// <param name="type"></param>
|
/// <returns></returns>
|
public static ItemConfig GetGemDataByLevelAndType(int level, int type)
|
{
|
ItemConfig item = null;
|
m_GemCfgs.TryGetValue(level * 1000 + type, out item);
|
return item;
|
}
|
|
|
}
|
|
|