public static void OnTooltipDisplay(Bookcase.Events.ItemTooltipEvent e, FishingLog fishingLog) { if (e.Item != null) { if (e.Item.Category == StardewValley.Object.FishCategory) { e.AddLine("\r\n" + fishingLog.GetCatchConditionsAsString(e.Item)); } } }
public override void Entry(IModHelper helper) { SaveEvents.AfterLoad += LoadFishingLog; SaveEvents.AfterSave += SaveFishingLog; BookcaseEvents.OnItemTooltip.Add((e) => TooltipPatch.OnTooltipDisplay(e, FishingLog), Priority.Low); BookcaseEvents.FishCaughtInfo.Add((e) => { if (e.FishSize == -1) { return; } Monitor.Log($"Fish caught {e.FishID} :: {e.FishSize}"); FishingLog.RecordCatch(e.FishID, e.FishSize, e.FishQuality); SaveFishingLog(null, null); }); BookcaseEvents.PostBundleSpecificPageSetup.Add((e) => { foreach (var ingredient in e.ingredientList) { if (ingredient != null && ingredient.item.Category == StardewValley.Object.FishCategory) { ingredient.hoverText += $"\r\n{FishingLog.GetCatchConditionsAsString(ingredient.item)}"; } } }); BookcaseEvents.CollectionsPageDrawEvent.Add((e) => { if (e.currentTab == CollectionsPage.fishTab && e.hoverText != "") { Item i = null; foreach (ClickableTextureComponent c in e.collections[e.currentTab][e.currentPage]) { if (int.TryParse(c.name.Split(' ')[0], out int index)) { string name = e.hoverText.Split('\r')[0]; if ((Game1.objectInformation[index].Split('/')[0].Equals(name, StringComparison.CurrentCultureIgnoreCase))) { i = new StardewValley.Object(index, 1, false, 0, 0); break; } } } if (i != null) { string result = FishingLog.GetCatchConditionsAsString(i); if (!e.hoverText.Contains(result)) { e.hoverText += "\r\n\r\n" + result; } } } }); }