diff --git a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs index 906ed124..aecbacc5 100644 --- a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs +++ b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs @@ -52,8 +52,8 @@ namespace Omegasis.HappyBirthday.Framework.Events { this.eventData = new StringBuilder(); - this.add(Time.ToString()); - this.add(NotTheseDays.ToString()); + this.add(Time); + this.add(NotTheseDays); } @@ -65,13 +65,9 @@ namespace Omegasis.HappyBirthday.Framework.Events if(v is WeatherPrecondition) { WeatherPrecondition w = (v as WeatherPrecondition); - if(w.weather== WeatherPrecondition.Weather.Sunny) + if(w.weather== WeatherPrecondition.Weather.Sunny || w.weather== WeatherPrecondition.Weather.Rainy) { - this.add(w.precondition_sunnyWeather()); - } - else if(w.weather== WeatherPrecondition.Weather.Rainy) - { - this.add(w.precondition_rainyWeather()); + this.add(v); } else if(w.weather== WeatherPrecondition.Weather.Debris) { @@ -97,7 +93,7 @@ namespace Omegasis.HappyBirthday.Framework.Events } - this.add(v.ToString()); + this.add(v); } } @@ -105,13 +101,13 @@ namespace Omegasis.HappyBirthday.Framework.Events /// Adds in the event data to the string builder and appends seperators as necessary. /// /// - public void add(string Data) + public virtual void add(EventPrecondition Data) { if (this.eventData.Length > 0) { this.eventData.Append(this.getSeperator()); } - this.eventData.Append(Data); + this.eventData.Append(Data.ToString()); } @@ -120,7 +116,7 @@ namespace Omegasis.HappyBirthday.Framework.Events /// /// /// - public int getFacingDirectionNumber(FacingDirection Dir) + public virtual int getFacingDirectionNumber(FacingDirection Dir) { return (int)Dir; } @@ -129,7 +125,7 @@ namespace Omegasis.HappyBirthday.Framework.Events /// Gets the even parsing seperator. /// /// - public string getSeperator() + public virtual string getSeperator() { return "/"; } @@ -149,7 +145,7 @@ namespace Omegasis.HappyBirthday.Framework.Events /// /// /// - public bool isIdValid(int IDToCheck) + public virtual bool isIdValid(int IDToCheck) { if (IDToCheck > 2147483647 || IDToCheck < 0) return false; else return true; @@ -160,496 +156,10 @@ namespace Omegasis.HappyBirthday.Framework.Events /// /// /// - public bool isIdValid(string IDToCheck) + public virtual 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/MISC/ChanceToOccur.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/ChanceToOccur.cs new file mode 100644 index 00000000..76770b7e --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/ChanceToOccur.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC +{ + public class ChanceToOccur:EventPrecondition + { + + public float chance; + + public ChanceToOccur() + { + + } + + public ChanceToOccur(float Chance) + { + if (Chance < 0) throw new Exception("Chance amount can't be less than 0!"); + if (Chance > 1) Chance = 1; + this.chance = Chance; + } + + public override string ToString() + { + return this.precondition_chanceToOccur(); + } + + /// + /// 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() + { + StringBuilder b = new StringBuilder(); + b.Append("r "); + b.Append(this.chance.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/EventNotInProgress.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/EventNotInProgress.cs new file mode 100644 index 00000000..eaa421ae --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/EventNotInProgress.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC +{ + public class EventNotInProgress:EventPrecondition + { + public string id; + + public EventNotInProgress() + { + + } + + public EventNotInProgress(string ID) + { + this.id = ID; + } + + public override string ToString() + { + return this.precondition_EventNotInProgress(); + } + + /// + /// 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() + { + StringBuilder b = new StringBuilder(); + b.Append("A "); + b.Append(this.id.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/JojaWarehouseCompleted.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/JojaWarehouseCompleted.cs new file mode 100644 index 00000000..4b30e319 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/MISC/JojaWarehouseCompleted.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC +{ + public class JojaWarehouseCompleted:EventPrecondition + { + public JojaWarehouseCompleted() + { + + } + + public override string ToString() + { + return this.precondition_JojaWarehouseCompleted(); + } + + /// + /// 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(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/DatingNPC.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/DatingNPC.cs new file mode 100644 index 00000000..f0825441 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/DatingNPC.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class DatingNPC:EventPrecondition + { + + public NPC npc; + public DatingNPC() + { + + } + public DatingNPC(NPC npc) + { + this.npc = npc; + } + + public override string ToString() + { + return this.precondition_DatingNPC(); + } + /// + /// Creates a precondition that the current player must be dating the current npc. + /// + /// + public string precondition_DatingNPC() + { + StringBuilder b = new StringBuilder(); + b.Append("D "); + b.Append(this.npc.Name); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/FriendshipPointsRequired.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/FriendshipPointsRequired.cs new file mode 100644 index 00000000..016997eb --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/FriendshipPointsRequired.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class FriendshipPointsRequired:EventPrecondition + { + public NPC npc; + public int amount; + + + public FriendshipPointsRequired() + { + + } + + public FriendshipPointsRequired(NPC NPC, int Amount) + { + this.npc = NPC; + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_FriendshipRequired(); + } + + /// + /// Gets the amount of friedship points required for this event to occur. + /// + /// + public string precondition_FriendshipRequired() + { + StringBuilder b = new StringBuilder(); + b.Append("f "); + b.Append(this.npc.Name); + b.Append(" "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/HeartsRequired.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/HeartsRequired.cs new file mode 100644 index 00000000..f4d71130 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/HeartsRequired.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class HeartsRequired:EventPrecondition + { + public NPC npc; + public int amount; + + + public HeartsRequired() + { + + } + + public HeartsRequired(NPC NPC, int Amount) + { + this.npc = NPC; + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_HeartsRequired(); + } + + /// + /// Gets the amount of hearts required for this event to occur. + /// + /// + public string precondition_HeartsRequired() + { + StringBuilder b = new StringBuilder(); + b.Append("f "); + b.Append(this.npc.Name); + b.Append(" "); + int hearts = this.amount * 250; + b.Append(hearts.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NPCInThisLocation.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NPCInThisLocation.cs new file mode 100644 index 00000000..9efc48a1 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NPCInThisLocation.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class NPCInThisLocation + { + + public NPC npc; + + public NPCInThisLocation() + { + + } + + public NPCInThisLocation(NPC NPC) + { + this.npc = NPC; + } + + public override string ToString() + { + return this.precondition_npcInPlayersLocation(); + } + + + /// + /// The given npc must be in the same game location as the player. + /// + /// + /// + public string precondition_npcInPlayersLocation() + { + StringBuilder b = new StringBuilder(); + b.Append("p "); + b.Append(this.npc.Name); + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotInvisible.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotInvisible.cs new file mode 100644 index 00000000..e41fa870 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotInvisible.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class NotInvisible:EventPrecondition + { + + public NPC npc; + public NotInvisible() + { + + } + public NotInvisible(NPC npc) + { + this.npc = npc; + } + + public override string ToString() + { + return this.precondition_npcNotInvisible(); + } + + /// + /// Creates a precondition where the npc is not invisible. (Probably that you can find them in the game world. + /// + /// + /// + public string precondition_npcNotInvisible() + { + StringBuilder b = new StringBuilder(); + b.Append("v "); + b.Append(this.npc.Name); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotMarriedTo.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotMarriedTo.cs new file mode 100644 index 00000000..6b77c845 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/NPCSpecific/NotMarriedTo.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using StardewValley; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific +{ + public class NotMarriedTo:EventPrecondition + { + + public NPC npc; + + public NotMarriedTo() + { + + } + + public NotMarriedTo(NPC npc) + { + this.npc = npc; + } + + public override string ToString() + { + return this.precondition_playerNotMarriedToThisNPC(); + } + + /// + /// Current player is not married to that NPC. + /// + /// + /// + public string precondition_playerNotMarriedToThisNPC() + { + StringBuilder b = new StringBuilder(); + b.Append("o "); + b.Append(this.npc.Name); + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/AnsweredDialogueOptions.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/AnsweredDialogueOptions.cs new file mode 100644 index 00000000..4af64eb5 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/AnsweredDialogueOptions.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class AnsweredDialogueOptions:EventPrecondition + { + public List answeredOptions; + + public AnsweredDialogueOptions() + { + this.answeredOptions = new List(); + } + + public AnsweredDialogueOptions(string Options) + { + this.answeredOptions = new List(); + this.answeredOptions.Add(Options); + } + + public AnsweredDialogueOptions(List Options) + { + this.answeredOptions = Options.ToList(); + } + + public override string ToString() + { + return this.precondition_answeredDialogueOptions(); + } + + /// + /// The player has answered with the dialogue options of these choices. + /// + /// + /// + public string precondition_answeredDialogueOptions() + { + StringBuilder b = new StringBuilder(); + b.Append("q "); + for (int i = 0; i < this.answeredOptions.Count; i++) + { + b.Append(this.answeredOptions[i]); + if (i != this.answeredOptions.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/CurrentMoney.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/CurrentMoney.cs new file mode 100644 index 00000000..dd1fd629 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/CurrentMoney.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class CurrentMoney:EventPrecondition + { + + public int amount; + + public CurrentMoney() + { + + } + + public CurrentMoney(int Amount) + { + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_playerHasThisMuchMoney(); + } + + /// + /// Adds in the precondition that the player has atleast this much money. + /// + /// + /// + public string precondition_playerHasThisMuchMoney() + { + StringBuilder b = new StringBuilder(); + b.Append("M "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/DaysPlayedFor.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/DaysPlayedFor.cs new file mode 100644 index 00000000..0150b349 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/DaysPlayedFor.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class DaysPlayedFor:EventPrecondition + { + /// + /// The minimum amount of days that must be played for this event to occur. + /// + public int amount; + + public DaysPlayedFor() + { + + } + + + public DaysPlayedFor(int Amount) + { + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_playerHasPlayedForXDays(); + } + + /// + /// Player has played for atleast this many days. + /// + /// + /// + public string precondition_playerHasPlayedForXDays() + { + StringBuilder b = new StringBuilder(); + b.Append("j "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/EmptyInventorySlots.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/EmptyInventorySlots.cs new file mode 100644 index 00000000..ce81005a --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/EmptyInventorySlots.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class EmptyInventorySlots:EventPrecondition + { + + public int amount; + + public EmptyInventorySlots() + { + + } + + public EmptyInventorySlots(int Amount) + { + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_playerHasInventorySlotsFree(); + } + + /// + /// Creates the precondition that the player has atleast this many inventory slots free for the event. + /// + /// + public string precondition_playerHasInventorySlotsFree() + { + StringBuilder b = new StringBuilder(); + b.Append("c "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/Gender.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/Gender.cs new file mode 100644 index 00000000..5e2fd150 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/Gender.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class Gender:EventPrecondition + { + public bool isMale; + + + public Gender() + { + + } + + public Gender(bool IsMale) + { + this.isMale = IsMale; + } + + public override string ToString() + { + if (this.isMale) + { + return this.precondition_playerIsMale(); + } + else + { + return this.precondition_playerIsFemale(); + } + } + + /// + /// 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(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasItem.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasItem.cs new file mode 100644 index 00000000..f51734b9 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasItem.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class HasItem:EventPrecondition + { + + public int id; + + public HasItem() + { + + } + + public HasItem(int ID) + { + this.id = ID; + } + + + public override string ToString() + { + return this.precondition_playerHasItem(); + } + + + /// + /// Player has the item with the given id. Parent sheet index? + /// + /// + /// + public string precondition_playerHasItem() + { + StringBuilder b = new StringBuilder(); + b.Append("i "); + b.Append(this.id.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasNotRecievedLetter.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasNotRecievedLetter.cs new file mode 100644 index 00000000..9bd38f98 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasNotRecievedLetter.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class HasNotRecievedLetter:EventPrecondition + { + + public string id; + + public HasNotRecievedLetter() + { + + } + + public HasNotRecievedLetter(string ID) + { + this.id = ID; + } + + public override string ToString() + { + return this.precondition_playerHasNotRecievedLetter(); + } + + /// + /// The player has not seen the letter with the given id. + /// + /// + /// + public string precondition_playerHasNotRecievedLetter() + { + StringBuilder b = new StringBuilder(); + b.Append("l "); + b.Append(this.id.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasRecievedLetter.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasRecievedLetter.cs new file mode 100644 index 00000000..5415c8cc --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/HasRecievedLetter.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.PlayerSpecific +{ + public class HasRecievedLetter:EventPrecondition + { + public string id; + + + public HasRecievedLetter() + { + + } + + public HasRecievedLetter(string ID) + { + this.id = ID; + } + + public override string ToString() + { + return this.precondition_playerHasRecievedLetter(); + } + + /// + /// The player has seen the letter with the given id. + /// + /// + /// + public string precondition_playerHasRecievedLetter() + { + StringBuilder b = new StringBuilder(); + b.Append("n "); + b.Append(this.id.ToString()); + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/MineBottomHit.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/MineBottomHit.cs new file mode 100644 index 00000000..86856f11 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/MineBottomHit.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class MineBottomHit:EventPrecondition + { + public int amount; + + public MineBottomHit() + { + + } + + public MineBottomHit(int Amount) + { + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_playerHasReachedMineBottomXTimes(); + } + + + /// + /// Creates the precondition that the player has reached the bottom of the mines this many times. + /// + /// + /// + public string precondition_playerHasReachedMineBottomXTimes() + { + StringBuilder b = new StringBuilder(); + b.Append("b "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PetPreference.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PetPreference.cs new file mode 100644 index 00000000..e0f23876 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PetPreference.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class PetPreference:EventPrecondition + { + public bool wantsDog; + + public PetPreference() + { + + } + + public PetPreference(bool WantsDog) + { + this.wantsDog = WantsDog; + } + + public override string ToString() + { + if (this.wantsDog) + { + return this.precondition_playerWantsDog(); + } + else + { + return this.precondition_playerWantsCat(); + } + } + + + /// + /// 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(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PlayerOnThisTile.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PlayerOnThisTile.cs new file mode 100644 index 00000000..00c69256 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/PlayerOnThisTile.cs @@ -0,0 +1,61 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Xna.Framework; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class PlayerOnThisTile:EventPrecondition + { + public int x; + public int y; + + public PlayerOnThisTile() + { + + } + + public PlayerOnThisTile(int x, int y) + { + this.x = x; + this.y = y; + } + + public PlayerOnThisTile(Vector2 vec) + { + this.x = (int)vec.X; + this.y = (int)vec.Y; + } + + public PlayerOnThisTile(Point Point) + { + this.x = Point.X; + this.y = Point.Y; + } + + public override string ToString() + { + return this.precondition_playerOnThisTile(); + } + + /// + /// Creates the precondition that the player must be standing on this tile. + /// + /// + /// + /// + public string precondition_playerOnThisTile() + { + StringBuilder b = new StringBuilder(); + b.Append("a "); + b.Append(this.x.ToString()); + b.Append(" "); + b.Append(this.y.ToString()); + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenEvents.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenEvents.cs new file mode 100644 index 00000000..1a7ab2f5 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenEvents.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class SeenEvents:EventPrecondition + { + + public List seenEvents; + + public SeenEvents() + { + this.seenEvents = new List(); + } + + public SeenEvents(string ID) + { + this.seenEvents.Add(ID); + } + + public SeenEvents(List IDS) + { + this.seenEvents = IDS.ToList(); + } + + public override string ToString() + { + return this.precondition_playerHasSeenEvents(); + } + + /// + /// Current player has seen the specified events. + /// + /// + /// + public string precondition_playerHasSeenEvents() + { + StringBuilder b = new StringBuilder(); + b.Append("e "); + for (int i = 0; i < this.seenEvents.Count; i++) + { + b.Append(this.seenEvents[i]); + if (i != this.seenEvents.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenSecretNote.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenSecretNote.cs new file mode 100644 index 00000000..14ff9463 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/SeenSecretNote.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class SeenSecretNote:EventPrecondition + { + + public string id; + + public SeenSecretNote() + { + + } + + public SeenSecretNote(string ID) + { + this.id = ID; + } + + public override string ToString() + { + return this.precondition_playerHasThisSecretNote(); + } + + /// + /// Adds in the precondition that the player has this secret note. + /// + /// + /// + public string precondition_playerHasThisSecretNote() + { + StringBuilder b = new StringBuilder(); + b.Append("S "); + b.Append(this.id.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/ShippedItems.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/ShippedItems.cs new file mode 100644 index 00000000..bb0b0ee6 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/ShippedItems.cs @@ -0,0 +1,63 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class ShippedItems:EventPrecondition + { + + public List> shippedItems; + + public ShippedItems() + { + this.shippedItems = new List>(); + } + + public ShippedItems(int id, int amount) + { + this.shippedItems.Add(new KeyValuePair(id, amount)); + } + + public ShippedItems(List> ShippedItems) + { + this.shippedItems = ShippedItems.ToList(); + } + + public override string ToString() + { + return this.precondition_playerHasShippedTheseItems(); + } + + /// + /// 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() + { + StringBuilder b = new StringBuilder(); + b.Append("s "); + for (int i = 0; i < this.shippedItems.Count; i++) + { + + int ID = this.shippedItems[i].Key; + int Amount = this.shippedItems[i].Value; + b.Append(ID); + b.Append(" "); + b.Append(Amount.ToString()); + + if (i != this.shippedItems.Count - 1) + { + b.Append(" "); + } + } + + + return b.ToString(); + } + + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/TotalMoneyEarned.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/TotalMoneyEarned.cs new file mode 100644 index 00000000..64faff19 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/TotalMoneyEarned.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class TotalMoneyEarned:EventPrecondition + { + + public int amount; + + public TotalMoneyEarned() + { + + } + + public TotalMoneyEarned(int Amount) + { + this.amount = Amount; + } + + public override string ToString() + { + return this.precondition_playerEarnedMoneyTotal(); + } + + /// + /// Current player has earned at least this much money (regardless of how much they currently have). + /// + /// + /// + public string precondition_playerEarnedMoneyTotal() + { + StringBuilder b = new StringBuilder(); + b.Append("m "); + b.Append(this.amount.ToString()); + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/UnseenEvents.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/UnseenEvents.cs new file mode 100644 index 00000000..57a01d51 --- /dev/null +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/PlayerSpecific/UnseenEvents.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific +{ + public class UnseenEvents:EventPrecondition + { + public List unseenEvents; + + public UnseenEvents() + { + this.unseenEvents = new List(); + } + + public UnseenEvents(string ID) + { + this.unseenEvents.Add(ID); + } + + public UnseenEvents(List IDS) + { + this.unseenEvents = IDS.ToList(); + } + + public override string ToString() + { + return this.precondition_playerHasNotSeenEvents(); + } + + /// + /// Current player has seen the specified events. + /// + /// + /// + public string precondition_playerHasNotSeenEvents() + { + StringBuilder b = new StringBuilder(); + b.Append("k "); + for (int i = 0; i < this.unseenEvents.Count; i++) + { + b.Append(this.unseenEvents[i]); + if (i != this.unseenEvents.Count - 1) + { + b.Append(" "); + } + } + return b.ToString(); + } + } +} diff --git a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs index 1d786c0e..d54a7de4 100644 --- a/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs +++ b/GeneralMods/HappyBirthday/Framework/Events/Preconditions/TimeSpecific/WeatherPrecondition.cs @@ -49,6 +49,21 @@ namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific return b.ToString(); } + public override string ToString() + { + if(this.weather== Weather.Sunny) + { + return this.precondition_sunnyWeather(); + } + + if(this.weather== Weather.Rainy) + { + return this.precondition_rainyWeather(); + } + + return ""; + } + //Experimental weather checks. May or may not be used when checking for when to use an event. }