Fixed issue with HappyBirthday not properly generating a list of possible birthday gifts from villagers.

This commit is contained in:
Joshua Navarro 2019-01-06 09:09:48 -08:00
parent 1df03e0dd7
commit dbca3a1d6b
2 changed files with 6 additions and 4 deletions

View File

@ -87,9 +87,9 @@ namespace Omegasis.HappyBirthday
/// <summary>Load birthday gift information from disk. Preferably from BirthdayGift.json in the mod's directory.</summary> /// <summary>Load birthday gift information from disk. Preferably from BirthdayGift.json in the mod's directory.</summary>
public void loadVillagerBirthdayGifts() public void loadVillagerBirthdayGifts()
{ {
string villagerGifts = Path.Combine("Content", "Gifts", "BirthdayGifts.json");
if (!HappyBirthday.Config.useLegacyBirthdayFiles) if (!HappyBirthday.Config.useLegacyBirthdayFiles)
{ {
string villagerGifts = Path.Combine("Content", "Gifts", "BirthdayGifts.json");
if (File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, villagerGifts))) if (File.Exists(Path.Combine(HappyBirthday.ModHelper.DirectoryPath, villagerGifts)))
this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts); this.defaultBirthdayGifts = HappyBirthday.ModHelper.Data.ReadJsonFile<Dictionary<string, string>>(villagerGifts);
@ -103,11 +103,13 @@ namespace Omegasis.HappyBirthday
HappyBirthday.ModMonitor.Log("Legacy loading detected. Attempting to load from StardewValley/Content/Data/PossibleBirthdayGifts.xnb"); HappyBirthday.ModMonitor.Log("Legacy loading detected. Attempting to load from StardewValley/Content/Data/PossibleBirthdayGifts.xnb");
this.defaultBirthdayGifts = Game1.content.Load<Dictionary<string, string>>(Path.Combine("Data", "PossibleBirthdayGifts")); this.defaultBirthdayGifts = Game1.content.Load<Dictionary<string, string>>(Path.Combine("Data", "PossibleBirthdayGifts"));
string villagerGifts = Path.Combine("Content", "Gifts", "BirthdayGifts.json");
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts); HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts);
} }
else else
HappyBirthday.ModMonitor.Log("No birthday gift information found. Loading from internal birthday list"); {
HappyBirthday.ModMonitor.Log("No birthday gift information found. Loading from internal birthday list and generating villagerGifts.json");
HappyBirthday.ModHelper.Data.WriteJsonFile<Dictionary<string, string>>(villagerGifts, this.defaultBirthdayGifts);
}
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"Name": "Happy Birthday", "Name": "Happy Birthday",
"Author": "Alpha_Omegasis", "Author": "Alpha_Omegasis",
"Version": "1.8.2", "Version": "1.8.3",
"Description": "Adds the farmer's birthday to the game.", "Description": "Adds the farmer's birthday to the game.",
"UniqueID": "Omegasis.HappyBirthday", "UniqueID": "Omegasis.HappyBirthday",
"EntryDll": "HappyBirthday.dll", "EntryDll": "HappyBirthday.dll",