Skip to content

Commit

Permalink
[slothsoft#63] fix tooltip for ginger
Browse files Browse the repository at this point in the history
  • Loading branch information
slothsoft committed Nov 19, 2022
1 parent bf7bedf commit b3ba349
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Informant/Implementation/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,13 @@ public static class BigCraftableIds {
WoodLamppost, IronLamppost, Hmtgf, JunimoKartArcadeSystem, PinkyLemon, Foroguemo, SolidGoldLewis, AutoGrabber, DeluxeScarecrow, Barrel, Crate,
Workbench, MiniJukebox, Telephone, CursedPkArcadeSystem, MiniObelisk, FarmComputer, SewingMachine, AutoPetter, Hopper, Campfire2,
}).ToArray();
}

/// <summary>
/// These constants can be used to compare to <code>Object.ParentSheetIndex</code>.
/// See https://stardewcommunitywiki.com/Modding:Object_data
/// </summary>
public static class ObjectIds {
public const int GingerForageCropId = 2;
public const int Ginger = 829;
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ public Tooltip Generate(TerrainFeature input) {
}

internal static Tooltip CreateTooltip(IModHelper modHelper, Crop crop) {
var displayName = GameInformation.GetObjectDisplayName(crop.indexOfHarvest.Value);
// for some reason, ginger is displayed as weeds
var parentSheetIndex = crop.whichForageCrop.Value == ObjectIds.GingerForageCropId ? ObjectIds.Ginger : crop.indexOfHarvest.Value;
var displayName = GameInformation.GetObjectDisplayName(parentSheetIndex);
var daysLeft = CalculateDaysLeftString(modHelper, crop);
return new Tooltip($"{displayName}\n{daysLeft}") {
Icon = Icon.ForParentSheetIndex(
crop.indexOfHarvest.Value,
parentSheetIndex,
false,
IPosition.CenterRight,
new Vector2(Game1.tileSize / 2f, Game1.tileSize / 2f)
Expand Down

0 comments on commit b3ba349

Please sign in to comment.