Moved events from HappyBirthday to StardustCore. Wrote extension system for flexibility. Added way to add in custom commands for events.

This commit is contained in:
JoshuaNavarro 2019-12-05 01:25:46 -08:00
parent f11ce9bb2f
commit 1b1b6d227a
49 changed files with 474 additions and 150 deletions

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Omegasis.HappyBirthday.Framework.Events;
using Omegasis.HappyBirthday.Framework.Events.Preconditions;
using Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific;
using Omegasis.HappyBirthday.Framework.Events.SpecialPreconditions;
using Omegasis.HappyBirthday.Framework.EventPreconditions;
using StardustCore.Events;
using StardustCore.Events.Preconditions;
using StardustCore.Events.Preconditions.TimeSpecific;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework
@ -20,10 +20,13 @@ namespace Omegasis.HappyBirthday.Framework
conditions.Add(new FarmerBirthdayPrecondition());
conditions.Add(new LocationPrecondition(Game1.getLocationFromName("CommunityCenter")));
conditions.Add(new TimePrecondition(600, 2600));
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 32, 22, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
EventHelper e = new EventHelper("CommunityCenterBirthday",19950, conditions, new EventStartData(EventStartData.MusicToPlayType.Continue, 32, 16, new EventStartData.FarmerData(32, 22, EventHelper.FacingDirection.Up),new List<EventStartData.NPCData>()));
e.globalFadeIn();
e.moveFarmerUp(6, EventHelper.FacingDirection.Up, false);
e.ViewportLerpTileOffset(new Microsoft.Xna.Framework.Point(0,-6),60*6);
e.addObjectToPlayersInventory(64, 22,true);
e.showMessage("Community center birthday here.");
e.end();
return e;

View File

@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Omegasis.HappyBirthday.Framework.Events.Preconditions;
using StardustCore.Events.Preconditions;
namespace Omegasis.HappyBirthday.Framework.Events.SpecialPreconditions
namespace Omegasis.HappyBirthday.Framework.EventPreconditions
{
public class FarmerBirthdayPrecondition:EventPrecondition
{

View File

@ -3,10 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Omegasis.HappyBirthday.Framework.Events.Preconditions;
using StardustCore.Events.Preconditions;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.SpecialPreconditions
namespace Omegasis.HappyBirthday.Framework.EventPreconditions
{
public class SpouseBirthdayPrecondition:EventPrecondition
{

View File

@ -1,48 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events
{
public class EventManager
{
public Dictionary<string, EventHelper> events;
public EventManager()
{
this.events = new Dictionary<string, EventHelper>();
}
public void addEvent(EventHelper Event)
{
this.events.Add(Event.eventName, Event);
}
public EventHelper getEvent(string Name)
{
if (this.events.ContainsKey(Name))
{
return this.events[Name];
}
else
{
return null;
}
}
public void clearEventFromFarmer(string EventName)
{
this.events.TryGetValue(EventName, out EventHelper e);
if (e == null) return;
Game1.player.eventsSeen.Remove(e.getEventID());
}
}
}

View File

@ -5,7 +5,7 @@ using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Omegasis.HappyBirthday.Framework;
using Omegasis.HappyBirthday.Framework.Events;
using StardustCore.Events;
using StardewModdingAPI;
using StardewModdingAPI.Events;
using StardewValley;
@ -101,7 +101,7 @@ namespace Omegasis.HappyBirthday
this.othersBirthdays = new Dictionary<long, PlayerData>();
this.eventManager = new EventManager();
this.eventManager.addCustomEventLogic("AddObjectToPlayersInventory", ExtraEventActions.addObjectToPlayerInventory);
}
private void Player_Warped(object sender, WarpedEventArgs e)
@ -575,8 +575,19 @@ namespace Omegasis.HappyBirthday
private void OnUpdateTicked(object sender, UpdateTickedEventArgs e)
{
if (!Context.IsWorldReady || Game1.eventUp || Game1.isFestival())
if (!Context.IsWorldReady || Game1.isFestival())
{
return;
}
if (Game1.eventUp)
{
if (this.eventManager != null)
{
this.eventManager.update();
}
return;
}
if (!this.HasChosenBirthday && Game1.activeClickableMenu == null && Game1.player.Name.ToLower() != "unnamed farmhand")
{

View File

@ -73,6 +73,9 @@
<PackageReference Include="Pathoschild.Stardew.ModBuildConfig" Version="3.0.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="StardustCore">
<HintPath>$(GamePath)\Mods\StardustCore\StardustCore.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
@ -83,48 +86,11 @@
<Compile Include="BirthdayMessages.cs" />
<Compile Include="Framework\BirthdayEvents.cs" />
<Compile Include="Framework\BirthdayMenu.cs" />
<Compile Include="Framework\Events\EventManager.cs" />
<Compile Include="Framework\Events\EventStartData.cs" />
<Compile Include="Framework\Events\Preconditions\LocationPrecondition.cs" />
<Compile Include="Framework\Events\Preconditions\MISC\ChanceToOccur.cs" />
<Compile Include="Framework\Events\Preconditions\MISC\EventNotInProgress.cs" />
<Compile Include="Framework\Events\Preconditions\MISC\JojaWarehouseCompleted.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\DatingNPC.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\FriendshipPointsRequired.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\HeartsRequired.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\NotInvisible.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\NotMarriedTo.cs" />
<Compile Include="Framework\Events\Preconditions\NPCSpecific\NPCInThisLocation.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\AnsweredDialogueOptions.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\CurrentMoney.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\DaysPlayedFor.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\EmptyInventorySlots.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\Gender.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\HasItem.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\HasNotRecievedLetter.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\HasRecievedLetter.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\MineBottomHit.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\PetPreference.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\PlayerOnThisTile.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\SeenEvents.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\SeenSecretNote.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\ShippedItems.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\TotalMoneyEarned.cs" />
<Compile Include="Framework\Events\Preconditions\PlayerSpecific\UnseenEvents.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\DayOfTheMonth.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\EventDayExclusionPrecondition.cs" />
<Compile Include="Framework\Events\EventHelper.cs" />
<Compile Include="Framework\Events\Preconditions\EventPrecondition.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\NotAFestivalDay.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\SeasonExclusion.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\TimePrecondition.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\WeatherPrecondition.cs" />
<Compile Include="Framework\Events\Preconditions\TimeSpecific\YearPrecondition.cs" />
<Compile Include="Framework\Events\SpecialPreconditions\FarmerBirthdayPrecondition.cs" />
<Compile Include="Framework\Events\SpecialPreconditions\SpouseBirthdayPrecondition.cs" />
<Compile Include="Framework\ModConfig.cs" />
<Compile Include="Framework\MultiplayerSupport.cs" />
<Compile Include="Framework\PlayerData.cs" />
<Compile Include="Framework\EventPreconditions\FarmerBirthdayPrecondition.cs" />
<Compile Include="Framework\EventPreconditions\SpouseBirthdayPrecondition.cs" />
<Compile Include="Framework\TranslationInfo.cs" />
<Compile Include="Framework\VillagerInfo.cs" />
<Compile Include="HappyBirthday.cs" />

View File

@ -6,5 +6,8 @@
"UniqueID": "Omegasis.HappyBirthday",
"EntryDll": "HappyBirthday.dll",
"MinimumApiVersion": "2.10.1",
"UpdateKeys": [ "Nexus:520" ]
"UpdateKeys": [ "Nexus:520" ],
"Dependencies": [
{ "UniqueID": "Omegasis.StardustCore" },
]
}

View File

@ -16,6 +16,9 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fall28SnowDay", "Fall28SnowDay\Fall28SnowDay.csproj", "{1DBB583D-4A4F-4A46-8CC5-42017C93D292}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HappyBirthday", "HappyBirthday\HappyBirthday.csproj", "{A7A4B67B-3CD7-421F-A4A7-2D656F0AB4D9}"
ProjectSection(ProjectDependencies) = postProject
{0756D36A-95C8-480D-8EA6-4584C03010C6} = {0756D36A-95C8-480D-8EA6-4584C03010C6}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MoreRain", "MoreRain\MoreRain.csproj", "{45721A43-630A-461F-9A50-E47D3D1926D0}"
EndProject

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StardustCore.Events
{
/// <summary>
/// Used to parse additional
/// </summary>
public static class EventExtensions
{
/// <summary>
/// Gets the current command string with all of it's data.
/// </summary>
/// <param name="CurrentEvent"></param>
/// <returns></returns>
public static string currentCommandString(this StardewValley.Event CurrentEvent)
{
if (CurrentEvent.currentCommand >= CurrentEvent.eventCommands.Length) return "";
return CurrentEvent.eventCommands.ElementAt(CurrentEvent.currentCommand);
}
/// <summary>
/// Gets the name of the current command string.
/// </summary>
/// <param name="CurrentEvent"></param>
/// <returns></returns>
public static string currentCommandStringName(this StardewValley.Event CurrentEvent)
{
if (CurrentEvent.currentCommand >= CurrentEvent.eventCommands.Length) return "";
return CurrentEvent.eventCommands.ElementAt(CurrentEvent.currentCommand).Split(' ')[0];
}
}
}

View File

@ -2,11 +2,11 @@ using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Omegasis.HappyBirthday.Framework.Events.Preconditions;
using Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific;
using StardustCore.Events.Preconditions;
using StardustCore.Events.Preconditions.TimeSpecific;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events
namespace StardustCore.Events
{
/// <summary>
///TODO: Figure out forked dialogue
@ -115,7 +115,7 @@ namespace Omegasis.HappyBirthday.Framework.Events
/// Adds in the data to the event data.Aka what happens during the event.
/// </summary>
/// <param name="Data"></param>
protected virtual void add(string Data)
public virtual void add(string Data)
{
if (this.eventData.Length > 0)
@ -129,7 +129,7 @@ namespace Omegasis.HappyBirthday.Framework.Events
/// Adds in the data to the event data. Aka what happens during the event.
/// </summary>
/// <param name="Builder"></param>
protected virtual void add(StringBuilder Builder)
public virtual void add(StringBuilder Builder)
{
this.add(Builder.ToString());
}
@ -178,7 +178,10 @@ namespace Omegasis.HappyBirthday.Framework.Events
string s = this.nexusUserId.ToString();
return s.Substring(0, 4);
}
/// <summary>
/// Gets the id for the event.
/// </summary>
/// <returns></returns>
public virtual int getEventID()
{
return Convert.ToInt32(this.getUniqueEventStartID() + this.eventID.ToString());
@ -205,12 +208,19 @@ namespace Omegasis.HappyBirthday.Framework.Events
if (Convert.ToInt32(IDToCheck) > 2147483647 || Convert.ToInt32(IDToCheck) < 0) return false;
else return true;
}
/// <summary>
/// Gets the string representation for the event's data.
/// </summary>
/// <returns></returns>
public virtual string getEventString()
{
return this.eventData.ToString();
}
/// <summary>
/// Creates the Stardew Valley event from the given event data.
/// </summary>
/// <param name="PlayerActor"></param>
/// <returns></returns>
protected virtual StardewValley.Event getEvent(Farmer PlayerActor = null)
{
return new StardewValley.Event(this.getEventString(), Convert.ToInt32(this.getEventID()), PlayerActor);
@ -1665,18 +1675,21 @@ namespace Omegasis.HappyBirthday.Framework.Events
/// <summary>
/// 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.
/// </summary>
/// <param name="XPosition"></param>
/// <param name="YPosition"></param>
/// <param name="Milliseconds"></param>
public virtual void panViewport(int XPosition, int YPosition, int Milliseconds)
/// <param name="xPixelAmount"></param>
/// <param name="yPixelAmount"></param>
/// <param name="MillisecondDuration"></param>
public virtual void panViewport(int xPixelAmount, int yPixelAmount, int MillisecondDuration)
{
StringBuilder b = new StringBuilder();
b.Append("viewport move ");
b.Append(XPosition);
b.Append(xPixelAmount);
b.Append(" ");
b.Append(YPosition);
b.Append(yPixelAmount);
b.Append(" ");
b.Append(MillisecondDuration);
this.add(b);
}
/// <summary>
/// Instantly reposition the camera to center on the given X, Y tile position. TODO: explain other parameters.
/// </summary>

View File

@ -0,0 +1,76 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using StardewValley;
namespace StardustCore.Events
{
public static class EventHelperExtensions
{
/// <summary>
/// Creates the event string to add the object to the player's inventory.
/// </summary>
/// <returns></returns>
public static void addObjectToPlayersInventory(this EventHelper EventHelper,int ParentSheetIndex, int Amount=1, bool MakeActiveObject=false)
{
StringBuilder b = new StringBuilder();
b.Append("Omegasis.EventFramework.AddObjectToPlayersInventory ");
b.Append(ParentSheetIndex);
b.Append(" ");
b.Append(Amount);
b.Append(" ");
b.Append(MakeActiveObject);
EventHelper.add(b);
}
public static void ViewportLerp(this EventHelper EventHelper, Point NewPosition, double Speed)
{
StringBuilder b = new StringBuilder();
b.Append("Omegasis.EventFramework.ViewportLerp ");
b.Append(NewPosition.X);
b.Append(" ");
b.Append(NewPosition.Y);
b.Append(" ");
b.Append(Speed);
EventHelper.add(b);
}
public static void ViewportLerpTile(this EventHelper EventHelper, Point NewTilePosition, double Speed)
{
StringBuilder b = new StringBuilder();
b.Append("Omegasis.EventFramework.ViewportLerp ");
b.Append(NewTilePosition.X*Game1.tileSize);
b.Append(" ");
b.Append(NewTilePosition.Y*Game1.tileSize);
b.Append(" ");
b.Append(Speed);
EventHelper.add(b);
}
/// <summary>
/// Lerps the camera an offset tile amount.
/// </summary>
/// <param name="EventHelper"></param>
/// <param name="NewTilePositionOffset"></param>
/// <param name="Speed">How many frames (aka update ticks) it takes to finish. Aka 60~=1 second</param>
public static void ViewportLerpTileOffset(this EventHelper EventHelper, Point NewTilePositionOffset, int Frames=60)
{
StringBuilder b = new StringBuilder();
b.Append("Omegasis.EventFramework.ViewportLerp ");
b.Append((NewTilePositionOffset.X * Game1.tileSize));
b.Append(" ");
b.Append((NewTilePositionOffset.Y * Game1.tileSize));
b.Append(" ");
b.Append(Frames);
EventHelper.add(b);
}
}
}

View File

@ -0,0 +1,140 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace StardustCore.Events
{
public class EventManager
{
/// <summary>
/// The list of events that this event manager is holding.
/// </summary>
public Dictionary<string, EventHelper> events;
/// <summary>
/// Event logic that occurs when the specialized command appears.
/// </summary>
public Dictionary<string, Action<string>> customEventLogic;
public bool eventStarted;
public EventManager()
{
this.events = new Dictionary<string, EventHelper>();
this.customEventLogic = new Dictionary<string, Action<string>>();
this.customEventLogic.Add("Omegasis.EventFramework.AddObjectToPlayersInventory", ExtraEventActions.addObjectToPlayerInventory);
this.customEventLogic.Add("Omegasis.EventFramework.ViewportLerp", ExtraEventActions.ViewportLerp);
}
/// <summary>
/// Adds an event to the dictionary of events.
/// </summary>
/// <param name="Event"></param>
public void addEvent(EventHelper Event)
{
this.events.Add(Event.eventName, Event);
}
/// <summary>
/// Adds in custom code that happens when the game's current event sees the given command name.
/// </summary>
/// <param name="CommandName"></param>
/// <param name="Function"></param>
public void addCustomEventLogic(string CommandName,Action<string> Function)
{
this.customEventLogic.Add(CommandName, Function);
}
/// <summary>
/// Hooked into the game's update tick.
/// </summary>
public virtual void update()
{
if (Game1.CurrentEvent == null) return;
string commandName = this.getGameCurrentEventCommandStringName();
//HappyBirthday.ModMonitor.Log("Current event command name is: " + commandName, StardewModdingAPI.LogLevel.Info);
if (string.IsNullOrEmpty(commandName)) return;
if (this.customEventLogic.ContainsKey(commandName)){
this.customEventLogic[commandName].Invoke(this.getGameCurrentEventCommandString());
}
}
/// <summary>
/// Gets the event from this list of events.
/// </summary>
/// <param name="Name"></param>
/// <returns></returns>
public EventHelper getEvent(string Name)
{
if (this.events.ContainsKey(Name))
{
return this.events[Name];
}
else
{
return null;
}
}
/// <summary>
/// Starts the event with the given id if possible.
/// </summary>
/// <param name="EventName"></param>
public virtual void startEventAtLocationIfPossible(string EventName)
{
if (this.events.ContainsKey(EventName))
{
this.events[EventName].startEventAtLocationifPossible();
}
}
/// <summary>
/// Clears the event from the farmer.
/// </summary>
/// <param name="EventName"></param>
public void clearEventFromFarmer(string EventName)
{
this.events.TryGetValue(EventName, out EventHelper e);
if (e == null) return;
Game1.player.eventsSeen.Remove(e.getEventID());
}
/// <summary>
/// Gets the current command and all of it's data.
/// </summary>
/// <returns></returns>
public virtual string getGameCurrentEventCommandString()
{
if (Game1.CurrentEvent != null)
{
return Game1.CurrentEvent.currentCommandString();
}
else
{
return "";
}
}
/// <summary>
/// Gets the name of the action for the current command in the string of event commands.
/// </summary>
/// <returns></returns>
public virtual string getGameCurrentEventCommandStringName()
{
if (Game1.CurrentEvent != null)
{
return Game1.CurrentEvent.currentCommandStringName();
}
else
{
return "";
}
}
}
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events
namespace StardustCore.Events
{
public class EventStartData
{
@ -57,6 +57,12 @@ namespace Omegasis.HappyBirthday.Framework.Events
{
}
/// <summary>
///Constructor.
/// </summary>
/// <param name="XTile"></param>
/// <param name="YTile"></param>
/// <param name="Direction"></param>
public FarmerData(int XTile, int YTile, EventHelper.FacingDirection Direction)
{
this.xPosition = XTile;
@ -64,6 +70,10 @@ namespace Omegasis.HappyBirthday.Framework.Events
this.direction = Direction;
}
/// <summary>
/// Gets a string representation of the farmer's starting data.
/// </summary>
/// <returns></returns>
public override string ToString()
{
StringBuilder b = new StringBuilder();
@ -84,6 +94,9 @@ namespace Omegasis.HappyBirthday.Framework.Events
/// </summary>
private StringBuilder builder;
/// <summary>
/// A special variable to determined if to continue the music that is already playing or to turn off the music.
/// </summary>
public enum MusicToPlayType
{
None,

View File

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using StardewValley;
namespace StardustCore.Events
{
/// <summary>
/// Contains functions that are used to parse event data and do additional things.
/// </summary>
public class ExtraEventActions
{
private static Point OldViewportPosition;
private static bool StartedLerp;
private static int CurrentViewportLerpAmount;
/// <summary>
/// Adds the item from Game1.ObjectInformation to the player's inventory from the given event string.
/// </summary>
/// <param name="EventData"></param>
public static void addObjectToPlayerInventory(string EventData)
{
string[] splits = EventData.Split(' ');
string name = splits[0];
int parentSheetIndex =Convert.ToInt32(splits[1]);
int amount = Convert.ToInt32(splits[2]);
bool makeActiveObject = Convert.ToBoolean(splits[3]);
StardewValley.Object obj = new StardewValley.Object(parentSheetIndex, amount);
Game1.player.addItemToInventoryBool(obj,makeActiveObject);
Game1.CurrentEvent.CurrentCommand++;
}
public static void ViewportLerp(string EventData)
{
string[] splits = EventData.Split(' ');
string name = splits[0];
int xEndPosition =Convert.ToInt32(splits[1]);
int yEndPosition = Convert.ToInt32(splits[2]);
int frames = Convert.ToInt32(splits[3]);
if (StartedLerp==false)
{
OldViewportPosition = new Point(Game1.viewport.Location.X,Game1.viewport.Location.Y);
StartedLerp = true;
}
++CurrentViewportLerpAmount;
if (CurrentViewportLerpAmount >= frames)
{
Vector2 currentLerp2 = Vector2.Lerp(new Vector2(OldViewportPosition.X, OldViewportPosition.Y), new Vector2(OldViewportPosition.X+xEndPosition, OldViewportPosition.Y+yEndPosition), (float)((float)CurrentViewportLerpAmount/(float)frames));
Game1.viewport.Location = new xTile.Dimensions.Location((int)currentLerp2.X, (int)currentLerp2.Y);
OldViewportPosition = new Point(0, 0);
CurrentViewportLerpAmount = 0;
StartedLerp = false;
++Game1.CurrentEvent.CurrentCommand; //I've been told ++<int> is more efficient than <int>++;
return;
}
Vector2 currentLerp = Vector2.Lerp(new Vector2(OldViewportPosition.X, OldViewportPosition.Y), new Vector2(OldViewportPosition.X + xEndPosition, OldViewportPosition.Y + yEndPosition), (float)((float)CurrentViewportLerpAmount/(float)frames));
Game1.viewport.Location = new xTile.Dimensions.Location((int)currentLerp.X, (int)currentLerp.Y);
}
}
}

View File

@ -4,7 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions
namespace StardustCore.Events.Preconditions
{
public class EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions
namespace StardustCore.Events.Preconditions
{
public class LocationPrecondition:EventPrecondition
{

View File

@ -5,11 +5,10 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC
namespace StardustCore.Events.Preconditions.MISC
{
public class ChanceToOccur:EventPrecondition
{
public float chance;
public ChanceToOccur()

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC
namespace StardustCore.Events.Preconditions.MISC
{
public class EventNotInProgress:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.MISC
namespace StardustCore.Events.Preconditions.MISC
{
public class JojaWarehouseCompleted:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class DatingNPC:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class FriendshipPointsRequired:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class HeartsRequired:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class NPCInThisLocation:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class NotInvisible:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.NPCSpecific
namespace StardustCore.Events.Preconditions.NPCSpecific
{
public class NotMarriedTo : EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class AnsweredDialogueOptions:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class CurrentMoney:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class DaysPlayedFor:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class EmptyInventorySlots:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class Gender:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class HasItem:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class HasNotRecievedLetter:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class HasRecievedLetter:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class MineBottomHit:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class PetPreference:EventPrecondition
{

View File

@ -7,7 +7,7 @@ using System.Threading.Tasks;
using Microsoft.Xna.Framework;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class PlayerOnThisTile:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class SeenEvents : EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class SeenSecretNote:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class ShippedItems:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class TotalMoneyEarned:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.PlayerSpecific
namespace StardustCore.Events.Preconditions.PlayerSpecific
{
public class UnseenEvents:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
/// <summary>
/// Event occurs on this day of the month. Range 1-28

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
public class EventDayExclusionPrecondition:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
/// <summary>
/// Precondition that ensures that this event can't happen on a festival day.

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
public class SeasonExclusion:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
/// <summary>
/// The event will only happen between the given times.

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
public class WeatherPrecondition:EventPrecondition
{

View File

@ -5,7 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using StardewValley;
namespace Omegasis.HappyBirthday.Framework.Events.Preconditions.TimeSpecific
namespace StardustCore.Events.Preconditions.TimeSpecific
{
/// <summary>
/// The event must occur on this year or after it.

View File

@ -86,6 +86,46 @@
<Compile Include="Animations\AnimationManager.cs" />
<Compile Include="Enums\Directions.cs" />
<Compile Include="Enums\Weather.cs" />
<Compile Include="Events\EventExtensions.cs" />
<Compile Include="Events\EventHelper.cs" />
<Compile Include="Events\EventHelperExtensions.cs" />
<Compile Include="Events\EventManager.cs" />
<Compile Include="Events\EventStartData.cs" />
<Compile Include="Events\ExtraEventActions.cs" />
<Compile Include="Events\Preconditions\EventPrecondition.cs" />
<Compile Include="Events\Preconditions\LocationPrecondition.cs" />
<Compile Include="Events\Preconditions\MISC\ChanceToOccur.cs" />
<Compile Include="Events\Preconditions\MISC\EventNotInProgress.cs" />
<Compile Include="Events\Preconditions\MISC\JojaWarehouseCompleted.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\DatingNPC.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\FriendshipPointsRequired.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\HeartsRequired.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\NotInvisible.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\NotMarriedTo.cs" />
<Compile Include="Events\Preconditions\NPCSpecific\NPCInThisLocation.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\AnsweredDialogueOptions.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\CurrentMoney.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\DaysPlayedFor.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\EmptyInventorySlots.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\Gender.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasItem.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasNotRecievedLetter.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\HasRecievedLetter.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\MineBottomHit.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\PetPreference.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\PlayerOnThisTile.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\SeenEvents.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\SeenSecretNote.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\ShippedItems.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\TotalMoneyEarned.cs" />
<Compile Include="Events\Preconditions\PlayerSpecific\UnseenEvents.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\DayOfTheMonth.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\EventDayExclusionPrecondition.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\NotAFestivalDay.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\SeasonExclusion.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\TimePrecondition.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\WeatherPrecondition.cs" />
<Compile Include="Events\Preconditions\TimeSpecific\YearPrecondition.cs" />
<Compile Include="IlluminateFramework\Colors.cs" />
<Compile Include="Math\Hex.cs" />
<Compile Include="Math\Hex32.cs" />