From 0db4c5452cfe150acef1323f338623c0bf078e7d Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Wed, 4 Dec 2019 13:28:50 -0800 Subject: [PATCH] Added in a location pre-condition for the event. --- .../Preconditions/LocationPrecondition.cs | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 GeneralMods/HappyBirthday/Framework/Events/Preconditions/LocationPrecondition.cs diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/LocationPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/LocationPrecondition.cs new file mode 100644 index 00000000..c69d011a --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/LocationPrecondition.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions +{ + public class LocationPrecondition:EventPrecondition + { + private string locationName; + private GameLocation location; + + + public LocationPrecondition() + { + + } + + public LocationPrecondition(GameLocation Location) + { + this.locationName = Location.NameOrUniqueName; + this.location = Location; + } + + /// + /// Constructor. + /// + /// The name of the location. + /// The location is a building on the farm. + public LocationPrecondition(string Location, bool IsStructure=false) + { + this.locationName = Location; + this.location = Game1.getLocationFromName(Location,IsStructure); + } + + public override bool meetsCondition() + { + return Game1.player.currentLocation == this.location; + } + } +}