From 7e40cb2583d5deb72bbf8e4455a4f0781220fd78 Mon Sep 17 00:00:00 2001 From: Date: Wed, 19 Sep 2018 01:37:51 -0700 Subject: [PATCH] More work to come. Needs content, AssetLoaders, and consistency --- GeneralMods/HappyBirthday/BirthdayMessages.cs | 6 +-- GeneralMods/HappyBirthday/HappyBirthday.cs | 35 ++++++++++------ .../HappyBirthday/HappyBirthday.csproj | 3 ++ GeneralMods/HappyBirthday/PossibleGifts.cs | 41 +++++++++++++------ 4 files changed, 57 insertions(+), 28 deletions(-) diff --git a/GeneralMods/HappyBirthday/BirthdayMessages.cs b/GeneralMods/HappyBirthday/BirthdayMessages.cs index 2d5e4017..851c566d 100644 --- a/GeneralMods/HappyBirthday/BirthdayMessages.cs +++ b/GeneralMods/HappyBirthday/BirthdayMessages.cs @@ -86,11 +86,11 @@ namespace Omegasis.HappyBirthday serializer.Formatting = Formatting.Indented; //English logic. - string defaultPath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", "English"); + string defaultPath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation); if (!Directory.Exists(defaultPath)) Directory.CreateDirectory(defaultPath); string birthdayFileDict=HappyBirthday.Config.translationInfo.getjsonForTranslation("BirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation); - string path = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue","English", birthdayFileDict); + string path = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, birthdayFileDict); //Handle normal birthday wishes. if (!File.Exists(path)) @@ -109,7 +109,7 @@ namespace Omegasis.HappyBirthday //handle spouse birthday wishes. string spouseBirthdayFileDict = HappyBirthday.Config.translationInfo.getjsonForTranslation("SpouseBirthdayWishes", HappyBirthday.Config.translationInfo.currentTranslation); - string spousePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue","English",spouseBirthdayFileDict); + string spousePath = Path.Combine(HappyBirthday.ModHelper.DirectoryPath, "Content", "Dialogue", HappyBirthday.Config.translationInfo.currentTranslation, spouseBirthdayFileDict); if (!File.Exists(path)) { diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index 04313651..b584cb3f 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -79,7 +79,7 @@ namespace Omegasis.HappyBirthday /// Provides simplified APIs for writing mods. public override void Entry(IModHelper helper) { - helper.Content.AssetLoaders.Add(new PossibleGifts()); + //helper.Content.AssetLoaders.Add(new PossibleGifts()); Config = helper.ReadConfig(); TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted; @@ -523,20 +523,29 @@ namespace Omegasis.HappyBirthday if (Game1.player.getFriendshipHeartLevelForNPC(name) >= Config.minNeutralFriendshipGiftLevel && Game1.player.getFriendshipHeartLevelForNPC(name) <= Config.maxNeutralFriendshipGiftLevel) this.PossibleBirthdayGifts.AddRange(this.GetUniversalItems("Neutral", false)); } + + if (Game1.player.isMarried()) + { + if (name == Game1.player.spouse) + { + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(198, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(204, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(220, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(221, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(223, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(233, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(234, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(286, 5)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(368, 5)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(608, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(612, 1)); + this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(773, 1)); + } + } + //TODO: Make different tiers of gifts depending on the friendship, and if it is the spouse. /* - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(198, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(204, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(220, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(221, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(223, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(233, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(234, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(286, 5)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(368, 5)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(608, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(612, 1)); - this.possible_birthday_gifts.Add((Item)new SytardewValley.Object(773, 1)); + */ return gifts; diff --git a/GeneralMods/HappyBirthday/HappyBirthday.csproj b/GeneralMods/HappyBirthday/HappyBirthday.csproj index dcd531c6..812fffb6 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.csproj +++ b/GeneralMods/HappyBirthday/HappyBirthday.csproj @@ -81,10 +81,13 @@ Properties\GlobalAssemblyInfo.cs + + + diff --git a/GeneralMods/HappyBirthday/PossibleGifts.cs b/GeneralMods/HappyBirthday/PossibleGifts.cs index 0e212841..e0006879 100644 --- a/GeneralMods/HappyBirthday/PossibleGifts.cs +++ b/GeneralMods/HappyBirthday/PossibleGifts.cs @@ -3,19 +3,9 @@ using System.Collections.Generic; namespace Omegasis.HappyBirthday { - class PossibleGifts : IAssetLoader + public class PossibleGifts { - public bool CanLoad(IAssetInfo asset) - { - return asset.AssetNameEquals(@"Data\PossibleBirthdayGifts"); - } - - /// Load a matched asset. - /// Basic metadata about the asset being loaded. - public T Load(IAssetInfo asset) - { - return (T)(object)new Dictionary // (T)(object) is a trick to cast anything to T if we know it's compatible - { + private Dictionary defaultBirthdayGifts=new Dictionary() { ["Universal_Love_Gift"] = "74 1 446 1 204 1 446 5 773 1", ["Universal_Like_Gift"] = "-2 3 -7 1 -26 2 -75 5 -80 3 72 1 220 1 221 1 395 1 613 1 634 1 635 1 636 1 637 1 638 1 724 1 233 1 223 1 465 20 -79 5", ["Universal_Neutral_Gift"] = "194 1 262 5 -74 5 -75 3 334 5 335 1 390 20 388 20 -81 5 -79 3", @@ -53,6 +43,33 @@ namespace Omegasis.HappyBirthday ["Willy"] = " Best/72 1 143 1 149 1 154 1 276 1 337 1 698 1 /Good/66 1 336 1 340 1 699 1 707 1 /Neutral/-4 3 / ", ["Krobus"] = " Best/72 1 16 1 276 1 337 1 305 1 /Good/66 1 336 1 340 1 /Neutral// " }; + + private Dictionary defaultSpouseBirthdayGifts = new Dictionary() { + + ["Universal_Love_Gift"] = "74 1 446 1 204 1 446 5 773 1", + ["Universal_Like_Gift"] = "-2 3 -7 1 -26 2 -75 5 -80 3 72 1 220 1 221 1 395 1 613 1 634 1 635 1 636 1 637 1 638 1 724 1 233 1 223 1 465 20 -79 5", + ["Universal_Neutral_Gift"] = "194 1 262 5 -74 5 -75 3 334 5 335 1 390 20 388 20 -81 5 -79 3", + ["Alex"] = "", + ["Elliott"] = "", + ["Harvey"] = "", + ["Sam"] = "", + ["Sebastian"] = "", + ["Shane"] = "", + ["Abigail"] = "", + ["Emily"] = "", + ["Haley"] = "", + ["Leah"] = "", + ["Maru"] = "", + ["Penny"] = "", + + + }; + + public Dictionary BirthdayGifts; + + public PossibleGifts() + { + } } }