diff --git a/GeneralMods/HappyBirthday/Content/Data/FarmerBirthdayDialogue.xnb b/GeneralMods/HappyBirthday/Content/Data/FarmerBirthdayDialogue.xnb deleted file mode 100644 index c1d08032..00000000 Binary files a/GeneralMods/HappyBirthday/Content/Data/FarmerBirthdayDialogue.xnb and /dev/null differ diff --git a/GeneralMods/HappyBirthday/Content/Data/PossibleBirthdayGifts.xnb b/GeneralMods/HappyBirthday/Content/Data/PossibleBirthdayGifts.xnb deleted file mode 100644 index e0650952..00000000 Binary files a/GeneralMods/HappyBirthday/Content/Data/PossibleBirthdayGifts.xnb and /dev/null differ diff --git a/GeneralMods/HappyBirthday/Content/Data/mail.xnb b/GeneralMods/HappyBirthday/Content/Data/mail.xnb deleted file mode 100644 index facfa1d8..00000000 Binary files a/GeneralMods/HappyBirthday/Content/Data/mail.xnb and /dev/null differ diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index 869e4829..83270f9a 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -13,7 +13,7 @@ using SObject = StardewValley.Object; namespace Omegasis.HappyBirthday { /// The mod entry point. - public class HappyBirthday : Mod + public class HappyBirthday : Mod, IAssetEditor, IAssetLoader { /********* ** Properties @@ -46,6 +46,68 @@ namespace Omegasis.HappyBirthday private bool CheckedForBirthday; //private Dictionary Dialogue; //private bool SeenEvent; + public bool CanLoad(IAssetInfo asset) + { + return asset.AssetNameEquals(@"Data\FarmerBirthdayDialogue"); + } + + /// 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 + { + ["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", + ["Maru"] = "Happy birthday @. I tried to make you an everlasting candle but sadly that didn't work out. Maybe next year right? $h", + ["Sebastian"] = "Happy birthday @. Here's to another year of chilling. ", + ["Linus"] = "Happy birthday @. Thanks for visiting me even on your birthday. It makes me really happy. ", + ["Pierre"] = "Hey @, happy birthday! Hopefully this next year for you will be a great one! ", + ["Caroline"] = "Happy birthday @. Thank you for all that you've done for our community. I'm sure your parents must be proud of you.$h", + ["Abigail"] = "Happy Birthday @! Hopefully this year we can go on even more adventures together $h!", + ["Alex"] = "Yo @, happy birthday! Maybe this will be your best year yet.$h", + ["George"] = "When you get to my age birthdays come and go. Still happy birthday @.", + ["Evelyn"] = "Happy birthday @. You have grown up to be such a fine individual and I'm sure you'll continue to grow. ", + ["Lewis"] = "Happy birthday @! I'm thankful for what you have done for the town and I'm sure your grandfather would be proud of you.", + ["Clint"] = "Hey happy birthday @. I'm sure this year is going to be great for you.", + ["Penny"] = "Happy birthday @. May you enjoy all of life's blessings this year. ", + ["Pam"] = "Happy birthday kid. We should have a drink to celebrate another year of life for you! $h", + ["Emily"] = "I'm sensing a strong positive life energy about you, so it must be your birthday. Happy birthday @!$h", + ["Haley"] = "Happy birthday @. Hopefully this year you'll get some good presents!$h", + ["Jas"] = "Happy birthday @. I hope you have a good birthday.", + ["Vincent"] = "Hey @ have you come to pl...oh it's your birthday? Happy birthday! ", + ["Jodi"] = "Hello there @. Rumor has it that today is your birthday. In that case, happy birthday!$h", + ["Kent"] = "Jodi told me that it was your birthday today @. Happy birthday and make sure to cherish every single day.", + ["Sam"] = "Yo @ happy birthday! We'll have to have a birthday jam session for you some time!$h ", + ["Leah"] = "Hey @ happy birthday! We should go to the saloon tonight and celebrate!$h ", + ["Shane"] = "Happy birthday @. Keep working hard and I'm sure this next year for you will be a great one.", + ["Marnie"] = "Hello there @. Everyone is talking about your birthday today and I wanted to make sure that I wished you a happy birthday as well, so 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!", + ["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 @. ", + ["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!", + ["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", + ["Krobus"] = "I have heard that it is tradition to give a gift to others on their birthday. In that case, happy birthday @." + }; + } + + public bool CanEdit(IAssetInfo asset) + { + return asset.AssetNameEquals(@"Data\mail"); + } + + public void Edit(IAssetData asset) + { + asset + .AsDictionary() + .Set("birthdayMom", "Dear @,^ Happy birthday sweetheart. It's been amazing watching you grow into the kind, hard working person that I've always dreamed that you would become. I hope you continue to make many more fond memories with the ones you love. ^ Love, Mom ^ P.S. Here's a little something that I made for you. %item object 221 1 %%"); + + asset + .AsDictionary() + .Set("birthdayDad", "Dear @,^ Happy birthday kiddo. It's been a little quiet around here on your birthday since you aren't around, but your mother and I know that you are making both your grandpa and us proud. We both know that living on your own can be tough but we believe in you one hundred percent, just keep following your dreams.^ Love, Dad ^ P.S. Here's some spending money to help you out on the farm. Good luck! %item money 5000 5001 %%"); + } /********* @@ -55,6 +117,7 @@ namespace Omegasis.HappyBirthday /// Provides simplified APIs for writing mods. public override void Entry(IModHelper helper) { + helper.Content.AssetLoaders.Add(new PossibleGifts()); this.Config = helper.ReadConfig(); TimeEvents.AfterDayStarted += this.TimeEvents_AfterDayStarted; @@ -299,8 +362,7 @@ namespace Omegasis.HappyBirthday { // read from birthday gifts file IDictionary data = Game1.content.Load>("Data\\PossibleBirthdayGifts"); - string text; - data.TryGetValue(name, out text); + data.TryGetValue(name, out string text); if (text != null) { string[] fields = text.Split('/'); @@ -400,8 +462,7 @@ namespace Omegasis.HappyBirthday if (!isBirthdayGiftList) { // get raw data - string text; - Game1.NPCGiftTastes.TryGetValue($"Universal_{group}", out text); + Game1.NPCGiftTastes.TryGetValue($"Universal_{group}", out string text); if (text == null) yield break; @@ -417,8 +478,7 @@ namespace Omegasis.HappyBirthday { // get raw data Dictionary data = Game1.content.Load>("Data\\PossibleBirthdayGifts"); - string text; - data.TryGetValue($"Universal_{group}_Gift", out text); + data.TryGetValue($"Universal_{group}_Gift", out string text); if (text == null) yield break; @@ -437,8 +497,7 @@ namespace Omegasis.HappyBirthday private IEnumerable GetLikedItems(string name) { // get raw data - string text; - Game1.NPCGiftTastes.TryGetValue(name, out text); + Game1.NPCGiftTastes.TryGetValue(name, out string text); if (text == null) yield break; @@ -457,8 +516,7 @@ namespace Omegasis.HappyBirthday private IEnumerable GetLovedItems(string name) { // get raw data - string text; - Game1.NPCGiftTastes.TryGetValue(name, out text); + Game1.NPCGiftTastes.TryGetValue(name, out string text); if (text == null) yield break; diff --git a/GeneralMods/HappyBirthday/HappyBirthday.csproj b/GeneralMods/HappyBirthday/HappyBirthday.csproj index b5255214..efee159d 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.csproj +++ b/GeneralMods/HappyBirthday/HappyBirthday.csproj @@ -23,6 +23,7 @@ prompt 4 false + x86 pdbonly @@ -47,18 +48,10 @@ + - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - diff --git a/GeneralMods/HappyBirthday/PossibleGifts.cs b/GeneralMods/HappyBirthday/PossibleGifts.cs new file mode 100644 index 00000000..0e212841 --- /dev/null +++ b/GeneralMods/HappyBirthday/PossibleGifts.cs @@ -0,0 +1,58 @@ +using StardewModdingAPI; +using System.Collections.Generic; + +namespace Omegasis.HappyBirthday +{ + class PossibleGifts : IAssetLoader + { + 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 + { + ["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", + ["Robin"] = " BestGifts/224 1 426 1 636 1/GoodGift/-6 5 -79 5 424 1 709 1/NeutralGift//", + ["Demetrius"] = " Best Gifts/207 1 232 1 233 1 400 1/Good Gifts/-5 3 -79 5 422 1/NeutralGift/-4 3/", + ["Maru"] = " BestGift/72 1 197 1 190 1 215 1 222 1 243 1 336 1 337 1 400 1 787 1/Good Gift/-260 1 62 1 64 1 66 1 68 1 70 1 334 1 335 1 725 1 726 1/NeutralGift/", + ["Sebastian"] = " Best/84 1 227 1 236 1 575 1 305 1 /Good/267 1 276 1/Neutral/-4 3/", + ["Linus"] = " Best/88 1 90 1 234 1 242 1 280 1/Good/-5 3 -6 5 -79 5 -81 10/Neutral/-4 3/", + ["Pierre"] = " Best/202 1/Good/-5 3 -6 5 -7 1 18 1 22 1 402 1 418 1 259 1/Neutral//", + ["Caroline"] = " Best/213 1 593 1/Good/-7 1 18 1 402 1 418 1/Neutral// ", + ["Abigail"] = " Best/66 1 128 1 220 1 226 1 276 1 611 1/Good//Neutral// ", + ["Alex"] = " Best/201 1 212 1 662 1 664 1/Good/-5 3/Neutral// ", + ["George"] = " Best/20 1 205 1/Good/18 1 195 1 199 1 200 1 214 1 219 1 223 1 231 1 233 1/Neutral// ", + ["Evelyn"] = " Best/72 1 220 1 239 1 284 1 591 1 595 1/Good/-6 5 18 1 402 1 418 1/Neutral// ", + ["Lewis"] = " Best/200 1 208 1 235 1 260 1/Good/-80 5 24 1 88 1 90 1 192 1 258 1 264 1 272 1 274 1 278 1/Neutral// ", + ["Clint"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 336 1 337 1 605 1 649 1 749 1 337 5/Good/334 20 335 10 336 5/Neutral// ", + ["Penny"] = " Best/60 1 376 1 651 1 72 1 164 1 218 1 230 1 244 1 254 1/Good/-6 5 20 1 22 1/Neutral// ", + ["Pam"] = " Best/24 1 90 1 199 1 208 1 303 1 346 1/Good/-6 5 -75 5 -79 5 18 1 227 1 228 1 231 1 232 1 233 1 234 1 235 1 236 1 238 1 402 1 418 1/Neutral/-4 3/ ", + ["Emily"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 241 1 428 1 440 1 /Good/18 1 82 1 84 1 86 1 196 1 200 1 207 1 230 1 235 1 402 1 418 1/Neutral// ", + ["Haley"] = " Best/221 1 421 1 610 1 88 1 /Good/18 1 60 1 62 1 64 1 70 1 88 1 222 1 223 1 232 1 233 1 234 1 402 1 418 1 /Neutral// ", + ["Jas"] = " Best/221 1 595 1 604 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ", + ["Vincent"] = " Best/221 1 398 1 612 1 /Good/18 1 60 1 64 1 70 1 88 1 232 1 233 1 234 1 222 1 223 1 340 1 344 1 402 1 418 1 /Neutral// ", + ["Jodi"] = " Best/72 1 200 1 211 1 214 1 220 1 222 1 225 1 231 1 /Good/-5 3 -6 5 -79 5 18 1 402 1 418 1 /Neutral// ", + ["Kent"] = " Best/607 1 649 1 /Good/-5 3 -79 5 18 1 402 1 418 1 /Neutral// ", + ["Sam"] = " Best/90 1 206 1 655 1 658 1 562 1 731 1/Good/167 1 210 1 213 1 220 1 223 1 224 1 228 1 232 1 233 1 239 1 -5 3/Neutral// ", + ["Leah"] = " Best/196 1 200 1 348 1 606 1 651 1 650 1 426 1 430 1 /Good/-5 3 -6 5 -79 5 -81 10 18 1 402 1 406 1 408 1 418 1 86 1 /Neutral// ", + ["Shane"] = " Best/206 1 215 1 260 1 346 1 /Good/-5 3 -79 5 303 1 /Neutral// ", + ["Marnie"] = " Best/72 1 221 1 240 1 608 1 /Good/-5 3 -6 5 402 1 418 1 /Neutral// ", + ["Elliott"] = " Best/715 1 732 1 218 1 444 1 /Good/727 1 728 1 -79 5 60 1 80 1 82 1 84 1 149 1 151 1 346 1 348 1 728 1 /Neutral/-4 3 / ", + ["Gus"] = " Best/72 1 213 1 635 1 729 1 /Good/348 1 303 1 -7 1 18 1 /Neutral// ", + ["Dwarf"] = " Best/60 1 62 1 64 1 66 1 68 1 70 1 749 1 /Good/82 1 84 1 86 1 96 1 97 1 98 1 99 1 121 1 122 1 /Neutral/-28 20 / ", + ["Wizard"] = " Best/107 1 155 1 422 1 769 1 768 1 /Good/-12 3 72 1 82 1 84 1/Neutral// ", + ["Harvey"] = " Best/348 1 237 1 432 1 395 1 342 1 /Good/-81 10 -79 5 -7 1 402 1 418 1 422 1 436 1 438 1 442 1 444 1 422 1 /Neutral// ", + ["Sandy"] = " Best/18 1 402 1 418 1 /Good/-75 5 -79 5 88 1 428 1 436 1 438 1 440 1 /Neutral// ", + ["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// " + }; + } + } +}