From 267ed77092207d56b4f4318e334963f979e8fedc Mon Sep 17 00:00:00 2001 From: JoshuaNavarro Date: Wed, 4 Dec 2019 16:50:23 -0800 Subject: [PATCH] Finished adding in what seemed to be important events. --- .../Framework/Events/EventHelper.cs | 425 ++++++++++++++++++ 1 file changed, 425 insertions(+) diff --git a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs index c1a3d95d..9ca4570e 100644 --- a/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs +++ b/GeneralMods/HappyBirthday/Framework/Events/EventHelper.cs @@ -11,8 +11,12 @@ using StardewValley; namespace Omegasis.HappyBirthday.Framework.Events { /// + ///TODO: Figure out forked dialogue + /// /// Helps in creating events based in code for stardew valley. /// https://stardewvalleywiki.com/Modding:Event_data + /// + /// A lot of the function comments were taken from the SDV wiki. /// public class EventHelper { @@ -1245,5 +1249,426 @@ namespace Omegasis.HappyBirthday.Framework.Events this.add(b); } + /// + /// Remove the first of an object from a player's inventory. + /// + /// + public virtual void removeItem(int ParentSheetIndex) { + + StringBuilder b = new StringBuilder(); + b.Append("removeItem "); + b.Append(ParentSheetIndex); + this.add(b); + } + /// + /// + /// + /// + /// + public virtual void removeObject(int TileX, int TileY) + { + StringBuilder b = new StringBuilder(); + b.Append("removeObject "); + b.Append(TileX); + b.Append(" "); + b.Append(TileY); + this.add(b); + } + + /// + /// Remove the specified quest from the quest log. + /// + /// + public virtual void removeQuest(int ID) + { + StringBuilder b = new StringBuilder(); + b.Append("removeQuest "); + b.Append(ID); + this.add(b); + } + + /// + /// Remove the temporary sprite at a position. + /// + /// + /// + public virtual void removeSprite(int XTile, int YTile) + { + StringBuilder b = new StringBuilder(); + b.Append("removeSprite "); + b.Append(" "); + b.Append(XTile); + b.Append(" "); + b.Append(YTile); + this.add(b); + } + + /// + /// Remove all temporary sprites. + /// + public virtual void removeTemporarySprites() + { + StringBuilder b = new StringBuilder(); + b.Append("removeTemporarySprites"); + this.add(b); + } + + /// + /// Flashes the screen white for an instant. An alpha value from 0 to 1 adjusts the brightness, and values from 1 and out flashes pure white for x seconds. + /// + /// + public virtual void screenFlash(float Alpha) + { + StringBuilder b = new StringBuilder(); + b.Append("screenFlash "); + b.Append(Alpha); + this.add(b); + } + + public virtual void setPlayerRunning() + { + StringBuilder b = new StringBuilder(); + b.Append("setRunning"); + this.add(b); + } + + public virtual void shakeNPC(NPC npc,int Milliseconds) + { + StringBuilder b = new StringBuilder(); + b.Append("shake "); + b.Append(npc.Name); + b.Append(" "); + b.Append(Milliseconds); + this.add(b); + } + + public virtual void shakeFarmer(int Milliseconds) + { + StringBuilder b = new StringBuilder(); + b.Append("shake "); + b.Append("farmer"); + b.Append(" "); + b.Append(Milliseconds); + this.add(b); + } + + /// + /// Set the named NPC's current frame in their Content\Characters\*.xnb spritesheet. Note that setting the farmer's sprite only changes parts of the sprite (some times arms, some times arms and legs and torso but not the head, etc). To rotate the whole sprite, use faceDirection farmer <0/1/2/3> first before modifying the sprite with showFrame. Frame ID starts from 0. If farmer is the one whose frame is being set, "farmer" can be eliminated, i.e. both showFrame farmer and showFrame would work. + /// + /// + /// + public virtual void showNPCFrame(NPC npc, int FrameIndex) + { + StringBuilder b = new StringBuilder(); + b.Append("showFrame "); + b.Append(npc.Name); + b.Append(" "); + b.Append(FrameIndex); + this.add(b); + } + + /// + /// Shows the given frame for the farmer. Forces the farmer to rotate first as specified by the wiki, + /// + /// + /// + public virtual void showFrameFarmer(FacingDirection Direction,int FrameIndex) + { + this.playerFaceDirection(Direction); + StringBuilder b = new StringBuilder(); + b.Append("showFrame "); + b.Append(FrameIndex); + this.add(b); + } + + //Skippable is enabled by default. + + + /// + /// Show dialogue text from a named NPC; see dialogue format. + /// + /// + /// + public virtual void speak(NPC npc, string Message) + { + StringBuilder b = new StringBuilder(); + b.Append("speak "); + b.Append(npc.Name); + b.Append(" "); + b.Append(Message); + this.add(b); + } + + /// + /// Make the player start jittering. + /// + public virtual void playerJitter() + { + StringBuilder b = new StringBuilder(); + b.Append("startJittering"); + this.add(b); + } + + /// + /// Stop movement from advancedMove. + /// + public virtual void stopAdvancedMoves() + { + StringBuilder b = new StringBuilder(); + b.Append("stopAdvancedMoves"); + this.add(b); + } + + /// + /// Stop the farmer's current animation. + /// + public virtual void stopFarmerAnimation() + { + StringBuilder b = new StringBuilder(); + b.Append("stopAnimation farmer"); + this.add(b); + } + + /// + /// Stop the named NPC's current animation. Not applicable to the farmer. + /// + /// + /// + public virtual void stopNPCAnimation(NPC npc, int EndFrame) + { + StringBuilder b = new StringBuilder(); + b.Append("stopAnimation "); + b.Append(npc.Name); + b.Append(" "); + b.Append(EndFrame); + this.add(b); + } + + /// + /// Make the screen stop glowing. + /// + public virtual void stopGlowing() + { + StringBuilder b = new StringBuilder(); + b.Append("stopGlowing"); + this.add(b); + } + + /// + /// Make the player stop jittering. + /// + public virtual void stopJittering() + { + StringBuilder b = new StringBuilder(); + b.Append("stopJittering"); + this.add(b); + } + + /// + /// Stop any currently playing music. + /// + public virtual void stopMusic() + { + StringBuilder b = new StringBuilder(); + b.Append("stopMusic"); + this.add(b); + } + + /// + /// Make the farmer stop running. + /// + public virtual void stopRunning() + { + StringBuilder b = new StringBuilder(); + b.Append("stopRunning"); + this.add(b); + } + + /// + /// Make the farmer stop swimming. + /// + public virtual void stopFarmerSwimming() + { + StringBuilder b = new StringBuilder(); + b.Append("stopSwimming farmer"); + this.add(b); + } + + /// + /// Make the npc stop swimming. + /// + public virtual void stopNPCSwimming(NPC npc) + { + StringBuilder b = new StringBuilder(); + b.Append("stopSwimming "); + b.Append(npc.Name); + this.add(b); + } + + /// + /// Make the farmer start swimming. + /// + public virtual void startFarmerSwimming() + { + StringBuilder b = new StringBuilder(); + b.Append("swimming farmer"); + this.add(b); + } + + + /// + /// Make the npc start swimming. + /// + /// + public virtual void startNPCSwimming(NPC npc) + { + StringBuilder b = new StringBuilder(); + b.Append("swimming "); + b.Append(npc.Name); + this.add(b); + } + + /// + /// Changes the current event (ie. event commands) to another event in the same location. + /// + /// + public virtual void switchEvent(int ID) + { + StringBuilder b = new StringBuilder(); + b.Append("switchEvent "); + b.Append(ID); + this.add(b); + } + + + /// + /// Create a temporary sprite with the given parameters. + /// + /// + /// + /// + /// + /// + /// + /// + public virtual void temporarySprite(int XPos, int YPos, int Index, int AnimationLength, int AnimationInterval, bool Looped, int LoopCount) + { + StringBuilder b = new StringBuilder(); + b.Append("temporarySprite "); + b.Append(XPos); + b.Append(" "); + b.Append(YPos); + b.Append(" "); + b.Append(Index); + b.Append(" "); + b.Append(AnimationLength); + b.Append(" "); + b.Append(AnimationInterval); + b.Append(" "); + b.Append(Looped); + b.Append(" "); + b.Append(LoopCount); + this.add(b); + } + + /// + /// Show a small text bubble over the named NPC's head with the given text; see dialogue format. + /// + /// + /// + public virtual void showSpeechBubble(NPC npc, string Message) + { + StringBuilder b = new StringBuilder(); + b.Append("textAboveHead "); + b.Append(npc.Name); + b.Append(" "); + b.Append(Message); + this.add(b); + } + + /// + /// Pan the the camera in the direction (and with the velocity) defined by x/y for the given duration in milliseconds. Example: "viewport move 2 -1 5000" moves the camera 2 pixels right and 1 pixel up for 5 seconds. + /// + /// + /// + /// + public virtual void panViewport(int XPosition, int YPosition, int Milliseconds) + { + StringBuilder b = new StringBuilder(); + b.Append("viewport move "); + b.Append(XPosition); + b.Append(" "); + b.Append(YPosition); + this.add(b); + } + /// + /// Instantly reposition the camera to center on the given X, Y tile position. TODO: explain other parameters. + /// + /// + /// + public virtual void setViewportPosition(int XPosition, int YPosition) + { + StringBuilder b = new StringBuilder(); + b.Append("viewport "); + b.Append(XPosition); + b.Append(" "); + b.Append(YPosition); + this.add(b); + } + + /// + /// Wait for other players (vanilla MP). + /// + public virtual void waitForAllPlayers() + { + StringBuilder b = new StringBuilder(); + b.Append("waitForOtherPlayers"); + this.add(b); + } + + /// + /// Warp the named NPC to a position to the given X, Y tile coordinate. This can be used to warp characters off-screen. + /// + /// + /// + public virtual void warpPlayer(int x, int y) + { + StringBuilder b = new StringBuilder(); + b.Append("warp farmer "); + b.Append(x); + b.Append(" "); + b.Append(y); + this.add(b); + } + + /// + /// Warp the named NPC to a position to the given X, Y tile coordinate. This can be used to warp characters off-screen. + /// + /// + /// + /// + public virtual void warpActor(string ActorName,int x, int y) + { + StringBuilder b = new StringBuilder(); + b.Append("warp "); + b.Append(ActorName); + b.Append(" "); + b.Append(x); + b.Append(" "); + b.Append(y); + this.add(b); + } + + public virtual void warpNPC(NPC NPC, int x, int y) + { + StringBuilder b = new StringBuilder(); + b.Append("warp "); + b.Append(NPC.Name); + b.Append(" "); + b.Append(x); + b.Append(" "); + b.Append(y); + this.add(b); + } } }