Added command to include key to exclusion
parent
6c8eddd08b
commit
469ed0a6a6
|
@ -78,112 +78,119 @@ namespace stardew_access.Game
|
||||||
|
|
||||||
public void checkTile(Vector2 position)
|
public void checkTile(Vector2 position)
|
||||||
{
|
{
|
||||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
try
|
||||||
|
{
|
||||||
|
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||||
|
|
||||||
// Check for npcs
|
// Check for npcs
|
||||||
if (Game1.currentLocation.isCharacterAtTile(position) != null && !exclusions.Contains("npc"))
|
if (Game1.currentLocation.isCharacterAtTile(position) != null && !exclusions.Contains("npc"))
|
||||||
{
|
|
||||||
NPC npc = Game1.currentLocation.isCharacterAtTile(position);
|
|
||||||
if (!npcs.Contains(npc))
|
|
||||||
{
|
{
|
||||||
playSoundAt(position, npc.displayName);
|
NPC npc = Game1.currentLocation.isCharacterAtTile(position);
|
||||||
}
|
if (!npcs.Contains(npc))
|
||||||
}
|
|
||||||
// Check for water
|
|
||||||
else if (Game1.currentLocation.isWaterTile((int)position.X, (int)position.Y) && !exclusions.Contains("water"))
|
|
||||||
{
|
|
||||||
playSoundAt(position, null);
|
|
||||||
}
|
|
||||||
// Check for objects
|
|
||||||
else if (Game1.currentLocation.isObjectAtTile((int)position.X, (int)position.Y))
|
|
||||||
{
|
|
||||||
string? objectName = ReadTile.getObjectNameAtTile((int)position.X, (int)position.Y);
|
|
||||||
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)position.X, (int)position.Y);
|
|
||||||
|
|
||||||
if (objectName != null)
|
|
||||||
{
|
|
||||||
if (obj is Furniture && !exclusions.Contains("furniture"))
|
|
||||||
{
|
{
|
||||||
if (!furnitures.Contains(obj as Furniture))
|
playSoundAt(position, npc.displayName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Check for water
|
||||||
|
else if (Game1.currentLocation.isWaterTile((int)position.X, (int)position.Y) && !exclusions.Contains("water"))
|
||||||
|
{
|
||||||
|
playSoundAt(position, null);
|
||||||
|
}
|
||||||
|
// Check for objects
|
||||||
|
else if (Game1.currentLocation.isObjectAtTile((int)position.X, (int)position.Y))
|
||||||
|
{
|
||||||
|
string? objectName = ReadTile.getObjectNameAtTile((int)position.X, (int)position.Y);
|
||||||
|
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)position.X, (int)position.Y);
|
||||||
|
|
||||||
|
if (objectName != null)
|
||||||
|
{
|
||||||
|
if (obj is Furniture && !exclusions.Contains("furniture"))
|
||||||
|
{
|
||||||
|
if (!furnitures.Contains(obj as Furniture))
|
||||||
|
{
|
||||||
|
furnitures.Add(obj as Furniture);
|
||||||
|
playSoundAt(position, objectName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
furnitures.Add(obj as Furniture);
|
|
||||||
playSoundAt(position, objectName);
|
playSoundAt(position, objectName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
playSoundAt(position, objectName);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
// Check for terrain features
|
||||||
// Check for terrain features
|
else if (terrainFeature.ContainsKey(position))
|
||||||
else if (terrainFeature.ContainsKey(position))
|
|
||||||
{
|
|
||||||
Netcode.NetRef<TerrainFeature> tr = terrainFeature[position];
|
|
||||||
string? terrain = ReadTile.getTerrainFeatureAtTile(tr).ToLower();
|
|
||||||
if (terrain != null)
|
|
||||||
{
|
{
|
||||||
if(tr.Get() is HoeDirt && !exclusions.Contains("crop"))
|
Netcode.NetRef<TerrainFeature> tr = terrainFeature[position];
|
||||||
|
string? terrain = ReadTile.getTerrainFeatureAtTile(tr).ToLower();
|
||||||
|
if (terrain != null)
|
||||||
{
|
{
|
||||||
playSoundAt(position, terrain);
|
if (tr.Get() is HoeDirt && !exclusions.Contains("crop"))
|
||||||
}
|
{
|
||||||
else if(tr.Get() is GiantCrop && !exclusions.Contains("giant crop"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is GiantCrop && !exclusions.Contains("giant crop"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Bush && !exclusions.Contains("bush"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Bush && !exclusions.Contains("bush"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is CosmeticPlant && !exclusions.Contains("cosmetic plant"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is CosmeticPlant && !exclusions.Contains("cosmetic plant"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Flooring && !exclusions.Contains("flooring"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Flooring && !exclusions.Contains("flooring"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is FruitTree && !exclusions.Contains("fruit tree"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is FruitTree && !exclusions.Contains("fruit tree"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Grass && !exclusions.Contains("grass"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Grass && !exclusions.Contains("grass"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Tree && !exclusions.Contains("tree"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Tree && !exclusions.Contains("tree"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Quartz && !exclusions.Contains("quartz"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Quartz && !exclusions.Contains("quartz"))
|
||||||
}
|
{
|
||||||
else if (tr.Get() is Leaf && !exclusions.Contains("leaf"))
|
playSoundAt(position, terrain);
|
||||||
{
|
}
|
||||||
playSoundAt(position, terrain);
|
else if (tr.Get() is Leaf && !exclusions.Contains("leaf"))
|
||||||
|
{
|
||||||
|
playSoundAt(position, terrain);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check for Mine ladders
|
||||||
|
else if (ReadTile.isMineLadderAtTile((int)position.X, (int)position.Y) && !exclusions.Contains("ladder"))
|
||||||
|
{
|
||||||
|
playSoundAt(position, null);
|
||||||
|
}
|
||||||
|
// Check for doors
|
||||||
|
else if (ReadTile.isDoorAtTile((int)position.X, (int)position.Y) && !exclusions.Contains("door"))
|
||||||
|
{
|
||||||
|
playSoundAt(position, null);
|
||||||
|
}
|
||||||
|
// Check for buildings on maps
|
||||||
|
else if (ReadTile.getBuildingAtTile((int)position.X, (int)position.Y) != null)
|
||||||
|
{
|
||||||
|
playSoundAt(position, ReadTile.getBuildingAtTile((int)position.X, (int)position.Y));
|
||||||
|
}
|
||||||
|
// Check for resource clumps
|
||||||
|
else if (ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y) != null)
|
||||||
|
{
|
||||||
|
playSoundAt(position, ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Check for Mine ladders
|
catch (Exception e)
|
||||||
else if (ReadTile.isMineLadderAtTile((int)position.X, (int)position.Y) && !exclusions.Contains("ladder"))
|
|
||||||
{
|
{
|
||||||
playSoundAt(position, null);
|
MainClass.monitor.Log($"{e.Message}\n{e.StackTrace}\n{e.Source}", StardewModdingAPI.LogLevel.Error);
|
||||||
}
|
|
||||||
// Check for doors
|
|
||||||
else if (ReadTile.isDoorAtTile((int)position.X, (int)position.Y) && !exclusions.Contains("door"))
|
|
||||||
{
|
|
||||||
playSoundAt(position, null);
|
|
||||||
}
|
|
||||||
// Check for buildings on maps
|
|
||||||
else if (ReadTile.getBuildingAtTile((int)position.X, (int)position.Y) != null)
|
|
||||||
{
|
|
||||||
playSoundAt(position, ReadTile.getBuildingAtTile((int)position.X, (int)position.Y));
|
|
||||||
}
|
|
||||||
// Check for resource clumps
|
|
||||||
else if (ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y) != null)
|
|
||||||
{
|
|
||||||
playSoundAt(position, ReadTile.getResourceClumpAtTile((int)position.X, (int)position.Y));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,7 +198,7 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
if (searchQuery == null || !exclusions.Contains(searchQuery))
|
if (searchQuery == null || !exclusions.Contains(searchQuery))
|
||||||
{
|
{
|
||||||
MainClass.monitor.Log($"{searchQuery}:X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
MainClass.monitor.Log($"Object:{searchQuery}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug);
|
||||||
Game1.currentLocation.localSoundAt("sa_poi", position);
|
Game1.currentLocation.localSoundAt("sa_poi", position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,41 +104,47 @@ namespace stardew_access.Game
|
||||||
public static string? getBuildingAtTile(int x, int y)
|
public static string? getBuildingAtTile(int x, int y)
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
string? toReturn = null;
|
||||||
int? index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
|
||||||
/* Add More
|
// It throws error if it can't find the index, do something else to fix this
|
||||||
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
try
|
||||||
*/
|
|
||||||
if (index != null)
|
|
||||||
{
|
{
|
||||||
switch (index)
|
int? index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||||
|
/* Add More
|
||||||
|
MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
|
||||||
|
*/
|
||||||
|
if (index != null)
|
||||||
{
|
{
|
||||||
case 1955:
|
switch (index)
|
||||||
case 41:
|
{
|
||||||
toReturn = "Mail Box";
|
case 1955:
|
||||||
break;
|
case 41:
|
||||||
case 173:
|
toReturn = "Mail Box";
|
||||||
toReturn = "Fridge";
|
break;
|
||||||
break;
|
case 173:
|
||||||
case 169:
|
toReturn = "Fridge";
|
||||||
case 170:
|
break;
|
||||||
case 171:
|
case 169:
|
||||||
case 172:
|
case 170:
|
||||||
toReturn = "Kitchen";
|
case 171:
|
||||||
break;
|
case 172:
|
||||||
case 1003:
|
toReturn = "Kitchen";
|
||||||
toReturn = "Street lamp";
|
break;
|
||||||
break;
|
case 1003:
|
||||||
case 78:
|
toReturn = "Street lamp";
|
||||||
toReturn = "Trash bin";
|
break;
|
||||||
break;
|
case 78:
|
||||||
case 617:
|
toReturn = "Trash bin";
|
||||||
toReturn = "Daily quest";
|
break;
|
||||||
break;
|
case 617:
|
||||||
case 616:
|
toReturn = "Daily quest";
|
||||||
toReturn = "Calender";
|
break;
|
||||||
break;
|
case 616:
|
||||||
|
toReturn = "Calender";
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch (Exception) {}
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -222,35 +222,46 @@ namespace stardew_access
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Custom Commands
|
#region Custom Commands
|
||||||
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string arg1, string[] arg2) =>
|
helper.ConsoleCommands.Add("read_tile", "Toggle read tile feature", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
readTile = !readTile;
|
readTile = !readTile;
|
||||||
|
|
||||||
monitor.Log("Read Tile is " + (readTile ? "on" : "off"), LogLevel.Info);
|
monitor.Log("Read Tile is " + (readTile ? "on" : "off"), LogLevel.Info);
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.ConsoleCommands.Add("snap_mouse", "Toggle snap mouse feature", (string arg1, string[] arg2) =>
|
helper.ConsoleCommands.Add("snap_mouse", "Toggle snap mouse feature", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
snapMouse = !snapMouse;
|
snapMouse = !snapMouse;
|
||||||
|
|
||||||
monitor.Log("Snap Mouse is " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
monitor.Log("Snap Mouse is " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.ConsoleCommands.Add("radar", "Toggle radar feature", (string arg1, string[] arg2) =>
|
helper.ConsoleCommands.Add("radar", "Toggle radar feature", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
radar = !radar;
|
radar = !radar;
|
||||||
|
|
||||||
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.ConsoleCommands.Add("r_in", "Include an object to radar", (string arg1, string[] arg2) =>
|
helper.ConsoleCommands.Add("r_in", "Include an object to radar", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
radar = !radar;
|
string? keyToAdd = null;
|
||||||
|
|
||||||
monitor.Log("Radar " + (snapMouse ? "on" : "off"), LogLevel.Info);
|
for (int i = 0; i < args.Count(); i++) { keyToAdd += " " + args[i]; }
|
||||||
|
|
||||||
|
if (keyToAdd != null)
|
||||||
|
{
|
||||||
|
keyToAdd = keyToAdd.Trim().ToLower();
|
||||||
|
radarFeature.exclusions.Add(keyToAdd);
|
||||||
|
monitor.Log($"Added {keyToAdd} key to exclusions.", LogLevel.Info);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
monitor.Log("Unable to add the key to exclusions.", LogLevel.Info);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string arg1, string[] arg2) =>
|
helper.ConsoleCommands.Add("ref_sr", "Refresh screen reader", (string commmand, string[] args) =>
|
||||||
{
|
{
|
||||||
ScreenReader.initializeScreenReader();
|
ScreenReader.initializeScreenReader();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue