Added up ladder and mine elevator

master
shoaib11120 2022-01-26 13:57:48 +05:30
parent 5c59d0fa1e
commit 20e07d79cc
2 changed files with 64 additions and 5 deletions

View File

@ -69,6 +69,7 @@ namespace stardew_access.Game
exclusions.Add("weed"); exclusions.Add("weed");
exclusions.Add("twig"); exclusions.Add("twig");
exclusions.Add("coloured stone"); exclusions.Add("coloured stone");
exclusions.Add("ice crystal");
exclusions.Add("clay stone"); exclusions.Add("clay stone");
exclusions.Add("fossil stone"); exclusions.Add("fossil stone");
exclusions.Add("crop"); exclusions.Add("crop");
@ -77,7 +78,7 @@ namespace stardew_access.Game
exclusions.Add("water"); exclusions.Add("water");
exclusions.Add("grass"); exclusions.Add("grass");
/* Not excluded /* Not excluded Categories
* *
* *
* exclusions.Add("farmer"); * exclusions.Add("farmer");
@ -291,7 +292,15 @@ namespace stardew_access.Game
} }
} }
// Check for Mine ladders // Check for Mine ladders
else if (ReadTile.isMineLadderAtTile((int)position.X, (int)position.Y)) else if (ReadTile.isMineDownLadderAtTile((int)position.X, (int)position.Y))
{
PlaySoundAt(position, "ladder", CATEGORY.Buildings);
}
else if (ReadTile.isMineUpLadderAtTile((int)position.X, (int)position.Y))
{
PlaySoundAt(position, "ladder", CATEGORY.Buildings);
}
else if (ReadTile.isElevatorAtTile((int)position.X, (int)position.Y))
{ {
PlaySoundAt(position, "ladder", CATEGORY.Buildings); PlaySoundAt(position, "ladder", CATEGORY.Buildings);
} }

View File

@ -75,10 +75,18 @@ namespace stardew_access.Game
{ {
toSpeak = "Door"; toSpeak = "Door";
} }
else if (isMineLadderAtTile(x, y)) else if (isMineDownLadderAtTile(x, y))
{ {
toSpeak = "Ladder"; toSpeak = "Ladder";
} }
else if (isMineUpLadderAtTile(x, y))
{
toSpeak = "Up Ladder";
}
else if (isElevatorAtTile(x, y))
{
toSpeak = "Elevator";
}
else if (getBuildingAtTile(x, y) != null) else if (getBuildingAtTile(x, y) != null)
{ {
toSpeak = getBuildingAtTile(x, y); toSpeak = getBuildingAtTile(x, y);
@ -203,6 +211,7 @@ namespace stardew_access.Game
/* Add More /* Add More
MainClass.monitor.Log(index.ToString(), LogLevel.Debug); MainClass.monitor.Log(index.ToString(), LogLevel.Debug);
*/ */
if (index != null) if (index != null)
{ {
switch (index) switch (index)
@ -240,6 +249,7 @@ namespace stardew_access.Game
break; break;
} }
} }
} }
return toReturn; return toReturn;
@ -572,11 +582,11 @@ namespace stardew_access.Game
return toReturn; return toReturn;
} }
public static bool isMineLadderAtTile(int x, int y) public static bool isMineDownLadderAtTile(int x, int y)
{ {
try try
{ {
if (Game1.inMine || Game1.currentLocation is Mine) if (Game1.currentLocation is Mine or MineShaft)
{ {
int? index = null; int? index = null;
@ -592,6 +602,46 @@ namespace stardew_access.Game
return false; return false;
} }
public static bool isMineUpLadderAtTile(int x, int y)
{
try
{
if (Game1.currentLocation is Mine or MineShaft)
{
int? index = null;
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null)
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
if (index == 115)
return true;
}
}
catch (Exception) { }
return false;
}
public static bool isElevatorAtTile(int x, int y)
{
try
{
if (Game1.currentLocation is Mine or MineShaft)
{
int? index = null;
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null)
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
if (index == 112)
return true;
}
}
catch (Exception) { }
return false;
}
public static bool isDoorAtTile(int x, int y) public static bool isDoorAtTile(int x, int y)
{ {
Point tilePoint = new Point(x, y); Point tilePoint = new Point(x, y);