diff --git a/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs b/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs index 193a4639..9b1836f2 100644 --- a/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs +++ b/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs @@ -10,8 +10,8 @@ public class RogueDialogueBaseConfigInfo public string OptionPath { get; set; } = string.Empty; public string DialoguePath { get; set; } = string.Empty; - public LevelGraphConfigInfo? DialogueInfo { get; set; } - public RogueDialogueEventConfigInfo? OptionInfo { get; set; } + [JsonIgnore] public LevelGraphConfigInfo? DialogueInfo { get; set; } + [JsonIgnore] public RogueDialogueEventConfigInfo? OptionInfo { get; set; } public void Loaded() { diff --git a/Common/Data/Excel/RogueDialogueDynamicDisplayExcel.cs b/Common/Data/Excel/RogueDialogueDynamicDisplayExcel.cs new file mode 100644 index 00000000..42665531 --- /dev/null +++ b/Common/Data/Excel/RogueDialogueDynamicDisplayExcel.cs @@ -0,0 +1,18 @@ +namespace EggLink.DanhengServer.Data.Excel; + +[ResourceEntity("RogueDialogueDynamicDisplay.json")] +public class RogueDialogueDynamicDisplayExcel : ExcelResource +{ + public int DisplayID { get; set; } + public HashName ContentText { get; set; } = new(); + + public override int GetId() + { + return DisplayID; + } + + public override void Loaded() + { + GameData.RogueDialogueDynamicDisplayData.Add(DisplayID, this); + } +} \ No newline at end of file diff --git a/Common/Data/Excel/RogueDialogueOptionDisplayExcel.cs b/Common/Data/Excel/RogueDialogueOptionDisplayExcel.cs new file mode 100644 index 00000000..5ee6b575 --- /dev/null +++ b/Common/Data/Excel/RogueDialogueOptionDisplayExcel.cs @@ -0,0 +1,19 @@ +namespace EggLink.DanhengServer.Data.Excel; + +[ResourceEntity("RogueDialogueOptionDisplay.json")] +public class RogueDialogueOptionDisplayExcel : ExcelResource +{ + public int OptionDisplayID { get; set; } + public HashName OptionTitle { get; set; } = new(); + public HashName OptionDesc { get; set; } = new(); + + public override int GetId() + { + return OptionDisplayID; + } + + public override void Loaded() + { + GameData.RogueDialogueOptionDisplayData.Add(OptionDisplayID, this); + } +} \ No newline at end of file diff --git a/Common/Data/Excel/RogueNPCExcel.cs b/Common/Data/Excel/RogueNPCExcel.cs index 7c90f4ca..e991b07a 100644 --- a/Common/Data/Excel/RogueNPCExcel.cs +++ b/Common/Data/Excel/RogueNPCExcel.cs @@ -1,4 +1,5 @@ using EggLink.DanhengServer.Data.Config.Rogue; +using Newtonsoft.Json; namespace EggLink.DanhengServer.Data.Excel; @@ -8,7 +9,7 @@ public class RogueNPCExcel : ExcelResource public int RogueNPCID { get; set; } public string NPCJsonPath { get; set; } = string.Empty; - public RogueNPCConfigInfo? RogueNpcConfig { get; set; } + [JsonIgnore] public RogueNPCConfigInfo? RogueNpcConfig { get; set; } public override int GetId() { diff --git a/Common/Data/Excel/RogueTalkNameConfigExcel.cs b/Common/Data/Excel/RogueTalkNameConfigExcel.cs new file mode 100644 index 00000000..df2435a0 --- /dev/null +++ b/Common/Data/Excel/RogueTalkNameConfigExcel.cs @@ -0,0 +1,18 @@ +namespace EggLink.DanhengServer.Data.Excel; + +[ResourceEntity("RogueTalkNameConfig.json")] +public class RogueTalkNameConfigExcel : ExcelResource +{ + public int TalkNameID { get; set; } + public HashName Name { get; set; } = new(); + + public override int GetId() + { + return TalkNameID; + } + + public override void Loaded() + { + GameData.RogueTalkNameConfigData.Add(TalkNameID, this); + } +} \ No newline at end of file diff --git a/Common/Data/GameData.cs b/Common/Data/GameData.cs index 14aa1502..9e88519a 100644 --- a/Common/Data/GameData.cs +++ b/Common/Data/GameData.cs @@ -268,6 +268,8 @@ public static class GameData public static Dictionary RogueBuffData { get; private set; } = []; public static Dictionary RogueBuffGroupData { get; private set; } = []; public static Dictionary RogueHandBookEventData { get; private set; } = []; + public static Dictionary RogueDialogueOptionDisplayData { get; private set; } = []; + public static Dictionary RogueDialogueDynamicDisplayData { get; private set; } = []; public static Dictionary RogueHandbookMiracleData { get; private set; } = []; public static Dictionary RogueManagerData { get; private set; } = []; public static Dictionary> RogueMapData { get; private set; } = []; @@ -280,6 +282,7 @@ public static class GameData public static Dictionary RogueMonsterData { get; private set; } = []; public static Dictionary RogueMonsterGroupData { get; private set; } = []; public static Dictionary RogueNPCData { get; private set; } = []; + public static Dictionary RogueTalkNameConfigData { get; private set; } = []; public static Dictionary RogueRoomData { get; private set; } = []; public static Dictionary RogueTalentData { get; private set; } = []; diff --git a/Program/Handbook/HandbookGenerator.cs b/Program/Handbook/HandbookGenerator.cs index 0d7b01c2..76833649 100644 --- a/Program/Handbook/HandbookGenerator.cs +++ b/Program/Handbook/HandbookGenerator.cs @@ -118,6 +118,11 @@ public static class HandbookGenerator builder.AppendLine("#RogueDiceSurface"); builder.AppendLine(); GenerateRogueDiceSurfaceDisplay(builder, textMap, fallbackTextMap); + + builder.AppendLine(); + builder.AppendLine("#RogueDialogue"); + builder.AppendLine(); + GenerateRogueDialogueDisplay(builder, textMap, fallbackTextMap); #endif builder.AppendLine(); @@ -240,8 +245,57 @@ public static class HandbookGenerator builder.AppendLine(display.SurfaceID + ": " + name + "\n" + "Desc: " + desc); } } + + public static void GenerateRogueDialogueDisplay(StringBuilder builder, Dictionary map, + Dictionary fallback) + { + foreach (var npc in GameData.RogueNPCData.Values.Where(x => x.RogueNpcConfig != null)) + { + builder.AppendLine("NpcId: " + npc.RogueNPCID); + foreach (var dialogue in npc.RogueNpcConfig?.DialogueList ?? []) + { + var eventNameHash = + GameData.RogueTalkNameConfigData.GetValueOrDefault(dialogue.TalkNameID)?.Name.Hash ?? + -1; + var eventName = GetNameFromTextMap(eventNameHash, map, fallback); + builder.AppendLine($" Progress: {dialogue.DialogueProgress} | {eventName}"); + builder.AppendLine($" Type: {npc.RogueNpcConfig!.DialogueType}"); + builder.AppendLine(" Options: "); + + foreach (var option in dialogue.OptionInfo?.OptionList ?? []) + { + var display = GameData.RogueDialogueOptionDisplayData.GetValueOrDefault(option.DisplayID); + if (display == null) continue; + + var optionName = GetNameFromTextMap(display.OptionTitle.Hash, map, fallback); + var optionDesc = GetNameFromTextMap(display.OptionDesc.Hash, map, fallback); + builder.AppendLine($" Option: {option.OptionID} - {optionName}"); + builder.AppendLine($" {optionDesc}".Replace("#2", option.DescValue.ToString()) + .Replace("#5", option.DescValue2.ToString()).Replace("#6", option.DescValue3.ToString()) + .Replace("#7", option.DescValue4.ToString())); + if (option.DynamicMap.Count == 0) continue; + + builder.AppendLine(" Dynamic Value:"); + foreach (var value in option.DynamicMap) + { + var dynamic = GameData.RogueDialogueDynamicDisplayData.GetValueOrDefault(value.Value.DisplayID); + if (dynamic == null) continue; + var dynamicName = GetNameFromTextMap(dynamic.ContentText.Hash, map, fallback); + builder.AppendLine($" Dynamic Id: {value.Key} | {dynamicName}"); + } + } + } + } + } #endif + public static string GetNameFromTextMap(long key, Dictionary map, Dictionary fallback) + { + if (map.TryGetValue(key, out var value)) return value; + if (fallback.TryGetValue(key, out value)) return value; + return $"[{key}]"; + } + public static void WriteToFile(string lang, string content) { File.WriteAllText($"GM Handbook/GM Handbook {lang}.txt", content);