Issue#33 Fixed rings bug in crafting page

master
Mohammad Shoaib Khan 2022-08-13 14:21:22 +05:30
parent 408a40121d
commit 18a7dc5d23
1 changed files with 30 additions and 29 deletions

View File

@ -773,9 +773,9 @@ namespace stardew_access.Patches
#region Health & stamina and buff items (effects like +1 walking speed) #region Health & stamina and buff items (effects like +1 walking speed)
Item producesItem = ___hoverRecipe.createItem(); Item producesItem = ___hoverRecipe.createItem();
StardewValley.Object? producesItemObject = ((StardewValley.Object)producesItem); if (producesItem is StardewValley.Object producesItemObject)
{
if (producesItem is StardewValley.Object && producesItemObject.Edibility != -300) if (producesItemObject.Edibility != -300)
{ {
int stamina_recovery = producesItemObject.staminaRecoveredOnConsumption(); int stamina_recovery = producesItemObject.staminaRecoveredOnConsumption();
buffs += $"{stamina_recovery} Energy"; buffs += $"{stamina_recovery} Energy";
@ -786,7 +786,7 @@ namespace stardew_access.Patches
} }
} }
// These variables are taken from the game's code itself (IClickableMenu.cs -> 1016 line) // These variables are taken from the game's code itself (IClickableMenu.cs -> 1016 line)
bool edibleItem = producesItem != null && producesItem is StardewValley.Object && (int)producesItemObject.Edibility != -300; bool edibleItem = producesItem != null && (int)producesItemObject.Edibility != -300;
string[]? buffIconsToDisplay = (producesItem != null && edibleItem && Game1.objectInformation[producesItemObject.ParentSheetIndex].Split('/').Length > 7) string[]? buffIconsToDisplay = (producesItem != null && edibleItem && Game1.objectInformation[producesItemObject.ParentSheetIndex].Split('/').Length > 7)
? producesItem.ModifyItemBuffs(Game1.objectInformation[producesItemObject.ParentSheetIndex].Split('/')[7].Split(' ')) ? producesItem.ModifyItemBuffs(Game1.objectInformation[producesItemObject.ParentSheetIndex].Split('/')[7].Split(' '))
: null; : null;
@ -811,6 +811,7 @@ namespace stardew_access.Patches
buffs = $"Buffs and boosts:\n {buffs}"; buffs = $"Buffs and boosts:\n {buffs}";
} }
}
#endregion #endregion