From c748f64c2a5902ffbacd509c52663437a2cc37ab Mon Sep 17 00:00:00 2001 From: Date: Mon, 27 Nov 2017 14:25:31 -0800 Subject: [PATCH 1/4] Made TaskMetaDataStatistics that will help calculate path cost and make isInventoryFull Pre-req --- .../StarAI/StarAI/ExecutionCore/CustomTask.cs | 11 ++- .../StarAI/StarAI/ExecutionCore/TaskList.cs | 7 +- .../StarAI/ExecutionCore/TaskMetaData.cs | 47 ++++++++++-- .../ExecutionCore/TaskMetaDataHeuristics.cs | 74 +++++++++++++++++++ .../InventoryFullPrerequisite.cs | 38 ++++++++++ .../TaskPrerequisites/ToolPrerequisite.cs | 10 ++- StarAI/StarAI/StarAI/ModCore.cs | 1 + .../StarAI/PathFindingCore/ChestLogic.cs | 2 +- .../PathFindingCore/CropLogic/CropLogic.cs | 4 +- StarAI/StarAI/StarAI/StarAI.csproj | 2 + 10 files changed, 181 insertions(+), 15 deletions(-) create mode 100644 StarAI/StarAI/StarAI/ExecutionCore/TaskMetaDataHeuristics.cs create mode 100644 StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs diff --git a/StarAI/StarAI/StarAI/ExecutionCore/CustomTask.cs b/StarAI/StarAI/StarAI/ExecutionCore/CustomTask.cs index 1a76a7a9..68c2c5b7 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/CustomTask.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/CustomTask.cs @@ -1,4 +1,5 @@ -using System; +using StarAI.PathFindingCore; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -17,11 +18,19 @@ namespace StarAI.ExecutionCore public VoidTask voidTask; public TaskMetaData taskMetaData; + + /// + /// Create a custom task and calculate cost of the action automatically without having to pass cost to the meta data. Saves a lot of code space and memory. + /// + /// + /// + /// public CustomTask(ObjectTask objTask,object[] arrayData, TaskMetaData TaskMetaData) { objectTask = objTask; objectParameterDataArray = arrayData; this.taskMetaData = TaskMetaData; + this.taskMetaData.calculateTaskCost((TileNode)arrayData[0]); } public CustomTask(VoidTask vTask, TaskMetaData TaskMetaData) diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs index 3dba0aec..a6976d1a 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskList.cs @@ -1,4 +1,5 @@ -using StardewModdingAPI; +using StarAI.PathFindingCore; +using StardewModdingAPI; using System; using System.Collections.Generic; using System.Linq; @@ -28,7 +29,9 @@ namespace StarAI.ExecutionCore foreach(var task2 in taskList) { if (removalList.Contains(task2)) continue; - task2.taskMetaData.cost = PathFindingCore.Utilities.calculatePathCost(task2.objectParameterDataArray); + object[] oArray = (object[])task2.objectParameterDataArray; + TileNode t =(TileNode) oArray[0]; + task2.taskMetaData.calculateTaskCost((t)); //task.taskMetaData = new TaskMetaData(task.taskMetaData.name, PathFindingCore.Utilities.calculatePathCost(task.objectParameterDataArray), task.taskMetaData.staminaPrerequisite, task.taskMetaData.toolPrerequisite); } diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs index 65d0d5ed..c74fbc44 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs @@ -1,4 +1,5 @@ -using System; +using StarAI.PathFindingCore; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -15,10 +16,11 @@ namespace StarAI.ExecutionCore public float frequency; public StarAI.ExecutionCore.TaskPrerequisites.StaminaPrerequisite staminaPrerequisite; public StarAI.ExecutionCore.TaskPrerequisites.ToolPrerequisite toolPrerequisite; + public TaskPrerequisites.InventoryFullPrerequisite inventoryPrerequisite; public List prerequisitesList; - public TaskMetaData(string Name, float Priority, float Cost, float Utility, float Frequency, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite=null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite=null) + public TaskMetaData(string Name, float Priority, float Cost, float Utility, float Frequency, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite=null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite=null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null) { this.name = Name; this.priority = Priority; @@ -27,35 +29,60 @@ namespace StarAI.ExecutionCore this.frequency = Frequency; this.staminaPrerequisite = StaminaPrerequisite; this.toolPrerequisite = ToolPrerequisite; - + this.inventoryPrerequisite = InventoryFull; //Make sure to set values correctly incase of null setUpStaminaPrerequisiteIfNull(); setUpToolPrerequisiteIfNull(); + setUpInventoryPrerequisiteIfNull(); this.prerequisitesList = new List(); this.prerequisitesList.Add(this.staminaPrerequisite); this.prerequisitesList.Add(this.toolPrerequisite); + this.prerequisitesList.Add(this.inventoryPrerequisite); } - public TaskMetaData(string Name,float Cost,TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null) + public TaskMetaData(string Name,float Cost,TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null) { this.name = Name; this.cost = Cost; this.staminaPrerequisite = StaminaPrerequisite; this.toolPrerequisite = ToolPrerequisite; - + this.inventoryPrerequisite = InventoryFull; //Make sure to set values correctly incase of null setUpStaminaPrerequisiteIfNull(); setUpToolPrerequisiteIfNull(); + setUpInventoryPrerequisiteIfNull(); this.prerequisitesList = new List(); this.prerequisitesList.Add(this.staminaPrerequisite); this.prerequisitesList.Add(this.toolPrerequisite); + this.prerequisitesList.Add(this.inventoryPrerequisite); + } + + public TaskMetaData(string Name, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull=null) + { + this.name = Name; + this.staminaPrerequisite = StaminaPrerequisite; + this.toolPrerequisite = ToolPrerequisite; + this.inventoryPrerequisite = InventoryFull; + //Make sure to set values correctly incase of null + setUpStaminaPrerequisiteIfNull(); + setUpToolPrerequisiteIfNull(); + setUpInventoryPrerequisiteIfNull(); + this.prerequisitesList = new List(); + this.prerequisitesList.Add(this.staminaPrerequisite); + this.prerequisitesList.Add(this.toolPrerequisite); + this.prerequisitesList.Add(this.inventoryPrerequisite); + } + + public void calculateTaskCost(TileNode source) + { + this.cost=TaskMetaDataHeuristics.calculateTaskCost(source, this.toolPrerequisite); } private void setUpToolPrerequisiteIfNull() { if (this.toolPrerequisite == null) { - this.toolPrerequisite = new TaskPrerequisites.ToolPrerequisite(false, null); + this.toolPrerequisite = new TaskPrerequisites.ToolPrerequisite(false, null,0); } } private void setUpStaminaPrerequisiteIfNull() @@ -66,6 +93,11 @@ namespace StarAI.ExecutionCore } } + private void setUpInventoryPrerequisiteIfNull() + { + if (this.inventoryPrerequisite == null) this.inventoryPrerequisite = new TaskPrerequisites.InventoryFullPrerequisite(false); + } + public bool verifyAllPrerequisitesHit() { @@ -87,7 +119,8 @@ namespace StarAI.ExecutionCore if(this.staminaPrerequisite.requiresStamina==true) s += " Requires : " + this.staminaPrerequisite.staminaCost + "Stamina.\n"; s += " Task Requires Tool: " + this.toolPrerequisite.requiresTool + "\n"; if (this.toolPrerequisite.requiresTool == true) s += " Requires a : " + this.toolPrerequisite.requiredTool + "\n"; - + s += " Task Requires Tool: " + this.toolPrerequisite.requiresTool + "\n"; + s += " Checks if inventory full: "+this.inventoryPrerequisite.doesTaskRequireInventorySpace.ToString() + "\n"; ModCore.CoreMonitor.Log(s); } diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaDataHeuristics.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaDataHeuristics.cs new file mode 100644 index 00000000..3253e34d --- /dev/null +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaDataHeuristics.cs @@ -0,0 +1,74 @@ +using StarAI.ExecutionCore.TaskPrerequisites; +using StarAI.PathFindingCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StarAI.ExecutionCore +{ + /// + /// This will be used to determine how much any given action, pathing distance, etc will have on the overall cost of a given task. + /// + public class TaskMetaDataHeuristics + { + + /// + /// Multiplier to be used to multiply out pathCost on any given action. Higher numbers will mean more discrimination against actions with long manhattan distances. + /// + public static int pathCostMultiplier=1; + /// + /// This is a dictionary that holds the action cost for every tool when it is used. + /// + public static Dictionary toolCostDictionary = new Dictionary(); + + /// + /// Used to set the values at the beginning. + /// + public static void initializeToolCostDictionary() + { + toolCostDictionary.Add(typeof(StardewValley.Tools.WateringCan), 2); + toolCostDictionary.Add(typeof(StardewValley.Tools.Axe), 4); + toolCostDictionary.Add(typeof(StardewValley.Tools.Pickaxe), 3); + toolCostDictionary.Add(typeof(StardewValley.Tools.FishingRod), 5); + toolCostDictionary.Add(typeof(StardewValley.Tools.Hoe), 2); + toolCostDictionary.Add(typeof(StardewValley.Tools.MeleeWeapon), 1); + toolCostDictionary.Add(typeof(StardewValley.Tools.Sword), 1); + } + + /// + /// Used to assign a weight to using a tool a single time. + /// + /// + /// + public static int parseToolCostMultiplier(TaskPrerequisites.ToolPrerequisite t) + { + Type tool = t.requiredTool; + int value=2; + bool f = toolCostDictionary.TryGetValue(tool,out value); + if (f == true) return value; + else return 2; + } + + /// + /// Used to calculate the weight of using a tool to add to the overall cost of a TaskMetaData cost. + /// + /// + /// + /// + public static int calculateToolCostMultiplier(TaskPrerequisites.ToolPrerequisite t) + { + if (t.requiresTool == false || t.requiredTool==null) return 0; //Default tool not used. + return (parseToolCostMultiplier(t) * t.estimatedNumberOfUses); + } + + public static float calculateTaskCost(TileNode v,ToolPrerequisite t) + { + float pathCost= StarAI.PathFindingCore.Utilities.calculatePathCost(v) * pathCostMultiplier; + float toolCost = calculateToolCostMultiplier(t); + return (pathCost + toolCost); + } + + } +} diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs new file mode 100644 index 00000000..02f7f5d7 --- /dev/null +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs @@ -0,0 +1,38 @@ +using StardewValley; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StarAI.ExecutionCore.TaskPrerequisites +{ + /// + /// Weirdly enough this will be empty because it's just a placeholder prerequisite. Doesn't need to hold any more data since the player will always have an updated inventory. + /// + public class InventoryFullPrerequisite:GenericPrerequisite + { + public bool doesTaskRequireInventorySpace; + public InventoryFullPrerequisite(bool RequiresInventorySpace) + { + this.doesTaskRequireInventorySpace = RequiresInventorySpace; + } + + public bool isPlayerInventoryFull() + { + + return Game1.player.isInventoryFull(); + } + + public override bool checkAllPrerequisites() + { + if (isPlayerInventoryFull() == false) return true; + else//player inventory is full + { + ModCore.CoreMonitor.Log("Player inventory is full failed the task prerequisite"); + return false; + } + } + + } +} diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/ToolPrerequisite.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/ToolPrerequisite.cs index 570c0388..45a5480e 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/ToolPrerequisite.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/ToolPrerequisite.cs @@ -11,17 +11,23 @@ namespace StarAI.ExecutionCore.TaskPrerequisites { public bool requiresTool; public Type requiredTool; + public int estimatedNumberOfUses; - public ToolPrerequisite(bool TaskNeedsTool, Type RequiredTool) + public ToolPrerequisite(bool TaskNeedsTool, Type RequiredTool, int EstimatedNumberOfUses) { requiresTool = TaskNeedsTool; requiredTool = RequiredTool; + this.estimatedNumberOfUses = EstimatedNumberOfUses; verifyToolSetUp(); } public void verifyToolSetUp() { - if (requiresTool == false) requiredTool = null; + if (requiresTool == false) + { + requiredTool = null; + estimatedNumberOfUses = 0; + } } public bool isToolInInventory() diff --git a/StarAI/StarAI/StarAI/ModCore.cs b/StarAI/StarAI/StarAI/ModCore.cs index 691cbfe0..18514c91 100644 --- a/StarAI/StarAI/StarAI/ModCore.cs +++ b/StarAI/StarAI/StarAI/ModCore.cs @@ -37,6 +37,7 @@ namespace StarAI CoreMonitor.Log("Hello AI WORLD!", LogLevel.Info); Commands.initializeCommands(); PathFindingCore.Utilities.initializeTileExceptionList(); + ExecutionCore.TaskMetaDataHeuristics.initializeToolCostDictionary(); //throw new NotImplementedException(); StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged; diff --git a/StarAI/StarAI/StarAI/PathFindingCore/ChestLogic.cs b/StarAI/StarAI/StarAI/PathFindingCore/ChestLogic.cs index 533054a2..a0d953bf 100644 --- a/StarAI/StarAI/StarAI/PathFindingCore/ChestLogic.cs +++ b/StarAI/StarAI/StarAI/PathFindingCore/ChestLogic.cs @@ -61,7 +61,7 @@ namespace StarAI.PathFindingCore object[] objList = new object[1]; objList[0] = v; // ExecutionCore.TaskList.taskList.Add(new Task(new Action(waterSingleCrop), obj)); - ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(pathToSingleChest, objList,new ExecutionCore.TaskMetaData("Path to chest for seeds",PathFindingCore.Utilities.calculatePathCost(v)))); + ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(pathToSingleChest, objList,new ExecutionCore.TaskMetaData("Path to chest for seeds",null,null,new ExecutionCore.TaskPrerequisites.InventoryFullPrerequisite(true)))); // waterSingleCrop(v); } } diff --git a/StarAI/StarAI/StarAI/PathFindingCore/CropLogic/CropLogic.cs b/StarAI/StarAI/StarAI/PathFindingCore/CropLogic/CropLogic.cs index 2dc18702..b7da991d 100644 --- a/StarAI/StarAI/StarAI/PathFindingCore/CropLogic/CropLogic.cs +++ b/StarAI/StarAI/StarAI/PathFindingCore/CropLogic/CropLogic.cs @@ -49,7 +49,7 @@ namespace StarAI.PathFindingCore.CropLogic obj[0] = v; // ExecutionCore.TaskList.taskList.Add(new Task(new Action(waterSingleCrop), obj)); StardewValley.Tools.WateringCan w = new StardewValley.Tools.WateringCan(); - ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(waterSingleCrop, obj,new ExecutionCore.TaskMetaData("Water Crop",PathFindingCore.Utilities.calculatePathCost(v),new StaminaPrerequisite(true,3),new ToolPrerequisite(true,w.GetType())))); + ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(waterSingleCrop, obj,new ExecutionCore.TaskMetaData("Water Crop", new StaminaPrerequisite(true,3),new ToolPrerequisite(true,w.GetType(),1)))); // waterSingleCrop(v); } } @@ -271,7 +271,7 @@ namespace StarAI.PathFindingCore.CropLogic object[] obj = new object[1]; obj[0] = v; //ExecutionCore.TaskList.taskList.Add(new Task(new Action(harvestSingleCrop), obj)); - ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(harvestSingleCrop, obj,new ExecutionCore.TaskMetaData("HarvestSingleCrop",StarAI.PathFindingCore.Utilities.calculatePathCost(v)))); + ExecutionCore.TaskList.taskList.Add(new ExecutionCore.CustomTask(harvestSingleCrop, obj,new ExecutionCore.TaskMetaData("HarvestSingleCrop",null,null,new ExecutionCore.TaskPrerequisites.InventoryFullPrerequisite(true)))); // waterSingleCrop(v); } diff --git a/StarAI/StarAI/StarAI/StarAI.csproj b/StarAI/StarAI/StarAI/StarAI.csproj index f220b72d..d085ed0c 100644 --- a/StarAI/StarAI/StarAI/StarAI.csproj +++ b/StarAI/StarAI/StarAI/StarAI.csproj @@ -60,7 +60,9 @@ + + From ad2ba9527bc86413da30bef0bd61c7bf3137e83d Mon Sep 17 00:00:00 2001 From: Date: Mon, 27 Nov 2017 23:38:12 -0800 Subject: [PATCH 2/4] Path find through grass and made prereq for making sure I don't stay up too late. --- .../StarAI/ExecutionCore/TaskMetaData.cs | 25 ++++++++- .../TaskPrerequisites/BedTimePrerequisite.cs | 56 +++++++++++++++++++ .../InventoryFullPrerequisite.cs | 1 + .../StarAI/PathFindingCore/TileNodeObject.cs | 37 ++++++------ StarAI/StarAI/StarAI/StarAI.csproj | 1 + 5 files changed, 98 insertions(+), 22 deletions(-) create mode 100644 StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/BedTimePrerequisite.cs diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs index c74fbc44..e26a5ad7 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskMetaData.cs @@ -18,9 +18,11 @@ namespace StarAI.ExecutionCore public StarAI.ExecutionCore.TaskPrerequisites.ToolPrerequisite toolPrerequisite; public TaskPrerequisites.InventoryFullPrerequisite inventoryPrerequisite; + public TaskPrerequisites.BedTimePrerequisite bedTimePrerequisite; + public List prerequisitesList; - public TaskMetaData(string Name, float Priority, float Cost, float Utility, float Frequency, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite=null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite=null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null) + public TaskMetaData(string Name, float Priority, float Cost, float Utility, float Frequency, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite=null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite=null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null, TaskPrerequisites.BedTimePrerequisite BedTimePrereq=null) { this.name = Name; this.priority = Priority; @@ -30,47 +32,59 @@ namespace StarAI.ExecutionCore this.staminaPrerequisite = StaminaPrerequisite; this.toolPrerequisite = ToolPrerequisite; this.inventoryPrerequisite = InventoryFull; + this.bedTimePrerequisite = BedTimePrereq; //Make sure to set values correctly incase of null setUpStaminaPrerequisiteIfNull(); setUpToolPrerequisiteIfNull(); setUpInventoryPrerequisiteIfNull(); + setUpBedTimeIfNull(); this.prerequisitesList = new List(); this.prerequisitesList.Add(this.staminaPrerequisite); this.prerequisitesList.Add(this.toolPrerequisite); this.prerequisitesList.Add(this.inventoryPrerequisite); + + this.prerequisitesList.Add(this.bedTimePrerequisite); } - public TaskMetaData(string Name,float Cost,TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null) + public TaskMetaData(string Name,float Cost,TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull = null,TaskPrerequisites.BedTimePrerequisite BedTimePrereq=null) { this.name = Name; this.cost = Cost; this.staminaPrerequisite = StaminaPrerequisite; this.toolPrerequisite = ToolPrerequisite; this.inventoryPrerequisite = InventoryFull; + + this.bedTimePrerequisite = BedTimePrereq; //Make sure to set values correctly incase of null setUpStaminaPrerequisiteIfNull(); setUpToolPrerequisiteIfNull(); setUpInventoryPrerequisiteIfNull(); + setUpBedTimeIfNull(); this.prerequisitesList = new List(); this.prerequisitesList.Add(this.staminaPrerequisite); this.prerequisitesList.Add(this.toolPrerequisite); this.prerequisitesList.Add(this.inventoryPrerequisite); + this.prerequisitesList.Add(this.bedTimePrerequisite); } - public TaskMetaData(string Name, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull=null) + public TaskMetaData(string Name, TaskPrerequisites.StaminaPrerequisite StaminaPrerequisite = null, TaskPrerequisites.ToolPrerequisite ToolPrerequisite = null, TaskPrerequisites.InventoryFullPrerequisite InventoryFull=null,TaskPrerequisites.BedTimePrerequisite bedTimePrereq=null) { this.name = Name; this.staminaPrerequisite = StaminaPrerequisite; this.toolPrerequisite = ToolPrerequisite; this.inventoryPrerequisite = InventoryFull; + + this.bedTimePrerequisite = bedTimePrereq; //Make sure to set values correctly incase of null setUpStaminaPrerequisiteIfNull(); setUpToolPrerequisiteIfNull(); setUpInventoryPrerequisiteIfNull(); + setUpBedTimeIfNull(); this.prerequisitesList = new List(); this.prerequisitesList.Add(this.staminaPrerequisite); this.prerequisitesList.Add(this.toolPrerequisite); this.prerequisitesList.Add(this.inventoryPrerequisite); + this.prerequisitesList.Add(this.bedTimePrerequisite); } public void calculateTaskCost(TileNode source) @@ -98,6 +112,11 @@ namespace StarAI.ExecutionCore if (this.inventoryPrerequisite == null) this.inventoryPrerequisite = new TaskPrerequisites.InventoryFullPrerequisite(false); } + private void setUpBedTimeIfNull() + { + if (this.bedTimePrerequisite == null) this.bedTimePrerequisite = new TaskPrerequisites.BedTimePrerequisite(true); + } + public bool verifyAllPrerequisitesHit() { diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/BedTimePrerequisite.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/BedTimePrerequisite.cs new file mode 100644 index 00000000..200a8672 --- /dev/null +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/BedTimePrerequisite.cs @@ -0,0 +1,56 @@ +using StardewValley; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StarAI.ExecutionCore.TaskPrerequisites +{ + public class BedTimePrerequisite : GenericPrerequisite + { + + public bool checkIfEnoughTimeRemaining; + public BedTimePrerequisite(bool CheckForBedtime) + { + this.checkIfEnoughTimeRemaining = CheckForBedtime; + } + + public int timeRemainingInDay() + { + int passOutTime = 2600; + return passOutTime - Game1.timeOfDay; + } + + /// + /// The default here will give you 2 hrs which should be enough for bedTime. + /// + /// + public bool enoughTimeToDoTask() + { + int timeRemaining = timeRemainingInDay(); + if (timeRemaining > 200) return true; + else return false; + } + + public bool enoughTimeToDoTask(int timeToDoTask) + { + int timeRemaining = timeRemainingInDay(); + if (timeRemaining > timeToDoTask) return true; + else return false; + } + + public override bool checkAllPrerequisites() + { + if (this.checkIfEnoughTimeRemaining == false) return true; + if (enoughTimeToDoTask()) return true; + else + { + ModCore.CoreMonitor.Log("Not enough time remaining in the day. You should go home."); + //Add functionality here to return home. + return false; + } + } + + } +} diff --git a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs index 02f7f5d7..e9118f37 100644 --- a/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs +++ b/StarAI/StarAI/StarAI/ExecutionCore/TaskPrerequisites/InventoryFullPrerequisite.cs @@ -26,6 +26,7 @@ namespace StarAI.ExecutionCore.TaskPrerequisites public override bool checkAllPrerequisites() { + if (this.doesTaskRequireInventorySpace == false) return true; if (isPlayerInventoryFull() == false) return true; else//player inventory is full { diff --git a/StarAI/StarAI/StarAI/PathFindingCore/TileNodeObject.cs b/StarAI/StarAI/StarAI/PathFindingCore/TileNodeObject.cs index c3d30f74..6e633445 100644 --- a/StarAI/StarAI/StarAI/PathFindingCore/TileNodeObject.cs +++ b/StarAI/StarAI/StarAI/PathFindingCore/TileNodeObject.cs @@ -7,6 +7,7 @@ using StardewValley; using StardewValley.Locations; using StardewValley.Menus; using StardewValley.Objects; +using StardewValley.TerrainFeatures; using StardustCore; using StardustCore.Animations; using System; @@ -65,7 +66,7 @@ namespace StarAI.PathFindingCore public TileNode parent; - public static bool checkIfICanPlaceHere(TileNode t, Vector2 pos, GameLocation loc = null, bool checkForCrops=false) + public static bool checkIfICanPlaceHere(TileNode t, Vector2 pos, GameLocation loc = null, bool checkForPassableTerrainFeatures = true) { bool cry = false; if (t.thisLocation == null) @@ -74,23 +75,7 @@ namespace StarAI.PathFindingCore cry = true; } - if (checkForCrops == true) - { - if (t.thisLocation.isTerrainFeatureAt((int)pos.X, (int)pos.Y)) - { - StardewValley.TerrainFeatures.TerrainFeature terrain = t.thisLocation.terrainFeatures[t.tileLocation]; - if (terrain != null) - { - if (terrain is StardewValley.TerrainFeatures.HoeDirt) - { - if ((terrain as StardewValley.TerrainFeatures.HoeDirt).crop != null) - { - return true; - } - } - } - } - } + if (t == null) { Console.WriteLine("OK T IS NULL"); @@ -99,12 +84,26 @@ namespace StarAI.PathFindingCore { Console.WriteLine("OK T LOCATION IS NULL"); } + + if (t.thisLocation.isObjectAt((int)pos.X, (int)pos.Y)) { - //ModCore.CoreMonitor.Log("Object at this tile position!: " + t.thisLocation.name, LogLevel.Warn); + //ModCore.CoreMonitor.Log("Object at this tile position!: " + t.thisLocation.objects[new Vector2(pos.X/Game1.tileSize,pos.Y/Game1.tileSize)].name, LogLevel.Warn); if (cry == true) t.thisLocation = null; return false; } + + + + if (checkForPassableTerrainFeatures) + { + bool terrainFeature = t.thisLocation.terrainFeatures.ContainsKey(pos / Game1.tileSize); + if (terrainFeature) + { + TerrainFeature terrain = t.thisLocation.terrainFeatures[pos / Game1.tileSize]; + if (terrain.isPassable()) return true; + } + } if (t.thisLocation.isTileOccupied(pos / Game1.tileSize)) { // ModCore.CoreMonitor.Log("Tile occupied!: " + t.thisLocation.name, LogLevel.Error); diff --git a/StarAI/StarAI/StarAI/StarAI.csproj b/StarAI/StarAI/StarAI/StarAI.csproj index d085ed0c..288d364b 100644 --- a/StarAI/StarAI/StarAI/StarAI.csproj +++ b/StarAI/StarAI/StarAI/StarAI.csproj @@ -61,6 +61,7 @@ + From 402c27b29c24c5f01897d20804e70ed88a64fc84 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 11 Jan 2018 00:43:32 -0500 Subject: [PATCH 3/4] update manifest format --- GeneralMods/AutoSpeed/manifest.json | 9 ++------- GeneralMods/BillboardAnywhere/manifest.json | 9 ++------- GeneralMods/BuildEndurance/manifest.json | 9 ++------- GeneralMods/BuildHealth/manifest.json | 9 ++------- GeneralMods/BuyBackCollectables/manifest.json | 9 ++------- GeneralMods/CustomShopsRedux/manifest.json | 9 ++------- GeneralMods/DailyQuestAnywhere/manifest.json | 9 ++------- GeneralMods/Fall28SnowDay/manifest.json | 9 ++------- GeneralMods/HappyBirthday/manifest.json | 9 ++------- GeneralMods/MoreRain/manifest.json | 9 ++------- GeneralMods/MuseumRearranger/manifest.json | 9 ++------- GeneralMods/NightOwl/manifest.json | 9 ++------- GeneralMods/NoMorePets/manifest.json | 9 ++------- GeneralMods/SaveAnywhere/manifest.json | 9 ++------- GeneralMods/SaveBackup/manifest.json | 9 ++------- GeneralMods/SimpleSoundManager/manifest.json | 9 ++------- GeneralMods/StardewSymphony/manifest.json | 9 ++------- GeneralMods/StardustCore/manifest.json | 11 +++-------- GeneralMods/TimeFreeze/manifest.json | 9 ++------- 19 files changed, 39 insertions(+), 134 deletions(-) diff --git a/GeneralMods/AutoSpeed/manifest.json b/GeneralMods/AutoSpeed/manifest.json index 14cce674..5eef2d12 100644 --- a/GeneralMods/AutoSpeed/manifest.json +++ b/GeneralMods/AutoSpeed/manifest.json @@ -1,15 +1,10 @@ { "Name": "Auto Speed", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Got to go fast!", "UniqueID": "Omegasis.AutoSpeed", "EntryDll": "AutoSpeed.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:443" ] } diff --git a/GeneralMods/BillboardAnywhere/manifest.json b/GeneralMods/BillboardAnywhere/manifest.json index fb131f8d..3dee7105 100644 --- a/GeneralMods/BillboardAnywhere/manifest.json +++ b/GeneralMods/BillboardAnywhere/manifest.json @@ -1,15 +1,10 @@ { "Name": "Billboard Anywhere", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Lets you view the billboard from anywhere.", "UniqueID": "Omegasis.BillboardAnywhere", "EntryDll": "BillboardAnywhere.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:492" ] } diff --git a/GeneralMods/BuildEndurance/manifest.json b/GeneralMods/BuildEndurance/manifest.json index a3751db4..33897c2b 100644 --- a/GeneralMods/BuildEndurance/manifest.json +++ b/GeneralMods/BuildEndurance/manifest.json @@ -1,15 +1,10 @@ { "Name": "Build Endurance", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Increase your health as you play.", "UniqueID": "Omegasis.BuildEndurance", "EntryDll": "BuildEndurance.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:445" ] } diff --git a/GeneralMods/BuildHealth/manifest.json b/GeneralMods/BuildHealth/manifest.json index 1645b030..9333b38e 100644 --- a/GeneralMods/BuildHealth/manifest.json +++ b/GeneralMods/BuildHealth/manifest.json @@ -1,15 +1,10 @@ { "Name": "Build Health", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Increase your health as you play.", "UniqueID": "Omegasis.BuildHealth", "EntryDll": "BuildHealth.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:446" ] } diff --git a/GeneralMods/BuyBackCollectables/manifest.json b/GeneralMods/BuyBackCollectables/manifest.json index 3b36fc9a..c1b70ba2 100644 --- a/GeneralMods/BuyBackCollectables/manifest.json +++ b/GeneralMods/BuyBackCollectables/manifest.json @@ -1,15 +1,10 @@ { "Name": "Buy Back Collectables", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Lets you buy back any obtained collectable.", "UniqueID": "Omegasis.BuyBackCollectables", "EntryDll": "BuyBackCollectables.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:507" ] } diff --git a/GeneralMods/CustomShopsRedux/manifest.json b/GeneralMods/CustomShopsRedux/manifest.json index 82e22db1..deff5333 100644 --- a/GeneralMods/CustomShopsRedux/manifest.json +++ b/GeneralMods/CustomShopsRedux/manifest.json @@ -1,15 +1,10 @@ { "Name": "Custom Shop Redux GUI", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "A nice way to make custom shops.", "UniqueID": "Omegasis.CustomShopReduxGui", "EntryDll": "CustomShopsRedux.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:1378" ] } diff --git a/GeneralMods/DailyQuestAnywhere/manifest.json b/GeneralMods/DailyQuestAnywhere/manifest.json index 77853411..faaaefa9 100644 --- a/GeneralMods/DailyQuestAnywhere/manifest.json +++ b/GeneralMods/DailyQuestAnywhere/manifest.json @@ -1,15 +1,10 @@ { "Name": "Daily Quest Anywhere", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Open the daily quest board from anywhere in the game.", "UniqueID": "Omegasis.DailyQuestAnywhere", "EntryDll": "DailyQuestAnywhere.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:513" ] } diff --git a/GeneralMods/Fall28SnowDay/manifest.json b/GeneralMods/Fall28SnowDay/manifest.json index d6b5107b..cd1457ca 100644 --- a/GeneralMods/Fall28SnowDay/manifest.json +++ b/GeneralMods/Fall28SnowDay/manifest.json @@ -1,15 +1,10 @@ { "Name": "Fall 28 Snow Day", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Makes it snow on Fall 28, which makes a good explanation for all the snow on the next day.", "UniqueID": "Omegasis.Fall28SnowDay", "EntryDll": "Fall28SnowDay.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:486" ] } diff --git a/GeneralMods/HappyBirthday/manifest.json b/GeneralMods/HappyBirthday/manifest.json index 1a0d213b..5186e9f5 100644 --- a/GeneralMods/HappyBirthday/manifest.json +++ b/GeneralMods/HappyBirthday/manifest.json @@ -1,15 +1,10 @@ { "Name": "Happy Birthday", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Adds the farmer's birthday to the game.", "UniqueID": "Omegasis.HappyBirthday", "EntryDll": "HappyBirthday.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:520" ] } diff --git a/GeneralMods/MoreRain/manifest.json b/GeneralMods/MoreRain/manifest.json index ad3e69fa..eaf789f3 100644 --- a/GeneralMods/MoreRain/manifest.json +++ b/GeneralMods/MoreRain/manifest.json @@ -1,15 +1,10 @@ { "Name": "More Rain", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 5, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.5.1", "Description": "Change how much it rains in the game.", "UniqueID": "Omegasis.MoreRain", "EntryDll": "MoreRain.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:441" ] } diff --git a/GeneralMods/MuseumRearranger/manifest.json b/GeneralMods/MuseumRearranger/manifest.json index 358f4460..a9d86bf1 100644 --- a/GeneralMods/MuseumRearranger/manifest.json +++ b/GeneralMods/MuseumRearranger/manifest.json @@ -1,15 +1,10 @@ { "Name": "Museum Rearranger", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Lets you rearrange the museum without needing to donate something.", "UniqueID": "Omegasis.MuseumRearranger", "EntryDll": "MuseumRearranger.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:428" ] } diff --git a/GeneralMods/NightOwl/manifest.json b/GeneralMods/NightOwl/manifest.json index dcfb3114..37fa292e 100644 --- a/GeneralMods/NightOwl/manifest.json +++ b/GeneralMods/NightOwl/manifest.json @@ -1,15 +1,10 @@ { "Name": "Night Owl", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Lets you stay up all night.", "UniqueID": "Omegasis.NightOwl", "EntryDll": "NightOwl.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:433" ] } diff --git a/GeneralMods/NoMorePets/manifest.json b/GeneralMods/NoMorePets/manifest.json index b361a65a..aed0a4e9 100644 --- a/GeneralMods/NoMorePets/manifest.json +++ b/GeneralMods/NoMorePets/manifest.json @@ -1,15 +1,10 @@ { "Name": "No More Pets", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Removes all pets from the game.", "UniqueID": "Omegasis.NoMorePets", "EntryDll": "NoMorePets.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:506" ] } diff --git a/GeneralMods/SaveAnywhere/manifest.json b/GeneralMods/SaveAnywhere/manifest.json index 0e6e3f38..ae7adf7c 100644 --- a/GeneralMods/SaveAnywhere/manifest.json +++ b/GeneralMods/SaveAnywhere/manifest.json @@ -1,15 +1,10 @@ { "Name": "Save Anywhere", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 2, - "MinorVersion": 6, - "PatchVersion": 2, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "2.6.2", "Description": "Lets you save almost anywhere.", "UniqueID": "Omegasis.SaveAnywhere", "EntryDll": "SaveAnywhere.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:444" ] } diff --git a/GeneralMods/SaveBackup/manifest.json b/GeneralMods/SaveBackup/manifest.json index 60a38c32..f4a680d1 100644 --- a/GeneralMods/SaveBackup/manifest.json +++ b/GeneralMods/SaveBackup/manifest.json @@ -1,15 +1,10 @@ { "Name": "Save Backup", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 3, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.3.1", "Description": "Backs up your save files at regular intervals.", "UniqueID": "Omegasis.SaveBackup", "EntryDll": "SaveBackup.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:435" ] } diff --git a/GeneralMods/SimpleSoundManager/manifest.json b/GeneralMods/SimpleSoundManager/manifest.json index 1040a456..d11b436a 100644 --- a/GeneralMods/SimpleSoundManager/manifest.json +++ b/GeneralMods/SimpleSoundManager/manifest.json @@ -1,15 +1,10 @@ { "Name": "Simple Sound Manager", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 0, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.0.1", "Description": "A simple framework to play sounds from wave banks.", "UniqueID": "Omegasis.SimpleSoundManager", "EntryDll": "SimpleSoundManager.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:1410" ] } diff --git a/GeneralMods/StardewSymphony/manifest.json b/GeneralMods/StardewSymphony/manifest.json index 44af2454..af9642e0 100644 --- a/GeneralMods/StardewSymphony/manifest.json +++ b/GeneralMods/StardewSymphony/manifest.json @@ -1,15 +1,10 @@ { "Name": "Stardew Symphony", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 4, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.4.1", "Description": "Adding more music to the game one beep at a time.", "UniqueID": "Omegasis.StardewSymphony", "EntryDll": "StardewSymphony.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:425" ] } diff --git a/GeneralMods/StardustCore/manifest.json b/GeneralMods/StardustCore/manifest.json index f1d7482d..6212b6da 100644 --- a/GeneralMods/StardustCore/manifest.json +++ b/GeneralMods/StardustCore/manifest.json @@ -1,15 +1,10 @@ { "Name": "StardustCore", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 2, - "MinorVersion": 0, - "PatchVersion": 0, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "2.0.0", "Description": "A core mod that allows for other mods to be run.", "UniqueID": "Omegasis.StardustCore", "EntryDll": "StardustCore.dll", - "UpdateKeys": [""] + "MinimumApiVersion": "2.0", + "UpdateKeys": [] } diff --git a/GeneralMods/TimeFreeze/manifest.json b/GeneralMods/TimeFreeze/manifest.json index 18d9099d..341cfbd7 100644 --- a/GeneralMods/TimeFreeze/manifest.json +++ b/GeneralMods/TimeFreeze/manifest.json @@ -1,15 +1,10 @@ { "Name": "Time Freeze", "Author": "Alpha_Omegasis", - "Version": { - "MajorVersion": 1, - "MinorVersion": 2, - "PatchVersion": 1, - "Build": null - }, - "MinimumApiVersion": "1.15", + "Version": "1.2.1", "Description": "Emulates old Harvest Moon-style games where time is frozen inside.", "UniqueID": "Omegasis.TimeFreeze", "EntryDll": "TimeFreeze.dll", + "MinimumApiVersion": "2.0", "UpdateKeys": [ "Nexus:973" ] } From c4e92f5cf3b6f2f56cf37872ed9035ef34e108bb Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 11 Jan 2018 00:50:16 -0500 Subject: [PATCH 4/4] update deprecated reflection API --- GeneralMods/MuseumRearranger/Framework/NewMuseumMenu.cs | 4 ++-- GeneralMods/MuseumRearranger/manifest.json | 2 +- GeneralMods/SaveAnywhere/SaveAnywhere.cs | 6 +++--- GeneralMods/SaveAnywhere/manifest.json | 2 +- GeneralMods/StardustCore/ModInfo/MetaData.cs | 2 +- GeneralMods/StardustCore/manifest.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/GeneralMods/MuseumRearranger/Framework/NewMuseumMenu.cs b/GeneralMods/MuseumRearranger/Framework/NewMuseumMenu.cs index f18c3185..dcef035a 100644 --- a/GeneralMods/MuseumRearranger/Framework/NewMuseumMenu.cs +++ b/GeneralMods/MuseumRearranger/Framework/NewMuseumMenu.cs @@ -17,7 +17,7 @@ namespace Omegasis.MuseumRearranger.Framework private bool ShowInventory = true; /// A reference to a private field for use in the overridden draw code. - private readonly IPrivateField HoldingMuseumPiece; + private readonly IReflectedField HoldingMuseumPiece; /********* @@ -27,7 +27,7 @@ namespace Omegasis.MuseumRearranger.Framework /// Simplifies access to private game code. public NewMuseumMenu(IReflectionHelper reflection) { - this.HoldingMuseumPiece = reflection.GetPrivateField(this, "holdingMuseumPiece"); + this.HoldingMuseumPiece = reflection.GetField(this, "holdingMuseumPiece"); } /// Toggle the inventory box. diff --git a/GeneralMods/MuseumRearranger/manifest.json b/GeneralMods/MuseumRearranger/manifest.json index a9d86bf1..f6f9d609 100644 --- a/GeneralMods/MuseumRearranger/manifest.json +++ b/GeneralMods/MuseumRearranger/manifest.json @@ -5,6 +5,6 @@ "Description": "Lets you rearrange the museum without needing to donate something.", "UniqueID": "Omegasis.MuseumRearranger", "EntryDll": "MuseumRearranger.dll", - "MinimumApiVersion": "2.0", + "MinimumApiVersion": "2.3", "UpdateKeys": [ "Nexus:428" ] } diff --git a/GeneralMods/SaveAnywhere/SaveAnywhere.cs b/GeneralMods/SaveAnywhere/SaveAnywhere.cs index 74e895f5..649c90d0 100644 --- a/GeneralMods/SaveAnywhere/SaveAnywhere.cs +++ b/GeneralMods/SaveAnywhere/SaveAnywhere.cs @@ -215,7 +215,7 @@ namespace Omegasis.SaveAnywhere int endFacingDir = Convert.ToInt32(fields[4]); schedulePathDescription = this.Helper.Reflection - .GetPrivateMethod(npc, "pathfindToNextScheduleLocation") + .GetMethod(npc, "pathfindToNextScheduleLocation") .Invoke(npc.currentLocation.name, npc.getTileX(), npc.getTileY(), endMap, x, y, endFacingDir, null, null); index++; } @@ -274,14 +274,14 @@ namespace Omegasis.SaveAnywhere if ((npc.name.Equals("Penny") && (dayName.Equals("Tue") || dayName.Equals("Wed") || dayName.Equals("Fri"))) || (npc.name.Equals("Maru") && (dayName.Equals("Tue") || dayName.Equals("Thu"))) || (npc.name.Equals("Harvey") && (dayName.Equals("Tue") || dayName.Equals("Thu")))) { this.Helper.Reflection - .GetPrivateField(npc, "nameofTodaysSchedule") + .GetField(npc, "nameofTodaysSchedule") .SetValue("marriageJob"); return "marriageJob"; } if (!Game1.isRaining && schedule.ContainsKey("marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth))) { this.Helper.Reflection - .GetPrivateField(npc, "nameofTodaysSchedule") + .GetField(npc, "nameofTodaysSchedule") .SetValue("marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth)); return "marriage_" + Game1.shortDayNameFromDayOfSeason(Game1.dayOfMonth); } diff --git a/GeneralMods/SaveAnywhere/manifest.json b/GeneralMods/SaveAnywhere/manifest.json index ae7adf7c..6e5cd1f0 100644 --- a/GeneralMods/SaveAnywhere/manifest.json +++ b/GeneralMods/SaveAnywhere/manifest.json @@ -5,6 +5,6 @@ "Description": "Lets you save almost anywhere.", "UniqueID": "Omegasis.SaveAnywhere", "EntryDll": "SaveAnywhere.dll", - "MinimumApiVersion": "2.0", + "MinimumApiVersion": "2.3", "UpdateKeys": [ "Nexus:444" ] } diff --git a/GeneralMods/StardustCore/ModInfo/MetaData.cs b/GeneralMods/StardustCore/ModInfo/MetaData.cs index c903d436..81fc6ec4 100644 --- a/GeneralMods/StardustCore/ModInfo/MetaData.cs +++ b/GeneralMods/StardustCore/ModInfo/MetaData.cs @@ -55,7 +55,7 @@ namespace StardustCore.ModInfo { // if (Game1.activeClickableMenu.allClickableComponents == null) return; try { - List pages = ModCore.ModHelper.Reflection.GetPrivateValue>(Game1.activeClickableMenu, "pages"); + List pages = ModCore.ModHelper.Reflection.GetField>(Game1.activeClickableMenu, "pages").GetValue(); if (Game1.activeClickableMenu is GameMenu) { StardewValley.Menus.IClickableMenu s = pages[(Game1.activeClickableMenu as GameMenu).currentTab]; diff --git a/GeneralMods/StardustCore/manifest.json b/GeneralMods/StardustCore/manifest.json index 6212b6da..7337f01c 100644 --- a/GeneralMods/StardustCore/manifest.json +++ b/GeneralMods/StardustCore/manifest.json @@ -5,6 +5,6 @@ "Description": "A core mod that allows for other mods to be run.", "UniqueID": "Omegasis.StardustCore", "EntryDll": "StardustCore.dll", - "MinimumApiVersion": "2.0", + "MinimumApiVersion": "2.3", "UpdateKeys": [] }