Merge pull request #17 from bradjrenshaw/MiscFixes

Misc fixes
master
Mohammad Shoaib 2022-05-14 08:15:53 +05:30 committed by GitHub
commit bd806c077a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -96,15 +96,10 @@ namespace stardew_access.Features
int minutes = timeOfDay % 100; int minutes = timeOfDay % 100;
int hours = timeOfDay / 100; int hours = timeOfDay / 100;
string amOrpm = "A M"; string amOrpm = hours / 12 == 1 ? "PM" : "AM";
if (hours >= 12) hours = hours % 12;
{ if (hours == 0) hours = 12;
amOrpm = "P M"; return $"{hours}:{minutes:00} {amOrpm}";
if (hours > 12)
hours -= 12;
}
return $"{hours}:{minutes} {amOrpm}";
} }
} }

View File

@ -47,9 +47,8 @@ namespace stardew_access.Features
(string? name, CATEGORY category) staticTile = MainClass.STiles.getStaticTileInfoAtWithCategory(x, y); (string? name, CATEGORY category) staticTile = MainClass.STiles.getStaticTileInfoAtWithCategory(x, y);
string? bush = getBushAtTile(x, y, lessInfo); string? bush = getBushAtTile(x, y, lessInfo);
if (Game1.currentLocation.isCharacterAtTile(tile) != null) if (Game1.currentLocation.isCharacterAtTile(tile) is NPC npc)
{ {
NPC npc = Game1.currentLocation.isCharacterAtTile(tile);
toReturn = npc.displayName; toReturn = npc.displayName;
if (npc.isVillager() || npc.CanSocialize) if (npc.isVillager() || npc.CanSocialize)
category = CATEGORY.Farmers; category = CATEGORY.Farmers;
@ -301,7 +300,11 @@ namespace stardew_access.Features
/// <br/>name: 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? category, string? name) getDynamicTilesInfo(int x, int y, bool lessInfo = false) public static (CATEGORY? category, string? name) getDynamicTilesInfo(int x, int y, bool lessInfo = false)
{ {
if (Game1.currentLocation is Farm farm) if (Game1.currentLocation.orePanPoint != Point.Zero && Game1.currentLocation.orePanPoint == new Point(x, y))
{
return (CATEGORY.Interactables, "panning spot");
}
else if (Game1.currentLocation is Farm farm)
{ {
if (farm.GetMainMailboxPosition().X == x && farm.GetMainMailboxPosition().Y == y) if (farm.GetMainMailboxPosition().X == x && farm.GetMainMailboxPosition().Y == y)
return (CATEGORY.Interactables, "Mail box"); return (CATEGORY.Interactables, "Mail box");
@ -408,7 +411,11 @@ namespace stardew_access.Features
} }
else if (Game1.currentLocation is Beach beach) else if (Game1.currentLocation is Beach beach)
{ {
if (x == 58 && y == 13) if (MainClass.ModHelper.Reflection.GetField<NPC>(beach, "oldMariner").GetValue() is NPC mariner && mariner.getTileLocation() == new Vector2(x, y))
{
return (CATEGORY.NPCs, "Old Mariner");
}
else if (x == 58 && y == 13)
{ {
if (!beach.bridgeFixed.Value) if (!beach.bridgeFixed.Value)
return (CATEGORY.Interactables, "Repair Bridge"); return (CATEGORY.Interactables, "Repair Bridge");