Files
DanhengServer-OpenSource/Common/Data/Excel/ChallengeConfigExcel.cs
2024-05-26 14:35:37 +08:00

89 lines
2.9 KiB
C#

using Newtonsoft.Json;
namespace EggLink.DanhengServer.Data.Excel
{
[ResourceEntity("ChallengeMazeConfig.json,ChallengeStoryMazeConfig.json",
isMultifile: true)]
public class ChallengeConfigExcel : ExcelResource
{
// General item data
public int ID { get; set; }
public int GroupID { get; set; }
public int MapEntranceID { get; set; }
public int StageNum { get; set; }
public int ChallengeCountDown { get; set; }
public int MazeBuffID { get; set; }
public List<int>? ChallengeTargetID { get; set; } = [];
public int MazeGroupID1 { get; set; }
public List<int>? ConfigList1 { get; set; } = [];
public List<int>? NpcMonsterIDList1 { get; set; } = [];
public List<int>? EventIDList1 { get; set; } = [];
public int MazeGroupID2 { get; set; }
public List<int>? ConfigList2 { get; set; } = [];
public List<int>? NpcMonsterIDList2 { get; set; } = [];
public List<int>? EventIDList2 { get; set; } = [];
[JsonIgnore]
public Dictionary<int, ChallengeMonsterInfo> ChallengeMonsters1 { get; set; } = new();
[JsonIgnore]
public Dictionary<int, ChallengeMonsterInfo> ChallengeMonsters2 { get; set; } = new();
[JsonIgnore]
public ChallengeStoryExtraExcel? StoryExcel;
public override int GetId()
{
return ID;
}
public bool IsStory()
{
return StoryExcel != null;
}
public void SetStoryExcel(ChallengeStoryExtraExcel storyExcel)
{
StoryExcel = storyExcel;
ChallengeCountDown = storyExcel.TurnLimit;
}
public override void Loaded()
{
// Cache challenge monsters
for (int i = 0; i < ConfigList1?.Count; i++)
{
if (ConfigList1[i] == 0) break;
var Monster = new ChallengeMonsterInfo(ConfigList1[i], NpcMonsterIDList1![i], EventIDList1![i]);
ChallengeMonsters1.Add(Monster.ConfigId, Monster);
}
for (int i = 0; i < ConfigList2?.Count; i++)
{
if (ConfigList2[i] == 0) break;
var Monster = new ChallengeMonsterInfo(ConfigList2[i], NpcMonsterIDList2![i], EventIDList2![i]);
ChallengeMonsters2.Add(Monster.ConfigId, Monster);
}
ConfigList1 = null;
NpcMonsterIDList1 = null;
EventIDList1 = null;
ConfigList2 = null;
NpcMonsterIDList2 = null;
EventIDList2 = null;
GameData.ChallengeConfigData[ID] = this;
}
public class ChallengeMonsterInfo(int ConfigId, int NpcMonsterId, int EventId)
{
public int ConfigId = ConfigId;
public int NpcMonsterId = NpcMonsterId;
public int EventId = EventId;
}
}
}