Added commands for focus mode
parent
832f92867b
commit
c5e72d545b
|
@ -7,35 +7,51 @@ namespace stardew_access
|
|||
internal static void Initialize(IModHelper helper)
|
||||
{
|
||||
|
||||
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("readtile", "Toggle read tile feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.readTile = !MainClass.readTile;
|
||||
|
||||
MainClass.monitor.Log("Read Tile is " + (MainClass.readTile ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.snapMouse = !MainClass.snapMouse;
|
||||
|
||||
MainClass.monitor.Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radar = !MainClass.radar;
|
||||
|
||||
MainClass.monitor.Log("Radar " + (MainClass.radar ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rdebug", "Toggle debugging in radar feature", (string commmand, string[] args) =>
|
||||
#region Radar Feature
|
||||
helper.ConsoleCommands.Add("rdebug", "Toggle debugging in radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radarDebug = !MainClass.radarDebug;
|
||||
|
||||
MainClass.monitor.Log("Radar debugging " + (MainClass.radarDebug ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rexclude", "Exclude an object key to radar", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radarStereoSound = !MainClass.radarStereoSound;
|
||||
|
||||
MainClass.monitor.Log("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rfocus", "Toggle focus mode in radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
bool focus = MainClass.radarFeature.toggleFocus();
|
||||
|
||||
MainClass.monitor.Log("Focus mode is " + (focus? "on" : "off"), LogLevel.Info);
|
||||
});
|
||||
|
||||
#region Exclusions
|
||||
helper.ConsoleCommands.Add("readd", "Add an object key to the exclusions list of radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
string? keyToAdd = null;
|
||||
|
||||
|
@ -53,7 +69,7 @@ namespace stardew_access
|
|||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rinclude", "Inlcude an object key to radar", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("reremove", "Remove an object key from the exclusions list of radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
string? keyToAdd = null;
|
||||
|
||||
|
@ -78,7 +94,7 @@ namespace stardew_access
|
|||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rlist", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("relist", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
if (MainClass.radarFeature.exclusions.Count > 0)
|
||||
{
|
||||
|
@ -93,18 +109,79 @@ namespace stardew_access
|
|||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rcount", "Number of exclusions in the radar feature.", (string commmand, string[] args) =>
|
||||
helper.ConsoleCommands.Add("recount", "Number of exclusions in the radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.monitor.Log($"There are {MainClass.radarFeature.exclusions.Count} exclusiond in the radar feature.", LogLevel.Info);
|
||||
});
|
||||
#endregion
|
||||
|
||||
helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature", (string commmand, string[] args) =>
|
||||
#region Focus
|
||||
helper.ConsoleCommands.Add("rfadd", "Add an object key to the focus list of radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.radarStereoSound = !MainClass.radarStereoSound;
|
||||
string? keyToAdd = null;
|
||||
|
||||
MainClass.monitor.Log("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"), LogLevel.Info);
|
||||
for (int i = 0; i < args.Count(); i++) { keyToAdd += " " + args[i]; }
|
||||
|
||||
if (keyToAdd != null)
|
||||
{
|
||||
keyToAdd = keyToAdd.Trim().ToLower();
|
||||
MainClass.radarFeature.focus.Add(keyToAdd);
|
||||
MainClass.monitor.Log($"Added {keyToAdd} key to focus.", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainClass.monitor.Log("Unable to add the key to focus.", LogLevel.Info);
|
||||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rfremove", "Remove an object key from the focus list of radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
string? keyToAdd = null;
|
||||
|
||||
for (int i = 0; i < args.Count(); i++) { keyToAdd += " " + args[i]; }
|
||||
|
||||
if (keyToAdd != null)
|
||||
{
|
||||
keyToAdd = keyToAdd.Trim().ToLower();
|
||||
if (MainClass.radarFeature.focus.Contains(keyToAdd))
|
||||
{
|
||||
MainClass.radarFeature.focus.Remove(keyToAdd);
|
||||
MainClass.monitor.Log($"Removed {keyToAdd} key from focus.", LogLevel.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainClass.monitor.Log($"Cannot find{keyToAdd} key in focus.", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainClass.monitor.Log("Unable to remove the key from exclusions.", LogLevel.Info);
|
||||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rflist", "List all the exclusions in the radar feature.", (string commmand, string[] args) =>
|
||||
{
|
||||
if (MainClass.radarFeature.focus.Count > 0)
|
||||
{
|
||||
for (int i = 0; i < MainClass.radarFeature.focus.Count; i++)
|
||||
{
|
||||
MainClass.monitor.Log($"{i + 1}) {MainClass.radarFeature.focus[i]}", LogLevel.Info);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MainClass.monitor.Log("No objects found in the focus list.", LogLevel.Info);
|
||||
}
|
||||
});
|
||||
|
||||
helper.ConsoleCommands.Add("rfcount", "Number of exclusions 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
|
||||
|
||||
helper.ConsoleCommands.Add("refsr", "Refresh screen reader", (string commmand, string[] args) =>
|
||||
{
|
||||
MainClass.screenReader.InitializeScreenReader();
|
||||
|
|
|
@ -16,7 +16,10 @@ namespace stardew_access.Game
|
|||
private List<Furniture> furnitures;
|
||||
private List<NPC> npcs;
|
||||
public List<string> exclusions;
|
||||
private List<string> temp_exclusions;
|
||||
public List<string> focus;
|
||||
public bool isRunning;
|
||||
public bool radarFocus = false;
|
||||
|
||||
public Radar()
|
||||
{
|
||||
|
@ -25,6 +28,8 @@ namespace stardew_access.Game
|
|||
furnitures = new List<Furniture>();
|
||||
npcs = new List<NPC>();
|
||||
exclusions = new List<string>();
|
||||
temp_exclusions = new List<string>();
|
||||
focus = new List<string>();
|
||||
|
||||
exclusions.Add("stone");
|
||||
exclusions.Add("weed");
|
||||
|
@ -44,7 +49,9 @@ namespace stardew_access.Game
|
|||
|
||||
public async void run()
|
||||
{
|
||||
if(MainClass.radarDebug)
|
||||
MainClass.monitor.Log($"\n\nRead Tile started", StardewModdingAPI.LogLevel.Debug);
|
||||
|
||||
isRunning = true;
|
||||
Vector2 currPosition = Game1.player.getTileLocation();
|
||||
int limit = 5;
|
||||
|
@ -54,7 +61,9 @@ namespace stardew_access.Game
|
|||
npcs.Clear();
|
||||
findTile(currPosition, currPosition, limit);
|
||||
|
||||
if(MainClass.radarDebug)
|
||||
MainClass.monitor.Log($"\nRead Tile stopped\n\n", StardewModdingAPI.LogLevel.Debug);
|
||||
|
||||
await Task.Delay(3000);
|
||||
isRunning = false;
|
||||
}
|
||||
|
@ -298,10 +307,36 @@ namespace stardew_access.Game
|
|||
soundName = $"obj{soundName}";
|
||||
else if (soundType == typeof(ResourceClump)) // Resource CLumps
|
||||
soundName = $"obj{soundName}";
|
||||
else if (soundType == typeof(junimoBundle)) // Junimo bundles
|
||||
soundName = $"obj{soundName}";
|
||||
else // Default
|
||||
soundName = $"obj{soundName}";
|
||||
|
||||
return soundName;
|
||||
}
|
||||
|
||||
public bool toggleFocus()
|
||||
{
|
||||
radarFocus = !radarFocus;
|
||||
|
||||
if (radarFocus)
|
||||
enableFocus();
|
||||
else
|
||||
disableFocus();
|
||||
|
||||
return radarFocus;
|
||||
}
|
||||
|
||||
public void enableFocus()
|
||||
{
|
||||
temp_exclusions = exclusions;
|
||||
exclusions.Clear();
|
||||
}
|
||||
|
||||
public void disableFocus()
|
||||
{
|
||||
exclusions = temp_exclusions;
|
||||
temp_exclusions.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,8 +15,8 @@ namespace stardew_access
|
|||
public static bool readTile = true;
|
||||
public static bool snapMouse = true;
|
||||
public static bool isNarratingHudMessage = false;
|
||||
public static bool radar = false;
|
||||
public static bool radarDebug = true;
|
||||
public static bool radar = true;
|
||||
public static bool radarDebug = false;
|
||||
public static bool radarStereoSound = true;
|
||||
public static IMonitor? monitor;
|
||||
AutoHotkeyEngine ahk;
|
||||
|
|
Loading…
Reference in New Issue