Fixed birthday messages not being created into .json files properly. Also re-implemented spouse messages and translations.
This commit is contained in:
parent
a6ad717d5e
commit
f522ee1931
|
@ -20,7 +20,7 @@ namespace Omegasis.HappyBirthday
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TODO: Make this.
|
/// TODO: Make this.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, string> defaultSpouseBirthdayWishes = new Dictionary<string, string>()
|
public Dictionary<string, string> defaultSpouseBirthdayWishes = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
["Alex"] = "",
|
["Alex"] = "",
|
||||||
["Elliott"] = "",
|
["Elliott"] = "",
|
||||||
|
@ -39,7 +39,7 @@ namespace Omegasis.HappyBirthday
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to contain
|
/// Used to contain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private Dictionary<string, string> defaultBirthdayWishes = new Dictionary<string, string>()
|
public Dictionary<string, string> defaultBirthdayWishes = new Dictionary<string, string>()
|
||||||
{
|
{
|
||||||
["Robin"] = "Hey @, happy birthday! I'm glad you choose this town to move here to. ",
|
["Robin"] = "Hey @, happy birthday! I'm glad you choose this town to move here to. ",
|
||||||
["Demetrius"] = "Happy birthday @! Make sure you take some time off today to enjoy yourself. $h",
|
["Demetrius"] = "Happy birthday @! Make sure you take some time off today to enjoy yourself. $h",
|
||||||
|
@ -69,7 +69,7 @@ namespace Omegasis.HappyBirthday
|
||||||
["Elliott"] = "What a wonderful day isn't it @? Especially since today is your birthday. I tried to make you a poem but I feel like the best way of putting it is simply, happy birthday. $h ",
|
["Elliott"] = "What a wonderful day isn't it @? Especially since today is your birthday. I tried to make you a poem but I feel like the best way of putting it is simply, happy birthday. $h ",
|
||||||
["Gus"] = "Hey @ happy birthday! Hopefully you enjoy the rest of the day and make sure you aren't a stranger at the saloon!",
|
["Gus"] = "Hey @ happy birthday! Hopefully you enjoy the rest of the day and make sure you aren't a stranger at the saloon!",
|
||||||
["Dwarf"] = "Happy birthday @. I hope that what I got you is acceptable for humans as well. ",
|
["Dwarf"] = "Happy birthday @. I hope that what I got you is acceptable for humans as well. ",
|
||||||
["Wizard"] = "The spirits told me that today is your birthday. In that case happy birthday @. ",
|
["Wizard"] = "The spirits told me that today is your birthday. In that case happy birthday @. May your year shine bright! ",
|
||||||
["Harvey"] = "Hey @, happy birthday! Make sure to come in for a checkup some time to make sure you live many more years! ",
|
["Harvey"] = "Hey @, happy birthday! Make sure to come in for a checkup some time to make sure you live many more years! ",
|
||||||
["Sandy"] = "Hello there @. I heard that today was your birthday and I didn't want you feeling left out, so happy birthday!",
|
["Sandy"] = "Hello there @. I heard that today was your birthday and I didn't want you feeling left out, so happy birthday!",
|
||||||
["Willy"] = "Aye @ happy birthday. Looking at you reminds me of ye days when I was just a guppy swimming out to sea. Continue to enjoy them youngin.$h",
|
["Willy"] = "Aye @ happy birthday. Looking at you reminds me of ye days when I was just a guppy swimming out to sea. Continue to enjoy them youngin.$h",
|
||||||
|
@ -90,38 +90,32 @@ namespace Omegasis.HappyBirthday
|
||||||
if (!Directory.Exists(defaultPath)) Directory.CreateDirectory(defaultPath);
|
if (!Directory.Exists(defaultPath)) Directory.CreateDirectory(defaultPath);
|
||||||
|
|
||||||
string birthdayFileDict=HappyBirthday.Config.translationInfo.getjsonForTranslation("BirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
|
string birthdayFileDict=HappyBirthday.Config.translationInfo.getjsonForTranslation("BirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
|
||||||
string path = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, birthdayFileDict);
|
string path = Path.Combine( "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, birthdayFileDict);
|
||||||
|
|
||||||
//Handle normal birthday wishes.
|
//Handle normal birthday wishes.
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
{
|
{
|
||||||
|
|
||||||
StreamWriter writer = new StreamWriter(path);
|
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(path, defaultBirthdayWishes);
|
||||||
serializer.Serialize(writer, defaultBirthdayWishes);
|
|
||||||
this.birthdayWishes = defaultBirthdayWishes;
|
this.birthdayWishes = defaultBirthdayWishes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StreamReader reader = new StreamReader(path);
|
birthdayWishes = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(path);
|
||||||
birthdayWishes = new Dictionary<string, string>();
|
|
||||||
birthdayWishes = (Dictionary<string, string>)serializer.Deserialize(reader, typeof(Dictionary<string, string>));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//handle spouse birthday wishes.
|
//handle spouse birthday wishes.
|
||||||
string spouseBirthdayFileDict = HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
|
string spouseBirthdayFileDict = HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation);
|
||||||
string spousePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, spouseBirthdayFileDict);
|
string spousePath = Path.Combine("Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, spouseBirthdayFileDict);
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(spousePath))
|
||||||
{
|
{
|
||||||
|
|
||||||
StreamWriter writer = new StreamWriter(spousePath);
|
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(spousePath, defaultSpouseBirthdayWishes);
|
||||||
serializer.Serialize(writer, defaultSpouseBirthdayWishes);
|
|
||||||
this.spouseBirthdayWishes = defaultSpouseBirthdayWishes;
|
this.spouseBirthdayWishes = defaultSpouseBirthdayWishes;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
StreamReader reader = new StreamReader(path);
|
spouseBirthdayWishes = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(spousePath);
|
||||||
birthdayWishes = new Dictionary<string, string>();
|
|
||||||
birthdayWishes = (Dictionary<string, string>)serializer.Deserialize(reader, typeof(Dictionary<string, string>));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Non-english logic
|
//Non-english logic
|
||||||
|
|
Loading…
Reference in New Issue