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,24 @@
namespace MikuSB.Data.Excel;
[ResourceEntity("break_level_limit.json")]
public class BreakLevelLimitExcel : ExcelResource
{
public int ID { get; set; }
public uint Break0 { get; set; }
public uint Break1 { get; set; }
public uint Break2 { get; set; }
public uint Break3 { get; set; }
public uint Break4 { get; set; }
public uint Break5 { get; set; }
public uint Break6 { get; set; }
public override uint GetId()
{
return (uint)ID;
}
public override void Loaded()
{
GameData.BreakLevelLimitData[ID] = this;
}
}

View File

@@ -0,0 +1,21 @@
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("recycle.json")]
public class RecycleExcel : ExcelResource
{
public int ID { get; set; }
public JToken? RecycleBase { get; set; }
public JToken? RecycleRatio { get; set; }
public override uint GetId()
{
return (uint)ID;
}
public override void Loaded()
{
GameData.RecycleData[ID] = this;
}
}

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;
}
}

View File

@@ -0,0 +1,49 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("upgrade_exp.json")]
public class UpgradeExpExcel : ExcelResource
{
public int Lv { get; set; }
[JsonProperty("CardNeedExp")] public JToken? CardNeedExpRaw { get; set; }
[JsonProperty("SSRCardNeedExp")] public JToken? SsrCardNeedExpRaw { get; set; }
[JsonProperty("SusNeedExp")] public JToken? SusNeedExpRaw { get; set; }
[JsonProperty("SSRSusNeedExp")] public JToken? SsrSusNeedExpRaw { get; set; }
[JsonProperty("WeaponNeedExp")] public JToken? WeaponNeedExpRaw { get; set; }
[JsonProperty("SSRWeaponNeedExp")] public JToken? SsrWeaponNeedExpRaw { get; set; }
[JsonIgnore] public uint CardNeedExp => ReadUInt(CardNeedExpRaw);
[JsonIgnore] public uint SSRCardNeedExp => ReadUInt(SsrCardNeedExpRaw);
[JsonIgnore] public uint SusNeedExp => ReadUInt(SusNeedExpRaw);
[JsonIgnore] public uint SSRSusNeedExp => ReadUInt(SsrSusNeedExpRaw);
[JsonIgnore] public uint WeaponNeedExp => ReadUInt(WeaponNeedExpRaw);
[JsonIgnore] public uint SSRWeaponNeedExp => ReadUInt(SsrWeaponNeedExpRaw);
public override uint GetId()
{
return (uint)Lv;
}
public override void Loaded()
{
GameData.UpgradeExpData[Lv] = 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
};
}
}

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;
}
}

View File

@@ -7,6 +7,10 @@ public static class GameData
public static Dictionary<uint, CardExcel> CardData { get; private set; } = [];
public static Dictionary<uint, WeaponExcel> WeaponData { get; private set; } = [];
public static Dictionary<uint, CardSkinExcel> CardSkinData { get; private set; } = [];
public static Dictionary<uint, SuppliesExcel> SuppliesData { get; private set; } = [];
public static Dictionary<int, UpgradeExpExcel> UpgradeExpData { get; private set; } = [];
public static Dictionary<int, BreakLevelLimitExcel> BreakLevelLimitData { get; private set; } = [];
public static Dictionary<int, RecycleExcel> RecycleData { get; private set; } = [];
}
public static class GameResourceTemplateId