From e190c9e66452a9e6ece41289c8c2035233f70775 Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Wed, 4 Dec 2019 14:11:38 -0800 Subject: [PATCH] Added in more event data to the event helper class. --- .../Framework/Events/EventHelper.cs | 280 +++++++++++++++++- 1 file changed, 278 insertions(+), 2 deletions(-) diff --git a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs index 554418d0..fc1c6715 100644 --- a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs +++ b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs @@ -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; } + /// + /// Gets the layer string from the Layer enum. + /// + /// + /// + 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 ""; + } + /// /// Gets the even parsing seperator. /// @@ -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); } + /// + /// Adds a temporary sprite at the specified tile from the Maps\springobjects.png sprite sheet. + /// + /// + /// + /// + /// + 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); + } + + /// + /// Adds a temporary sprite at the specified tile from the Maps\springobjects.png sprite sheet. + /// + /// + /// + /// + /// + 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); + } + + /// + /// Add a solid prop from the current festival texture. Default solid width/height is 1. Default display height is solid height. + /// + /// + /// + /// + /// + /// + /// + 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); + } + + /// + /// Add the specified quest to the quest log. + /// + /// + public virtual void addQuest(int QuestID) + { + StringBuilder b = new StringBuilder(); + b.Append("addQuest "); + b.Append(QuestID.ToString()); + this.add(b); + } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + 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); + } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + /// + 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); + } + + /// + /// 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. + /// + /// + /// + /// + /// + /// + /// + /// + 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); + } + + /// + /// Places on object on the furniture at a position. If the location is FarmHouse, then it will always be placed on the initial table. + /// + /// + /// + /// + 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); + } + + /// + /// Adds the Return Scepter to the player's inventory. + /// + public virtual void addTool_ReturnScepter() + { + StringBuilder b = new StringBuilder(); + b.Append("addTool Wand"); + this.add(b); + } + + /// + /// 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/ + /// + /// + /// + /// + public virtual void advanceMove(NPC npc, bool Loop, List 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); + } + + /// + /// 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. + /// + /// + /// + /// + 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); + } + + /// + /// 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. + /// + /// + public virtual void setAmbientLight(Color color) + { + this.setAmbientLight(color.R, color.G, color.B); + } }