using UnityEngine; namespace IdleSpectator; /// /// World skull hover highlight + click → Lore (no separate grave window). /// public static class GraveHover { private const float HitRadius = 1.35f; /// Stack key under mouse - drives skull hover flicker. public static long HighlightStackKey { get; private set; } public static void Update() { HighlightStackKey = 0; if (!ModSettings.Enabled || !ModSettings.GravestonesEnabled) { return; } if (GraveMarkers.StackCount <= 0) { return; } bool overUi = false; try { overUi = World.world != null && World.world.isOverUI(); } catch { overUi = false; } if (overUi && !ChronicleHud.IsPointerOverPanel() && !WatchCaption.IsPointerOverPanel()) { // Pointer on other game UI - no hover highlight / click. } else { GraveMarkers.GraveStack hover = ResolveHoverStack(); if (hover != null) { HighlightStackKey = hover.Key; } } HandleWorldClick(); } private static void HandleWorldClick() { if (!InputHelpers.GetMouseButtonDown(0)) { return; } if (ChronicleHud.IsPointerOverPanel() || WatchCaption.IsPointerOverInteractive()) { return; } try { if (World.world != null && World.world.isOverUI()) { return; } } catch { return; } GraveMarkers.GraveStack stack = ResolveHoverStack(); if (stack == null || stack.Entries.Count == 0) { return; } InspectUi.MarkGraveSession(); ChronicleHud.OpenGraveStack(stack.TileX, stack.TileY, pauseIdle: true); } private static GraveMarkers.GraveStack ResolveHoverStack() { try { WorldTile tile = World.world.getMouseTilePosCachedFrame() ?? World.world.getMouseTilePos(); if (tile != null && GraveMarkers.TryGetStack(tile.x, tile.y, out GraveMarkers.GraveStack atTile)) { return atTile; } Vector2 mouse = World.world.getMousePos(); return GraveMarkers.FindNearestStack(mouse, HitRadius); } catch { return null; } } }