41 lines
1.1 KiB
C#
Executable File
41 lines
1.1 KiB
C#
Executable File
using System.Collections.Generic;
|
|
using ET;
|
|
|
|
namespace Cal.DataTable
|
|
{
|
|
public partial class StarSoulLevelConfigCategory
|
|
{
|
|
/// <summary>
|
|
/// kv[quality, kv[level, id]]
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
private Dictionary<byte, Dictionary<byte, long>> idDictionary = new Dictionary<byte, Dictionary<byte, long>>();
|
|
|
|
public StarSoulLevelConfig GetByQualityAndLevel(Quality quality, byte level)
|
|
{
|
|
if (this.idDictionary.TryGetValue((byte) quality, out var dic))
|
|
{
|
|
if (dic.TryGetValue(level, out long id))
|
|
{
|
|
return Get(id);
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
public override void EndInit()
|
|
{
|
|
base.EndInit();
|
|
foreach (var kv in this.dict)
|
|
{
|
|
if (!this.idDictionary.TryGetValue(kv.Value.Quality, out var dic))
|
|
{
|
|
idDictionary[kv.Value.Quality] = dic = new Dictionary<byte, long>();
|
|
}
|
|
|
|
dic[kv.Value.Level] = kv.Key;
|
|
}
|
|
}
|
|
}
|
|
} |