From a9160b4ff643a13f36fb86d3c31d38f6c2453274 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sat, 22 Oct 2022 22:19:38 +0530 Subject: [PATCH] Issue#54 the names in static tiles now ignore anything between square brackets --- stardew-access/Features/StaticTiles.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index 5befb38..c0bb806 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -45,7 +45,7 @@ namespace stardew_access.Features foreach (var location in data) { - if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower())) + if (!Game1.currentLocation.name.Value.ToLower().Equals(location.Key.ToLower())) continue; if (location.Value != null) @@ -83,7 +83,21 @@ namespace stardew_access.Features } if (isXPresent && isYPresent) - return (tile.Key, CATEGORY.FromString(tileType.ToString().ToLower())); + { + string key = tile.Key; + if (key.Contains('[') && key.Contains(']')) + { + int i1 = key.IndexOf('['); + int i2 = key.LastIndexOf(']'); + + if (i1 < i2) + { + key = key.Remove(i1, ++i2 - i1); + } + } + + return (key.Trim(), CATEGORY.FromString(tileType.ToString().ToLower())); + } } }