Fixed more translation issues. WOW Brazillian Protuguese Rude characters have messed up pretty big with file size.

This commit is contained in:
2018-08-19 02:06:55 -07:00
parent 8a0f669a28
commit 2e2aedcc3a
4 changed files with 234 additions and 359 deletions

View File

@ -87,6 +87,7 @@ namespace Vocalization.Framework
public void initializeEnglishScrape()
{
if (name == "TV")
{
dataFileNames.Add("CookingChannel.xnb");
@ -151,126 +152,7 @@ namespace Vocalization.Framework
else if (name == "Temp")
{
Vocalization.ModMonitor.Log("Scraping dialogue file: Temp.xnb", StardewModdingAPI.LogLevel.Debug);
//dataFileNames.Add(Path.Combine("Events", "Temp.xnb"));
Dictionary<string, string> meh = Game1.content.Load<Dictionary<string, string>>(Path.Combine("Data", "Events", "Temp.xnb"));
foreach(KeyValuePair<string,string> pair in meh)
{
if(pair.Key== "decorate")
{
string dia = pair.Value;
Vocalization.ModMonitor.Log(dia);
string[]values = dia.Split('\"');
foreach(var v in values)
{
Vocalization.ModMonitor.Log(v);
Vocalization.ModMonitor.Log("HELLO?");
}
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
foreach(var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach(var cleanSentence in clean)
{
try
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch(Exception err)
{
}
}
}
}
if (pair.Key == "leave")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach (var cleanSentence in clean)
{
try
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch(Exception err)
{
}
}
}
}
if (pair.Key == "tooBold")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach (var cleanSentence in clean)
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
}
}
if (pair.Key == "poppy" || pair.Key=="heavy" || pair.Key=="techno"|| pair.Key=="honkytonk")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
goodValues.Add(values.ElementAt(7));
goodValues.Add(values.ElementAt(9));
goodValues.Add(values.ElementAt(11));
goodValues.Add(values.ElementAt(13));
goodValues.Add(values.ElementAt(15));
goodValues.Add(values.ElementAt(17));
goodValues.Add(values.ElementAt(19));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence,this);
foreach (var cleanSentence in clean)
{
try
{
this.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch (Exception err)
{
}
}
}
}
}
stringsFileNames.Add("Temp.xnb");
}
else
@ -278,16 +160,13 @@ namespace Vocalization.Framework
dialogueFileNames.Add(name + ".xnb");
dialogueFileNames.Add("rainy.xnb");
dialogueFileNames.Add("MarriageDialogue.xnb");
dialogueFileNames.Add("MarriageDialogue"+name+".xnb");
dialogueFileNames.Add("MarriageDialogue" + name + ".xnb");
dataFileNames.Add("EngagementDialogue.xnb");
stringsFileNames.Add("StringsFromCSFiles.xnb");
stringsFileNames.Add(name + ".xnb");
}
}
@ -299,23 +178,30 @@ namespace Vocalization.Framework
{
for (int i = 0; i < this.dataFileNames.Count; i++)
{
Vocalization.ModMonitor.Log(dataFileNames.ElementAt(i));
string s = dataFileNames.ElementAt(i);
s=dataFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
dataFileNames[i] = s;
Vocalization.ModMonitor.Log(dataFileNames.ElementAt(i));
}
for (int i = 0; i < this.dialogueFileNames.Count; i++)
{
Vocalization.ModMonitor.Log(dialogueFileNames.ElementAt(i));
string s = dialogueFileNames.ElementAt(i);
s=dialogueFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
dialogueFileNames[i] = s;
Vocalization.ModMonitor.Log(dialogueFileNames.ElementAt(i));
}
for (int i = 0; i < this.stringsFileNames.Count; i++)
{
Vocalization.ModMonitor.Log(stringsFileNames.ElementAt(i));
string s = stringsFileNames.ElementAt(i);
s=stringsFileNames.ElementAt(i).Replace(".xnb", Vocalization.config.translationInfo.getFileExtentionForTranslation(translation));
stringsFileNames[i] = s;
Vocalization.ModMonitor.Log(stringsFileNames.ElementAt(i));
}
}

View File

@ -48,7 +48,7 @@ namespace Vocalization.Framework
currentTranslation = "English";
translationFileInfo.Add("English", ".xnb");
translationFileInfo.Add("Spanish", ".es - ES.xnb");
translationFileInfo.Add("Spanish", ".es-ES.xnb");
translationFileInfo.Add("Chinese", ".zh-CN.xnb");
translationFileInfo.Add("Japanese", ".ja-JP.xnb");
translationFileInfo.Add("Russian", ".ru-RU.xnb");
@ -61,13 +61,27 @@ namespace Vocalization.Framework
/// <summary>
/// Gets the proper file extension for the current translation.
/// </summary>
/// <param name="translation"></param>
/// <param name="path"></param>
/// <returns></returns>
public string getFileExtentionForTranslation(string translation)
public string getFileExtentionForTranslation(string path)
{
/*
bool f = translationFileInfo.TryGetValue(translation, out string value);
if (f == false) return ".xnb";
else return value;
*/
string translation = Path.GetFileName(path);
try
{
return translationFileInfo[translation];
}
catch(Exception err)
{
Vocalization.ModMonitor.Log(err.ToString());
Vocalization.ModMonitor.Log("Attempted to get translation: " + translation);
return ".xnb";
}
}
/// <summary>
@ -89,227 +103,73 @@ namespace Vocalization.Framework
/// <returns></returns>
public string getXNBForTranslation(string xnbFileName, string translation)
{
return xnbFileName + translation;
return xnbFileName + getFileExtentionForTranslation(translation);
}
/// <summary>
/// Loads a coresponding string from a data file in Content/Strings
/// Loads an XNB file from StardewValley/Content
/// </summary>
/// <param name="xnbFileName"></param>
/// <param name="key"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string LoadStringFromStringsFile(string xnbFileName,string key,string translation)
public string LoadXNBFile(string xnbFileName, string key, string translation)
{
string str = "Strings";
string xnb = xnbFileName + getFileExtentionForTranslation(translation);
string path = Path.Combine(str, xnbFileName);
Dictionary<string,string> loadedDict = Game1.content.Load<Dictionary<string, string>>(path);
return loadedDict[key];
}
Dictionary<string, string> loadedDict = Game1.content.Load<Dictionary<string, string>>(xnb);
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
string loaded;
bool f = loadedDict.TryGetValue(key, out loaded);
if (f == false)
{
return string.Format(loaded, sub1);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1, object sub2)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromStringsFile(string xnbFileName, string key, string translation, object sub1, object sub2, object sub3)
{
string loaded = LoadStringFromStringsFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1, sub2,sub3);
}
catch (Exception err)
{
return loaded;
}
}
/// <summary>
/// Loads a corresponding string from a data file in Content/Data
/// </summary>
/// <param name="xnbFileName"></param>
/// <param name="key"></param>
/// <param name="translation"></param>
/// <returns></returns>
public string LoadStringFromDataFile(string xnbFileName, string key, string translation)
{
string str = "Data";
string xnb = xnbFileName + getFileExtentionForTranslation(translation);
string path = Path.Combine(str, xnbFileName);
Dictionary<string, string> loadedDict = Game1.content.Load<Dictionary<string, string>>(path);
string loaded = loadedDict[key];
return loaded;
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1, object sub2)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2);
}
catch (Exception err)
{
return loaded;
}
}
public string LoadStringFromDataFile(string xnbFileName, string key, string translation, object sub1, object sub2, object sub3)
{
string loaded = LoadStringFromDataFile(xnbFileName, key, translation);
try
{
return string.Format(loaded, sub1,sub2,sub3);
}
catch (Exception err)
{
return loaded;
Vocalization.ModMonitor.Log("Big issue: Key not found in file:" + xnb + " " + key);
return "";
}
else return loaded;
}
public virtual string LoadString(string path, string translation,object sub1, object sub2, object sub3)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[]{ Environment.NewLine },StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
string format = this.LoadString(path, translation);
try
{
if (sub3 != null) {
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2, sub3);
}
if (sub2 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
return string.Format(format, sub1,sub2,sub3);
}
if (folder == "Strings")
catch (Exception ex)
{
if (sub3 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2, sub3);
}
if (sub2 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
return format;
}
public virtual string LoadString(string path, string translation, object sub1, object sub2)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
string format = this.LoadString(path, translation);
try
{
if (sub2 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
return string.Format(format, sub1,sub2);
}
if (folder == "Strings")
catch (Exception ex)
{
if (sub2 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1, sub2);
}
if (sub1 != null)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
return format;
}
public virtual string LoadString(string path, string translation, object sub1)
{
string assetName;
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
if (sub1 != null)
string format = this.LoadString(path, translation);
try
{
return LoadStringFromDataFile(assetName, key, translation, sub1);
return string.Format(format, sub1);
}
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings")
{
if (sub1 != null)
catch (Exception ex)
{
return LoadStringFromStringsFile(assetName, key, translation, sub1);
}
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
return format;
}
public virtual string LoadString(string path, string translation)
@ -318,17 +178,7 @@ namespace Vocalization.Framework
string key;
this.parseStringPath(path, out assetName, out key);
string[] split = path.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
string folder = split[0];
if (folder == "Data")
{
return LoadStringFromDataFile(assetName, key, translation);
}
if (folder == "Strings") {
return LoadStringFromStringsFile(assetName, key, translation);
}
return "";
return LoadXNBFile(assetName, key, translation);
}
public virtual string LoadString(string path,string translation, params object[] substitutions)

View File

@ -11,67 +11,67 @@ namespace Vocalization.Framework
public class Vocabulary
{
public static string[] getRandomNegativeItemSlanderNouns()
public static string[] getRandomNegativeItemSlanderNouns(string translation)
{
string[] strArray = Game1.content.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeItemNoun")).Split('#');
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeItemNoun"),translation).Split('#');
return strArray;
}
public static string[] getRandomDeliciousAdjectives(NPC n = null)
public static string[] getRandomDeliciousAdjectives(string translation,NPC n = null)
{
string[] strArray;
if (n != null && n.Age == 2)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomDeliciousAdjective_Child").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomDeliciousAdjective_Child"),translation).Split('#');
else
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomDeliciousAdjective").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomDeliciousAdjective"),translation).Split('#');
return strArray;
}
public static string[] getRandomNegativeFoodAdjectives(NPC n = null)
public static string[] getRandomNegativeFoodAdjectives(string translation,NPC n = null)
{
string[] strArray;
if (n != null && n.Age == 2)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeFoodAdjective_Child").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective_Child"),translation).Split('#');
else if (n != null && n.Manners == 1)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeFoodAdjective_Polite").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective_Polite"),translation).Split('#');
else
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeFoodAdjective").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective"),translation).Split('#');
return strArray;
}
public static string[] getRandomSlightlyPositiveAdjectivesForEdibleNoun(NPC n = null)
public static string[] getRandomSlightlyPositiveAdjectivesForEdibleNoun(string translation,NPC n = null)
{
string[] strArray = Game1.content.LoadString("Strings\\Lexicon:RandomSlightlyPositiveFoodAdjective").Split('#');
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomSlightlyPositiveFoodAdjective"),translation).Split('#');
return strArray;
}
public static string[] getRandomNegativeAdjectivesForEventOrPerson(NPC n = null)
public static string[] getRandomNegativeAdjectivesForEventOrPerson(string translation,NPC n = null)
{
Random random = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2);
string[] strArray;
if (n != null && n.Age != 0)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeAdjective_Child").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_Child"),translation).Split('#');
else if (n != null && n.Gender == 0)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeAdjective_AdultMale").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_AdultMale"),translation).Split('#');
else if (n != null && n.Gender == 1)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeAdjective_AdultFemale").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_AdultFemale"),translation).Split('#');
else
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomNegativeAdjective_PlaceOrEvent").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_PlaceOrEvent"),translation).Split('#');
return strArray;
}
public static string[] getRandomPositiveAdjectivesForEventOrPerson(NPC n = null)
public static string[] getRandomPositiveAdjectivesForEventOrPerson(string translation,NPC n = null)
{
Random random = new Random((int)Game1.stats.DaysPlayed + (int)Game1.uniqueIDForThisGame / 2);
string[] strArray;
if (n != null && n.Age != 0)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomPositiveAdjective_Child").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_Child"),translation).Split('#');
else if (n != null && n.Gender == 0)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomPositiveAdjective_AdultMale").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_AdultMale"),translation).Split('#');
else if (n != null && n.Gender == 1)
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomPositiveAdjective_AdultFemale").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_AdultFemale"),translation).Split('#');
else
strArray = Game1.content.LoadString("Strings\\Lexicon:RandomPositiveAdjective_PlaceOrEvent").Split('#');
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_PlaceOrEvent"),translation).Split('#');
return strArray;
}

View File

@ -656,7 +656,7 @@ namespace Vocalization
List<string> translations = Directory.GetDirectories(VoicePath).ToList();
foreach (var translation in translations)
{
List<string> characterVoiceLines = Directory.GetDirectories(translation).ToList();
string[] characterVoiceLines = Directory.GetDirectories(translation);
//get a list of all characters supported in this translation and load their voice cue file.
foreach (var dir in characterVoiceLines)
{
@ -681,7 +681,9 @@ namespace Vocalization
{
CharacterVoiceCue cue = new CharacterVoiceCue(characterName);
//Change this up for different translations???
ModMonitor.Log("WTF???");
cue.initializeEnglishScrape();
ModMonitor.Log("OK SERIOUSLY WTF???");
cue.initializeForTranslation(translation);
scrapeDictionaries(voiceCueFile,cue,translation);
///??? DO I NEVER ACTUALLY ADD IT IN???
@ -914,13 +916,13 @@ namespace Vocalization
{
if(key== "NewChild_Adoption") {
cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue",key,translation,replacementStrings.kid1Name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key, translation, replacementStrings.kid2Name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:"+key),translation,replacementStrings.kid1Name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:"+key), translation, replacementStrings.kid2Name), new VoiceAudioOptions());
continue;
}
if(key== "NewChild_FirstChild")
{
cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key, translation, replacementStrings.kid1Name), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:"+key), translation, replacementStrings.kid1Name), new VoiceAudioOptions());
continue;
}
@ -931,7 +933,7 @@ namespace Vocalization
foreach(KeyValuePair<string, string> pair2 in BuildingDict)
{
List<string> cleanedDialogues = sanitizeDialogueFromDictionaries(config.translationInfo.LoadStringFromDataFile("ExtraDialogue",key,translation,pair2.Key),cue);
List<string> cleanedDialogues = sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:"+key),translation,pair2.Key),cue);
foreach (var clean_str in cleanedDialogues) {
cue.addDialogue(clean_str, new VoiceAudioOptions());
}
@ -973,7 +975,7 @@ namespace Vocalization
{
foreach(var lvl in levels)
{
cue.addDialogue(config.translationInfo.LoadStringFromDataFile("ExtraDialogue", key,translation ,lvl+tool), new VoiceAudioOptions());
cue.addDialogue(config.translationInfo.LoadString(Path.Combine("Data","ExtraDialogue:"+key),translation ,lvl+tool), new VoiceAudioOptions());
}
}
continue;
@ -1447,6 +1449,139 @@ namespace Vocalization
}
else if (cue.name == "Temp")
{
Vocalization.ModMonitor.Log("Scraping dialogue file: Temp.xnb", StardewModdingAPI.LogLevel.Debug);
//dataFileNames.Add(Path.Combine("Events", "Temp.xnb"));
Dictionary<string, string> meh = Game1.content.Load<Dictionary<string, string>>(Path.Combine("Data", "Events", config.translationInfo.getXNBForTranslation("Temp", translation)));
foreach (KeyValuePair<string, string> pair in meh)
{
if (pair.Key == "decorate")
{
string dia = pair.Value;
Vocalization.ModMonitor.Log(dia);
string[] values = dia.Split('\"');
foreach (var v in values)
{
Vocalization.ModMonitor.Log(v);
Vocalization.ModMonitor.Log("HELLO?");
}
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence, cue);
foreach (var cleanSentence in clean)
{
try
{
cue.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch (Exception err)
{
}
}
}
}
if (pair.Key == "leave")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence, cue);
foreach (var cleanSentence in clean)
{
try
{
cue.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch (Exception err)
{
}
}
}
}
if (pair.Key == "tooBold")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence, cue);
foreach (var cleanSentence in clean)
{
try
{
cue.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch (Exception err)
{
}
}
}
}
if (pair.Key == "poppy" || pair.Key == "heavy" || pair.Key == "techno" || pair.Key == "honkytonk")
{
string dia = pair.Value;
string[] values = dia.Split('\"');
List<string> goodValues = new List<string>();
goodValues.Add(values.ElementAt(1));
goodValues.Add(values.ElementAt(3));
goodValues.Add(values.ElementAt(5));
goodValues.Add(values.ElementAt(7));
goodValues.Add(values.ElementAt(9));
goodValues.Add(values.ElementAt(11));
goodValues.Add(values.ElementAt(13));
goodValues.Add(values.ElementAt(15));
goodValues.Add(values.ElementAt(17));
goodValues.Add(values.ElementAt(19));
foreach (var sentence in goodValues)
{
List<string> clean = Vocalization.sanitizeDialogueFromDictionaries(sentence, cue);
foreach (var cleanSentence in clean)
{
try
{
cue.dialogueCues.Add(cleanSentence, new VoiceAudioOptions());
}
catch (Exception err)
{
}
}
}
}
}
}
//Dialogue scrape for npc specific text.
else
@ -1676,7 +1811,11 @@ namespace Vocalization
cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:NPC.cs.4486"), translation, (object)replacementStrings.farmerName), cue).ElementAt(0), new VoiceAudioOptions());
for (int i = 4507; i <= 4523; i++)
{
cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), translation, (object)config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.")+i.ToString(),translation)), cue).ElementAt(0), new VoiceAudioOptions());
if(i==20 || i == 21)
{
continue;
}
cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4465"), translation,(object)config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.")+i.ToString(),translation)), cue).ElementAt(0), new VoiceAudioOptions());
cue.addDialogue(sanitizeDialogueFromDictionaries(config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.4466"), translation, (object)config.translationInfo.LoadString(Path.Combine("Strings","StringsFromCSFiles:NPC.cs.") + i.ToString(),translation)), cue).ElementAt(0), new VoiceAudioOptions());
}
@ -1731,7 +1870,8 @@ namespace Vocalization
}
//LOad item dictionary, pass in item and npc, sanitize the output string using the sanitizationDictionary function, and add in the cue!
Dictionary<int, string> objDict = Game1.content.Load<Dictionary<int, string>>(Path.Combine("Data", "ObjectInformation.xnb"));
Dictionary<int, string> objDict = Game1.content.Load<Dictionary<int, string>>(Path.Combine("Data", config.translationInfo.getXNBForTranslation("ObjectInformation",translation)));
ModMonitor.Log("LOAD THE OBJECT INFO: ", LogLevel.Alert);
foreach(KeyValuePair<int,string> pair in objDict)
{
for(int i=0; i<=3; i++) {
@ -1747,7 +1887,6 @@ namespace Vocalization
foreach (string raw in rawScrape)
{
List<string> cleanDialogues = sanitizeDialogueFromDictionaries(raw, cue);
foreach (var dia in cleanDialogues)
{
@ -1801,7 +1940,7 @@ namespace Vocalization
case 0:
if (i.quality.Value == 1)
{
foreach (string str in Vocabulary.getRandomDeliciousAdjectives(n))
foreach (string str in Vocabulary.getRandomDeliciousAdjectives(translation,n))
{
string str19 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityHigh"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)str);
dialogueReturn.Add(str19);
@ -1810,7 +1949,7 @@ namespace Vocalization
}
if (i.quality.Value == 0)
{
foreach (string str in Vocabulary.getRandomNegativeFoodAdjectives(n))
foreach (string str in Vocabulary.getRandomNegativeFoodAdjectives(translation,n))
{
string str18 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_1_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)str);
dialogueReturn.Add(str18);
@ -1826,16 +1965,16 @@ namespace Vocalization
{
if (i.quality.Value != 2)
{
foreach (var word1 in Vocabulary.getRandomNegativeFoodAdjectives(n))
foreach (var word1 in Vocabulary.getRandomNegativeFoodAdjectives(translation,n))
{
foreach (string word2 in Vocabulary.getRandomNegativeItemSlanderNouns()) {
foreach (string word2 in Vocabulary.getRandomNegativeItemSlanderNouns(translation)) {
string str17 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityLow_Rude"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1, (object)word2);
dialogueReturn.Add(str17);
}
}
break;
}
foreach (string word1 in Vocabulary.getRandomSlightlyPositiveAdjectivesForEdibleNoun(n))
foreach (string word1 in Vocabulary.getRandomSlightlyPositiveAdjectivesForEdibleNoun(translation))
{
string str10 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_3_QualityHigh_Rude"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)(i.salePrice() / 2), (object)word1);
dialogueReturn.Add(str10);
@ -1858,7 +1997,7 @@ namespace Vocalization
}
if (i.Category == -7)
{
foreach (string forEventOrPerson in Vocabulary.getRandomPositiveAdjectivesForEventOrPerson(n))
foreach (string forEventOrPerson in Vocabulary.getRandomPositiveAdjectivesForEventOrPerson(translation))
{
string str14 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_5_Cooking"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)Lexicon.getProperArticleForWord(forEventOrPerson), (object)forEventOrPerson);
dialogueReturn.Add(str14);
@ -1895,7 +2034,7 @@ namespace Vocalization
{
if (i.quality.Value == 0)
{
foreach (string word1 in Vocabulary.getRandomNegativeItemSlanderNouns())
foreach (string word1 in Vocabulary.getRandomNegativeItemSlanderNouns(translation))
{
string str12 = config.translationInfo.LoadString(Path.Combine("Data", "ExtraDialogue:PurchasedItem_Abigail_QualityLow"), translation, (object)str3, (object)str4, (object)i.DisplayName, (object)word1);
dialogueReturn.Add(str12);