This commit is contained in:
Kei-Luna
2026-05-19 10:05:28 +09:00
parent 3bc30812aa
commit 686794a68c
4 changed files with 514 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using MikuSB.Util;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace MikuSB.Data.Excel;
[ResourceEntity("gacha/gacha.json")]
public class GachaExcel : ExcelResource
{
public uint ID { get; set; }
public List<string>? Pool { get; set; }
public uint Probability { get; set; }
public uint ProbabilityTen { get; set; }
public JToken? ProtectNum { get; set; }
public JToken? UpNum { get; set; }
public uint? ProtectTag { get; set; }
public uint? ProtectType { get; set; }
public JToken? ProtectCount { get; set; }
public override uint GetId() => ID;
public override void Loaded() => GameData.GachaData[ID] = this;
public override void AfterAllDone()
{
foreach (var poolName in Pool ?? [])
{
if (GameData.GachaPoolData.ContainsKey(poolName)) continue;
var path = ConfigManager.Config.Path.ResourcePath + "/gacha/pool/" + poolName + ".json";
if (!File.Exists(path)) continue;
var json = File.ReadAllText(path);
var items = JsonConvert.DeserializeObject<List<GachaPoolItem>>(json) ?? [];
GameData.GachaPoolData[poolName] = items;
}
}
}
public class GachaPoolItem
{
public int ID { get; set; }
public int Rarity { get; set; }
public List<uint> GDPL { get; set; } = [];
public int Weight { get; set; }
public int? UPTag { get; set; }
}

View File

@@ -0,0 +1,18 @@
namespace MikuSB.Data.Excel;
[ResourceEntity("gacha/probability.json")]
public class GachaProbabilityExcel : ExcelResource
{
public uint ID { get; set; }
public int Rarity1 { get; set; }
public int Rarity2 { get; set; }
public int Rarity3 { get; set; }
public int Rarity4 { get; set; }
public int Rarity5 { get; set; }
public int Rarity6 { get; set; }
public int[] Weights => [Rarity1, Rarity2, Rarity3, Rarity4, Rarity5, Rarity6];
public override uint GetId() => ID;
public override void Loaded() => GameData.GachaProbabilityData[ID] = this;
}