From a9e015f11f49a21d89d7f0820935c358461fc03c Mon Sep 17 00:00:00 2001 From: shoaib11120 Date: Thu, 13 Jan 2022 12:52:20 +0530 Subject: [PATCH] better narration of fruit trees --- stardew-access/Game/ReadTile.cs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/stardew-access/Game/ReadTile.cs b/stardew-access/Game/ReadTile.cs index ac57f22..0fac40e 100644 --- a/stardew-access/Game/ReadTile.cs +++ b/stardew-access/Game/ReadTile.cs @@ -169,10 +169,7 @@ namespace stardew_access.Game } else if (terrain.Get() is FruitTree) { - FruitTree fruitTree = (FruitTree)terrain.Get(); - int stage = fruitTree.growthStage.Value; - int fruitType = fruitTree.indexOfFruit.Get(); - toReturn = $"{Game1.objectInformation[fruitType].Split('/')[0]} tree"; + toReturn = getFruitTree((FruitTree)terrain.Get()); } else if (terrain.Get() is Grass) { @@ -194,6 +191,27 @@ namespace stardew_access.Game return toReturn; } + public static string getFruitTree(FruitTree fruitTree) + { + int stage = fruitTree.growthStage.Value; + int fruitIndex = fruitTree.indexOfFruit.Get(); + + string toReturn = Game1.objectInformation[fruitIndex].Split('/')[0]; + + if (stage == 0) + toReturn = $"{toReturn} seed"; + else if(stage == 1) + toReturn = $"{toReturn} sprout"; + else if(stage == 2) + toReturn = $"{toReturn} sapling"; + else if(stage == 3) + toReturn = $"{toReturn} bush"; + else if(stage >= 4) + toReturn = $"{toReturn} tree"; + + return toReturn; + } + public static string getTree(Tree tree) { int treeType = tree.treeType.Value; @@ -213,6 +231,7 @@ namespace stardew_access.Game return "Mushroom Tree"; } + if (treeType <= 3) seedName = Game1.objectInformation[308 + treeType].Split('/')[0]; else if (treeType == 8)