From b8e7b41d5ec00a20643123feea64a0affc0ba07b Mon Sep 17 00:00:00 2001 From: Somebody Date: Sat, 10 Aug 2024 15:16:29 +0800 Subject: [PATCH] Fix Basic Rogue Event --- Common/Data/Config/AnchorInfo.cs | 5 -- .../Rogue/RogueDialogueBaseConfigInfo.cs | 62 +++++++++++++++++++ .../Rogue/RogueDialogueEventConfigInfo.cs | 6 ++ .../RogueDialogueEventOptionConfigInfo.cs | 13 ++++ ...gueDialogueEventOptionDynamicConfigInfo.cs | 7 +++ .../Data/Config/Rogue/RogueNPCConfigInfo.cs | 22 +++++++ .../Rogue/RogueNPCDialogueConfigInfo.cs | 8 +++ Common/Data/Config/Scene/AnchorInfo.cs | 5 ++ Common/Data/Config/{ => Scene}/FloorInfo.cs | 56 ++++++++--------- Common/Data/Config/{ => Scene}/GroupInfo.cs | 2 +- Common/Data/Config/{ => Scene}/MonsterInfo.cs | 2 +- Common/Data/Config/{ => Scene}/NpcInfo.cs | 2 +- .../Data/Config/{ => Scene}/PositionInfo.cs | 2 +- Common/Data/Config/{ => Scene}/PropInfo.cs | 2 +- Common/Data/Excel/RogueNPCDialogueExcel.cs | 31 ---------- Common/Data/Excel/RogueNPCExcel.cs | 28 +++++++++ Common/Data/GameData.cs | 4 +- Common/Data/ResourceManager.cs | 15 +++-- Common/Enums/Rogue/RogueDialogueTypeEnum.cs | 9 +++ .../Loaders/TrialActivityEntityLoader.cs | 2 +- .../Game/Challenge/ChallengeEntityLoader.cs | 2 +- .../ChessRogue/Cell/ChessRogueEntityLoader.cs | 2 +- .../Game/Mission/StoryLineEntityLoader.cs | 2 +- GameServer/Game/Rogue/BaseRogueInstance.cs | 4 +- .../Game/Rogue/Event/RogueEventInstance.cs | 8 +-- .../Game/Rogue/Event/RogueEventManager.cs | 4 +- .../Game/Rogue/Scene/Entity/RogueNpc.cs | 2 +- .../Game/Rogue/Scene/Entity/RogueProp.cs | 2 +- .../Game/Rogue/Scene/RogueEntityLoader.cs | 2 +- GameServer/Game/Scene/Entity/EntityMonster.cs | 2 +- GameServer/Game/Scene/Entity/EntityNpc.cs | 2 +- GameServer/Game/Scene/Entity/EntityProp.cs | 2 +- GameServer/Game/Scene/SceneEntityLoader.cs | 2 +- GameServer/Game/Scene/SceneInstance.cs | 2 +- GameServer/Game/Task/LevelTask.cs | 1 + ...ketSelectRogueCommonDialogueOptionScRsp.cs | 3 +- ...RogueCommonDialogueOptionFinishScNotify.cs | 1 - 37 files changed, 225 insertions(+), 101 deletions(-) delete mode 100644 Common/Data/Config/AnchorInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueDialogueEventConfigInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueDialogueEventOptionConfigInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueDialogueEventOptionDynamicConfigInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueNPCConfigInfo.cs create mode 100644 Common/Data/Config/Rogue/RogueNPCDialogueConfigInfo.cs create mode 100644 Common/Data/Config/Scene/AnchorInfo.cs rename Common/Data/Config/{ => Scene}/FloorInfo.cs (64%) rename Common/Data/Config/{ => Scene}/GroupInfo.cs (98%) rename Common/Data/Config/{ => Scene}/MonsterInfo.cs (79%) rename Common/Data/Config/{ => Scene}/NpcInfo.cs (68%) rename Common/Data/Config/{ => Scene}/PositionInfo.cs (94%) rename Common/Data/Config/{ => Scene}/PropInfo.cs (98%) delete mode 100644 Common/Data/Excel/RogueNPCDialogueExcel.cs create mode 100644 Common/Data/Excel/RogueNPCExcel.cs create mode 100644 Common/Enums/Rogue/RogueDialogueTypeEnum.cs diff --git a/Common/Data/Config/AnchorInfo.cs b/Common/Data/Config/AnchorInfo.cs deleted file mode 100644 index 39b8e835..00000000 --- a/Common/Data/Config/AnchorInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace EggLink.DanhengServer.Data.Config; - -public class AnchorInfo : PositionInfo -{ -} \ No newline at end of file diff --git a/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs b/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs new file mode 100644 index 00000000..ef507652 --- /dev/null +++ b/Common/Data/Config/Rogue/RogueDialogueBaseConfigInfo.cs @@ -0,0 +1,62 @@ +using EggLink.DanhengServer.Internationalization; +using EggLink.DanhengServer.Util; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace EggLink.DanhengServer.Data.Config.Rogue; + +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; } + + public void Loaded() + { + var logger = Logger.GetByClassName(); + if (!string.IsNullOrEmpty(OptionPath)) + { + var path = ConfigManager.Config.Path.ResourcePath + "/" + OptionPath; + var file = new FileInfo(path); + if (!file.Exists) return; + try + { + using var reader = file.OpenRead(); + using StreamReader reader2 = new(reader); + var text = reader2.ReadToEnd(); + var info = JsonConvert.DeserializeObject(text); + OptionInfo = info; + } + catch (Exception ex) + { + logger.Error( + I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name, + I18nManager.Translate("Word.Error")), ex); + } + } + + if (!string.IsNullOrEmpty(DialoguePath)) + { + var path = ConfigManager.Config.Path.ResourcePath + "/" + DialoguePath; + var file = new FileInfo(path); + if (!file.Exists) return; + try + { + using var reader = file.OpenRead(); + using StreamReader reader2 = new(reader); + var text = reader2.ReadToEnd().Replace("$type", "Type"); + var obj = JObject.Parse(text); + var info = LevelGraphConfigInfo.LoadFromJsonObject(obj); + DialogueInfo = info; + } + catch (Exception ex) + { + logger.Error( + I18nManager.Translate("Server.ServerInfo.FailedToReadItem", file.Name, + I18nManager.Translate("Word.Error")), ex); + } + } + } +} \ No newline at end of file diff --git a/Common/Data/Config/Rogue/RogueDialogueEventConfigInfo.cs b/Common/Data/Config/Rogue/RogueDialogueEventConfigInfo.cs new file mode 100644 index 00000000..a81f8896 --- /dev/null +++ b/Common/Data/Config/Rogue/RogueDialogueEventConfigInfo.cs @@ -0,0 +1,6 @@ +namespace EggLink.DanhengServer.Data.Config.Rogue; + +public class RogueDialogueEventConfigInfo +{ + public List OptionList { get; set; } = []; +} \ No newline at end of file diff --git a/Common/Data/Config/Rogue/RogueDialogueEventOptionConfigInfo.cs b/Common/Data/Config/Rogue/RogueDialogueEventOptionConfigInfo.cs new file mode 100644 index 00000000..8fceb1a1 --- /dev/null +++ b/Common/Data/Config/Rogue/RogueDialogueEventOptionConfigInfo.cs @@ -0,0 +1,13 @@ +namespace EggLink.DanhengServer.Data.Config.Rogue; + +public class RogueDialogueEventOptionConfigInfo +{ + public int OptionID { get; set; } + public int DisplayID { get; set; } + public int SpecialOptionID { get; set; } + public Dictionary DynamicMap { get; set; } = []; + public int DescValue { get; set; } + public int DescValue2 { get; set; } + public int DescValue3 { get; set; } + public int DescValue4 { get; set; } +} \ No newline at end of file diff --git a/Common/Data/Config/Rogue/RogueDialogueEventOptionDynamicConfigInfo.cs b/Common/Data/Config/Rogue/RogueDialogueEventOptionDynamicConfigInfo.cs new file mode 100644 index 00000000..dd8ab2d0 --- /dev/null +++ b/Common/Data/Config/Rogue/RogueDialogueEventOptionDynamicConfigInfo.cs @@ -0,0 +1,7 @@ +namespace EggLink.DanhengServer.Data.Config.Rogue; + +public class RogueDialogueEventOptionDynamicConfigInfo +{ + public int DisplayID { get; set; } + public int DisplayID2 { get; set; } +} \ No newline at end of file diff --git a/Common/Data/Config/Rogue/RogueNPCConfigInfo.cs b/Common/Data/Config/Rogue/RogueNPCConfigInfo.cs new file mode 100644 index 00000000..cdb10ef1 --- /dev/null +++ b/Common/Data/Config/Rogue/RogueNPCConfigInfo.cs @@ -0,0 +1,22 @@ +using EggLink.DanhengServer.Enums.Rogue; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace EggLink.DanhengServer.Data.Config.Rogue; + +public class RogueNPCConfigInfo +{ + [JsonConverter(typeof(StringEnumConverter))] + public RogueDialogueTypeEnum DialogueType { get; set; } + public List DialogueList { get; set; } = []; + + public void Loaded() + { + if (DialogueList.Count == 0) return; + + foreach (var info in DialogueList) + { + info.Loaded(); + } + } +} diff --git a/Common/Data/Config/Rogue/RogueNPCDialogueConfigInfo.cs b/Common/Data/Config/Rogue/RogueNPCDialogueConfigInfo.cs new file mode 100644 index 00000000..aa5aef8a --- /dev/null +++ b/Common/Data/Config/Rogue/RogueNPCDialogueConfigInfo.cs @@ -0,0 +1,8 @@ +namespace EggLink.DanhengServer.Data.Config.Rogue; + +public class RogueNPCDialogueConfigInfo : RogueDialogueBaseConfigInfo +{ + public int DialogueProgress { get; set; } + public int UnlockID { get; set; } + public int TalkNameID { get; set; } +} \ No newline at end of file diff --git a/Common/Data/Config/Scene/AnchorInfo.cs b/Common/Data/Config/Scene/AnchorInfo.cs new file mode 100644 index 00000000..5858afd2 --- /dev/null +++ b/Common/Data/Config/Scene/AnchorInfo.cs @@ -0,0 +1,5 @@ +namespace EggLink.DanhengServer.Data.Config.Scene; + +public class AnchorInfo : PositionInfo +{ +} \ No newline at end of file diff --git a/Common/Data/Config/FloorInfo.cs b/Common/Data/Config/Scene/FloorInfo.cs similarity index 64% rename from Common/Data/Config/FloorInfo.cs rename to Common/Data/Config/Scene/FloorInfo.cs index f2ae158b..092d476f 100644 --- a/Common/Data/Config/FloorInfo.cs +++ b/Common/Data/Config/Scene/FloorInfo.cs @@ -1,7 +1,7 @@ using EggLink.DanhengServer.Enums.Scene; using Newtonsoft.Json; -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class FloorInfo { @@ -42,35 +42,35 @@ public class FloorInfo // Cache anchors foreach (var group in Groups.Values) - foreach (var prop in group.PropList) - // Check if prop can be teleported to - if (prop.AnchorID > 0) - { - // Put inside cached teleport list to send to client when they request map info - CachedTeleports.TryAdd(prop.MappingInfoID, prop); - UnlockedCheckpoints.Add(prop); - - // Force prop to be in the unlocked state - prop.State = PropStateEnum.CheckPointEnable; - } - else if (!string.IsNullOrEmpty(prop.InitLevelGraph)) - { - var json = prop.InitLevelGraph; - - // Hacky way to setup prop triggers - if (json.Contains("Maze_GroupProp_OpenTreasure_WhenMonsterDie")) + foreach (var prop in group.PropList) + // Check if prop can be teleported to + if (prop.AnchorID > 0) { - //prop.Trigger = new TriggerOpenTreasureWhenMonsterDie(group.Id); - } - else if (json.Contains("Common_Console")) - { - prop.CommonConsole = true; - } + // Put inside cached teleport list to send to client when they request map info + CachedTeleports.TryAdd(prop.MappingInfoID, prop); + UnlockedCheckpoints.Add(prop); - // Clear for garbage collection - prop.ValueSource = null; - prop.InitLevelGraph = null; - } + // Force prop to be in the unlocked state + prop.State = PropStateEnum.CheckPointEnable; + } + else if (!string.IsNullOrEmpty(prop.InitLevelGraph)) + { + var json = prop.InitLevelGraph; + + // Hacky way to setup prop triggers + if (json.Contains("Maze_GroupProp_OpenTreasure_WhenMonsterDie")) + { + //prop.Trigger = new TriggerOpenTreasureWhenMonsterDie(group.Id); + } + else if (json.Contains("Common_Console")) + { + prop.CommonConsole = true; + } + + // Clear for garbage collection + prop.ValueSource = null; + prop.InitLevelGraph = null; + } Loaded = true; } diff --git a/Common/Data/Config/GroupInfo.cs b/Common/Data/Config/Scene/GroupInfo.cs similarity index 98% rename from Common/Data/Config/GroupInfo.cs rename to Common/Data/Config/Scene/GroupInfo.cs index 29ba9af2..310b6fd4 100644 --- a/Common/Data/Config/GroupInfo.cs +++ b/Common/Data/Config/Scene/GroupInfo.cs @@ -6,7 +6,7 @@ using EggLink.DanhengServer.Util; using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class GroupInfo { diff --git a/Common/Data/Config/MonsterInfo.cs b/Common/Data/Config/Scene/MonsterInfo.cs similarity index 79% rename from Common/Data/Config/MonsterInfo.cs rename to Common/Data/Config/Scene/MonsterInfo.cs index fb90903f..f09da8b2 100644 --- a/Common/Data/Config/MonsterInfo.cs +++ b/Common/Data/Config/Scene/MonsterInfo.cs @@ -1,4 +1,4 @@ -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class MonsterInfo : PositionInfo { diff --git a/Common/Data/Config/NpcInfo.cs b/Common/Data/Config/Scene/NpcInfo.cs similarity index 68% rename from Common/Data/Config/NpcInfo.cs rename to Common/Data/Config/Scene/NpcInfo.cs index 8f6e02eb..4c275e10 100644 --- a/Common/Data/Config/NpcInfo.cs +++ b/Common/Data/Config/Scene/NpcInfo.cs @@ -1,4 +1,4 @@ -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class NpcInfo : PositionInfo { diff --git a/Common/Data/Config/PositionInfo.cs b/Common/Data/Config/Scene/PositionInfo.cs similarity index 94% rename from Common/Data/Config/PositionInfo.cs rename to Common/Data/Config/Scene/PositionInfo.cs index a0eae5a3..c8bce664 100644 --- a/Common/Data/Config/PositionInfo.cs +++ b/Common/Data/Config/Scene/PositionInfo.cs @@ -1,6 +1,6 @@ using EggLink.DanhengServer.Util; -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class PositionInfo { diff --git a/Common/Data/Config/PropInfo.cs b/Common/Data/Config/Scene/PropInfo.cs similarity index 98% rename from Common/Data/Config/PropInfo.cs rename to Common/Data/Config/Scene/PropInfo.cs index 4562cb92..29e410a0 100644 --- a/Common/Data/Config/PropInfo.cs +++ b/Common/Data/Config/Scene/PropInfo.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Linq; -namespace EggLink.DanhengServer.Data.Config; +namespace EggLink.DanhengServer.Data.Config.Scene; public class PropInfo : PositionInfo { diff --git a/Common/Data/Excel/RogueNPCDialogueExcel.cs b/Common/Data/Excel/RogueNPCDialogueExcel.cs deleted file mode 100644 index 3f9fc96a..00000000 --- a/Common/Data/Excel/RogueNPCDialogueExcel.cs +++ /dev/null @@ -1,31 +0,0 @@ -using EggLink.DanhengServer.Data.Config; -using Newtonsoft.Json; - -namespace EggLink.DanhengServer.Data.Excel; - -[ResourceEntity("RogueNPCDialogue.json")] -public class RogueNPCDialogueExcel : ExcelResource -{ - public int RogueNPCID { get; set; } - public int DialogueProgress { get; set; } - public int HandbookEventID { get; set; } - public string DialoguePath { get; set; } = ""; - - [JsonIgnore] public DialogueInfo? DialogueInfo { get; set; } - - public override int GetId() - { - return RogueNPCID * 100 + DialogueProgress; - } - - public override void Loaded() - { - GameData.RogueNPCDialogueData.Add(GetId(), this); - } - - public bool CanUseInVer(int version) - { - GameData.RogueHandBookEventData.TryGetValue(HandbookEventID, out var handbookEvent); - return DialogueInfo != null && handbookEvent != null && handbookEvent.EventTypeList.Contains(version); - } -} \ No newline at end of file diff --git a/Common/Data/Excel/RogueNPCExcel.cs b/Common/Data/Excel/RogueNPCExcel.cs new file mode 100644 index 00000000..75a85515 --- /dev/null +++ b/Common/Data/Excel/RogueNPCExcel.cs @@ -0,0 +1,28 @@ +using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Rogue; + +namespace EggLink.DanhengServer.Data.Excel; + +[ResourceEntity("RogueNPC.json")] +public class RogueNPCExcel : ExcelResource +{ + public int RogueNPCID { get; set; } + public string NPCJsonPath { get; set; } = string.Empty; + + public RogueNPCConfigInfo? RogueNpcConfig { get; set; } + + public override int GetId() + { + return RogueNPCID; + } + + public override void Loaded() + { + GameData.RogueNPCData.TryAdd(RogueNPCID, this); + } + + public bool CanUseInVer(int version) + { + return RogueNpcConfig != null; + } +} \ No newline at end of file diff --git a/Common/Data/GameData.cs b/Common/Data/GameData.cs index 9879b3ba..a44d641f 100644 --- a/Common/Data/GameData.cs +++ b/Common/Data/GameData.cs @@ -1,4 +1,4 @@ -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Custom; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Rogue; @@ -201,7 +201,7 @@ public static class GameData public static Dictionary> RogueMiracleGroupData { get; set; } = []; public static Dictionary RogueMiracleDisplayData { get; private set; } = []; public static Dictionary RogueMonsterData { get; private set; } = []; - public static Dictionary RogueNPCDialogueData { get; private set; } = []; + public static Dictionary RogueNPCData { get; private set; } = []; public static Dictionary RogueRoomData { get; private set; } = []; public static Dictionary RogueTalentData { get; private set; } = []; diff --git a/Common/Data/ResourceManager.cs b/Common/Data/ResourceManager.cs index c5fcfaa9..76afcdd2 100644 --- a/Common/Data/ResourceManager.cs +++ b/Common/Data/ResourceManager.cs @@ -1,5 +1,7 @@ using System.Reflection; using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Rogue; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Custom; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Rogue; @@ -361,9 +363,9 @@ public class ResourceManager { Logger.Info(I18nManager.Translate("Server.ServerInfo.LoadingItem", I18nManager.Translate("Word.DialogueInfo"))); var count = 0; - foreach (var dialogue in GameData.RogueNPCDialogueData) + foreach (var dialogue in GameData.RogueNPCData) { - var path = ConfigManager.Config.Path.ResourcePath + "/" + dialogue.Value.DialoguePath; + var path = ConfigManager.Config.Path.ResourcePath + "/" + dialogue.Value.NPCJsonPath; var file = new FileInfo(path); if (!file.Exists) continue; try @@ -371,14 +373,11 @@ public class ResourceManager using var reader = file.OpenRead(); using StreamReader reader2 = new(reader); var text = reader2.ReadToEnd().Replace("$type", "Type"); - var dialogueInfo = JsonConvert.DeserializeObject(text); + var dialogueInfo = JsonConvert.DeserializeObject(text); if (dialogueInfo != null) { - dialogue.Value.DialogueInfo = dialogueInfo; + dialogue.Value.RogueNpcConfig = dialogueInfo; dialogueInfo.Loaded(); - if (dialogueInfo.DialogueIds.Count == 0) - // set to invalid - dialogue.Value.DialogueInfo = null; count++; } } @@ -390,7 +389,7 @@ public class ResourceManager } } - if (count < GameData.RogueNPCDialogueData.Count) + if (count < GameData.RogueNPCData.Count) Logger.Warn(I18nManager.Translate("Server.ServerInfo.ConfigMissing", I18nManager.Translate("Word.DialogueInfo"), $"{ConfigManager.Config.Path.ResourcePath}/Config/Level/Rogue/Dialogue", diff --git a/Common/Enums/Rogue/RogueDialogueTypeEnum.cs b/Common/Enums/Rogue/RogueDialogueTypeEnum.cs new file mode 100644 index 00000000..9c30bc74 --- /dev/null +++ b/Common/Enums/Rogue/RogueDialogueTypeEnum.cs @@ -0,0 +1,9 @@ +namespace EggLink.DanhengServer.Enums.Rogue; + +public enum RogueDialogueTypeEnum +{ + None = 0, + Story = 1, + Event = 2, + Store = 3 +} diff --git a/GameServer/Game/Activity/Loaders/TrialActivityEntityLoader.cs b/GameServer/Game/Activity/Loaders/TrialActivityEntityLoader.cs index 7e5ed4d6..edfbc242 100644 --- a/GameServer/Game/Activity/Loaders/TrialActivityEntityLoader.cs +++ b/GameServer/Game/Activity/Loaders/TrialActivityEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Scene; using EggLink.DanhengServer.GameServer.Game.Player; diff --git a/GameServer/Game/Challenge/ChallengeEntityLoader.cs b/GameServer/Game/Challenge/ChallengeEntityLoader.cs index 08f463f5..52688d4a 100644 --- a/GameServer/Game/Challenge/ChallengeEntityLoader.cs +++ b/GameServer/Game/Challenge/ChallengeEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Scene; using EggLink.DanhengServer.GameServer.Game.Player; diff --git a/GameServer/Game/ChessRogue/Cell/ChessRogueEntityLoader.cs b/GameServer/Game/ChessRogue/Cell/ChessRogueEntityLoader.cs index 01d8ad57..cd5798a0 100644 --- a/GameServer/Game/ChessRogue/Cell/ChessRogueEntityLoader.cs +++ b/GameServer/Game/ChessRogue/Cell/ChessRogueEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Rogue; using EggLink.DanhengServer.Enums.Scene; diff --git a/GameServer/Game/Mission/StoryLineEntityLoader.cs b/GameServer/Game/Mission/StoryLineEntityLoader.cs index 1b041b3f..764b872e 100644 --- a/GameServer/Game/Mission/StoryLineEntityLoader.cs +++ b/GameServer/Game/Mission/StoryLineEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Scene; using EggLink.DanhengServer.GameServer.Game.Scene; diff --git a/GameServer/Game/Rogue/BaseRogueInstance.cs b/GameServer/Game/Rogue/BaseRogueInstance.cs index d32ab47e..1e3cdfec 100644 --- a/GameServer/Game/Rogue/BaseRogueInstance.cs +++ b/GameServer/Game/Rogue/BaseRogueInstance.cs @@ -359,10 +359,10 @@ public abstract class BaseRogueInstance(PlayerInstance player, int rogueVersionI public async ValueTask GenerateEvent(RogueNpc npc) { - RogueNPCDialogueExcel? dialogue; + RogueNPCExcel? dialogue; do { - dialogue = GameData.RogueNPCDialogueData.Values.ToList().RandomElement(); + dialogue = GameData.RogueNPCData.Values.ToList().RandomElement(); } while (!dialogue.CanUseInVer(RogueType)); var instance = new RogueEventInstance(dialogue, npc, CurEventUniqueID++); diff --git a/GameServer/Game/Rogue/Event/RogueEventInstance.cs b/GameServer/Game/Rogue/Event/RogueEventInstance.cs index 60a7e296..fb687cc4 100644 --- a/GameServer/Game/Rogue/Event/RogueEventInstance.cs +++ b/GameServer/Game/Rogue/Event/RogueEventInstance.cs @@ -8,12 +8,12 @@ namespace EggLink.DanhengServer.GameServer.Game.Rogue.Event; public class RogueEventInstance(int eventId, RogueNpc npc, List optionIds, int uniqueId) { - public RogueEventInstance(RogueNPCDialogueExcel excel, RogueNpc npc, int uniqueId) : this(excel.RogueNPCID, npc, [], + public RogueEventInstance(RogueNPCExcel excel, RogueNpc npc, int uniqueId) : this(excel.RogueNPCID, npc, [], uniqueId) // check in RogueInstance.cs { - foreach (var option in excel.DialogueInfo!.DialogueIds) + foreach (var option in excel.RogueNpcConfig!.DialogueList[0].OptionInfo?.OptionList ?? []) { - GameData.DialogueEventData.TryGetValue(option, out var dialogueEvent); + GameData.DialogueEventData.TryGetValue(option.OptionID, out var dialogueEvent); if (dialogueEvent == null) continue; var argId = 0; @@ -25,7 +25,7 @@ public class RogueEventInstance(int eventId, RogueNpc npc, List Options.Add(new RogueEventParam { - OptionId = option, + OptionId = option.OptionID, ArgId = argId }); } diff --git a/GameServer/Game/Rogue/Event/RogueEventManager.cs b/GameServer/Game/Rogue/Event/RogueEventManager.cs index 24d677eb..003a52c7 100644 --- a/GameServer/Game/Rogue/Event/RogueEventManager.cs +++ b/GameServer/Game/Rogue/Event/RogueEventManager.cs @@ -108,8 +108,7 @@ public class RogueEventManager await Player.SendPacket(new PacketSelectRogueCommonDialogueOptionScRsp()); return; } - - option.IsSelected = true; + await Player.SendPacket(new PacketSyncRogueCommonDialogueDataScNotify(eventInstance)); var param = dialogueEvent.RogueEffectParamList; if (option.ArgId > 0) @@ -138,6 +137,7 @@ public class RogueEventManager // send rsp await Player.SendPacket(new PacketSyncRogueCommonDialogueOptionFinishScNotify(eventInstance)); + option.IsSelected = true; await Player.SendPacket(new PacketSelectRogueCommonDialogueOptionScRsp(eventInstance)); } } \ No newline at end of file diff --git a/GameServer/Game/Rogue/Scene/Entity/RogueNpc.cs b/GameServer/Game/Rogue/Scene/Entity/RogueNpc.cs index cb9d3531..c7aefebd 100644 --- a/GameServer/Game/Rogue/Scene/Entity/RogueNpc.cs +++ b/GameServer/Game/Rogue/Scene/Entity/RogueNpc.cs @@ -1,4 +1,4 @@ -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.GameServer.Game.Rogue.Event; using EggLink.DanhengServer.GameServer.Game.Scene; using EggLink.DanhengServer.GameServer.Game.Scene.Entity; diff --git a/GameServer/Game/Rogue/Scene/Entity/RogueProp.cs b/GameServer/Game/Rogue/Scene/Entity/RogueProp.cs index 061f82f5..22b16624 100644 --- a/GameServer/Game/Rogue/Scene/Entity/RogueProp.cs +++ b/GameServer/Game/Rogue/Scene/Entity/RogueProp.cs @@ -1,4 +1,4 @@ -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.GameServer.Game.Scene; using EggLink.DanhengServer.GameServer.Game.Scene.Entity; diff --git a/GameServer/Game/Rogue/Scene/RogueEntityLoader.cs b/GameServer/Game/Rogue/Scene/RogueEntityLoader.cs index 95e13b02..17f905b1 100644 --- a/GameServer/Game/Rogue/Scene/RogueEntityLoader.cs +++ b/GameServer/Game/Rogue/Scene/RogueEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Enums.Scene; using EggLink.DanhengServer.GameServer.Game.Player; using EggLink.DanhengServer.GameServer.Game.Rogue.Scene.Entity; diff --git a/GameServer/Game/Scene/Entity/EntityMonster.cs b/GameServer/Game/Scene/Entity/EntityMonster.cs index e9879eb4..3bff8488 100644 --- a/GameServer/Game/Scene/Entity/EntityMonster.cs +++ b/GameServer/Game/Scene/Entity/EntityMonster.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Database.Inventory; using EggLink.DanhengServer.Enums.Mission; diff --git a/GameServer/Game/Scene/Entity/EntityNpc.cs b/GameServer/Game/Scene/Entity/EntityNpc.cs index 867da06e..6c19c81b 100644 --- a/GameServer/Game/Scene/Entity/EntityNpc.cs +++ b/GameServer/Game/Scene/Entity/EntityNpc.cs @@ -1,4 +1,4 @@ -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.GameServer.Game.Battle; using EggLink.DanhengServer.Proto; using EggLink.DanhengServer.Util; diff --git a/GameServer/Game/Scene/Entity/EntityProp.cs b/GameServer/Game/Scene/Entity/EntityProp.cs index e9a11782..fb946ab4 100644 --- a/GameServer/Game/Scene/Entity/EntityProp.cs +++ b/GameServer/Game/Scene/Entity/EntityProp.cs @@ -1,4 +1,4 @@ -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Scene; using EggLink.DanhengServer.GameServer.Game.Battle; diff --git a/GameServer/Game/Scene/SceneEntityLoader.cs b/GameServer/Game/Scene/SceneEntityLoader.cs index b7c2ac8b..ac4d5bff 100644 --- a/GameServer/Game/Scene/SceneEntityLoader.cs +++ b/GameServer/Game/Scene/SceneEntityLoader.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Enums; using EggLink.DanhengServer.Enums.Mission; using EggLink.DanhengServer.Enums.Scene; diff --git a/GameServer/Game/Scene/SceneInstance.cs b/GameServer/Game/Scene/SceneInstance.cs index 22195c1a..bb424fda 100644 --- a/GameServer/Game/Scene/SceneInstance.cs +++ b/GameServer/Game/Scene/SceneInstance.cs @@ -1,5 +1,5 @@ using EggLink.DanhengServer.Data; -using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Database.Avatar; using EggLink.DanhengServer.Enums.Scene; diff --git a/GameServer/Game/Task/LevelTask.cs b/GameServer/Game/Task/LevelTask.cs index 2ee20553..4b722a5b 100644 --- a/GameServer/Game/Task/LevelTask.cs +++ b/GameServer/Game/Task/LevelTask.cs @@ -1,4 +1,5 @@ using EggLink.DanhengServer.Data.Config; +using EggLink.DanhengServer.Data.Config.Scene; using EggLink.DanhengServer.Data.Config.Task; using EggLink.DanhengServer.Data.Excel; using EggLink.DanhengServer.Enums.Mission; diff --git a/GameServer/Server/Packet/Send/RogueCommon/PacketSelectRogueCommonDialogueOptionScRsp.cs b/GameServer/Server/Packet/Send/RogueCommon/PacketSelectRogueCommonDialogueOptionScRsp.cs index 65b46fe7..8944a1c9 100644 --- a/GameServer/Server/Packet/Send/RogueCommon/PacketSelectRogueCommonDialogueOptionScRsp.cs +++ b/GameServer/Server/Packet/Send/RogueCommon/PacketSelectRogueCommonDialogueOptionScRsp.cs @@ -13,7 +13,8 @@ public class PacketSelectRogueCommonDialogueOptionScRsp : BasePacket { EventUniqueId = (uint)rogueEvent.EventUniqueId, DialogueData = rogueEvent.ToProto(), - OptionId = (uint)rogueEvent.SelectedOptionId + OptionId = (uint)rogueEvent.SelectedOptionId, + MMDFEMGOIAI = true }; SetData(proto); diff --git a/GameServer/Server/Packet/Send/RogueCommon/PacketSyncRogueCommonDialogueOptionFinishScNotify.cs b/GameServer/Server/Packet/Send/RogueCommon/PacketSyncRogueCommonDialogueOptionFinishScNotify.cs index 8e9a5f21..66093ec6 100644 --- a/GameServer/Server/Packet/Send/RogueCommon/PacketSyncRogueCommonDialogueOptionFinishScNotify.cs +++ b/GameServer/Server/Packet/Send/RogueCommon/PacketSyncRogueCommonDialogueOptionFinishScNotify.cs @@ -11,7 +11,6 @@ public class PacketSyncRogueCommonDialogueOptionFinishScNotify : BasePacket { var proto = new SyncRogueCommonDialogueOptionFinishScNotify { - DialogueData = instance.ToProto(), EventUniqueId = (uint)instance.EventUniqueId, OptionId = (uint)instance.SelectedOptionId, ResultOptionInfo = instance.Options.Find(o => o.OptionId == instance.SelectedOptionId)!.ToProto()