Support Card Affix

This commit is contained in:
Kei-Luna
2026-05-15 16:07:36 +09:00
parent 46d945f3ce
commit 0058ba0db6
8 changed files with 144 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("item/support/affix.json")]
public class SupportAffixExcel : ExcelResource
{
[JsonProperty("ID")] public int Id { get; set; }
[JsonExtensionData] public IDictionary<string, JToken> ExtraData { get; set; } = new Dictionary<string, JToken>();
public int TierCount =>
ExtraData
.Where(x => x.Key != "ID" && x.Key != "Sift" && x.Key != "Comment")
.Select(x => x.Value)
.OfType<JObject>()
.Select(x => x.Count)
.DefaultIfEmpty(0)
.Max();
public override uint GetId() => (uint)Id;
public override void Loaded()
{
GameData.SupportAffixData[Id] = this;
}
}

View File

@@ -0,0 +1,35 @@
using Newtonsoft.Json;
namespace MikuSB.Data.Excel;
[ResourceEntity("item/support/affix_pool.json")]
public class SupportAffixPoolExcel : ExcelResource
{
[JsonProperty("ID")] public int Id { get; set; }
public List<int> AffixGroup1 { get; set; } = [];
public int Weight1 { get; set; }
public List<int> AffixGroup2 { get; set; } = [];
public int Weight2 { get; set; }
public List<int> AffixGroup3 { get; set; } = [];
public int Weight3 { get; set; }
public List<int> AffixGroup4 { get; set; } = [];
public int Weight4 { get; set; }
public IEnumerable<(IReadOnlyList<int> Affixs, int Weight)> Groups
{
get
{
if (AffixGroup1.Count > 0 && Weight1 > 0) yield return (AffixGroup1, Weight1);
if (AffixGroup2.Count > 0 && Weight2 > 0) yield return (AffixGroup2, Weight2);
if (AffixGroup3.Count > 0 && Weight3 > 0) yield return (AffixGroup3, Weight3);
if (AffixGroup4.Count > 0 && Weight4 > 0) yield return (AffixGroup4, Weight4);
}
}
public override uint GetId() => (uint)Id;
public override void Loaded()
{
GameData.SupportAffixPoolData[Id] = this;
}
}

View File

@@ -11,7 +11,9 @@ public class SupportCardExcel : ExcelResource
public uint Level { get; set; }
public uint Icon { get; set; }
public uint ProvideExp { get; set; }
public uint Color { get; set; }
[JsonProperty("LevelLimitID")] public int LevelLimitId { get; set; }
[JsonProperty("AffixPool")] public List<int> AffixPool { get; set; } = [];
public uint MaxLevel => LevelLimitId switch
{
@@ -21,6 +23,12 @@ public class SupportCardExcel : ExcelResource
_ => 10
};
// Number of affixes granted initially
public int InitialAffixCount => Color >= 5 ? 2 : 1;
// Total maximum affixes (including ones unlocked at max level)
public int TotalAffixCount => Color >= 5 ? 3 : 2;
public ulong TemplateId => GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
public override uint GetId() => Icon;

View File

@@ -23,6 +23,8 @@ public static class GameData
public static Dictionary<uint, SpineExcel> SpineData { get; private set; } = [];
public static Dictionary<uint, NodeConditionExcel> NodeConditionData { get; private set; } = [];
public static List<SupportCardExcel> SupportCardData { get; private set; } = [];
public static Dictionary<int, SupportAffixExcel> SupportAffixData { get; private set; } = [];
public static Dictionary<int, SupportAffixPoolExcel> SupportAffixPoolData { get; private set; } = [];
public static Dictionary<uint, WeaponSkinExcel> WeaponSkinData { get; private set; } = [];
public static Dictionary<uint, DailyLevelExcel> DailyLevelData { get; private set; } = [];
public static Dictionary<uint, ProfileExcel> ProfileData { get; private set; } = [];

View File

@@ -106,6 +106,8 @@ public class GameSkinInfo : BaseGameItemInfo
public class GameSupportCardInfo : BaseGameItemInfo
{
public uint AffixId { get; set; }
[SugarColumn(IsJson = true)] public List<uint> Affixs { get; set; } = [];
public override Item ToProto()
{
var proto = new Item
@@ -120,6 +122,7 @@ public class GameSupportCardInfo : BaseGameItemInfo
Exp = Exp
}
};
proto.Enhance.Affixs.AddRange(Affixs);
proto.Slots[(uint)ItemSupportCardSlotTypeEnum.SLOT_AFFIXINDEX] = AffixId;
return proto;
}