Code documentation
parent
d27c7c749c
commit
eb25243377
|
@ -6,7 +6,12 @@ namespace stardew_access.Features
|
|||
internal class CurrentPlayer
|
||||
{
|
||||
|
||||
public static int getHealth()
|
||||
/// <summary>
|
||||
/// Returns the percentage health remaining of player.
|
||||
/// </summary>
|
||||
public static int Health
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return 0;
|
||||
|
@ -17,8 +22,14 @@ namespace stardew_access.Features
|
|||
int healthPercentage = (int)(currentHealth * 100) / maxHealth;
|
||||
return healthPercentage;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getStamina()
|
||||
/// <summary>
|
||||
/// Returns the percentage stamine/energy remaining of player.
|
||||
/// </summary>
|
||||
public static int Stamina
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return 0;
|
||||
|
@ -30,32 +41,56 @@ namespace stardew_access.Features
|
|||
|
||||
return staminaPercentage;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector2 getPosition()
|
||||
/// <summary>
|
||||
/// Returns the tile location of the player
|
||||
/// </summary>
|
||||
public static Vector2 Position
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return Vector2.Zero;
|
||||
|
||||
return Game1.player.getTileLocation();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPositionX()
|
||||
/// <summary>
|
||||
/// Returns the X coordinate of the player
|
||||
/// </summary>
|
||||
public static int PositionX
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return 0;
|
||||
|
||||
return (int)getPosition().X;
|
||||
return (int)Position.X;
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPositionY()
|
||||
/// <summary>
|
||||
/// Returns the Y coordinate of the player
|
||||
/// </summary>
|
||||
public static int PositionY
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return 0;
|
||||
|
||||
return (int)getPosition().Y;
|
||||
return (int)Position.Y;
|
||||
}
|
||||
}
|
||||
|
||||
public static string getTimeOfDay()
|
||||
/// <summary>
|
||||
/// Returns the time in the 12 hours format
|
||||
/// </summary>
|
||||
public static string TimeOfDay
|
||||
{
|
||||
get
|
||||
{
|
||||
int timeOfDay = Game1.timeOfDay;
|
||||
|
||||
|
@ -71,31 +106,45 @@ namespace stardew_access.Features
|
|||
|
||||
return $"{hours}:{minutes} {amOrpm}";
|
||||
}
|
||||
|
||||
public static string getSeason()
|
||||
{
|
||||
return Game1.CurrentSeasonDisplayName;
|
||||
}
|
||||
|
||||
public static int getDate()
|
||||
{
|
||||
return Game1.dayOfMonth;
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the current season
|
||||
/// </summary>
|
||||
public static string Season => Game1.CurrentSeasonDisplayName;
|
||||
|
||||
public static string getDay()
|
||||
{
|
||||
return Game1.Date.DayOfWeek.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// Returns the current date of month
|
||||
/// </summary>
|
||||
public static int Date => Game1.dayOfMonth;
|
||||
|
||||
public static int getMoney()
|
||||
/// <summary>
|
||||
/// Returns the current day of week
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string Day => Game1.Date.DayOfWeek.ToString();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of money the player has currently
|
||||
/// </summary>
|
||||
public static int Money
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Game1.player == null)
|
||||
return -1;
|
||||
|
||||
return Game1.player.Money;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector2 getNextTile()
|
||||
/// <summary>
|
||||
/// Returns the tile position of the tile the player is facing
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
public static Vector2 FacingTile
|
||||
{
|
||||
get
|
||||
{
|
||||
int x = Game1.player.GetBoundingBox().Center.X;
|
||||
int y = Game1.player.GetBoundingBox().Center.Y;
|
||||
|
@ -124,3 +173,4 @@ namespace stardew_access.Features
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -262,7 +262,7 @@ namespace stardew_access.Features
|
|||
#region Check whether to skip the object or not
|
||||
|
||||
// Skip if player is directly looking at the tile
|
||||
if (CurrentPlayer.getNextTile().Equals(position))
|
||||
if (CurrentPlayer.FacingTile.Equals(position))
|
||||
return;
|
||||
|
||||
if (!radarFocus)
|
||||
|
|
|
@ -25,12 +25,12 @@ namespace stardew_access.Features
|
|||
if (!playersPosition)
|
||||
{
|
||||
// Grab tile
|
||||
tile = CurrentPlayer.getNextTile();
|
||||
tile = CurrentPlayer.FacingTile;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Player's standing tile
|
||||
tile = CurrentPlayer.getPosition();
|
||||
tile = CurrentPlayer.Position;
|
||||
}
|
||||
x = (int)tile.X;
|
||||
y = (int)tile.Y;
|
||||
|
|
|
@ -220,11 +220,11 @@ namespace stardew_access
|
|||
string toSpeak;
|
||||
if (Config.VerboseCoordinates)
|
||||
{
|
||||
toSpeak = $"X: {CurrentPlayer.getPositionX()}, Y: {CurrentPlayer.getPositionY()}";
|
||||
toSpeak = $"X: {CurrentPlayer.PositionX}, Y: {CurrentPlayer.PositionY}";
|
||||
}
|
||||
else
|
||||
{
|
||||
toSpeak = $"{CurrentPlayer.getPositionX()}, {CurrentPlayer.getPositionY()}";
|
||||
toSpeak = $"{CurrentPlayer.PositionX}, {CurrentPlayer.PositionY}";
|
||||
}
|
||||
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
|
@ -234,7 +234,7 @@ namespace stardew_access
|
|||
// Narrate health and stamina
|
||||
if (Config.HealthNStaminaKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"Health is {CurrentPlayer.getHealth()} and Stamina is {CurrentPlayer.getStamina()}";
|
||||
string toSpeak = $"Health is {CurrentPlayer.Health} and Stamina is {CurrentPlayer.Stamina}";
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ namespace stardew_access
|
|||
// Narrate money at hand
|
||||
if (Config.MoneyKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"You have {CurrentPlayer.getMoney()}g";
|
||||
string toSpeak = $"You have {CurrentPlayer.Money}g";
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ namespace stardew_access
|
|||
// Narrate time and season
|
||||
if (Config.TimeNSeasonKey.JustPressed())
|
||||
{
|
||||
string toSpeak = $"Time is {CurrentPlayer.getTimeOfDay()} and it is {CurrentPlayer.getDay()} {CurrentPlayer.getDate()} of {CurrentPlayer.getSeason()}";
|
||||
string toSpeak = $"Time is {CurrentPlayer.TimeOfDay} and it is {CurrentPlayer.Day} {CurrentPlayer.Date} of {CurrentPlayer.Season}";
|
||||
MainClass.ScreenReader.Say(toSpeak, true);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -436,7 +436,7 @@ namespace stardew_access.Patches
|
|||
|
||||
if (cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
||||
{
|
||||
Vector2 nextTile = CurrentPlayer.getNextTile();
|
||||
Vector2 nextTile = CurrentPlayer.FacingTile;
|
||||
if (TileInfo.isCollidingAtTile((int)nextTile.X, (int)nextTile.Y))
|
||||
{
|
||||
if (prevTile != nextTile)
|
||||
|
|
Loading…
Reference in New Issue