Can now fall asleep and open the shipping menu if things have been shipped.
This commit is contained in:
parent
ce355fd2c0
commit
b4d82f972a
|
@ -0,0 +1,55 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StarAI.DialogueCore
|
||||
{
|
||||
public class ReponseLogic
|
||||
{
|
||||
public static void answerDialogueResponses()
|
||||
{
|
||||
if (Game1.player.currentLocation.lastQuestionKey != null)
|
||||
{
|
||||
ModCore.CoreMonitor.Log(Game1.player.currentLocation.lastQuestionKey);
|
||||
while (Game1.player.currentLocation.lastQuestionKey == "Sleep")
|
||||
{
|
||||
//WindowsInput.InputSimulator.SimulateKeyDown(WindowsInput.VirtualKeyCode.ESCAPE);
|
||||
Game1.player.currentLocation.lastQuestionKey = null;
|
||||
ModCore.CoreMonitor.Log("GO TO SLEEP");
|
||||
answerDialogueSleep();
|
||||
//Game1.player.currentLocation.answerDialogue(new Response(Game1.player.currentLocation.lastQuestionKey, "Yes"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void answerDialogueSleep()
|
||||
{
|
||||
GameLocation location = Game1.player.currentLocation;
|
||||
if ((double)location.LightLevel == 0.0 && Game1.timeOfDay < 2000)
|
||||
{
|
||||
location.LightLevel = 0.6f;
|
||||
|
||||
Game1.playSound("openBox");
|
||||
Game1.NewDay(600f);
|
||||
}
|
||||
else if ((double)location.LightLevel > 0.0 && Game1.timeOfDay >= 2000)
|
||||
{
|
||||
location.LightLevel = 0.0f;
|
||||
Game1.playSound("openBox");
|
||||
Game1.NewDay(600f);
|
||||
}
|
||||
else
|
||||
Game1.NewDay(0.0f);
|
||||
Game1.player.mostRecentBed = Game1.player.position;
|
||||
Game1.player.doEmote(24);
|
||||
Game1.player.freezePause = 2000;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StarAI.InterfaceCore
|
||||
{
|
||||
public class InterfaceLogic
|
||||
{
|
||||
public static void interactWithCurrentMenu()
|
||||
{
|
||||
|
||||
if (Game1.activeClickableMenu == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//WindowsInput.InputSimulator.SimulateKeyUp(WindowsInput.VirtualKeyCode.ESCAPE);
|
||||
ModCore.CoreMonitor.Log(Game1.activeClickableMenu.ToString());
|
||||
while(Game1.activeClickableMenu is StardewValley.Menus.DialogueBox)
|
||||
{
|
||||
Game1.activeClickableMenu.exitThisMenu(true);
|
||||
ModCore.CoreMonitor.Log("BYE");
|
||||
}
|
||||
|
||||
while (Game1.activeClickableMenu is StardewValley.Menus.ShippingMenu)
|
||||
{
|
||||
//(Game1.activeClickableMenu as StardewValley.Menus.ShippingMenu).readyToClose
|
||||
//Game1.activeClickableMenu.exitThisMenu(true);
|
||||
ShippingMenuCore.closeMenu();
|
||||
ModCore.CoreMonitor.Log("Hello");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using StardewValley;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StarAI.InterfaceCore
|
||||
{
|
||||
class ShippingMenuCore
|
||||
{
|
||||
public static void closeMenu()
|
||||
{
|
||||
(Game1.activeClickableMenu as StardewValley.Menus.ShippingMenu).okButton.snapMouseCursorToCenter();
|
||||
if (Game1.activeClickableMenu is StardewValley.Menus.ShippingMenu)
|
||||
{
|
||||
ModCore.CoreMonitor.Log("PRESS ALREADY!");
|
||||
WindowsInput.InputSimulator.SimulateKeyDown(WindowsInput.VirtualKeyCode.ESCAPE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -27,6 +27,7 @@ namespace StarAI
|
|||
public static object[] obj = new object[3];
|
||||
|
||||
public static bool throwUpShippingMenu;
|
||||
private bool playerHasLoadedGame;
|
||||
|
||||
public override void Entry(IModHelper helper)
|
||||
{
|
||||
|
@ -46,13 +47,25 @@ namespace StarAI
|
|||
StardewModdingAPI.Events.SaveEvents.BeforeSave += SaveEvents_BeforeSave;
|
||||
StardewModdingAPI.Events.SaveEvents.AfterSave += SaveEvents_AfterSave;
|
||||
|
||||
StardewModdingAPI.Events.GameEvents.UpdateTick += GameEvents_UpdateTick;
|
||||
playerHasLoadedGame = false;
|
||||
|
||||
StardustCore.ModCore.SerializationManager.acceptedTypes.Add("StarAI.PathFindingCore.TileNode", new StardustCore.Serialization.SerializerDataNode(new StardustCore.Serialization.SerializerDataNode.SerializingFunction(StarAI.PathFindingCore.TileNode.Serialize), new StardustCore.Serialization.SerializerDataNode.ParsingFunction(StarAI.PathFindingCore.TileNode.ParseIntoInventory), new StardustCore.Serialization.SerializerDataNode.WorldParsingFunction(StarAI.PathFindingCore.TileNode.SerializeFromWorld), new StardustCore.Serialization.SerializerDataNode.SerializingToContainerFunction(StarAI.PathFindingCore.TileNode.Serialize)));
|
||||
}
|
||||
|
||||
private void GameEvents_UpdateTick(object sender, EventArgs e)
|
||||
{
|
||||
if (playerHasLoadedGame == false) return;
|
||||
DialogueCore.ReponseLogic.answerDialogueResponses();
|
||||
InterfaceCore.InterfaceLogic.interactWithCurrentMenu();
|
||||
}
|
||||
|
||||
private void SaveEvents_AfterSave(object sender, EventArgs e)
|
||||
{
|
||||
WayPoints.setUpBedWaypoint();
|
||||
UtilityCore.SeedCropUtility.setUpCropUtilityDictionaryDaily();
|
||||
WindowsInput.InputSimulator.SimulateKeyUp(WindowsInput.VirtualKeyCode.ESCAPE);
|
||||
|
||||
}
|
||||
|
||||
public void initializeEverything()
|
||||
|
@ -100,7 +113,7 @@ namespace StarAI
|
|||
WayPoints.verifyWayPoints();
|
||||
UtilityCore.SeedCropUtility.setUpUserCropUtilityDictionary(); //Runs once
|
||||
UtilityCore.SeedCropUtility.setUpCropUtilityDictionaryDaily(); //Runs daily
|
||||
|
||||
playerHasLoadedGame = true;
|
||||
}
|
||||
|
||||
private void ControlEvents_KeyPressed(object sender, StardewModdingAPI.Events.EventArgsKeyPressed e)
|
||||
|
@ -228,9 +241,6 @@ namespace StarAI
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void LocationEvents_CurrentLocationChanged(object sender, StardewModdingAPI.Events.EventArgsCurrentLocationChanged e)
|
||||
{
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<ItemGroup>
|
||||
<Compile Include="CheatCore\DoorsToWarps.cs" />
|
||||
<Compile Include="Commands.cs" />
|
||||
<Compile Include="DialogueCore\ReponseLogic.cs" />
|
||||
<Compile Include="ExecutionCore\CustomTask.cs" />
|
||||
<Compile Include="ExecutionCore\TaskList.cs" />
|
||||
<Compile Include="ExecutionCore\TaskMetaData.cs" />
|
||||
|
@ -69,6 +70,8 @@
|
|||
<Compile Include="ExecutionCore\TaskPrerequisites\LocationPrerequisite.cs" />
|
||||
<Compile Include="ExecutionCore\TaskPrerequisites\StaminaPrerequisite.cs" />
|
||||
<Compile Include="ExecutionCore\TaskPrerequisites\ToolPrerequisite.cs" />
|
||||
<Compile Include="InterfaceCore\InterfaceLogic.cs" />
|
||||
<Compile Include="InterfaceCore\ShippingMenuCore.cs" />
|
||||
<Compile Include="MenuCore\CropUtilityMenu.cs" />
|
||||
<Compile Include="ModCore.cs" />
|
||||
<Compile Include="ShopCore\ShopLogic.cs" />
|
||||
|
|
|
@ -1126,6 +1126,7 @@ namespace StarAI.TaskCore.MapTransitionLogic
|
|||
{
|
||||
TaskCore.CropLogic.SeedLogic.buySeeds();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue