Prioritised custom-tiles.json over static-tiles

- Bug fix in LibraryMuseum
master
Mohammad Shoaib Khan 2022-10-29 16:52:37 +05:30
parent f5db6eb655
commit 0f0824a422
No known key found for this signature in database
GPG Key ID: 3EE32C9DFF520699
2 changed files with 16 additions and 10 deletions

View File

@ -48,8 +48,8 @@ namespace stardew_access.Features
{ {
List<JObject> allData = new List<JObject>(); List<JObject> allData = new List<JObject>();
if (staticTilesData != null) allData.Add(staticTilesData);
if (customTilesData != null) allData.Add(customTilesData); if (customTilesData != null) allData.Add(customTilesData);
if (staticTilesData != null) allData.Add(staticTilesData);
foreach (JObject data in allData) foreach (JObject data in allData)
{ {
@ -81,8 +81,8 @@ namespace stardew_access.Features
{ {
List<JObject> allData = new List<JObject>(); List<JObject> allData = new List<JObject>();
if (staticTilesData != null) allData.Add(staticTilesData);
if (customTilesData != null) allData.Add(customTilesData); if (customTilesData != null) allData.Add(customTilesData);
if (staticTilesData != null) allData.Add(staticTilesData);
foreach (JObject data in allData) foreach (JObject data in allData)
{ {

View File

@ -582,7 +582,7 @@ namespace stardew_access.Features
{ {
for (int y1 = 0; y1 < libraryMuseum.map.Layers[0].LayerHeight; y1++) for (int y1 = 0; y1 < libraryMuseum.map.Layers[0].LayerHeight; y1++)
{ {
if (x != x1 && y != y1) continue; if (x != x1 || y != y1) continue;
if (libraryMuseum.doesTileHaveProperty(x1, y1, "Action", "Buildings") != null && libraryMuseum.doesTileHaveProperty(x1, y1, "Action", "Buildings").Contains("Notes")) if (libraryMuseum.doesTileHaveProperty(x1, y1, "Action", "Buildings") != null && libraryMuseum.doesTileHaveProperty(x1, y1, "Action", "Buildings").Contains("Notes"))
{ {
@ -594,25 +594,31 @@ namespace stardew_access.Features
tile.Properties.TryGetValue("Action", out xTile.ObjectModel.PropertyValue? value); tile.Properties.TryGetValue("Action", out xTile.ObjectModel.PropertyValue? value);
if (value != null) action = value.ToString(); if (value != null) action = value.ToString();
} }
catch (System.Exception) catch (System.Exception e)
{ {
MainClass.ErrorLog($"Cannot get action value at x:{x} y:{y} in LibraryMuseum"); MainClass.ErrorLog($"Cannot get action value at x:{x} y:{y} in LibraryMuseum");
MainClass.ErrorLog(e.Message);
} }
if (action != null) if (action != null)
{ {
string[] actionParams = action.Split(' '); string[] actionParams = action.Split(' ');
int which = Convert.ToInt32(actionParams[1]);
if (booksFound >= which) try
{ {
string message = Game1.content.LoadString("Strings\\Notes:" + which); int which = Convert.ToInt32(actionParams[1]);
return (CATEGORY.Interactables, $"{message.Split('\n')[0]} Book"); if (booksFound >= which)
{
string message = Game1.content.LoadString("Strings\\Notes:" + which);
return (CATEGORY.Interactables, $"{message.Split('\n')[0]} Book");
}
} }
else catch (System.Exception e)
{ {
return (CATEGORY.Others, $"Lost Book"); MainClass.ErrorLog(e.Message);
} }
return (CATEGORY.Others, $"Lost Book");
} }
} }
} }