using OWML.ModHelper.Events; using QSB.Utility; using QSB.WorldSync; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace QSB.ConversationSync { public static class ConversationPatches { public static void StartConversation(CharacterDialogueTree __instance) { var index = WorldRegistry.OldDialogueTrees.FindIndex(x => x == __instance); DebugLog.DebugWrite("START CONVO " + index); } public static bool InputDialogueOption(int optionIndex, DialogueBoxVer2 ____currentDialogueBox) { if (optionIndex >= 0) { var selectedOption = ____currentDialogueBox.OptionFromUIIndex(optionIndex); ConversationManager.Instance.SendPlayerOption(selectedOption.Text); } return true; } public static void GetNextPage(DialogueNode __instance, string ____name, List ____listPagesToDisplay, int ____currentPage) { DebugLog.DebugWrite("Name is : " + __instance.Name); DebugLog.DebugWrite("Target Name is : " + __instance.TargetName); var key = ____name + ____listPagesToDisplay[____currentPage]; var mainText = TextTranslation.Translate(key).Trim(); ConversationManager.Instance.SendCharacterDialogue(mainText); } public static void AddPatches() { QSB.Helper.HarmonyHelper.AddPostfix("GetNextPage", typeof(ConversationPatches), nameof(GetNextPage)); QSB.Helper.HarmonyHelper.AddPrefix("InputDialogueOption", typeof(ConversationPatches), nameof(InputDialogueOption)); QSB.Helper.HarmonyHelper.AddPostfix("StartConversation", typeof(ConversationPatches), nameof(StartConversation)); } } }