Finished moving events to a seperate class for more flexibility.

This commit is contained in:
JoshuaNavarro 2019-12-04 01:04:20 -08:00
parent 717900d3e3
commit ac5e291492
27 changed files with 1198 additions and 501 deletions

View File

@ -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.
/// </summary>
/// <param name="Data"></param>
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
/// </summary>
/// <param name="Dir"></param>
/// <returns></returns>
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.
/// </summary>
/// <returns></returns>
public string getSeperator()
public virtual string getSeperator()
{
return "/";
}
@ -149,7 +145,7 @@ namespace Omegasis.HappyBirthday.Framework.Events
/// </summary>
/// <param name="IDToCheck"></param>
/// <returns></returns>
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
/// </summary>
/// <param name="IDToCheck"></param>
/// <returns></returns>
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
/// <summary>
/// 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."
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_EventNotInProgress(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("A ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Creates a precondition where the event has a specific amount chance to occur.
/// </summary>
/// <param name="Amount">The chance to occur between 0 and 1. .45 would be a 45% chance to occur.</param>
/// <returns></returns>
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();
}
/// <summary>
/// Creates a precondition where the npc is not invisible. (Probably that you can find them in the game world.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_npcNotInvisible(NPC npc)
{
StringBuilder b = new StringBuilder();
b.Append("v ");
b.Append(npc.Name);
return b.ToString();
}
/// <summary>
/// Creates a precondition that the current player must be dating the current npc.
/// </summary>
/// <param name="NPC"></param>
/// <returns></returns>
public string precondition_DatingNPC(NPC NPC)
{
StringBuilder b = new StringBuilder();
b.Append("D ");
b.Append(NPC.Name);
return b.ToString();
}
/// <summary>
/// Adds in the precondition that the joja warehouse has been completed.
/// </summary>
/// <returns></returns>
public string precondition_JojaWarehouseCompleted()
{
StringBuilder b = new StringBuilder();
b.Append("J");
return b.ToString();
}
/// <summary>
/// Adds in the precondition that the player has atleast this much money.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasThisMuchMoney(int Amount)
{
StringBuilder b = new StringBuilder();
b.Append("M ");
b.Append(Amount.ToString());
return b.ToString();
}
/// <summary>
/// Adds in the precondition that the player has this secret note.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasThisSecretNote(int ID)
{
StringBuilder b = new StringBuilder();
b.Append("S ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Creates the precondition that the player must be standing on this tile.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Creates the precondition that the player must be standing on this tile.
/// </summary>
/// <param name="Position"></param>
/// <returns></returns>
public string precondition_playerOnThisTile(Vector2 Position)
{
return this.precondition_playerOnThisTile((int)Position.X, (int)Position.Y);
}
/// <summary>
/// Creates the precondition that the player must be standing on this tile.
/// </summary>
/// <param name="Position"></param>
/// <returns></returns>
public string precondition_playerOnThisTile(Point Position)
{
return this.precondition_playerOnThisTile(Position.X, Position.Y);
}
/// <summary>
/// Creates the precondition that the player has reached the bottom of the mines this many times.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasReachedMineBottomXTimes(int Amount)
{
StringBuilder b = new StringBuilder();
b.Append("b ");
b.Append(Amount.ToString());
return b.ToString();
}
/// <summary>
/// Creates the precondition that the player has atleast this many inventory slots free for the event.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasInventorySlotsFree(int Amount)
{
StringBuilder b = new StringBuilder();
b.Append("c ");
b.Append(Amount.ToString());
return b.ToString();
}
/// <summary>
/// Current player has seen the specified event .
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasSeenEvent(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("e ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Current player has seen the specified events.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
public string precondition_playerHasSeenEvents(List<string> 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();
}
/// <summary>
/// Gets the amount of friedship points required for this event to occur.
/// </summary>
/// <param name="Npc"></param>
/// <param name="Points"></param>
/// <returns></returns>
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();
}
/// <summary>
/// Gets the amount of hearts required for this event to occur.
/// </summary>
/// <param name="Points"></param>
/// <param name="Npc"></param>
/// <returns></returns>
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();
}
/// <summary>
/// The player must be male to view this event.
/// </summary>
/// <returns></returns>
public string precondition_playerIsMale()
{
StringBuilder b = new StringBuilder();
b.Append("g ");
b.Append("0");
return b.ToString();
}
/// <summary>
/// The player must be female to view this event.
/// </summary>
/// <returns></returns>
public string precondition_playerIsFemale()
{
StringBuilder b = new StringBuilder();
b.Append("g ");
b.Append("1");
return b.ToString();
}
/// <summary>
/// Condition: The player has no pet and wants a cat.
/// </summary>
/// <returns></returns>
public string precondition_playerWantsCat()
{
StringBuilder b = new StringBuilder();
b.Append("h ");
b.Append("cat");
return b.ToString();
}
/// <summary>
/// Condition: The player has no pet and wants a dog.
/// </summary>
/// <returns></returns>
public string precondition_playerWantsDog()
{
StringBuilder b = new StringBuilder();
b.Append("h ");
b.Append("dog");
return b.ToString();
}
/// <summary>
/// Player has the item with the given id. Parent sheet index?
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasItem(int ID)
{
StringBuilder b = new StringBuilder();
b.Append("i ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Player has played for atleast this many days.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasPlayedForXDays(int Amount)
{
StringBuilder b = new StringBuilder();
b.Append("j ");
b.Append(Amount.ToString());
return b.ToString();
}
/// <summary>
/// The player has not seen the event.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasNotSeenEvent(int ID)
{
StringBuilder b = new StringBuilder();
b.Append("k ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// The player has not seen these events.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
public string precondition_playerHasNotSeenEvents(List<string> 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();
}
/// <summary>
/// The player has not seen the letter with the given id.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasNotRecievedLetter(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("l ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Current player has earned at least this much money (regardless of how much they currently have).
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerEarnedMoneyTotal(int Amount)
{
StringBuilder b = new StringBuilder();
b.Append("m ");
b.Append(Amount.ToString());
return b.ToString();
}
/// <summary>
/// The player has seen the letter with the given id.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasRecievedLetter(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("n ");
b.Append(ID.ToString());
return b.ToString();
}
/// <summary>
/// Current player is not married to that NPC.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_playerNotMarriedToThisNPC(NPC npc)
{
StringBuilder b = new StringBuilder();
b.Append("o ");
b.Append(npc.Name);
return b.ToString();
}
/// <summary>
/// The given npc must be in the same game location as the player.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_npcInPlayersLocation(NPC npc)
{
StringBuilder b = new StringBuilder();
b.Append("p ");
b.Append(npc.Name);
return b.ToString();
}
/// <summary>
/// The player has answered with the dialogue option of this choice.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_answeredDialogueOption(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("q ");
b.Append(ID);
return b.ToString();
}
/// <summary>
/// The player has answered with the dialogue options of these choices.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
public string precondition_answeredDialogueOptions(List<string> 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();
}
/// <summary>
/// Current player has shipped at least <Amount> of the specified item. Can specify multiple item and number pairs, in which case all of them must be met.
/// </summary>
/// <param name="ID">The id of the item. Parent sheet index?</param>
/// <param name="Amount">The amount shipped.</param>
/// <returns></returns>
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();
}
/// <summary>
/// Current player has shipped at least <Amount> of the specified item. Can specify multiple item and number pairs, in which case all of them must be met.
/// </summary>
/// <param name="Pairs"></param>
/// <returns></returns>
public string precondition_playerHasShippedTheseItems(List<KeyValuePair<int,int>> 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
}
}

View File

@ -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();
}
/// <summary>
/// Creates a precondition where the event has a specific amount chance to occur.
/// </summary>
/// <param name="Amount">The chance to occur between 0 and 1. .45 would be a 45% chance to occur.</param>
/// <returns></returns>
public string precondition_chanceToOccur()
{
StringBuilder b = new StringBuilder();
b.Append("r ");
b.Append(this.chance.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// 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."
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_EventNotInProgress()
{
StringBuilder b = new StringBuilder();
b.Append("A ");
b.Append(this.id.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Adds in the precondition that the joja warehouse has been completed.
/// </summary>
/// <returns></returns>
public string precondition_JojaWarehouseCompleted()
{
StringBuilder b = new StringBuilder();
b.Append("J");
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Creates a precondition that the current player must be dating the current npc.
/// </summary>
/// <returns></returns>
public string precondition_DatingNPC()
{
StringBuilder b = new StringBuilder();
b.Append("D ");
b.Append(this.npc.Name);
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Gets the amount of friedship points required for this event to occur.
/// </summary>
/// <returns></returns>
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();
}
}
}

View File

@ -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();
}
/// <summary>
/// Gets the amount of hearts required for this event to occur.
/// </summary>
/// <returns></returns>
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();
}
}
}

View File

@ -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();
}
/// <summary>
/// The given npc must be in the same game location as the player.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_npcInPlayersLocation()
{
StringBuilder b = new StringBuilder();
b.Append("p ");
b.Append(this.npc.Name);
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Creates a precondition where the npc is not invisible. (Probably that you can find them in the game world.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_npcNotInvisible()
{
StringBuilder b = new StringBuilder();
b.Append("v ");
b.Append(this.npc.Name);
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Current player is not married to that NPC.
/// </summary>
/// <param name="npc"></param>
/// <returns></returns>
public string precondition_playerNotMarriedToThisNPC()
{
StringBuilder b = new StringBuilder();
b.Append("o ");
b.Append(this.npc.Name);
return b.ToString();
}
}
}

View File

@ -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<string> answeredOptions;
public AnsweredDialogueOptions()
{
this.answeredOptions = new List<string>();
}
public AnsweredDialogueOptions(string Options)
{
this.answeredOptions = new List<string>();
this.answeredOptions.Add(Options);
}
public AnsweredDialogueOptions(List<string> Options)
{
this.answeredOptions = Options.ToList();
}
public override string ToString()
{
return this.precondition_answeredDialogueOptions();
}
/// <summary>
/// The player has answered with the dialogue options of these choices.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -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();
}
/// <summary>
/// Adds in the precondition that the player has atleast this much money.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasThisMuchMoney()
{
StringBuilder b = new StringBuilder();
b.Append("M ");
b.Append(this.amount.ToString());
return b.ToString();
}
}
}

View File

@ -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
{
/// <summary>
/// The minimum amount of days that must be played for this event to occur.
/// </summary>
public int amount;
public DaysPlayedFor()
{
}
public DaysPlayedFor(int Amount)
{
this.amount = Amount;
}
public override string ToString()
{
return this.precondition_playerHasPlayedForXDays();
}
/// <summary>
/// Player has played for atleast this many days.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasPlayedForXDays()
{
StringBuilder b = new StringBuilder();
b.Append("j ");
b.Append(this.amount.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Creates the precondition that the player has atleast this many inventory slots free for the event.
/// </summary>
/// <returns></returns>
public string precondition_playerHasInventorySlotsFree()
{
StringBuilder b = new StringBuilder();
b.Append("c ");
b.Append(this.amount.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
}
/// <summary>
/// The player must be male to view this event.
/// </summary>
/// <returns></returns>
public string precondition_playerIsMale()
{
StringBuilder b = new StringBuilder();
b.Append("g ");
b.Append("0");
return b.ToString();
}
/// <summary>
/// The player must be female to view this event.
/// </summary>
/// <returns></returns>
public string precondition_playerIsFemale()
{
StringBuilder b = new StringBuilder();
b.Append("g ");
b.Append("1");
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Player has the item with the given id. Parent sheet index?
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasItem()
{
StringBuilder b = new StringBuilder();
b.Append("i ");
b.Append(this.id.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// The player has not seen the letter with the given id.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasNotRecievedLetter()
{
StringBuilder b = new StringBuilder();
b.Append("l ");
b.Append(this.id.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// The player has seen the letter with the given id.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasRecievedLetter()
{
StringBuilder b = new StringBuilder();
b.Append("n ");
b.Append(this.id.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Creates the precondition that the player has reached the bottom of the mines this many times.
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerHasReachedMineBottomXTimes()
{
StringBuilder b = new StringBuilder();
b.Append("b ");
b.Append(this.amount.ToString());
return b.ToString();
}
}
}

View File

@ -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();
}
}
/// <summary>
/// Condition: The player has no pet and wants a cat.
/// </summary>
/// <returns></returns>
public string precondition_playerWantsCat()
{
StringBuilder b = new StringBuilder();
b.Append("h ");
b.Append("cat");
return b.ToString();
}
/// <summary>
/// Condition: The player has no pet and wants a dog.
/// </summary>
/// <returns></returns>
public string precondition_playerWantsDog()
{
StringBuilder b = new StringBuilder();
b.Append("h ");
b.Append("dog");
return b.ToString();
}
}
}

View File

@ -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();
}
/// <summary>
/// Creates the precondition that the player must be standing on this tile.
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -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<string> seenEvents;
public SeenEvents()
{
this.seenEvents = new List<string>();
}
public SeenEvents(string ID)
{
this.seenEvents.Add(ID);
}
public SeenEvents(List<string> IDS)
{
this.seenEvents = IDS.ToList();
}
public override string ToString()
{
return this.precondition_playerHasSeenEvents();
}
/// <summary>
/// Current player has seen the specified events.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -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();
}
/// <summary>
/// Adds in the precondition that the player has this secret note.
/// </summary>
/// <param name="ID"></param>
/// <returns></returns>
public string precondition_playerHasThisSecretNote()
{
StringBuilder b = new StringBuilder();
b.Append("S ");
b.Append(this.id.ToString());
return b.ToString();
}
}
}

View File

@ -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<KeyValuePair<int, int>> shippedItems;
public ShippedItems()
{
this.shippedItems = new List<KeyValuePair<int, int>>();
}
public ShippedItems(int id, int amount)
{
this.shippedItems.Add(new KeyValuePair<int, int>(id, amount));
}
public ShippedItems(List<KeyValuePair<int,int>> ShippedItems)
{
this.shippedItems = ShippedItems.ToList();
}
public override string ToString()
{
return this.precondition_playerHasShippedTheseItems();
}
/// <summary>
/// Current player has shipped at least <Amount> of the specified item. Can specify multiple item and number pairs, in which case all of them must be met.
/// </summary>
/// <param name="Pairs"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -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();
}
/// <summary>
/// Current player has earned at least this much money (regardless of how much they currently have).
/// </summary>
/// <param name="Amount"></param>
/// <returns></returns>
public string precondition_playerEarnedMoneyTotal()
{
StringBuilder b = new StringBuilder();
b.Append("m ");
b.Append(this.amount.ToString());
return b.ToString();
}
}
}

View File

@ -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<string> unseenEvents;
public UnseenEvents()
{
this.unseenEvents = new List<string>();
}
public UnseenEvents(string ID)
{
this.unseenEvents.Add(ID);
}
public UnseenEvents(List<string> IDS)
{
this.unseenEvents = IDS.ToList();
}
public override string ToString()
{
return this.precondition_playerHasNotSeenEvents();
}
/// <summary>
/// Current player has seen the specified events.
/// </summary>
/// <param name="IDS"></param>
/// <returns></returns>
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();
}
}
}

View File

@ -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.
}