Implement Weapon_Upgrade

This commit is contained in:
Kei-Luna
2026-04-26 06:30:40 +09:00
parent f95468c8b8
commit 3460ad9185
12 changed files with 654 additions and 9 deletions

View File

@@ -0,0 +1,52 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("suplies.json")]
public class SuppliesExcel : ExcelResource
{
public uint Genre { get; set; }
public uint Detail { get; set; }
public uint Particular { get; set; }
public uint Level { get; set; }
[JsonProperty("Color")] public JToken? ColorRaw { get; set; }
[JsonProperty("ProvideExp")] public JToken? ProvideExpRaw { get; set; }
[JsonProperty("ConsumeGold")] public JToken? ConsumeGoldRaw { get; set; }
[JsonIgnore] public int Color => ReadInt(ColorRaw);
[JsonIgnore] public uint ProvideExp => ReadUInt(ProvideExpRaw);
[JsonIgnore] public uint ConsumeGold => ReadUInt(ConsumeGoldRaw);
public override uint GetId()
{
return (uint)GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
}
public override void Loaded()
{
GameData.SuppliesData[GetId()] = this;
}
private static int ReadInt(JToken? token)
{
if (token == null)
{
return 0;
}
return token.Type switch
{
JTokenType.Integer => token.Value<int>(),
JTokenType.Float => (int)token.Value<decimal>(),
JTokenType.String when int.TryParse(token.Value<string>(), out var value) => value,
_ => 0
};
}
private static uint ReadUInt(JToken? token)
{
var value = ReadInt(token);
return value > 0 ? (uint)value : 0;
}
}