mirror of
https://github.com/EpinelPS/EpinelPS.git
synced 2025-12-14 16:04:36 +01:00
Various bug fixes
Fix sim room system error Added stub for obtain item in field Properly save tutorial data
This commit is contained in:
@@ -41,5 +41,15 @@ namespace nksrv.StaticInfo
|
||||
public int reward_id;
|
||||
public int reward_value;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class ClearedTutorialData
|
||||
{
|
||||
public int id;
|
||||
public int VersionGroup = 0;
|
||||
public int GroupId;
|
||||
public int ClearedStageId;
|
||||
public int NextId;
|
||||
public bool SaveTutorial;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace nksrv.StaticInfo
|
||||
private JArray chapterCampaignData;
|
||||
private JArray characterCostumeTable;
|
||||
private JArray characterTable;
|
||||
private JArray tutorialTable;
|
||||
public StaticDataParser(string filePath)
|
||||
{
|
||||
if (!File.Exists(filePath)) throw new ArgumentException("Static data file must exist", nameof(filePath));
|
||||
@@ -230,6 +231,7 @@ namespace nksrv.StaticInfo
|
||||
chapterCampaignData = await LoadZip("CampaignChapterTable.json");
|
||||
characterCostumeTable = await LoadZip("CharacterCostumeTable.json");
|
||||
characterTable = await LoadZip("CharacterTable.json");
|
||||
tutorialTable = await LoadZip("ContentsTutorialTable.json");
|
||||
}
|
||||
|
||||
public MainQuestCompletionData? GetMainQuestForStageClearCondition(int stage)
|
||||
@@ -382,5 +384,27 @@ namespace nksrv.StaticInfo
|
||||
yield return value;
|
||||
}
|
||||
}
|
||||
|
||||
internal ClearedTutorialData GetTutorialDataById(int TableId)
|
||||
{
|
||||
foreach (JObject item in tutorialTable)
|
||||
{
|
||||
var id = item["id"];
|
||||
if (id == null)
|
||||
{
|
||||
throw new Exception("expected id field in reward data");
|
||||
}
|
||||
|
||||
int idValue = id.ToObject<int>();
|
||||
if (idValue == TableId)
|
||||
{
|
||||
ClearedTutorialData? data = JsonConvert.DeserializeObject<ClearedTutorialData>(item.ToString());
|
||||
if (data == null) throw new Exception("failed to deserialize reward data");
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception("tutorial not found: " + TableId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user