Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/main/java/com/duckblade/osrs/sailing/SailingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,25 @@ default Color highlightCrystalExtractorInactiveColour()
return Color.YELLOW;
}

enum SailHighlightMode
{
AREA,
SAIL,
;
}

@ConfigItem(
keyName = "sailHighlightMode",
name = "Highlight Sails Mode",
description = "How to highlight trimmable sails. Area highlights the full clickable area, Sail highlights the sail outline.",
section = SECTION_FACILITIES,
position = 8
)
default SailHighlightMode sailHighlightMode()
{
return SailHighlightMode.AREA;
}

enum CrewmateMuteMode
{
NONE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.client.ui.overlay.outline.ModelOutlineRenderer;

@Slf4j
@Singleton
Expand All @@ -28,13 +29,20 @@ public class LuffOverlay
private final Client client;
private final SailingConfig config;
private final BoatTracker boatTracker;
private final ModelOutlineRenderer modelOutlineRenderer;

@Inject
public LuffOverlay(Client client, SailingConfig config, BoatTracker boatTracker)
public LuffOverlay(
Client client,
SailingConfig config,
BoatTracker boatTracker,
ModelOutlineRenderer modelOutlineRenderer
)
{
this.client = client;
this.config = config;
this.boatTracker = boatTracker;
this.modelOutlineRenderer = modelOutlineRenderer;

setLayer(OverlayLayer.ABOVE_SCENE);
setPosition(OverlayPosition.DYNAMIC);
Expand All @@ -56,20 +64,31 @@ public Dimension render(Graphics2D g)

Boat boat = boatTracker.getBoat();
GameObject sail = boat != null ? boat.getSail() : null;

if (sail == null)
{
return null;
}

// Core behaviour: only show when the luff action is actually available
if (!sail.isOpShown(0))
{
return null;
}

Shape convexHull = sail.getConvexHull();
if (convexHull != null)
SailingConfig.SailHighlightMode mode = config.sailHighlightMode();

if (mode == SailingConfig.SailHighlightMode.AREA)
{
Shape hull = sail.getConvexHull();
if (hull != null)
{
OverlayUtil.renderPolygon(g, hull, Color.GREEN);
}
}
else if (mode == SailingConfig.SailHighlightMode.SAIL)
{
OverlayUtil.renderPolygon(g, convexHull, Color.green);
modelOutlineRenderer.drawOutline(sail, 2, Color.GREEN, 250);
}

return null;
Expand Down