Made reading floorings toggleable | Added names to tuples making it more readable
parent
0de1cd419b
commit
fcd2243cc5
|
@ -27,6 +27,13 @@ namespace stardew_access
|
||||||
MainClass.GetMonitor().Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info);
|
MainClass.GetMonitor().Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) =>
|
||||||
|
{
|
||||||
|
MainClass.readFlooring = !MainClass.readFlooring;
|
||||||
|
|
||||||
|
MainClass.GetMonitor().Log("Flooring is " + (MainClass.readFlooring ? "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.radar = !MainClass.radar;
|
||||||
|
|
|
@ -191,14 +191,14 @@ namespace stardew_access.Features
|
||||||
|
|
||||||
public (bool, string?, string) CheckTile(Vector2 position)
|
public (bool, string?, string) CheckTile(Vector2 position)
|
||||||
{
|
{
|
||||||
(string?, CATEGORY?) tileDetail = ReadTile.getNameWithCategoryAtTile(position);
|
(string? name, CATEGORY? category) tileDetail = ReadTile.getNameWithCategoryAtTile(position);
|
||||||
if (tileDetail.Item1 == null)
|
if (tileDetail.name == null)
|
||||||
return (false, null, CATEGORY.Others.ToString());
|
return (false, null, CATEGORY.Others.ToString());
|
||||||
|
|
||||||
if (tileDetail.Item2 == null)
|
if (tileDetail.category == null)
|
||||||
tileDetail.Item2 = CATEGORY.Others;
|
tileDetail.category = CATEGORY.Others;
|
||||||
|
|
||||||
return (true, tileDetail.Item1, tileDetail.Item2.ToString());
|
return (true, tileDetail.name, tileDetail.category.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,9 +208,9 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
if (Game1.currentLocation.isObjectAtTile((int)position.X, (int)position.Y))
|
if (Game1.currentLocation.isObjectAtTile((int)position.X, (int)position.Y))
|
||||||
{
|
{
|
||||||
(string?, CATEGORY) objDetails = ReadTile.getObjectAtTile((int)position.X, (int)position.Y);
|
(string? name, CATEGORY category) objDetails = ReadTile.getObjectAtTile((int)position.X, (int)position.Y);
|
||||||
string? objectName = objDetails.Item1;
|
string? objectName = objDetails.name;
|
||||||
CATEGORY category = objDetails.Item2;
|
CATEGORY category = objDetails.category;
|
||||||
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)position.X, (int)position.Y);
|
StardewValley.Object obj = Game1.currentLocation.getObjectAtTile((int)position.X, (int)position.Y);
|
||||||
|
|
||||||
if (objectName != null)
|
if (objectName != null)
|
||||||
|
@ -232,13 +232,13 @@ namespace stardew_access.Features
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
(string?, CATEGORY?) tileDetail = ReadTile.getNameWithCategoryAtTile(position);
|
(string? name, CATEGORY? category) tileDetail = ReadTile.getNameWithCategoryAtTile(position);
|
||||||
if (tileDetail.Item1 != null)
|
if (tileDetail.name != null)
|
||||||
{
|
{
|
||||||
if (tileDetail.Item2 == null)
|
if (tileDetail.category == null)
|
||||||
tileDetail.Item2 = CATEGORY.Others;
|
tileDetail.category = CATEGORY.Others;
|
||||||
|
|
||||||
PlaySoundAt(position, tileDetail.Item1, tileDetail.Item2);
|
PlaySoundAt(position, tileDetail.name, tileDetail.category);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,18 +72,18 @@ namespace stardew_access.Features
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>Returns the name of the object at tile alongwith it's category's name</summary>
|
///<summary>Returns the name of the object at tile alongwith it's category's name</summary>
|
||||||
public static (string?, string?) getNameWithCategoryNameAtTile(Vector2 tile)
|
public static (string? name, string? categoryName) getNameWithCategoryNameAtTile(Vector2 tile)
|
||||||
{
|
{
|
||||||
(string?, CATEGORY?) tileDetail = getNameWithCategoryAtTile(tile);
|
(string? name, CATEGORY? category) tileDetail = getNameWithCategoryAtTile(tile);
|
||||||
|
|
||||||
if (tileDetail.Item2 == null)
|
if (tileDetail.category == null)
|
||||||
tileDetail.Item2 = CATEGORY.Others;
|
tileDetail.category = CATEGORY.Others;
|
||||||
|
|
||||||
return (tileDetail.Item1, tileDetail.Item2.ToString());
|
return (tileDetail.name, tileDetail.category.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
///<summary>Returns the name of the object at tile alongwith it's category</summary>
|
///<summary>Returns the name of the object at tile alongwith it's category</summary>
|
||||||
public static (string?, CATEGORY?) getNameWithCategoryAtTile(Vector2 tile)
|
public static (string? name, CATEGORY? category) getNameWithCategoryAtTile(Vector2 tile)
|
||||||
{
|
{
|
||||||
int x = (int)tile.X;
|
int x = (int)tile.X;
|
||||||
int y = (int)tile.Y;
|
int y = (int)tile.Y;
|
||||||
|
@ -93,7 +93,7 @@ namespace stardew_access.Features
|
||||||
bool isColliding = isCollidingAtTile(x, y);
|
bool isColliding = isCollidingAtTile(x, y);
|
||||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||||
string? door = getDoorAtTile(x, y);
|
string? door = getDoorAtTile(x, y);
|
||||||
(CATEGORY?, string?) tileInfo = getTileInfo(x, y);
|
(CATEGORY? category, string? name) tileInfo = getTileInfo(x, y);
|
||||||
string? junimoBundle = getJunimoBundleAt(x, y);
|
string? junimoBundle = getJunimoBundleAt(x, y);
|
||||||
string? resourceClump = getResourceClumpAtTile(x, y);
|
string? resourceClump = getResourceClumpAtTile(x, y);
|
||||||
string? farmAnimal = getFarmAnimalAt(Game1.currentLocation, x, y);
|
string? farmAnimal = getFarmAnimalAt(Game1.currentLocation, x, y);
|
||||||
|
@ -119,18 +119,18 @@ namespace stardew_access.Features
|
||||||
}
|
}
|
||||||
else if (Game1.currentLocation.isObjectAtTile(x, y))
|
else if (Game1.currentLocation.isObjectAtTile(x, y))
|
||||||
{
|
{
|
||||||
(string?, CATEGORY?) obj = getObjectAtTile(x, y);
|
(string? name, CATEGORY? category) obj = getObjectAtTile(x, y);
|
||||||
toReturn = obj.Item1;
|
toReturn = obj.name;
|
||||||
category = obj.Item2;
|
category = obj.category;
|
||||||
}
|
}
|
||||||
else if (terrainFeature.ContainsKey(tile))
|
else if (terrainFeature.ContainsKey(tile))
|
||||||
{
|
{
|
||||||
(string?, CATEGORY) tf = getTerrainFeatureAtTile(terrainFeature[tile]);
|
(string? name, CATEGORY category) tf = getTerrainFeatureAtTile(terrainFeature[tile]);
|
||||||
string? terrain = tf.Item1;
|
string? terrain = tf.name;
|
||||||
if (terrain != null)
|
if (terrain != null)
|
||||||
{
|
{
|
||||||
toReturn = terrain;
|
toReturn = terrain;
|
||||||
category = tf.Item2;
|
category = tf.category;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -164,10 +164,10 @@ namespace stardew_access.Features
|
||||||
toReturn = "Elevator";
|
toReturn = "Elevator";
|
||||||
category = CATEGORY.Doors;
|
category = CATEGORY.Doors;
|
||||||
}
|
}
|
||||||
else if (tileInfo.Item2 != null)
|
else if (tileInfo.name != null)
|
||||||
{
|
{
|
||||||
toReturn = tileInfo.Item2;
|
toReturn = tileInfo.name;
|
||||||
category = tileInfo.Item1;
|
category = tileInfo.category;
|
||||||
}
|
}
|
||||||
else if (junimoBundle != null)
|
else if (junimoBundle != null)
|
||||||
{
|
{
|
||||||
|
@ -191,7 +191,7 @@ namespace stardew_access.Features
|
||||||
bool isColliding = isCollidingAtTile(x, y);
|
bool isColliding = isCollidingAtTile(x, y);
|
||||||
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
Dictionary<Vector2, Netcode.NetRef<TerrainFeature>> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict;
|
||||||
string? door = getDoorAtTile(x, y);
|
string? door = getDoorAtTile(x, y);
|
||||||
(CATEGORY?, string?) tileInfo = getTileInfo(x, y);
|
(CATEGORY? category, string? name) tileInfo = getTileInfo(x, y);
|
||||||
string? junimoBundle = getJunimoBundleAt(x, y);
|
string? junimoBundle = getJunimoBundleAt(x, y);
|
||||||
string? resourceClump = getResourceClumpAtTile(x, y);
|
string? resourceClump = getResourceClumpAtTile(x, y);
|
||||||
string? farmAnimal = getFarmAnimalAt(Game1.currentLocation, x, y);
|
string? farmAnimal = getFarmAnimalAt(Game1.currentLocation, x, y);
|
||||||
|
@ -211,7 +211,7 @@ namespace stardew_access.Features
|
||||||
}
|
}
|
||||||
else if (Game1.currentLocation.isObjectAtTile(x, y))
|
else if (Game1.currentLocation.isObjectAtTile(x, y))
|
||||||
{
|
{
|
||||||
toReturn = getObjectAtTile(x, y).Item1;
|
toReturn = getObjectAtTile(x, y).name;
|
||||||
}
|
}
|
||||||
else if (terrainFeature.ContainsKey(tile))
|
else if (terrainFeature.ContainsKey(tile))
|
||||||
{
|
{
|
||||||
|
@ -243,9 +243,9 @@ namespace stardew_access.Features
|
||||||
{
|
{
|
||||||
toReturn = "Elevator";
|
toReturn = "Elevator";
|
||||||
}
|
}
|
||||||
else if (tileInfo.Item2 != null)
|
else if (tileInfo.name != null)
|
||||||
{
|
{
|
||||||
toReturn = tileInfo.Item2;
|
toReturn = tileInfo.name;
|
||||||
}
|
}
|
||||||
else if (junimoBundle != null)
|
else if (junimoBundle != null)
|
||||||
{
|
{
|
||||||
|
@ -391,9 +391,9 @@ namespace stardew_access.Features
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="x"></param>
|
/// <param name="x"></param>
|
||||||
/// <param name="y"></param>
|
/// <param name="y"></param>
|
||||||
/// <returns>Item1: This is the category of the tile. Default to Furnitures.
|
/// <returns>category: This is the category of the tile. Default to Furnitures.
|
||||||
/// <br/>Item2: This is the name of the tile. Default to null if the tile tile has nothing on it.</returns>
|
/// <br/>name: This is the name of the tile. Default to null if the tile tile has nothing on it.</returns>
|
||||||
public static (CATEGORY?, string?) getTileInfo(int x, int y)
|
public static (CATEGORY? category, string? name) getTileInfo(int x, int y)
|
||||||
{
|
{
|
||||||
|
|
||||||
int? index = null;
|
int? index = null;
|
||||||
|
@ -449,7 +449,7 @@ namespace stardew_access.Features
|
||||||
return (null, null);
|
return (null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static (string?, CATEGORY) getTerrainFeatureAtTile(Netcode.NetRef<TerrainFeature> terrain)
|
public static (string? name, CATEGORY category) getTerrainFeatureAtTile(Netcode.NetRef<TerrainFeature> terrain)
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
string? toReturn = null;
|
||||||
CATEGORY category = CATEGORY.Others;
|
CATEGORY category = CATEGORY.Others;
|
||||||
|
@ -518,7 +518,7 @@ namespace stardew_access.Features
|
||||||
if (toReturn.Contains("feature"))
|
if (toReturn.Contains("feature"))
|
||||||
toReturn.Replace("feature", "");
|
toReturn.Replace("feature", "");
|
||||||
}
|
}
|
||||||
else if (terrain.Get() is Flooring)
|
else if (terrain.Get() is Flooring && MainClass.readFlooring)
|
||||||
{
|
{
|
||||||
category = CATEGORY.Flooring;
|
category = CATEGORY.Flooring;
|
||||||
Flooring flooring = (Flooring)terrain.Get();
|
Flooring flooring = (Flooring)terrain.Get();
|
||||||
|
@ -639,7 +639,7 @@ namespace stardew_access.Features
|
||||||
return seedName;
|
return seedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static (string?, CATEGORY) getObjectAtTile(int x, int y)
|
public static (string? name, CATEGORY category) getObjectAtTile(int x, int y)
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
string? toReturn = null;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ namespace stardew_access
|
||||||
public static bool radar = false;
|
public static bool radar = false;
|
||||||
public static bool radarDebug = false;
|
public static bool radarDebug = false;
|
||||||
public static bool radarStereoSound = true;
|
public static bool radarStereoSound = true;
|
||||||
|
public static bool readFlooring = false;
|
||||||
private static IMonitor monitor;
|
private static IMonitor monitor;
|
||||||
public static string hudMessageQueryKey = "";
|
public static string hudMessageQueryKey = "";
|
||||||
private static Radar radarFeature;
|
private static Radar radarFeature;
|
||||||
|
|
Loading…
Reference in New Issue