Added junimo bundle narration in read tile
parent
b611b01d9a
commit
ea3ffb4e18
|
@ -81,14 +81,25 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
toSpeak = getBuildingAtTile(x, y);
|
toSpeak = getBuildingAtTile(x, y);
|
||||||
}
|
}
|
||||||
|
else if(getJunimoBundleAt(x, y) != null)
|
||||||
|
{
|
||||||
|
toSpeak = getJunimoBundleAt(x, y);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Narrate toSpeak
|
#region Narrate toSpeak
|
||||||
if (toSpeak != " ")
|
if (toSpeak != " ")
|
||||||
if (manuallyTriggered)
|
if (manuallyTriggered)
|
||||||
ScreenReader.say(toSpeak, true);
|
ScreenReader.say(toSpeak, true);
|
||||||
else
|
else
|
||||||
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
ScreenReader.sayWithTileQuery(toSpeak, x, y, true);
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Play colliding sound effect
|
||||||
|
if (isCollidingAtTile(x, y) && prevTile != gt)
|
||||||
|
{
|
||||||
|
Game1.playSound("colliding");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
prevTile = gt;
|
prevTile = gt;
|
||||||
|
@ -104,6 +115,42 @@ namespace stardew_access.Game
|
||||||
isReadingTile = false;
|
isReadingTile = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string? getJunimoBundleAt(int x, int y)
|
||||||
|
{
|
||||||
|
if (Game1.currentLocation is not CommunityCenter)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
CommunityCenter communityCenter = (Game1.currentLocation as CommunityCenter);
|
||||||
|
|
||||||
|
string? name = (x, y) switch
|
||||||
|
{
|
||||||
|
(14, 5) => "Pantry",
|
||||||
|
(14, 23) => "Crafts Room",
|
||||||
|
(40, 10) => "Fish Tank",
|
||||||
|
(63, 14) => "Boiler Room",
|
||||||
|
(55, 6) => "Vault",
|
||||||
|
(46, 11) => "Bulletin Board",
|
||||||
|
_ => null,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (communityCenter.shouldNoteAppearInArea(CommunityCenter.getAreaNumberFromName(name)))
|
||||||
|
return $"{name} bundle";
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool isCollidingAtTile(int x, int y)
|
||||||
|
{
|
||||||
|
Rectangle rect = new Rectangle(x * 64 + 1,y * 64 + 1, 62, 62);
|
||||||
|
|
||||||
|
if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: true))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static string? getFarmAnimalAt(GameLocation? location, int x, int y, bool onlyName = false)
|
public static string? getFarmAnimalAt(GameLocation? location, int x, int y, bool onlyName = false)
|
||||||
{
|
{
|
||||||
if (location == null)
|
if (location == null)
|
||||||
|
@ -147,56 +194,51 @@ namespace stardew_access.Game
|
||||||
{
|
{
|
||||||
string? toReturn = null;
|
string? toReturn = null;
|
||||||
|
|
||||||
// It throws error if it can't find the index, do something else to fix this
|
int? index = null;
|
||||||
try
|
|
||||||
{
|
|
||||||
int? index = null;
|
|
||||||
|
|
||||||
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y]!=null)
|
if (Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y] != null)
|
||||||
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
index = Game1.currentLocation.Map.GetLayer("Buildings").Tiles[x, y].TileIndex;
|
||||||
/* 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)
|
||||||
|
{
|
||||||
|
case 1955:
|
||||||
|
case 41:
|
||||||
|
toReturn = "Mail Box";
|
||||||
|
break;
|
||||||
|
case 1003:
|
||||||
|
toReturn = "Street lamp";
|
||||||
|
break;
|
||||||
|
case 78:
|
||||||
|
toReturn = "Trash bin";
|
||||||
|
break;
|
||||||
|
case 617:
|
||||||
|
toReturn = "Daily quest";
|
||||||
|
break;
|
||||||
|
case 616:
|
||||||
|
toReturn = "Calender";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
||||||
{
|
{
|
||||||
switch (index)
|
switch (index)
|
||||||
{
|
{
|
||||||
case 1955:
|
case 173:
|
||||||
case 41:
|
toReturn = "Fridge";
|
||||||
toReturn = "Mail Box";
|
|
||||||
break;
|
break;
|
||||||
case 1003:
|
case 169:
|
||||||
toReturn = "Street lamp";
|
case 170:
|
||||||
|
case 171:
|
||||||
|
case 172:
|
||||||
|
toReturn = "Kitchen";
|
||||||
break;
|
break;
|
||||||
case 78:
|
|
||||||
toReturn = "Trash bin";
|
|
||||||
break;
|
|
||||||
case 617:
|
|
||||||
toReturn = "Daily quest";
|
|
||||||
break;
|
|
||||||
case 616:
|
|
||||||
toReturn = "Calender";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(Game1.currentLocation is FarmHouse || Game1.currentLocation is IslandFarmHouse)
|
|
||||||
{
|
|
||||||
switch (index)
|
|
||||||
{
|
|
||||||
case 173:
|
|
||||||
toReturn = "Fridge";
|
|
||||||
break;
|
|
||||||
case 169:
|
|
||||||
case 170:
|
|
||||||
case 171:
|
|
||||||
case 172:
|
|
||||||
toReturn = "Kitchen";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception) {}
|
|
||||||
|
|
||||||
return toReturn;
|
return toReturn;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,12 @@ namespace stardew_access.Patches
|
||||||
if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
||||||
{
|
{
|
||||||
Vector2 nextTile = CurrentPlayer.getNextTile();
|
Vector2 nextTile = CurrentPlayer.getNextTile();
|
||||||
Rectangle rect = new Rectangle((int)nextTile.X * 64 + 1,(int) nextTile.Y * 64 + 1, 62, 62);
|
if (ReadTile.isCollidingAtTile((int)nextTile.X, (int)nextTile.Y))
|
||||||
if (Game1.currentLocation.isCollidingPosition(rect, Game1.viewport, true, 0, glider: false, Game1.player, pathfinding: false))
|
|
||||||
{
|
{
|
||||||
if (prevTile != nextTile)
|
if (prevTile != nextTile)
|
||||||
{
|
{
|
||||||
prevTile = nextTile;
|
prevTile = nextTile;
|
||||||
Game1.playSound("colliding");
|
//Game1.playSound("colliding");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue