mirror of
https://github.com/MikuLeaks/MikuSB.git
synced 2026-06-04 07:44:00 +00:00
ClimbTowerLogic_GetReward
This commit is contained in:
56
Common/Data/Excel/ClimbTowerAwardExcel.cs
Normal file
56
Common/Data/Excel/ClimbTowerAwardExcel.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
[ResourceEntity("challenge/climbtower/climb_tower_award.json")]
|
||||
public class ClimbTowerAwardExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("ID")] public uint ID { get; set; }
|
||||
[JsonProperty("Diff")] public JToken? DiffRaw { get; set; }
|
||||
[JsonProperty("FirstAward")] public List<List<uint>> FirstAward { get; set; } = [];
|
||||
[JsonProperty("StarCount1")] public int StarCount1 { get; set; }
|
||||
[JsonProperty("StarAward1")] public List<List<uint>> StarAward1 { get; set; } = [];
|
||||
[JsonProperty("StarCount2")] public int StarCount2 { get; set; }
|
||||
[JsonProperty("StarAward2")] public List<List<uint>> StarAward2 { get; set; } = [];
|
||||
[JsonProperty("StarCount3")] public int StarCount3 { get; set; }
|
||||
[JsonProperty("StarAward3")] public List<List<uint>> StarAward3 { get; set; } = [];
|
||||
|
||||
[JsonIgnore]
|
||||
public int Diff => DiffRaw?.Type switch
|
||||
{
|
||||
JTokenType.Integer => Math.Max(1, DiffRaw.Value<int>()),
|
||||
JTokenType.String when int.TryParse(DiffRaw.Value<string>(), out var value) => Math.Max(1, value),
|
||||
_ => 1
|
||||
};
|
||||
|
||||
public override uint GetId() => (ID * 10u) + (uint)Diff;
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
if (!GameData.ClimbTowerAwardData.TryGetValue(ID, out var diffMap))
|
||||
{
|
||||
diffMap = [];
|
||||
GameData.ClimbTowerAwardData[ID] = diffMap;
|
||||
}
|
||||
|
||||
diffMap[Diff] = this;
|
||||
}
|
||||
|
||||
public int GetStarCount(int group) => group switch
|
||||
{
|
||||
1 => StarCount1,
|
||||
2 => StarCount2,
|
||||
3 => StarCount3,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
public IReadOnlyList<IReadOnlyList<uint>> GetRewards(int group) => group switch
|
||||
{
|
||||
0 => FirstAward,
|
||||
1 => StarAward1,
|
||||
2 => StarAward2,
|
||||
3 => StarAward3,
|
||||
_ => []
|
||||
};
|
||||
}
|
||||
17
Common/Data/Excel/ClimbTowerLevelOrderExcel.cs
Normal file
17
Common/Data/Excel/ClimbTowerLevelOrderExcel.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
[ResourceEntity("challenge/climbtower/climb_tower_levelorder.json")]
|
||||
public class ClimbTowerLevelOrderExcel : ExcelResource
|
||||
{
|
||||
[JsonProperty("ID")] public uint ID { get; set; }
|
||||
[JsonProperty("LevelID")] public uint LevelID { get; set; }
|
||||
|
||||
public override uint GetId() => ID;
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.ClimbTowerLevelOrderData[ID] = this;
|
||||
}
|
||||
}
|
||||
38
Common/Data/Excel/OtherItemExcel.cs
Normal file
38
Common/Data/Excel/OtherItemExcel.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MikuSB.Data.Excel;
|
||||
|
||||
[ResourceEntity("item/templates/others.json")]
|
||||
public class OtherItemExcel : ExcelResource
|
||||
{
|
||||
public uint Genre { get; set; }
|
||||
public uint Detail { get; set; }
|
||||
public uint Particular { get; set; }
|
||||
public uint Level { get; set; }
|
||||
[JsonProperty("GMnum")] public JToken? GMnumRaw { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public uint GMnum => ReadUInt(GMnumRaw);
|
||||
|
||||
public override uint GetId() => (uint)GameResourceTemplateId.FromGdpl(Genre, Detail, Particular, Level);
|
||||
|
||||
public override void Loaded()
|
||||
{
|
||||
GameData.OtherItemData[GetId()] = 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
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,10 @@ public static class GameData
|
||||
public static Dictionary<uint, BossPvpBossExcel> BossPvpBossData { get; private set; } = [];
|
||||
public static Dictionary<uint, BossPvpNumExcel> BossPvpNumData { get; private set; } = [];
|
||||
public static Dictionary<uint, ClimbTowerTimeExcel> ClimbTowerTimeData { get; private set; } = [];
|
||||
public static Dictionary<uint, Dictionary<int, ClimbTowerAwardExcel>> ClimbTowerAwardData { get; private set; } = [];
|
||||
public static Dictionary<uint, ClimbTowerLevelOrderExcel> ClimbTowerLevelOrderData { get; private set; } = [];
|
||||
public static Dictionary<uint, TowerLevelExcel> TowerLevelData { get; private set; } = [];
|
||||
public static Dictionary<uint, OtherItemExcel> OtherItemData { get; private set; } = [];
|
||||
public static Dictionary<uint, ProfileExcel> ProfileData { get; private set; } = [];
|
||||
public static Dictionary<uint, CardSkinPartsExcel> CardSkinPartsData { get; private set; } = [];
|
||||
public static Dictionary<uint, CallItemExcel> CallItemData { get; private set; } = [];
|
||||
|
||||
Reference in New Issue
Block a user