From 50151b2e6989574dcfdb60b9ac8960a2aa3ac1bd Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Sat, 7 Dec 2019 17:54:49 -0800 Subject: [PATCH] Finished Leah friendship event. Added in some utility command for friendship for Stardust Core. --- GeneralMods/HappyBirthday/BirthdayMessages.cs | 19 ++++---- .../HappyBirthday/Framework/BirthdayEvents.cs | 46 ++++++++++++++++++- GeneralMods/HappyBirthday/HappyBirthday.cs | 25 ++++++++++ GeneralMods/StardustCore/ModCore.cs | 18 ++++++++ 4 files changed, 98 insertions(+), 10 deletions(-) diff --git a/GeneralMods/HappyBirthday/BirthdayMessages.cs b/GeneralMods/HappyBirthday/BirthdayMessages.cs index 07309598..29138088 100644 --- a/GeneralMods/HappyBirthday/BirthdayMessages.cs +++ b/GeneralMods/HappyBirthday/BirthdayMessages.cs @@ -140,11 +140,10 @@ namespace Omegasis.HappyBirthday ["Mail: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 %%", ["Mail: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 %%", ["Mail:birthdayJunimos"] = "Please come to the community center. ^ Sincerly,^ -The Junimos", - - ["Mail:birthdayDatingPenny"] = "Dear @. ^ My mom and I decided to have a little birthday party for you. Could you come by sometime today?^Sincerly,^ -Penny", ["Mail:birthdayDatingMaru"] = "Hey @. ^ My family and I decided to have a birthday party for you at our place. Could you come by our house sometime today?^Sincerly,^ -Maru", ["Mail:birthdayDatingSebastian"] = "Hey @. ^ Could you come by my place later? My family and I decided to have a birthday party for you to celebrate. ^^ -Sebastian", + ["Mail:birthdayDatingLeah"] = "Hey @. ^ Could you come by my place later? I thought it would be nice if we had a small party for you. ^Sincerly,^ -Leah", ["Happy Birthday: Star Message"] = "It's your birthday today! Happy birthday!", @@ -166,7 +165,6 @@ namespace Omegasis.HappyBirthday ["Event:DatingPennyBirthday_Finish:0"] = "It was nice celebrating my birthday with Pam and Penny.", ["Event:DatingPennyBirthday_Finish:1"] = "Looks like there was some leftover cake and beer too!", - ["Event:DatingMaruBirthday_Demetrius:0"] = "Welcome @, come in and make yourself at home.$h", ["Event:DatingMaruBirthday_Demetrius:1"] = "I agree. I think this party is perfecty wonderful. Besides studies show that your productivity is boosted when you have fun once in a while.$h", ["Event:DatingMaruBirthday_Maru:0"] = "Ohh @, you are just in time for the party.$h", @@ -180,24 +178,27 @@ namespace Omegasis.HappyBirthday ["Event:DatingMaruBirthday_Finish:0"] = "It was nice celebrating my birthday with Maru and her family.", ["Event:DatingMaruBirthday_Finish:1"] = "It looks like there was some leftover cake too!", - - ["Event:DatingSebastianBirthday_Demetrius:0"] = "I agree. I think this party is perfecty wonderful. Besides studies show that your productivity is boosted when you have fun once in a while.$h", ["Event:DatingSebastianBirthday_Demetrius:1"] = "Alright, @ go ahead and make a wish!$h", - ["Event:DatingSebastianBirthday_Maru:0"] = "Happy birthday @. Honestly, I'm a bit surprised that we are having this party. Sebastian never been too keen on celebrations.", ["Event:DatingSebastianBirthday_Maru:1"] = "Oh sweet we finally get to have some cake! Let me get you the first slice @!$h", - - ["Event:DatingSebastianBirthday_Robin:0"]= "Welcome @, come in and make yourself at home.$h", + ["Event:DatingSebastianBirthday_Robin:0"] = "Welcome @, come in and make yourself at home.$h", ["Event:DatingSebastianBirthday_Robin:1"] = "Hey now, I think that it's great that Sebastian wanted to have a party for @. $h", ["Event:DatingSebastianBirthday_Robin:2"] = "Oh I think the cake is ready!", - ["Event:DatingSebastianBirthday_Sebastian:0"] = "Hey @ you are here just in time. Mom is just finishing the cake right now. $h", ["Event:DatingSebastianBirthday_Sebastian:1"] = "Honestly... and they wonder why I don't do stuff like this more often.", ["Event:DatingSebastianBirthday_Sebastian:2"] = "Happy Birthday @. I'm glad we got to spend time like this together. $h", ["Event:DatingSebastianBirthday_Finish:0"] = "It was nice celebrating my birthday with Sebastian and his family.", ["Event:DatingSebastianBirthday_Finish:1"] = "It looks like there was some leftover cake too!", + ["Event:DatingLeahBirthday_Leah:0"] = "Welcome @! Come in and make yourself at home!$h", + ["Event:DatingLeahBirthday_Leah:1"] = "I knew today was your birthday so I thought we would have a little celebration for you. I event got some cake for us.$h", + ["Event:DatingLeahBirthday_Leah:2"] = "You know I haven't celebrated a birthday with anyone in a few years, but somehow I felt like I really wanted to spend today with you.$l", + ["Event:DatingLeahBirthday_Leah:3"] = "I would have never though I'd change my mind about celebrations like this but I guess being with you has really opened me up again.$l", + ["Event:DatingLeahBirthday_Leah:4"] = "Anyways enough of this embarrasing talk. Happy birthday @. Now shall we have some cake?$h", + ["Event:DatingLeahBirthday_Finish:0"] = "It was nice celebrating my birthday with Leah.", + ["Event:DatingLeahBirthday_Finish:1"] = "It looks like there was some leftover cake too!", + ["Event:PartyOver"] = "That was a fun party. Back to work!" }, diff --git a/GeneralMods/HappyBirthday/Framework/BirthdayEvents.cs b/GeneralMods/HappyBirthday/Framework/BirthdayEvents.cs index f1a2e6c5..9c6ec081 100644 --- a/GeneralMods/HappyBirthday/Framework/BirthdayEvents.cs +++ b/GeneralMods/HappyBirthday/Framework/BirthdayEvents.cs @@ -231,11 +231,55 @@ namespace Omegasis.HappyBirthday.Framework e.end(); return e; } - /* + + /// + /// Birthday event for when the player is dating Leah. + /// Finished. + /// + /// public static EventHelper DatingBirthday_Leah() { + List conditions = new List(); + conditions.Add(new FarmerBirthdayPrecondition()); + conditions.Add(new LocationPrecondition(Game1.getLocationFromName("LeahHouse"))); + conditions.Add(new TimePrecondition(600, 2600)); + NPC leah = Game1.getCharacterFromName("Leah"); + + conditions.Add(new StardustCore.Events.Preconditions.NPCSpecific.DatingNPC(leah)); + + EventHelper e = new EventHelper("BirthdayDating:Leah", 19953, conditions, new EventStartData("playful", 12, 7, new EventStartData.FarmerData(7, 9, EventHelper.FacingDirection.Up), new List() { + new EventStartData.NPCData(leah,14,11, EventHelper.FacingDirection.Left), + })); + e.addObject(11, 11, 220); + e.globalFadeIn(); + e.moveFarmerUp(2, EventHelper.FacingDirection.Up, false); + e.moveFarmerRight(5, EventHelper.FacingDirection.Down, false); + e.npcFaceDirection(leah, EventHelper.FacingDirection.Up); + e.speak(leah, GetTranslatedString("Event:DatingLeahBirthday_Leah:0")); //0 + e.moveFarmerDown(2, EventHelper.FacingDirection.Down, false) ; + e.moveFarmerRight(1, EventHelper.FacingDirection.Down, false); + e.moveFarmerDown(1, EventHelper.FacingDirection.Down, false); + e.speak(leah, GetTranslatedString("Event:DatingLeahBirthday_Leah:1")); //1 + e.emoteFarmer_Happy(); + e.speak(leah, GetTranslatedString("Event:DatingLeahBirthday_Leah:2"));//2 + e.speak(leah, GetTranslatedString("Event:DatingLeahBirthday_Leah:3"));//3 + e.speak(leah, GetTranslatedString("Event:DatingLeahBirthday_Leah:4"));//4 + + + e.emoteFarmer_Heart(); + e.emote_Heart("Leah"); + e.globalFadeOut(0.010); + e.setViewportPosition(-100, -100); + e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:DatingLeahBirthday_Finish:0")); //maru party finish 0 + e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:DatingLeahBirthday_Finish:1")); //maru party finish 0 + e.addObjectToPlayersInventory(220, 1, false); + e.showMessage(HappyBirthday.Config.translationInfo.getTranslatedString("Event:PartyOver")); + e.end(); + return e; } + + /* public static EventHelper DatingBirthday_Abigail() { diff --git a/GeneralMods/HappyBirthday/HappyBirthday.cs b/GeneralMods/HappyBirthday/HappyBirthday.cs index ce790af7..78e1a627 100644 --- a/GeneralMods/HappyBirthday/HappyBirthday.cs +++ b/GeneralMods/HappyBirthday/HappyBirthday.cs @@ -125,6 +125,11 @@ namespace Omegasis.HappyBirthday EventHelper eve2 = this.eventManager.getEvent("BirthdayDating:Sebastian"); eve2.startEventAtLocationifPossible(); } + if (e.NewLocation == Game1.getLocationFromName("LeahHouse")) + { + EventHelper eve = this.eventManager.getEvent("BirthdayDating:Leah"); + eve.startEventAtLocationifPossible(); + } } private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e) @@ -154,6 +159,7 @@ namespace Omegasis.HappyBirthday data["birthdayDatingPenny"] = BirthdayMessages.GetTranslatedString("Mail:birthdayDatingPenny"); data["birthdayDatingMaru"] = BirthdayMessages.GetTranslatedString("Mail:birthdayDatingMaru"); data["birthdayDatingSebastian"] = BirthdayMessages.GetTranslatedString("Mail:birthdayDatingSebastian"); + data["birthdayDatingLeah"] = BirthdayMessages.GetTranslatedString("Mail:birthdayDatingLeah"); } @@ -591,16 +597,23 @@ namespace Omegasis.HappyBirthday { Game1.player.mailReceived.Remove("birthdayDatingSebastian"); } + if (Game1.player.mailReceived.Contains("birthdayDatingLeah")) + { + Game1.player.mailReceived.Remove("birthdayDatingLeah"); + } EventHelper communityCenterJunimoBirthday = BirthdayEvents.CommunityCenterJunimoBirthday(); EventHelper birthdayDating_Penny = BirthdayEvents.DatingBirthday_Penny(); EventHelper birthdayDating_Maru = BirthdayEvents.DatingBirthday_Maru(); EventHelper birthdayDating_Sebastian = BirthdayEvents.DatingBirthday_Sebastian(); + EventHelper birthdayDating_Leah = BirthdayEvents.DatingBirthday_Leah(); + this.eventManager.addEvent(communityCenterJunimoBirthday); this.eventManager.addEvent(birthdayDating_Penny); this.eventManager.addEvent(birthdayDating_Maru); this.eventManager.addEvent(birthdayDating_Sebastian); + this.eventManager.addEvent(birthdayDating_Leah); if (Game1.player.eventsSeen.Contains(communityCenterJunimoBirthday.getEventID())) { Game1.player.eventsSeen.Remove(communityCenterJunimoBirthday.getEventID()); //Repeat the event. @@ -617,6 +630,10 @@ namespace Omegasis.HappyBirthday { Game1.player.eventsSeen.Remove(birthdayDating_Sebastian.getEventID()); //Repeat the event. } + if (Game1.player.eventsSeen.Contains(birthdayDating_Leah.getEventID())) + { + Game1.player.eventsSeen.Remove(birthdayDating_Leah.getEventID()); //Repeat the event. + } } /// Raised before the game begins writes data to the save file (except the initial save creation). @@ -687,6 +704,14 @@ namespace Omegasis.HappyBirthday } } + if (Game1.player.friendshipData.ContainsKey("Leah")) + { + if (Game1.player.friendshipData["Leah"].IsDating()) + { + Game1.player.mailbox.Add("birthdayDatingLeah"); + } + } + if (Game1.player.friendshipData.ContainsKey("Sebastian")) { diff --git a/GeneralMods/StardustCore/ModCore.cs b/GeneralMods/StardustCore/ModCore.cs index b468ad6f..087d44d1 100644 --- a/GeneralMods/StardustCore/ModCore.cs +++ b/GeneralMods/StardustCore/ModCore.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.IO; using StardewModdingAPI; @@ -41,6 +42,8 @@ namespace StardustCore this.Helper.Events.GameLoop.GameLaunched += this.GameLoop_GameLaunched; + this.Helper.ConsoleCommands.Add("Omegasis.StardustCore.ModdingUtilities.AddFriendship", "Adds a certain amount of friendship to the given npc. ", AddNPCFriendship); + this.config = ModHelper.ReadConfig(); } @@ -57,5 +60,20 @@ namespace StardustCore { ModMonitor.Log(message); } + + + public static void AddNPCFriendship(string ActionName, string[] Params) + { + string npcName = Params[0]; + int amount = Convert.ToInt32(Params[1]); + if (Game1.player.friendshipData.ContainsKey(npcName)){ + Game1.player.friendshipData[npcName].Points += amount; + } + else + { + Game1.player.friendshipData.Add(npcName, new Friendship(amount)); + } + + } } }