Fixed casing issue in static tiles location names and added shafts to read tile

master
Mohammad Shoaib Khan 2022-08-17 13:06:47 +05:30
parent a908e09884
commit d12e9b2590
2 changed files with 35 additions and 12 deletions

View File

@ -26,7 +26,7 @@ namespace stardew_access.Features
foreach (var location in data) foreach (var location in data)
{ {
if (locationName.ToLower().Equals(location.Key)) if (locationName.ToLower().Equals(location.Key.ToLower()))
return true; return true;
} }
@ -45,7 +45,7 @@ namespace stardew_access.Features
foreach (var location in data) foreach (var location in data)
{ {
if (!Game1.currentLocation.Name.ToLower().Equals(location.Key)) if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower()))
continue; continue;
if (location.Value != null) if (location.Value != null)
@ -83,7 +83,7 @@ namespace stardew_access.Features
} }
if (isXPresent && isYPresent) if (isXPresent && isYPresent)
return (tile.Key, CATEGORY.FromString(tileType.ToString())); return (tile.Key, CATEGORY.FromString(tileType.ToString().ToLower()));
} }
} }

View File

@ -122,6 +122,11 @@ namespace stardew_access.Features
toReturn = "Ladder"; toReturn = "Ladder";
category = CATEGORY.Doors; category = CATEGORY.Doors;
} }
else if (isShaftAtTile(x, y))
{
toReturn = "Shaft";
category = CATEGORY.Doors;
}
else if (isMineUpLadderAtTile(x, y)) else if (isMineUpLadderAtTile(x, y))
{ {
toReturn = "Up Ladder"; toReturn = "Up Ladder";
@ -917,12 +922,32 @@ namespace stardew_access.Features
{ {
if (Game1.currentLocation is Mine or MineShaft) if (Game1.currentLocation is Mine or MineShaft)
{ {
int? index = null; if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] == null)
return false;
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null) int index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
if (index == 173 || index == 174) if (index == 173)
{
return true;
}
}
}
catch (Exception) { }
return false;
}
public static bool isShaftAtTile(int x, int y)
{
try
{
if (Game1.currentLocation is Mine or MineShaft)
{
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] == null)
return false;
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex == 174)
return true; return true;
} }
} }
@ -937,12 +962,10 @@ namespace stardew_access.Features
{ {
if (Game1.currentLocation is Mine or MineShaft) if (Game1.currentLocation is Mine or MineShaft)
{ {
int? index = null; if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] == null)
return false;
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null) if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex == 115)
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
if (index == 115)
return true; return true;
} }
} }