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
|
||||
{
|
||||
|
@ -48,14 +51,14 @@ namespace stardew_access
|
|||
{
|
||||
bool focus = MainClass.radarFeature.ToggleFocus();
|
||||
|
||||
MainClass.monitor.Log("Focus mode is " + (focus? "on" : "off"), LogLevel.Info);
|
||||
MainClass.monitor.Log("Focus mode is " + (focus ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rdelay", "Set the delay of radar feature in milliseconds.", (string commmand, string[] args) =>
|
||||
{
|
||||
string? delayInString = null;
|
||||
|
||||
if(args.Length > 0)
|
||||
if (args.Length > 0)
|
||||
{
|
||||
delayInString = args[0];
|
||||
|
||||
|
@ -66,7 +69,7 @@ namespace stardew_access
|
|||
if (isParsable)
|
||||
{
|
||||
MainClass.radarFeature.delay = delay;
|
||||
if(delay>=1000)
|
||||
if (delay >= 1000)
|
||||
MainClass.monitor.Log($"Delay set to {MainClass.radarFeature.delay} milliseconds.", LogLevel.Info);
|
||||
else
|
||||
MainClass.monitor.Log($"Delay should be atleast 1 second or 1000 millisecond long.", LogLevel.Info);
|
||||
|
@ -99,7 +102,7 @@ namespace stardew_access
|
|||
if (isParsable)
|
||||
{
|
||||
MainClass.radarFeature.range = range;
|
||||
if (range >= 2 && range<=10)
|
||||
if (range >= 2 && range <= 10)
|
||||
MainClass.monitor.Log($"Range set to {MainClass.radarFeature.range}.", LogLevel.Info);
|
||||
else
|
||||
MainClass.monitor.Log($"Range should be atleast 2 and maximum 10.", LogLevel.Info);
|
||||
|
@ -173,10 +176,12 @@ namespace stardew_access
|
|||
{
|
||||
if (MainClass.radarFeature.exclusions.Count > 0)
|
||||
{
|
||||
string toPrint = "";
|
||||
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
|
||||
{
|
||||
|
@ -251,10 +256,12 @@ namespace stardew_access
|
|||
{
|
||||
if (MainClass.radarFeature.focus.Count > 0)
|
||||
{
|
||||
string toPrint = "";
|
||||
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
|
||||
{
|
||||
|
@ -271,11 +278,58 @@ namespace stardew_access
|
|||
helper.ConsoleCommands.Add("rfcount", "Number of list in the radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.monitor.Log($"There are {MainClass.radarFeature.focus.Count} objects in the focus list in the radar feature.", LogLevel.Info);
|
||||
});
|
||||
});
|
||||
#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) =>
|
||||
{
|
||||
MainClass.screenReader.InitializeScreenReader();
|
||||
|
|
|
@ -325,18 +325,53 @@ namespace stardew_access.Game
|
|||
|
||||
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
|
||||
if (CurrentPlayer.getNextTile().Equals(position))
|
||||
return;
|
||||
|
||||
if (!radarFocus && (exclusions.Contains(category.ToString().ToLower().Trim()) || exclusions.Contains(searchQuery.ToLower().Trim())))
|
||||
return;
|
||||
if (!radarFocus)
|
||||
{
|
||||
if ((exclusions.Contains(category.ToString().ToLower().Trim()) || exclusions.Contains(searchQuery.ToLower().Trim())))
|
||||
return;
|
||||
|
||||
if (radarFocus && !(focus.Contains(category.ToString().ToLower().Trim()) || focus.Contains(searchQuery.ToLower().Trim())))
|
||||
return;
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
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)
|
||||
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 py = (int)Game1.player.getTileY(); // Player's Y postion
|
||||
|
|
|
@ -7,6 +7,7 @@ using stardew_access.Patches;
|
|||
using AutoHotkey.Interop;
|
||||
using System.Runtime.InteropServices;
|
||||
using stardew_access.ScreenReader;
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace stardew_access
|
||||
{
|
||||
|
@ -28,7 +29,7 @@ namespace stardew_access
|
|||
private static IModHelper _modHelper;
|
||||
public static IModHelper ModHelper
|
||||
{
|
||||
get{return _modHelper;}
|
||||
get { return _modHelper; }
|
||||
}
|
||||
|
||||
/*********
|
||||
|
@ -46,7 +47,7 @@ namespace stardew_access
|
|||
Game1.options.setGamepadMode("force_on");
|
||||
|
||||
// Initialize AutoHotKey
|
||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
InitializeAutoHotKey();
|
||||
|
||||
screenReader = new ScreenReaderController().Initialize();
|
||||
|
@ -60,6 +61,11 @@ namespace stardew_access
|
|||
harmony = new Harmony(ModManifest.UniqueID);
|
||||
HarmonyPatches.Initialize(harmony);
|
||||
|
||||
//Initialize marked locations
|
||||
for (int i = 0; i < BuildingNAnimalMenuPatches.marked.Length; i++)
|
||||
{
|
||||
BuildingNAnimalMenuPatches.marked[i] = Vector2.Zero;
|
||||
}
|
||||
#endregion
|
||||
|
||||
helper.Events.Input.ButtonPressed += this.OnButtonPressed;
|
||||
|
@ -68,10 +74,10 @@ namespace stardew_access
|
|||
AppDomain.CurrentDomain.ProcessExit += OnExit;
|
||||
}
|
||||
|
||||
public void OnExit (object? sender, EventArgs? e)
|
||||
public void OnExit(object? sender, EventArgs? e)
|
||||
{
|
||||
// Don't if this ever gets called or not but, just in case if it does.
|
||||
if(screenReader!=null)
|
||||
if (screenReader != null)
|
||||
screenReader.CloseScreenReader();
|
||||
}
|
||||
|
||||
|
@ -97,10 +103,10 @@ namespace stardew_access
|
|||
if (snapMouse)
|
||||
Other.SnapMouseToPlayer();
|
||||
|
||||
if(!ReadTile.isReadingTile && readTile)
|
||||
if (!ReadTile.isReadingTile && readTile)
|
||||
ReadTile.run();
|
||||
|
||||
if(!radarFeature.isRunning && radar)
|
||||
if (!radarFeature.isRunning && radar)
|
||||
radarFeature.Run();
|
||||
|
||||
if (!isNarratingHudMessage)
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Microsoft.Xna.Framework;
|
||||
using StardewValley;
|
||||
using StardewValley.Menus;
|
||||
|
||||
|
@ -5,6 +6,7 @@ namespace stardew_access.Patches
|
|||
{
|
||||
internal class BuildingNAnimalMenuPatches
|
||||
{
|
||||
internal static Vector2[] marked = new Vector2[10];
|
||||
internal static string carpenterMenuQuery = "";
|
||||
internal static bool isSayingBlueprintInfo = false;
|
||||
internal static string prevBlueprintInfo = "";
|
||||
|
|
Loading…
Reference in New Issue