Implement stage skipping

This commit is contained in:
Mikhail
2024-07-14 19:07:42 -04:00
parent 367cd64b8e
commit 5134ac187b
15 changed files with 558 additions and 49 deletions

View File

@@ -26,6 +26,7 @@ namespace nksrv.StaticInfo
/// Can be Normal or Hard
/// </summary>
public string chapter_mod = "";
public string stage_type = "";
}
public class RewardTableRecord
{

View File

@@ -448,5 +448,22 @@ namespace nksrv.StaticInfo
return null;
}
internal IEnumerable<int> GetStageIdsForChapter(int chapterNumber, bool normal)
{
string mod = normal ? "Normal" : "Hard";
foreach (JObject item in stageDataRecords)
{
CampaignStageRecord? data = JsonConvert.DeserializeObject<CampaignStageRecord>(item.ToString());
if (data == null) throw new Exception("failed to deserialize stage data");
int chVal = data.chapter_id - 1;
if (chapterNumber == chVal && data.chapter_mod == mod && data.stage_type == "Main")
{
yield return data.id;
}
}
}
}
}