Degeneralized shops for Vocalization, fixed output garbage for symphony.
This commit is contained in:
parent
d881946f67
commit
fe1ecc44b1
|
@ -429,7 +429,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
public Dictionary<MusicPack,List<Song>> getLocationSpecificMusic()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
@ -520,7 +520,7 @@ namespace StardewSymphonyRemastered.Framework
|
|||
}
|
||||
else
|
||||
{
|
||||
StardewSymphony.ModMonitor.Log("HELLO??? LOCATION????");
|
||||
//StardewSymphony.ModMonitor.Log("HELLO??? LOCATION????");
|
||||
//Try to play a generalized festival song.
|
||||
var listOfLocationPacks = this.getLocationSpecificMusic();
|
||||
if (listOfLocationPacks.Count > 0)
|
||||
|
|
|
@ -28,6 +28,8 @@ namespace Vocalization.Framework
|
|||
/// </summary>
|
||||
public Dictionary<string, string> translationFileInfo;
|
||||
|
||||
|
||||
public Dictionary<string, LocalizedContentManager.LanguageCode> translationCodes;
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
|
@ -36,7 +38,7 @@ namespace Vocalization.Framework
|
|||
translations = new List<string>();
|
||||
|
||||
translationFileInfo = new Dictionary<string, string>();
|
||||
|
||||
translationCodes = new Dictionary<string, LocalizedContentManager.LanguageCode>();
|
||||
translations.Add("English");
|
||||
translations.Add("Spanish");
|
||||
translations.Add("Chinese");
|
||||
|
@ -56,6 +58,34 @@ namespace Vocalization.Framework
|
|||
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>
|
||||
|
|
|
@ -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.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using sObj = StardewValley.Object;
|
||||
namespace Vocalization.Framework
|
||||
{
|
||||
public class Vocabulary
|
||||
|
@ -13,67 +18,116 @@ namespace Vocalization.Framework
|
|||
|
||||
public static string[] getRandomNegativeItemSlanderNouns(string translation)
|
||||
{
|
||||
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeItemNoun"),translation).Split('#');
|
||||
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeItemNoun"), translation).Split('#');
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string[] getRandomDeliciousAdjectives(string translation,NPC n = null)
|
||||
public static string[] getRandomDeliciousAdjectives(string translation, NPC n = null)
|
||||
{
|
||||
string[] strArray;
|
||||
if (n != null && n.Age == 2)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomDeliciousAdjective_Child"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomDeliciousAdjective_Child"), translation).Split('#');
|
||||
else
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomDeliciousAdjective"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomDeliciousAdjective"), translation).Split('#');
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string[] getRandomNegativeFoodAdjectives(string translation,NPC n = null)
|
||||
public static string[] getRandomNegativeFoodAdjectives(string translation, NPC n = null)
|
||||
{
|
||||
string[] strArray;
|
||||
if (n != null && n.Age == 2)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective_Child"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeFoodAdjective_Child"), translation).Split('#');
|
||||
else if (n != null && n.Manners == 1)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective_Polite"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeFoodAdjective_Polite"), translation).Split('#');
|
||||
else
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeFoodAdjective"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeFoodAdjective"), translation).Split('#');
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string[] getRandomSlightlyPositiveAdjectivesForEdibleNoun(string translation,NPC n = null)
|
||||
public static string[] getRandomSlightlyPositiveAdjectivesForEdibleNoun(string translation, NPC n = null)
|
||||
{
|
||||
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomSlightlyPositiveFoodAdjective"),translation).Split('#');
|
||||
string[] strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomSlightlyPositiveFoodAdjective"), translation).Split('#');
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string[] getRandomNegativeAdjectivesForEventOrPerson(string translation,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 = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_Child"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeAdjective_Child"), translation).Split('#');
|
||||
else if (n != null && n.Gender == 0)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_AdultMale"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeAdjective_AdultMale"), translation).Split('#');
|
||||
else if (n != null && n.Gender == 1)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_AdultFemale"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeAdjective_AdultFemale"), translation).Split('#');
|
||||
else
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomNegativeAdjective_PlaceOrEvent"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomNegativeAdjective_PlaceOrEvent"), translation).Split('#');
|
||||
return strArray;
|
||||
}
|
||||
|
||||
public static string[] getRandomPositiveAdjectivesForEventOrPerson(string translation,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 = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_Child"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomPositiveAdjective_Child"), translation).Split('#');
|
||||
else if (n != null && n.Gender == 0)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_AdultMale"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomPositiveAdjective_AdultMale"), translation).Split('#');
|
||||
else if (n != null && n.Gender == 1)
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_AdultFemale"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomPositiveAdjective_AdultFemale"), translation).Split('#');
|
||||
else
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings","Lexicon:RandomPositiveAdjective_PlaceOrEvent"),translation).Split('#');
|
||||
strArray = Vocalization.config.translationInfo.LoadString(Path.Combine("Strings", "Lexicon:RandomPositiveAdjective_PlaceOrEvent"), translation).Split('#');
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -277,6 +277,7 @@ namespace Vocalization
|
|||
{
|
||||
List<string> tries = new List<string>();
|
||||
tries.Add("SpeechBubbles");
|
||||
tries.Add(v.Name);
|
||||
foreach (var speech in tries)
|
||||
{
|
||||
CharacterVoiceCue voice;
|
||||
|
@ -875,6 +876,56 @@ namespace Vocalization
|
|||
if (!key.Contains("ShopMenu")) continue;
|
||||
//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>();
|
||||
cleanDialogues = sanitizeDialogueFromDictionaries(rawDialogue,cue);
|
||||
foreach (var str in cleanDialogues)
|
||||
|
|
Loading…
Reference in New Issue