Added commands for marking positions.
parent
9fb57be2f0
commit
d18fe74885
|
@ -1,4 +1,7 @@
|
||||||
using StardewModdingAPI;
|
using Microsoft.Xna.Framework;
|
||||||
|
using stardew_access.Patches;
|
||||||
|
using StardewModdingAPI;
|
||||||
|
using StardewValley;
|
||||||
|
|
||||||
namespace stardew_access
|
namespace stardew_access
|
||||||
{
|
{
|
||||||
|
@ -173,10 +176,12 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
if (MainClass.radarFeature.exclusions.Count > 0)
|
if (MainClass.radarFeature.exclusions.Count > 0)
|
||||||
{
|
{
|
||||||
|
string toPrint = "";
|
||||||
for (int i = 0; i < MainClass.radarFeature.exclusions.Count; i++)
|
for (int i = 0; i < MainClass.radarFeature.exclusions.Count; i++)
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"{i + 1}) {MainClass.radarFeature.exclusions[i]}", LogLevel.Info);
|
toPrint = $"{toPrint}\t{i + 1}: {MainClass.radarFeature.exclusions[i]}";
|
||||||
}
|
}
|
||||||
|
MainClass.monitor.Log(toPrint, LogLevel.Info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -251,10 +256,12 @@ namespace stardew_access
|
||||||
{
|
{
|
||||||
if (MainClass.radarFeature.focus.Count > 0)
|
if (MainClass.radarFeature.focus.Count > 0)
|
||||||
{
|
{
|
||||||
|
string toPrint = "";
|
||||||
for (int i = 0; i < MainClass.radarFeature.focus.Count; i++)
|
for (int i = 0; i < MainClass.radarFeature.focus.Count; i++)
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"{i + 1}) {MainClass.radarFeature.focus[i]}", LogLevel.Info);
|
toPrint = $"{toPrint}\t{i + 1}): {MainClass.radarFeature.focus[i]}";
|
||||||
}
|
}
|
||||||
|
MainClass.monitor.Log(toPrint, LogLevel.Info);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -276,6 +283,53 @@ namespace stardew_access
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Tile marking
|
||||||
|
helper.ConsoleCommands.Add("mark", "Marks the player's position for use in building cunstruction in Carpenter Menu.", (string commmand, string[] args) =>
|
||||||
|
{
|
||||||
|
if (Game1.currentLocation is not Farm)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log("Can only use this command in the farm", LogLevel.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string? indexInString = args.ElementAtOrDefault(0);
|
||||||
|
if (indexInString == null)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log("Enter the index too! Example syntax: mark 0, here 0 is the index and it can be from 0 to 9 only", LogLevel.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int index;
|
||||||
|
bool isParsable = int.TryParse(indexInString, out index);
|
||||||
|
|
||||||
|
if (!isParsable || !(index >= 0 && index <= 9))
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log("Index can only be a number and from 0 to 9 only", LogLevel.Info);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BuildingNAnimalMenuPatches.marked[index] = new Vector2((int)Game1.player.getTileX(), (int)Game1.player.getTileY());
|
||||||
|
MainClass.monitor.Log($"Location {(int)Game1.player.getTileX()}x {(int)Game1.player.getTileY()}y add at {index} index.", LogLevel.Info);
|
||||||
|
});
|
||||||
|
|
||||||
|
helper.ConsoleCommands.Add("marklist", "List all marked positions.", (string commmand, string[] args) =>
|
||||||
|
{
|
||||||
|
string toPrint = "";
|
||||||
|
for (int i = 0; i < BuildingNAnimalMenuPatches.marked.Length; i++)
|
||||||
|
{
|
||||||
|
if (BuildingNAnimalMenuPatches.marked[i] != Vector2.Zero)
|
||||||
|
{
|
||||||
|
toPrint = $"{toPrint}\t Index {i}: {BuildingNAnimalMenuPatches.marked[i].X}x {BuildingNAnimalMenuPatches.marked[i].Y}y";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (toPrint == "")
|
||||||
|
MainClass.monitor.Log("No positions marked!", LogLevel.Info);
|
||||||
|
else
|
||||||
|
MainClass.monitor.Log($"Marked positions:\t{toPrint}", LogLevel.Info);
|
||||||
|
});
|
||||||
|
#endregion
|
||||||
|
|
||||||
helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) =>
|
helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
MainClass.screenReader.InitializeScreenReader();
|
MainClass.screenReader.InitializeScreenReader();
|
||||||
|
|
|
@ -325,18 +325,53 @@ namespace stardew_access.Game
|
||||||
|
|
||||||
public void PlaySoundAt(Vector2 position, String searchQuery, CATEGORY category)
|
public void PlaySoundAt(Vector2 position, String searchQuery, CATEGORY category)
|
||||||
{
|
{
|
||||||
|
#region Check whether to skip the object or not
|
||||||
|
|
||||||
// Skip if player is directly looking at the tile
|
// Skip if player is directly looking at the tile
|
||||||
if (CurrentPlayer.getNextTile().Equals(position))
|
if (CurrentPlayer.getNextTile().Equals(position))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!radarFocus && (exclusions.Contains(category.ToString().ToLower().Trim()) || exclusions.Contains(searchQuery.ToLower().Trim())))
|
if (!radarFocus)
|
||||||
|
{
|
||||||
|
if ((exclusions.Contains(category.ToString().ToLower().Trim()) || exclusions.Contains(searchQuery.ToLower().Trim())))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (radarFocus && !(focus.Contains(category.ToString().ToLower().Trim()) || focus.Contains(searchQuery.ToLower().Trim())))
|
// Check if a word in searchQuery matches the one in exclusions list
|
||||||
|
string[] sqArr = searchQuery.ToLower().Trim().Split(" ");
|
||||||
|
for (int j = 0; j < sqArr.Length; j++)
|
||||||
|
{
|
||||||
|
if (exclusions.Contains(sqArr[j]))
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (focus.Count >= 0)
|
||||||
|
{
|
||||||
|
bool found = false;
|
||||||
|
|
||||||
|
// Check if a word in searchQuery matches the one in focus list
|
||||||
|
string[] sqArr = searchQuery.ToLower().Trim().Split(" ");
|
||||||
|
for (int j = 0; j < sqArr.Length; j++)
|
||||||
|
{
|
||||||
|
if (focus.Contains(sqArr[j]))
|
||||||
|
{
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This condition has to be after the for loop
|
||||||
|
if (!found && !(focus.Contains(category.ToString().ToLower().Trim()) || focus.Contains(searchQuery.ToLower().Trim())))
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
if (MainClass.radarDebug)
|
if (MainClass.radarDebug)
|
||||||
MainClass.monitor.Log($"Object:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
MainClass.monitor.Log($"{radarFocus}\tObject:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
||||||
|
|
||||||
int px = (int)Game1.player.getTileX(); // Player's X postion
|
int px = (int)Game1.player.getTileX(); // Player's X postion
|
||||||
int py = (int)Game1.player.getTileY(); // Player's Y postion
|
int py = (int)Game1.player.getTileY(); // Player's Y postion
|
||||||
|
|
|
@ -7,6 +7,7 @@ using stardew_access.Patches;
|
||||||
using AutoHotkey.Interop;
|
using AutoHotkey.Interop;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using stardew_access.ScreenReader;
|
using stardew_access.ScreenReader;
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
|
|
||||||
namespace stardew_access
|
namespace stardew_access
|
||||||
{
|
{
|
||||||
|
@ -60,6 +61,11 @@ namespace stardew_access
|
||||||
harmony = new Harmony(ModManifest.UniqueID);
|
harmony = new Harmony(ModManifest.UniqueID);
|
||||||
HarmonyPatches.Initialize(harmony);
|
HarmonyPatches.Initialize(harmony);
|
||||||
|
|
||||||
|
//Initialize marked locations
|
||||||
|
for (int i = 0; i < BuildingNAnimalMenuPatches.marked.Length; i++)
|
||||||
|
{
|
||||||
|
BuildingNAnimalMenuPatches.marked[i] = Vector2.Zero;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using Microsoft.Xna.Framework;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
|
|
||||||
|
@ -5,6 +6,7 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
internal class BuildingNAnimalMenuPatches
|
internal class BuildingNAnimalMenuPatches
|
||||||
{
|
{
|
||||||
|
internal static Vector2[] marked = new Vector2[10];
|
||||||
internal static string carpenterMenuQuery = "";
|
internal static string carpenterMenuQuery = "";
|
||||||
internal static bool isSayingBlueprintInfo = false;
|
internal static bool isSayingBlueprintInfo = false;
|
||||||
internal static string prevBlueprintInfo = "";
|
internal static string prevBlueprintInfo = "";
|
||||||
|
|
Loading…
Reference in New Issue