multiple values for same tile

master
Mohammad Shoaib 2022-04-24 11:57:14 +05:30
parent 98b4247cbb
commit 4082cc033b
1 changed files with 25 additions and 4 deletions

View File

@ -54,14 +54,35 @@ namespace stardew_access.Features
if (tile.Value == null)
continue;
JToken? tileX = tile.Value["x"];
JToken? tileY = tile.Value["y"];
JToken? tileXArray = tile.Value["x"];
JToken? tileYArray = tile.Value["y"];
JToken? tileType = tile.Value["type"];
if (tileX == null || tileY == null || tileType == null)
if (tileXArray == null || tileYArray == null || tileType == null)
continue;
if (short.Parse(tileX.ToString()) == x && short.Parse(tileY.ToString()) == y)
bool isXPresent = false;
bool isYPresent = false;
foreach (var item in tileXArray)
{
if (short.Parse(item.ToString()) == x)
{
isXPresent = true;
break;
}
}
foreach (var item in tileYArray)
{
if (short.Parse(item.ToString()) == y)
{
isYPresent = true;
break;
}
}
if (isXPresent && isYPresent)
return (tile.Key, CATEGORY.FromString(tileType.ToString()));
}
}