diff --git a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs new file mode 100644 index 00000000..906ed124 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs @@ -0,0 +1,655 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; +using Omegasis.HappyBirthday.Framework.Events.Preconditions; +using Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events +{ + /// + /// Helps in creating events based in code for stardew valley. + /// https://stardewvalleywiki.com/Modding:Event_data + /// + public class EventHelper + { + + /// + /// Nexus user id for Omegasis (aka me). + /// + private const int nexusUserId = 32171640; + + /// + /// Wraps SDV facing direction. + /// + public enum FacingDirection + { + Up, + Right, + Down, + Left + } + + + private bool _precondition_snowWeather; + private bool _precondition_debrisWeather; + private bool _precondition_weddingDayWeather; + private bool _precondition_stormyWeather; + private bool _precondition_festivalWeather; + + + private StringBuilder eventData; + + public EventHelper() + { + + } + + public EventHelper(TimePrecondition Time, EventDayExclusionPrecondition NotTheseDays) + { + this.eventData = new StringBuilder(); + + this.add(Time.ToString()); + this.add(NotTheseDays.ToString()); + + } + + public EventHelper(List Conditions) + { + this.eventData = new StringBuilder(); + foreach(var v in Conditions) + { + if(v is WeatherPrecondition) + { + WeatherPrecondition w = (v as WeatherPrecondition); + if(w.weather== WeatherPrecondition.Weather.Sunny) + { + this.add(w.precondition_sunnyWeather()); + } + else if(w.weather== WeatherPrecondition.Weather.Rainy) + { + this.add(w.precondition_rainyWeather()); + } + else if(w.weather== WeatherPrecondition.Weather.Debris) + { + this._precondition_debrisWeather = true; + } + else if(w.weather== WeatherPrecondition.Weather.Festival) + { + this._precondition_festivalWeather = true; + } + else if(w.weather== WeatherPrecondition.Weather.Snow) + { + this._precondition_snowWeather = true; + } + else if(w.weather== WeatherPrecondition.Weather.Storm) + { + this._precondition_stormyWeather = true; + } + else if(w.weather== WeatherPrecondition.Weather.Wedding) + { + this._precondition_weddingDayWeather = true; + } + continue; + } + + + this.add(v.ToString()); + } + } + + /// + /// Adds in the event data to the string builder and appends seperators as necessary. + /// + /// + public void add(string Data) + { + if (this.eventData.Length > 0) + { + this.eventData.Append(this.getSeperator()); + } + this.eventData.Append(Data); + } + + + /// + /// Converts the direction to enum. + /// + /// + /// + public int getFacingDirectionNumber(FacingDirection Dir) + { + return (int)Dir; + } + + /// + /// Gets the even parsing seperator. + /// + /// + public string getSeperator() + { + return "/"; + } + + /// + /// Gets the starting event numbers based off of my nexus user id. + /// + /// + private string getUniqueEventStartID() + { + string s = nexusUserId.ToString(); + return s.Substring(0, 4); + } + + /// + /// Checks to ensure I don't create a id value that is too big for nexus. + /// + /// + /// + public bool isIdValid(int IDToCheck) + { + if (IDToCheck > 2147483647 || IDToCheck < 0) return false; + else return true; + } + + /// + /// Checks to ensure I don't create a id value that is too big for nexus. + /// + /// + /// + public bool isIdValid(string IDToCheck) + { + if (Convert.ToInt32(IDToCheck) > 2147483647 ||Convert.ToInt32(IDToCheck) < 0) return false; + else return true; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~// + // Preconditions // + //~~~~~~~~~~~~~~~~~~~~~~~~~// + + #region + + /// + /// Quote from SDV wiki. + /// "The special dialogue event with the given ID is not in progress. + /// This can be a custom event ID, but these are the in-game IDs: + /// cc_Begin, cc_Boulder, cc_Bridge, cc_Bus, cc_Complete, cc_Greenhouse, cc_Minecart, dumped_Girls, dumped_Guys, Introduction, joja_Begin, pamHouseUpgrade, pamHouseUpgradeAnonymous, secondChance_Girls, secondChance_Guys, willyCrabs." + /// + /// + /// + public string precondition_EventNotInProgress(string ID) + { + StringBuilder b = new StringBuilder(); + b.Append("A "); + b.Append(ID.ToString()); + return b.ToString(); + } + + + + /// + /// Creates a precondition where the event has a specific amount chance to occur. + /// + /// The chance to occur between 0 and 1. .45 would be a 45% chance to occur. + /// + public string precondition_chanceToOccur(float Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("r "); + if (Amount < 0) throw new Exception("Chance amount can't be less than 0!"); + if (Amount > 1) Amount=1; + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// Creates a precondition where the npc is not invisible. (Probably that you can find them in the game world. + /// + /// + /// + public string precondition_npcNotInvisible(NPC npc) + { + StringBuilder b = new StringBuilder(); + b.Append("v "); + b.Append(npc.Name); + return b.ToString(); + } + + + + + /// + /// Creates a precondition that the current player must be dating the current npc. + /// + /// + /// + public string precondition_DatingNPC(NPC NPC) + { + StringBuilder b = new StringBuilder(); + b.Append("D "); + b.Append(NPC.Name); + return b.ToString(); + } + + /// + /// Adds in the precondition that the joja warehouse has been completed. + /// + /// + public string precondition_JojaWarehouseCompleted() + { + StringBuilder b = new StringBuilder(); + b.Append("J"); + return b.ToString(); + } + + + /// + /// Adds in the precondition that the player has atleast this much money. + /// + /// + /// + public string precondition_playerHasThisMuchMoney(int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("M "); + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// Adds in the precondition that the player has this secret note. + /// + /// + /// + public string precondition_playerHasThisSecretNote(int ID) + { + StringBuilder b = new StringBuilder(); + b.Append("S "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// Creates the precondition that the player must be standing on this tile. + /// + /// + /// + /// + public string precondition_playerOnThisTile(int x,int y) + { + StringBuilder b = new StringBuilder(); + b.Append("a "); + b.Append(x.ToString()); + b.Append(" "); + b.Append(y.ToString()); + return b.ToString(); + } + + /// + /// Creates the precondition that the player must be standing on this tile. + /// + /// + /// + public string precondition_playerOnThisTile(Vector2 Position) + { + return this.precondition_playerOnThisTile((int)Position.X, (int)Position.Y); + } + + /// + /// Creates the precondition that the player must be standing on this tile. + /// + /// + /// + public string precondition_playerOnThisTile(Point Position) + { + return this.precondition_playerOnThisTile(Position.X, Position.Y); + } + + /// + /// Creates the precondition that the player has reached the bottom of the mines this many times. + /// + /// + /// + public string precondition_playerHasReachedMineBottomXTimes(int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("b "); + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// Creates the precondition that the player has atleast this many inventory slots free for the event. + /// + /// + /// + public string precondition_playerHasInventorySlotsFree(int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("c "); + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// Current player has seen the specified event . + /// + /// + /// + public string precondition_playerHasSeenEvent(string ID) + { + StringBuilder b = new StringBuilder(); + b.Append("e "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// Current player has seen the specified events. + /// + /// + /// + public string precondition_playerHasSeenEvents(List IDS) + { + StringBuilder b = new StringBuilder(); + b.Append("e "); + for (int i = 0; i < IDS.Count; i++) + { + b.Append(IDS[i]); + if (i != IDS.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + + /// + /// Gets the amount of friedship points required for this event to occur. + /// + /// + /// + /// + public string precondition_FriendshipRequired(NPC Npc, int Points) + { + StringBuilder b = new StringBuilder(); + b.Append("f "); + b.Append(Npc.Name); + b.Append(" "); + b.Append(Points.ToString()); + return b.ToString(); + } + + /// + /// Gets the amount of hearts required for this event to occur. + /// + /// + /// + /// + public string precondition_FriendshipHeartsRequired(NPC Npc, int Hearts) + { + StringBuilder b = new StringBuilder(); + b.Append("f "); + b.Append(Npc.Name); + b.Append(" "); + int points = Hearts * 250; + b.Append(points.ToString()); + return b.ToString(); + } + + /// + /// The player must be male to view this event. + /// + /// + public string precondition_playerIsMale() + { + StringBuilder b = new StringBuilder(); + b.Append("g "); + b.Append("0"); + return b.ToString(); + } + + /// + /// The player must be female to view this event. + /// + /// + public string precondition_playerIsFemale() + { + StringBuilder b = new StringBuilder(); + b.Append("g "); + b.Append("1"); + return b.ToString(); + } + + /// + /// Condition: The player has no pet and wants a cat. + /// + /// + public string precondition_playerWantsCat() + { + StringBuilder b = new StringBuilder(); + b.Append("h "); + b.Append("cat"); + return b.ToString(); + } + /// + /// Condition: The player has no pet and wants a dog. + /// + /// + public string precondition_playerWantsDog() + { + StringBuilder b = new StringBuilder(); + b.Append("h "); + b.Append("dog"); + return b.ToString(); + } + + /// + /// Player has the item with the given id. Parent sheet index? + /// + /// + /// + public string precondition_playerHasItem(int ID) + { + StringBuilder b = new StringBuilder(); + b.Append("i "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// Player has played for atleast this many days. + /// + /// + /// + public string precondition_playerHasPlayedForXDays(int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("j "); + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// The player has not seen the event. + /// + /// + /// + public string precondition_playerHasNotSeenEvent(int ID) + { + StringBuilder b = new StringBuilder(); + b.Append("k "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// The player has not seen these events. + /// + /// + /// + public string precondition_playerHasNotSeenEvents(List IDS) + { + StringBuilder b = new StringBuilder(); + b.Append("k "); + for (int i = 0; i < IDS.Count; i++) + { + b.Append(IDS[i]); + if (i != IDS.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + + /// + /// The player has not seen the letter with the given id. + /// + /// + /// + public string precondition_playerHasNotRecievedLetter(string ID) + { + StringBuilder b = new StringBuilder(); + b.Append("l "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// Current player has earned at least this much money (regardless of how much they currently have). + /// + /// + /// + public string precondition_playerEarnedMoneyTotal(int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("m "); + b.Append(Amount.ToString()); + return b.ToString(); + } + /// + /// The player has seen the letter with the given id. + /// + /// + /// + public string precondition_playerHasRecievedLetter(string ID) + { + StringBuilder b = new StringBuilder(); + b.Append("n "); + b.Append(ID.ToString()); + return b.ToString(); + } + + /// + /// Current player is not married to that NPC. + /// + /// + /// + public string precondition_playerNotMarriedToThisNPC(NPC npc) + { + StringBuilder b = new StringBuilder(); + b.Append("o "); + b.Append(npc.Name); + return b.ToString(); + } + + /// + /// The given npc must be in the same game location as the player. + /// + /// + /// + public string precondition_npcInPlayersLocation(NPC npc) + { + StringBuilder b = new StringBuilder(); + b.Append("p "); + b.Append(npc.Name); + return b.ToString(); + } + /// + /// The player has answered with the dialogue option of this choice. + /// + /// + /// + public string precondition_answeredDialogueOption(string ID) + { + StringBuilder b = new StringBuilder(); + b.Append("q "); + b.Append(ID); + return b.ToString(); + } + + /// + /// The player has answered with the dialogue options of these choices. + /// + /// + /// + public string precondition_answeredDialogueOptions(List IDS) + { + StringBuilder b = new StringBuilder(); + b.Append("q "); + for (int i = 0; i < IDS.Count; i++) + { + b.Append(IDS[i]); + if (i != IDS.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + + /// + /// Current player has shipped at least of the specified item. Can specify multiple item and number pairs, in which case all of them must be met. + /// + /// The id of the item. Parent sheet index? + /// The amount shipped. + /// + public string precondition_playerHasShippedItem(int ID, int Amount) + { + StringBuilder b = new StringBuilder(); + b.Append("s "); + b.Append(ID); + b.Append(" "); + b.Append(Amount.ToString()); + return b.ToString(); + } + + /// + /// Current player has shipped at least of the specified item. Can specify multiple item and number pairs, in which case all of them must be met. + /// + /// + /// + public string precondition_playerHasShippedTheseItems(List> Pairs) + { + StringBuilder b = new StringBuilder(); + b.Append("s "); + for(int i = 0; i < Pairs.Count; i++) + { + + int ID = Pairs[i].Key; + int Amount = Pairs[i].Value; + b.Append(ID); + b.Append(" "); + b.Append(Amount.ToString()); + + if (i != Pairs.Count - 1) + { + b.Append(" "); + } + } + + + return b.ToString(); + } + + #endregion + + + + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/EventPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/EventPrecondition.cs new file mode 100644 index 00000000..f97ca340 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/EventPrecondition.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions +{ + public class EventPrecondition + { + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/DayOfTheMonth.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/DayOfTheMonth.cs new file mode 100644 index 00000000..59ee5b22 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/DayOfTheMonth.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + /// + /// Event occurs on this day of the month. Range 1-28 + /// + /// + public class DayOfTheMonth:EventPrecondition + { + + public int day; + public DayOfTheMonth() + { + + } + + public DayOfTheMonth(int Day) + { + if (Day <= 0) throw new Exception("Day must be in range of 1-28!"); + if (Day > 28) throw new Exception("Day must be in range of 1-28!"); + this.day = Day; + } + + public override string ToString() + { + return this.precondition_occursOnThisDayOfTheMonth(); + } + + /// + /// Event occurs on this day of the month. Range 1-28 + /// + /// The day this can occur on. Range 1-28 + /// + public string precondition_occursOnThisDayOfTheMonth() + { + StringBuilder b = new StringBuilder(); + b.Append("u "); + b.Append(this.day.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/EventDayExclusionPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/EventDayExclusionPrecondition.cs new file mode 100644 index 00000000..005430a7 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/EventDayExclusionPrecondition.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + public class EventDayExclusionPrecondition:EventPrecondition + { + + public bool sunday; + public bool monday; + public bool tuesday; + public bool wednesday; + public bool thursday; + public bool friday; + public bool saturday; + + public EventDayExclusionPrecondition() + { + + } + + public EventDayExclusionPrecondition(bool Sunday, bool Monday, bool Tuesday, bool Wednesday, bool Thursday, bool Friday, bool Saturday) + { + this.sunday = Sunday; + this.monday = Monday; + this.tuesday = Tuesday; + this.wednesday = Wednesday; + this.thursday = Thursday; + this.friday = Friday; + this.saturday = Saturday; + } + + /// + /// Gets the event precondition data. + /// + /// + public override string ToString() + { + StringBuilder b = new StringBuilder(); + b.Append("d "); + + List words = new List(); + + if (this.monday) + { + words.Add("Mon"); + } + if (this.tuesday) + { + words.Add("Tue"); + } + if (this.wednesday) + { + words.Add("Wed"); + } + if (this.thursday) + { + words.Add("Thu"); + } + if (this.friday) + { + words.Add("Fri"); + } + if (this.saturday) + { + words.Add("Sat"); + } + if (this.sunday) + { + words.Add("Sun"); + } + + for (int i = 0; i < words.Count; i++) + { + b.Append(words[i]); + if (i != words.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/NotAFestivalDay.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/NotAFestivalDay.cs new file mode 100644 index 00000000..5260edcc --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/NotAFestivalDay.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + /// + /// Precondition that ensures that this event can't happen on a festival day. + /// + /// + public class NotAFestivalDay:EventPrecondition + { + public NotAFestivalDay() + { + + } + + public override string ToString() + { + StringBuilder b = new StringBuilder(); + b.Append("F"); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/SeasonExclusion.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/SeasonExclusion.cs new file mode 100644 index 00000000..3f9747e6 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/SeasonExclusion.cs @@ -0,0 +1,78 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + public class SeasonExclusion:EventPrecondition + { + public bool spring; + public bool summer; + public bool fall; + public bool winter; + + public SeasonExclusion() + { + + } + + public SeasonExclusion(bool Spring, bool Summer, bool Fall, bool Winter) + { + this.spring = Spring; + this.summer = Summer; + this.fall = Fall; + this.winter = Winter; + } + + public override string ToString() + { + return this.precondition_NotThisSeason(); + } + + /// + /// This event will occur in the seasons that aren't these seasons. + /// + /// If true this event won't occur in the spring. + /// If true this event won't occur in the summer. + /// If true this event won't occur in the fall. + /// If true this event won't occur in the winter. + /// + public string precondition_NotThisSeason() + { + StringBuilder b = new StringBuilder(); + b.Append("d "); + + List words = new List(); + + if (this.spring) + { + words.Add("spring"); + } + if (this.summer) + { + words.Add("summer"); + } + if (this.fall) + { + words.Add("fall"); + } + if (this.winter) + { + words.Add("winter"); + } + + for (int i = 0; i < words.Count; i++) + { + b.Append(words[i]); + if (i != words.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/TimePrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/TimePrecondition.cs new file mode 100644 index 00000000..d2268abb --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/TimePrecondition.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + /// + /// The event will only happen between the given times. + /// + /// + /// + /// + public class TimePrecondition:EventPrecondition + { + public int start; + public int end; + + public TimePrecondition() + { + + } + + public TimePrecondition(int Start, int End) + { + this.start = Start; + this.end = End; + } + + public override string ToString() + { + StringBuilder b = new StringBuilder(); + b.Append("t "); + b.Append(this.start.ToString()); + b.Append(" "); + b.Append(this.end.ToString()); + return b.ToString(); + + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs new file mode 100644 index 00000000..1d786c0e --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + public class WeatherPrecondition:EventPrecondition + { + public enum Weather + { + Sunny, + Rainy, + Debris, + Storm, + Festival, + Snow, + Wedding + } + + public Weather weather; + + public WeatherPrecondition() + { + + } + + /// + /// Creates the prconiditon that it must be sunny for the event to occur. + /// + /// + public string precondition_sunnyWeather() + { + StringBuilder b = new StringBuilder(); + b.Append("w sunny"); + return b.ToString(); + } + + /// + /// Creates the precondition that it must be rainy for the event to occur. + /// + /// + public string precondition_rainyWeather() + { + StringBuilder b = new StringBuilder(); + b.Append("w rainy"); + return b.ToString(); + } + + //Experimental weather checks. May or may not be used when checking for when to use an event. + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/YearPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/YearPrecondition.cs new file mode 100644 index 00000000..e5c0addc --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/YearPrecondition.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific +{ + /// + /// The event must occur on this year or after it. + /// If year is 1 then the event must occur in the first year. + /// If year is >1 then the year must be that year value atleast. Aka year 2 means the event can occur years 2+. + /// + public class YearPrecondition:EventPrecondition + { + + public int year; + public YearPrecondition() + { + + } + + public YearPrecondition(int Year) + { + this.year = Year; + } + + + public override string ToString() + { + return this.precondition_occursThisYearOrBefore(); + } + + /// + /// The event must occur on this year or after it. + /// If year is 1 then the event must occur in the first year. + /// If year is >1 then the year must be that year value atleast. Aka year 2 means the event can occur years 2+. + /// + /// If is 1, must be in the first year. Otherwise, year must be at least this value. + /// + public string precondition_occursThisYearOrBefore() + { + StringBuilder b = new StringBuilder(); + b.Append("y "); + b.Append(this.year.ToString()); + return b.ToString(); + } + } +}