mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 08:04:01 +00:00
Implement Weapon_Upgrade
This commit is contained in:
24
Common/Data/Excel/BreakLevelLimitExcel.cs
Normal file
24
Common/Data/Excel/BreakLevelLimitExcel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
21
Common/Data/Excel/RecycleExcel.cs
Normal file
21
Common/Data/Excel/RecycleExcel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
52
Common/Data/Excel/SuppliesExcel.cs
Normal file
52
Common/Data/Excel/SuppliesExcel.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
49
Common/Data/Excel/UpgradeExpExcel.cs
Normal file
49
Common/Data/Excel/UpgradeExpExcel.cs
Normal 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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,6 +23,16 @@ public abstract class BaseGameItemInfo
|
||||
public uint UniqueId { get; set; }
|
||||
public ulong TemplateId { get; set; }
|
||||
public uint ItemCount { get; set; }
|
||||
|
||||
public virtual Item ToProto()
|
||||
{
|
||||
return new Item
|
||||
{
|
||||
Id = UniqueId,
|
||||
Template = TemplateId,
|
||||
Count = ItemCount
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class GrowableItemInfo : BaseGameItemInfo
|
||||
@@ -30,12 +40,13 @@ public abstract class GrowableItemInfo : BaseGameItemInfo
|
||||
public bool IsLocked { get; set; }
|
||||
public uint Level { get; set; }
|
||||
public uint Exp { get; set; }
|
||||
public uint Break { get; set; }
|
||||
public uint EquipAvatarId { get; set; }
|
||||
}
|
||||
|
||||
public class GameWeaponInfo : GrowableItemInfo
|
||||
{
|
||||
public Item ToProto()
|
||||
public override Item ToProto()
|
||||
{
|
||||
var proto = new Item
|
||||
{
|
||||
@@ -44,17 +55,17 @@ public class GameWeaponInfo : GrowableItemInfo
|
||||
Count = ItemCount,
|
||||
Enhance = new Enhance
|
||||
{
|
||||
Level = Level
|
||||
Level = Level,
|
||||
Exp = Exp,
|
||||
Break = Break
|
||||
}
|
||||
};
|
||||
return proto;
|
||||
}
|
||||
}
|
||||
|
||||
public class GameSkinInfo : BaseGameItemInfo
|
||||
}public class GameSkinInfo : BaseGameItemInfo
|
||||
{
|
||||
public uint Level { get; set; }
|
||||
public Item ToProto()
|
||||
public override Item ToProto()
|
||||
{
|
||||
var proto = new Item
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user