diff --git a/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs b/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs index c502124d..38ccacff 100644 --- a/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs +++ b/GeneralMods/Vocalization/Vocalization/Framework/CharacterVoiceCue.cs @@ -38,6 +38,7 @@ namespace Vocalization.Framework public List eventFileNames; + /// /// A dictionary of dialogue strings that correspond to audio files. /// @@ -188,6 +189,16 @@ namespace Vocalization.Framework festivalFileNames.Add("winter8.xnb"); festivalFileNames.Add("winter25.xnb"); + + string content = Game1.content.RootDirectory; + string dir = Path.Combine(content, "Data", "Events"); + string[] files = Directory.GetFiles(dir); + foreach(var file in files) + { + string eventFileName = Path.GetFileNameWithoutExtension(file)+".xnb"; + if (eventFileNames.Contains(eventFileName)) continue; + else eventFileNames.Add(eventFileName); + } } } @@ -224,7 +235,25 @@ namespace Vocalization.Framework s=stringsFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); stringsFileNames[i] = s; Vocalization.ModMonitor.Log(stringsFileNames.ElementAt(i)); - } + } + + for (int i = 0; i < this.festivalFileNames.Count; i++) + { + Vocalization.ModMonitor.Log(festivalFileNames.ElementAt(i)); + string s = festivalFileNames.ElementAt(i); + s = festivalFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + festivalFileNames[i] = s; + Vocalization.ModMonitor.Log(festivalFileNames.ElementAt(i)); + } + + for (int i = 0; i < this.eventFileNames.Count; i++) + { + Vocalization.ModMonitor.Log(eventFileNames.ElementAt(i)); + string s = eventFileNames.ElementAt(i); + s = eventFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation)); + eventFileNames[i] = s; + Vocalization.ModMonitor.Log(eventFileNames.ElementAt(i)); + } } diff --git a/GeneralMods/Vocalization/Vocalization/Vocalization.cs b/GeneralMods/Vocalization/Vocalization/Vocalization.cs index 614b96bc..755d359e 100644 --- a/GeneralMods/Vocalization/Vocalization/Vocalization.cs +++ b/GeneralMods/Vocalization/Vocalization/Vocalization.cs @@ -728,6 +728,7 @@ namespace Vocalization var stringsPath = Path.Combine("Strings"); //Used for all sorts of extra strings and stuff for like StringsFromCS var dataPath = Path.Combine("Data"); //Used for engagement dialogue strings, and ExtraDialogue, Notes, Secret Notes, Mail var festivalPath = Path.Combine(dataPath, "Festivals"); + var eventPath = Path.Combine(dataPath, "Events"); ModMonitor.Log("Scraping dialogue for character: " + cue.name,LogLevel.Info); //If the "character"'s name is TV which means I'm watching tv, scrape the data from the TV shows. @@ -1722,6 +1723,46 @@ namespace Vocalization } } } + + + foreach (var fileName in cue.eventFileNames) + { + ModMonitor.Log(" Scraping event file: " + fileName, LogLevel.Info); + //basically this will never run but can be used below to also add in dialogue. + if (!String.IsNullOrEmpty(fileName)) + { + string dialoguePath2 = Path.Combine(eventPath, fileName); + string root = Game1.content.RootDirectory;///////USE THIS TO CHECK FOR EXISTENCE!!!!! + if (!File.Exists(Path.Combine(root, dialoguePath2))) + { + ModMonitor.Log("Dialogue file not found for:" + fileName + ". This might not necessarily be a mistake just a safety check."); + continue; //If the file is not found for some reason... + } + var DialogueDict = ModHelper.Content.Load>(dialoguePath2, ContentSource.GameContent); + + foreach (KeyValuePair pair in DialogueDict) + { + string key = pair.Key; + if (key != cue.name) continue; + string rawDialogue = pair.Value; + + List speakingLines = getEventSpeakerLines(rawDialogue, cue.name); + //Sanitize Event info here! + + + List cleanDialogues = new List(); + cleanDialogues = sanitizeDialogueFromDictionaries(rawDialogue, cue); + foreach (var str in cleanDialogues) + { + cue.addDialogue(str, new VoiceAudioOptions()); //Make a new dialogue line based off of the text, but have the .wav value as empty. + } + } + } + } + + + + foreach (var fileName in cue.dataFileNames) { ModMonitor.Log(" Scraping dialogue file: " + fileName, LogLevel.Info); @@ -1940,6 +1981,24 @@ namespace Vocalization //DialogueCues.Add(cue.name, cue); } + public List getEventSpeakerLines(string rawDialogue, string speakerName) + { + string[] dialogueSplit= rawDialogue.Split('/'); + List speakingData = new List(); + foreach(var dia in dialogueSplit) + { + if (!dia.Contains("speak") && !dia.Contains("textAboveHead") && !dia.Contains(speakerName)) continue; + string[] actualDialogue = dia.Split(new string[] { "\"" }, StringSplitOptions.None); + + ModMonitor.Log(actualDialogue[1]); + //Get the actual dialogue line from this npc. + speakingData.Add(actualDialogue[1]); + } + + + return speakingData; + } + /// /// Function taken from game code to satisfy all dialogue options.