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

@@ -1,4 +1,7 @@
namespace MikuSB.Data.Excel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("weapon.json")]
public class WeaponExcel : ExcelResource
@@ -7,8 +10,13 @@ public class WeaponExcel : ExcelResource
public uint Detail { get; set; }
public uint Particular { get; set; }
public uint Level { get; set; }
[JsonProperty("Color")] public JToken? ColorRaw { get; set; }
[JsonProperty("InitBreak")] public JToken? InitBreakRaw { get; set; }
public int Class { get; set; }
public uint Icon { get; set; }
[JsonProperty("ProvideExp")] public JToken? ProvideExpRaw { get; set; }
[JsonProperty("ConsumeGold")] public JToken? ConsumeGoldRaw { get; set; }
[JsonProperty("RecycleID")] public JToken? RecycleIdRaw { get; set; }
public int EvolutionMatID { get; set; }
public int BreakMatID { get; set; }
public int LevelLimitID { get; set; }
@@ -17,6 +25,13 @@ public class WeaponExcel : ExcelResource
public List<int> DefaultSkillID { get; set; } = [];
public List<int> WeaponPartsLimit { get; set; } = [];
public string I18n { get; set; } = "";
[JsonIgnore] public int Color => ReadInt(ColorRaw);
[JsonIgnore] public uint InitBreak => ReadUInt(InitBreakRaw);
[JsonIgnore] public uint ProvideExp => ReadUInt(ProvideExpRaw);
[JsonIgnore] public uint ConsumeGold => ReadUInt(ConsumeGoldRaw);
[JsonIgnore] public int RecycleID => ReadInt(RecycleIdRaw);
public override uint GetId()
{
return (uint)I18n.GetHashCode();
@@ -26,4 +41,26 @@ public class WeaponExcel : ExcelResource
{
GameData.WeaponData.Add(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;
}
}