ClimbTowerLogic_GetReward

This commit is contained in:
Kei-Luna
2026-05-24 05:40:26 +09:00
parent 589f7d6340
commit 55bfadbd3e
5 changed files with 563 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("item/templates/others.json")]
public class OtherItemExcel : ExcelResource
{
public uint Genre { get; set; }
public uint Detail { get; set; }
public uint Particular { get; set; }
public uint Level { get; set; }
[JsonProperty("GMnum")] public JToken? GMnumRaw { get; set; }
[JsonIgnore]
public uint GMnum => ReadUInt(GMnumRaw);
public override uint GetId() => (uint)GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
public override void Loaded()
{
GameData.OtherItemData[GetId()] = this;
}
private static uint ReadUInt(JToken? token)
{
if (token == null)
return 0;
return token.Type switch
{
JTokenType.Integer => token.Value<uint>(),
JTokenType.Float => (uint)Math.Max(0, token.Value<decimal>()),
JTokenType.String when uint.TryParse(token.Value<string>(), out var value) => value,
_ => 0
};
}
}