Added buildlist command

master
Mohammad Shoaib 2022-02-03 16:42:58 +05:30
parent 547f6290c4
commit ec08f2c019
4 changed files with 16 additions and 7 deletions

View File

@ -342,9 +342,16 @@ namespace stardew_access
string toPrint = "";
Farm farm = (Farm)Game1.getLocationFromName("Farm");
Netcode.NetCollection<Building> buildings = farm.buildings;
int buildingIndex = 0;
for (int i = 0; i < buildings.Count; i++)
{
toPrint = $"{toPrint},\t{buildings[i].nameOfIndoorsWithoutUnique}: At {buildings[i].tileX}x and {buildings[i].tileY}y";
string? name = buildings[i].nameOfIndoorsWithoutUnique;
name = (name == "null") ? buildings[i].buildingType.Value : name;
BuildingNAnimalMenuPatches.availableBuildings[buildingIndex] = buildings[i];
toPrint = $"{toPrint}\nIndex {buildingIndex}: {name}: At {buildings[i].tileX}x and {buildings[i].tileY}y";
++buildingIndex;
}
if (toPrint == "")
@ -353,7 +360,7 @@ namespace stardew_access
}
else
{
MainClass.monitor.Log($"Available buildings: {toPrint}", LogLevel.Info);
MainClass.monitor.Log($"Available buildings:{toPrint}\nOpen the command menu and use pageup and pagedown to check the list", LogLevel.Info);
}
});
#endregion

View File

@ -268,7 +268,7 @@ namespace stardew_access.Game
if (Game1.currentLocation is Farm)
{
Building building = (Game1.currentLocation as Farm).getBuildingAt(new Vector2(x, y));
Building building = ((Farm)Game1.currentLocation).getBuildingAt(new Vector2(x, y));
if (building != null)
{
return (CATEGORY.Buildings, building.buildingType.Value);

View File

@ -1,6 +1,7 @@
using Microsoft.Xna.Framework;
using StardewModdingAPI;
using StardewValley;
using StardewValley.Buildings;
using StardewValley.Menus;
namespace stardew_access.Patches
@ -8,6 +9,7 @@ namespace stardew_access.Patches
internal class BuildingNAnimalMenuPatches
{
internal static Vector2[] marked = new Vector2[10];
internal static Building[] availableBuildings = new Building[100];
internal static string carpenterMenuQuery = "";
internal static bool isSayingBlueprintInfo = false;
internal static string prevBlueprintInfo = "";

View File

@ -25,11 +25,11 @@ namespace stardew_access.Patches
#region To narrate previous and next chat messages
if (isNextArrowPressed && !isChatRunning)
{
_ = CycleThroughChatMessages(true, ___messages);
CycleThroughChatMessages(true, ___messages);
}
else if (isPrevArrowPressed && !isChatRunning)
{
_ = CycleThroughChatMessages(false, ___messages);
CycleThroughChatMessages(false, ___messages);
}
#endregion
}
@ -52,10 +52,9 @@ namespace stardew_access.Patches
}
}
private static async Task CycleThroughChatMessages(bool increase, List<ChatMessage> ___messages)
private static async void CycleThroughChatMessages(bool increase, List<ChatMessage> ___messages)
{
isChatRunning = true;
await Task.Delay(200);
string toSpeak = " ";
if (increase)
{
@ -79,6 +78,7 @@ namespace stardew_access.Patches
});
MainClass.screenReader.Say(toSpeak, true);
await Task.Delay(200);
isChatRunning = false;
}
}