Added in more event data to the event helper class.

This commit is contained in:
JoshuaNavarro 2019-12-04 14:11:38 -08:00
parent 7e17ae90a7
commit e190c9e664
1 changed files with 278 additions and 2 deletions

View File

@ -33,6 +33,15 @@ namespace Omegasis.HappyBirthday.Framework.Events
Left
}
public enum Layers
{
Back,
Paths,
Buildings,
Front,
AlwaysFront
}
protected StringBuilder eventData;
protected StringBuilder eventPreconditionData;
@ -118,6 +127,21 @@ namespace Omegasis.HappyBirthday.Framework.Events
return (int)Dir;
}
/// <summary>
/// Gets the layer string from the Layer enum.
/// </summary>
/// <param name="Layer"></param>
/// <returns></returns>
protected virtual string getLayerName(Layers Layer)
{
if (Layer == Layers.AlwaysFront) return "AlwaysFront";
if (Layer == Layers.Back) return "Back";
if (Layer == Layers.Buildings) return "Buildings";
if (Layer == Layers.Front) return "Front";
if (Layer == Layers.Paths) return "Paths";
return "";
}
/// <summary>
/// Gets the even parsing seperator.
/// </summary>
@ -181,7 +205,8 @@ namespace Omegasis.HappyBirthday.Framework.Events
{
if (this.canEventOccur())
{
Game1.player.currentLocation.currentEvent = this.getEvent();
//Game1.player.currentLocation.currentEvent = this.getEvent();
Game1.player.currentLocation.startEvent(this.getEvent());
}
}
@ -310,11 +335,262 @@ namespace Omegasis.HappyBirthday.Framework.Events
protected virtual void addMailReceived(string ID)
{
StringBuilder b = new StringBuilder();
b.Append("addMailReceived ");
b.Append("addMailReceived ");
b.Append(ID);
this.add(b);
}
/// <summary>
/// Adds a temporary sprite at the specified tile from the Maps\springobjects.png sprite sheet.
/// </summary>
/// <param name="XTile"></param>
/// <param name="YTile"></param>
/// <param name="ParentSheetIndex"></param>
/// <param name="Layer"></param>
protected virtual void addObject(int XTile, int YTile, int ParentSheetIndex, string Layer)
{
StringBuilder b = new StringBuilder();
b.Append("addObject ");
b.Append(XTile.ToString());
b.Append(" ");
b.Append(YTile.ToString());
b.Append(" ");
b.Append(Layer);
this.add(b);
}
/// <summary>
/// Adds a temporary sprite at the specified tile from the Maps\springobjects.png sprite sheet.
/// </summary>
/// <param name="XTile"></param>
/// <param name="YTile"></param>
/// <param name="ParentSheetIndex"></param>
/// <param name="Layer"></param>
protected virtual void addObject(int XTile, int YTile, int ParentSheetIndex, Layers Layer)
{
StringBuilder b = new StringBuilder();
b.Append("addObject ");
b.Append(XTile.ToString());
b.Append(" ");
b.Append(YTile.ToString());
b.Append(" ");
b.Append(this.getLayerName(Layer));
this.add(b);
}
/// <summary>
/// Add a solid prop from the current festival texture. Default solid width/height is 1. Default display height is solid height.
/// </summary>
/// <param name="Index"></param>
/// <param name="XTile"></param>
/// <param name="YTile"></param>
/// <param name="SolidWidth"></param>
/// <param name="SolidHeight"></param>
/// <param name="DisplayHeight"></param>
protected virtual void addProp(int Index, int XTile, int YTile, int SolidWidth, int SolidHeight, int DisplayHeight)
{
StringBuilder b = new StringBuilder();
b.Append("addProp ");
b.Append(Index.ToString());
b.Append(" ");
b.Append(XTile.ToString());
b.Append(" ");
b.Append(YTile.ToString());
b.Append(" ");
b.Append(SolidWidth.ToString());
b.Append(" ");
b.Append(SolidHeight.ToString());
b.Append(" ");
b.Append(DisplayHeight.ToString());
this.add(b);
}
/// <summary>
/// Add the specified quest to the quest log.
/// </summary>
/// <param name="QuestID"></param>
public virtual void addQuest(int QuestID)
{
StringBuilder b = new StringBuilder();
b.Append("addQuest ");
b.Append(QuestID.ToString());
this.add(b);
}
/// <summary>
/// Add a temporary actor. 'breather' is boolean. The category determines where the texture will be loaded from, default is Character. Animal name only applies to animal.
/// </summary>
/// <param name="npc"></param>
/// <param name="SpriteWidth"></param>
/// <param name="SpriteHeight"></param>
/// <param name="TileX"></param>
/// <param name="TileY"></param>
/// <param name="Direction"></param>
/// <param name="Breather"></param>
public virtual void addTemporaryActor_NPC(NPC npc, int SpriteWidth, int SpriteHeight, int TileX, int TileY, FacingDirection Direction, bool Breather)
{
StringBuilder b = new StringBuilder();
b.Append("addTemporaryActor ");
b.Append(npc.Name);
b.Append(" ");
b.Append(SpriteWidth.ToString());
b.Append(" ");
b.Append(SpriteHeight.ToString());
b.Append(" ");
b.Append(TileX.ToString());
b.Append(" ");
b.Append(TileY.ToString());
b.Append(" ");
b.Append(Direction);
b.Append(" ");
b.Append("Character");
this.add(b);
}
/// <summary>
/// Add a temporary actor. 'breather' is boolean. The category determines where the texture will be loaded from, default is Character. Animal name only applies to animal.
/// </summary>
/// <param name="character"></param>
/// <param name="SpriteWidth"></param>
/// <param name="SpriteHeight"></param>
/// <param name="TileX"></param>
/// <param name="TileY"></param>
/// <param name="Direction"></param>
/// <param name="Breather"></param>
/// <param name="AnimalName"></param>
public virtual void addTemporaryActor_Animal(string character, int SpriteWidth, int SpriteHeight, int TileX, int TileY, FacingDirection Direction, bool Breather,string AnimalName)
{
StringBuilder b = new StringBuilder();
b.Append("addTemporaryActor ");
b.Append(character);
b.Append(" ");
b.Append(SpriteWidth.ToString());
b.Append(" ");
b.Append(SpriteHeight.ToString());
b.Append(" ");
b.Append(TileX.ToString());
b.Append(" ");
b.Append(TileY.ToString());
b.Append(" ");
b.Append(Direction);
b.Append(" ");
b.Append("Animal");
b.Append(" ");
b.Append(AnimalName);
this.add(b);
}
/// <summary>
/// Add a temporary actor. 'breather' is boolean. The category determines where the texture will be loaded from, default is Character. Animal name only applies to animal.
/// </summary>
/// <param name="character"></param>
/// <param name="SpriteWidth"></param>
/// <param name="SpriteHeight"></param>
/// <param name="TileX"></param>
/// <param name="TileY"></param>
/// <param name="Direction"></param>
/// <param name="Breather"></param>
public virtual void addTemporaryActor_Monster(string character, int SpriteWidth, int SpriteHeight, int TileX, int TileY, FacingDirection Direction, bool Breather)
{
StringBuilder b = new StringBuilder();
b.Append("addTemporaryActor ");
b.Append(character);
b.Append(" ");
b.Append(SpriteWidth.ToString());
b.Append(" ");
b.Append(SpriteHeight.ToString());
b.Append(" ");
b.Append(TileX.ToString());
b.Append(" ");
b.Append(TileY.ToString());
b.Append(" ");
b.Append(Direction);
b.Append(" ");
b.Append("Monster");
this.add(b);
}
/// <summary>
/// Places on object on the furniture at a position. If the location is FarmHouse, then it will always be placed on the initial table.
/// </summary>
/// <param name="XPosition"></param>
/// <param name="YPosition"></param>
/// <param name="ObjectParentSheetIndex"></param>
public virtual void addToTable(int XPosition, int YPosition, int ObjectParentSheetIndex)
{
StringBuilder b = new StringBuilder();
b.Append("addToTable ");
b.Append(XPosition);
b.Append(" ");
b.Append(YPosition);
b.Append(" ");
b.Append(ObjectParentSheetIndex);
this.add(b);
}
/// <summary>
/// Adds the Return Scepter to the player's inventory.
/// </summary>
public virtual void addTool_ReturnScepter()
{
StringBuilder b = new StringBuilder();
b.Append("addTool Wand");
this.add(b);
}
/// <summary>
/// Set multiple movements for an NPC. You can set True to have NPC walk the path continuously. Example: /advancedMove Robin false 0 3 2 0 0 2 -2 0 0 -2 2 0/
/// </summary>
/// <param name="npc"></param>
/// <param name="Loop"></param>
/// <param name="TilePoints"></param>
public virtual void advanceMove(NPC npc, bool Loop, List<Point> TilePoints)
{
StringBuilder b = new StringBuilder();
b.Append("advancedMove ");
b.Append(npc.Name);
b.Append(" ");
b.Append(Loop.ToString());
b.Append(" ");
for(int i = 0; i < TilePoints.Count; i++)
{
b.Append(TilePoints[i].X);
b.Append(" ");
b.Append(TilePoints[i].Y);
if (i != TilePoints.Count - 1)
{
b.Append(" ");
}
}
this.add(b);
}
/// <summary>
/// Modifies the ambient light level, with RGB values from 0 to 255. Note that it works by removing colors from the existing light ambience, so ambientLight 1 80 80 would reduce green and blue and leave the light with a reddish hue.
/// </summary>
/// <param name="r"></param>
/// <param name="g"></param>
/// <param name="b"></param>
public virtual void setAmbientLight(int r, int g, int b)
{
StringBuilder builder = new StringBuilder();
builder.Append("ambientLight ");
builder.Append(r);
builder.Append(" ");
builder.Append(g);
builder.Append(" ");
builder.Append(b);
this.add(builder);
}
/// <summary>
/// Modifies the ambient light level, with RGB values from 0 to 255. Note that it works by removing colors from the existing light ambience, so ambientLight 1 80 80 would reduce green and blue and leave the light with a reddish hue.
/// </summary>
/// <param name="color"></param>
public virtual void setAmbientLight(Color color)
{
this.setAmbientLight(color.R, color.G, color.B);
}
}