Degeneralized shops for Vocalization, fixed output garbage for symphony.

This commit is contained in:
2018-08-20 12:58:08 -07:00
parent d881946f67
commit fe1ecc44b1
4 changed files with 161 additions and 26 deletions

View File

@ -429,7 +429,7 @@ namespace StardewSymphonyRemastered.Framework
public Dictionary<MusicPack,List<Song>> getLocationSpecificMusic() public Dictionary<MusicPack,List<Song>> getLocationSpecificMusic()
{ {
Dictionary<MusicPack, List<Song>> listOfValidDictionaries = new Dictionary<MusicPack, List<Song>>(); Dictionary<MusicPack, List<Song>> listOfValidDictionaries = new Dictionary<MusicPack, List<Song>>();
StardewSymphony.ModMonitor.Log(SongSpecifics.getCurrentConditionalString(true)); //StardewSymphony.ModMonitor.Log(SongSpecifics.getCurrentConditionalString(true));
foreach (var v in this.musicPacks) foreach (var v in this.musicPacks)
{ {
@ -520,7 +520,7 @@ namespace StardewSymphonyRemastered.Framework
} }
else else
{ {
StardewSymphony.ModMonitor.Log("HELLO??? LOCATION????"); //StardewSymphony.ModMonitor.Log("HELLO??? LOCATION????");
//Try to play a generalized festival song. //Try to play a generalized festival song.
var listOfLocationPacks = this.getLocationSpecificMusic(); var listOfLocationPacks = this.getLocationSpecificMusic();
if (listOfLocationPacks.Count > 0) if (listOfLocationPacks.Count > 0)

View File

@ -28,6 +28,8 @@ namespace Vocalization.Framework
/// </summary> /// </summary>
public Dictionary<string, string> translationFileInfo; public Dictionary<string, string> translationFileInfo;
public Dictionary<string, LocalizedContentManager.LanguageCode> translationCodes;
/// <summary> /// <summary>
/// Default constructor. /// Default constructor.
/// </summary> /// </summary>
@ -36,7 +38,7 @@ namespace Vocalization.Framework
translations = new List<string>(); translations = new List<string>();
translationFileInfo = new Dictionary<string, string>(); translationFileInfo = new Dictionary<string, string>();
translationCodes = new Dictionary<string, LocalizedContentManager.LanguageCode>();
translations.Add("English"); translations.Add("English");
translations.Add("Spanish"); translations.Add("Spanish");
translations.Add("Chinese"); translations.Add("Chinese");
@ -56,6 +58,34 @@ namespace Vocalization.Framework
translationFileInfo.Add("Brazillian Portuguese", ".pt-BR.xnb"); translationFileInfo.Add("Brazillian Portuguese", ".pt-BR.xnb");
translationCodes.Add("English", LocalizedContentManager.LanguageCode.en);
translationCodes.Add("Spanish", LocalizedContentManager.LanguageCode.es);
translationCodes.Add("Chinese", LocalizedContentManager.LanguageCode.zh);
translationCodes.Add("Japanese", LocalizedContentManager.LanguageCode.ja);
translationCodes.Add("Russian", LocalizedContentManager.LanguageCode.ru);
translationCodes.Add("German", LocalizedContentManager.LanguageCode.de);
translationCodes.Add("Brazillian Portuguese", LocalizedContentManager.LanguageCode.pt);
}
public string getTranslationNameFromPath(string fullPath)
{
return Path.GetFileName(fullPath);
}
public void changeLocalizedContentManagerFromTranslation(string translation)
{
string tra = getTranslationNameFromPath(translation);
bool f = translationCodes.TryGetValue(tra, out LocalizedContentManager.LanguageCode code);
if (f == false) LocalizedContentManager.CurrentLanguageCode = LocalizedContentManager.LanguageCode.en;
else LocalizedContentManager.CurrentLanguageCode = code;
return;
}
public void resetLocalizationCode()
{
LocalizedContentManager.CurrentLanguageCode = LocalizedContentManager.LanguageCode.en;
} }
/// <summary> /// <summary>

View File

@ -1,11 +1,16 @@
using StardewValley; using Microsoft.Xna.Framework;
using Netcode;
using StardewModdingAPI;
using StardewValley;
using StardewValley.BellsAndWhistles;
using StardewValley.Objects;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using sObj = StardewValley.Object;
namespace Vocalization.Framework namespace Vocalization.Framework
{ {
public class Vocabulary public class Vocabulary
@ -75,5 +80,54 @@ namespace Vocalization.Framework
return strArray; return strArray;
} }
public static List<string> getCarpenterStock(string translation)
{
List<string> stock = new List<string>();
Vocalization.config.translationInfo.changeLocalizedContentManagerFromTranslation(translation);
for(int i=0; i <= 1854; i++)
{
try
{
Furniture f = new Furniture(i, Vector2.Zero);
stock.Add(f.DisplayName);
}
catch(Exception err)
{
}
}
Vocalization.config.translationInfo.resetLocalizationCode();
return stock;
}
public static List<string> getMerchantStock(string translation)
{
List<string> stock = new List<string>();
Dictionary<int, string> objDict = Game1.content.Load<Dictionary<int, string>>(Path.Combine("Data", Vocalization.config.translationInfo.getXNBForTranslation("ObjectInformation", translation)));
Vocalization.ModMonitor.Log("LOAD THE OBJECT INFO: ", LogLevel.Alert);
foreach (KeyValuePair<int, string> pair in objDict)
{
for (int i = 0; i <= 3; i++)
{
StardewValley.Object obj = new StardewValley.Object(pair.Key, 1, false, -1, i);
stock.Add(obj.DisplayName);
}
}
foreach(var item in getCarpenterStock(translation))
{
stock.Add(item);
}
return stock;
}
public static string getProperArticleForWord(string displayName, string translation)
{
Vocalization.config.translationInfo.changeLocalizedContentManagerFromTranslation(translation);
string s=Lexicon.getProperArticleForWord(displayName);
Vocalization.config.translationInfo.resetLocalizationCode();
return s;
}
} }
} }

View File

@ -277,6 +277,7 @@ namespace Vocalization
{ {
List<string> tries = new List<string>(); List<string> tries = new List<string>();
tries.Add("SpeechBubbles"); tries.Add("SpeechBubbles");
tries.Add(v.Name);
foreach (var speech in tries) foreach (var speech in tries)
{ {
CharacterVoiceCue voice; CharacterVoiceCue voice;
@ -875,6 +876,56 @@ namespace Vocalization
if (!key.Contains("ShopMenu")) continue; if (!key.Contains("ShopMenu")) continue;
//If the key contains the character's name. //If the key contains the character's name.
if(key== "ShopMenu.cs.11464")
{
foreach (var obj in Vocabulary.getCarpenterStock(translation)) {
foreach (string word1 in Vocabulary.getRandomPositiveAdjectivesForEventOrPerson(translation, null))
{
rawDialogue=config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:ShopMenu.cs.11464"), translation, (object)obj, (object)word1, (object)Vocabulary.getProperArticleForWord(obj,translation));
List<string> cleanDialogues2 = new List<string>();
cleanDialogues2 = sanitizeDialogueFromDictionaries(rawDialogue, cue);
foreach (var str in cleanDialogues2)
{
cue.addDialogue(str, new VoiceAudioOptions()); //Make a new dialogue line based off of the text, but have the .wav value as empty.
}
}
}
continue;
}
if(key== "ShopMenu.cs.11502")
{
foreach (var obj in Vocabulary.getMerchantStock(translation))
{
rawDialogue = config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:ShopMenu.cs.11502"), translation, (object)obj);
List<string> cleanDialogues2 = new List<string>();
cleanDialogues2 = sanitizeDialogueFromDictionaries(rawDialogue, cue);
foreach (var str in cleanDialogues2)
{
cue.addDialogue(str, new VoiceAudioOptions()); //Make a new dialogue line based off of the text, but have the .wav value as empty.
}
}
continue;
}
if (key == "ShopMenu.cs.11512")
{
foreach (var obj in Vocabulary.getMerchantStock(translation))
{
rawDialogue = config.translationInfo.LoadString(Path.Combine("Strings", "StringsFromCSFiles:ShopMenu.cs.11512"), translation, (object)obj);
List<string> cleanDialogues2 = new List<string>();
cleanDialogues2 = sanitizeDialogueFromDictionaries(rawDialogue, cue);
foreach (var str in cleanDialogues2)
{
cue.addDialogue(str, new VoiceAudioOptions()); //Make a new dialogue line based off of the text, but have the .wav value as empty.
}
}
continue;
}
List<string> cleanDialogues = new List<string>(); List<string> cleanDialogues = new List<string>();
cleanDialogues = sanitizeDialogueFromDictionaries(rawDialogue,cue); cleanDialogues = sanitizeDialogueFromDictionaries(rawDialogue,cue);
foreach (var str in cleanDialogues) foreach (var str in cleanDialogues)