Files
MikuSB/Common/Data/Excel/Rogue3DTalentExcel.cs

32 lines
939 B
C#

using Newtonsoft.Json;
namespace MikuSB.Data.Excel;
[ResourceEntity("dlc/rogue3d/server_03_talent.json")]
public class Rogue3DTalentExcel : ExcelResource
{
[JsonProperty("TalentID")] public uint TalentId { get; set; }
[JsonProperty("UnlockCondition")] private object? UnlockConditionRaw { get; set; }
[JsonIgnore] public uint UnlockCondition { get; private set; }
public override uint GetId() => TalentId;
public override void Loaded()
{
UnlockCondition = ParseUnlockCondition(UnlockConditionRaw);
GameData.Rogue3DTalentData[TalentId] = this;
}
private static uint ParseUnlockCondition(object? raw)
{
return raw switch
{
null => 0,
long value when value > 0 => (uint)value,
int value when value > 0 => (uint)value,
string text when uint.TryParse(text, out var value) => value,
_ => 0
};
}
}