Merge pull request #5447 from deathbeam/add-option-spot
Add fishing spot display configuration
This commit is contained in:
@@ -44,17 +44,39 @@ public interface FishingConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "showIcons",
|
||||
name = "Display Fish icons",
|
||||
description = "Display icons instead of text on fishing spots."
|
||||
keyName = "showTiles",
|
||||
name = "Display spot tiles",
|
||||
description = "Configures whether tiles for fishing spots are highlighted"
|
||||
)
|
||||
default boolean showIcons()
|
||||
default boolean showSpotTiles()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "showIcons",
|
||||
name = "Display spot icons",
|
||||
description = "Configures whether icons for fishing spots are displayed"
|
||||
)
|
||||
default boolean showSpotIcons()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "showNames",
|
||||
name = "Display spot names",
|
||||
description = "Configures whether names for fishing spots are displayed"
|
||||
)
|
||||
default boolean showSpotNames()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "statTimeout",
|
||||
name = "Reset stats (minutes)",
|
||||
description = "The time until fishing session data is reset in minutes."
|
||||
@@ -65,7 +87,7 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
position = 5,
|
||||
keyName = "showFishingStats",
|
||||
name = "Show Fishing session stats",
|
||||
description = "Display the fishing session stats."
|
||||
@@ -76,7 +98,7 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
position = 6,
|
||||
keyName = "showMinnowOverlay",
|
||||
name = "Show Minnow Movement overlay",
|
||||
description = "Display the minnow progress pie overlay."
|
||||
@@ -87,7 +109,7 @@ public interface FishingConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
position = 7,
|
||||
keyName = "trawlerNotification",
|
||||
name = "Trawler activity notification",
|
||||
description = "Send a notification when fishing trawler activity drops below 15%."
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.fishing;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@@ -126,27 +127,39 @@ class FishingSpotOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
if (config.showIcons())
|
||||
if (config.showSpotTiles())
|
||||
{
|
||||
BufferedImage fishImage = getFishImage(spot);
|
||||
if (fishImage != null)
|
||||
Polygon poly = npc.getCanvasTilePoly();
|
||||
if (poly != null)
|
||||
{
|
||||
OverlayUtil.renderActorOverlayImage(graphics, npc, fishImage, color.darker(), npc.getLogicalHeight());
|
||||
OverlayUtil.renderPolygon(graphics, poly, color.darker());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
if (config.showSpotIcons())
|
||||
{
|
||||
BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId());;
|
||||
if (fishImage != null)
|
||||
{
|
||||
Point imageLocation = npc.getCanvasImageLocation(graphics, fishImage, npc.getLogicalHeight());
|
||||
if (imageLocation != null)
|
||||
{
|
||||
OverlayUtil.renderImageLocation(graphics, imageLocation, fishImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.showSpotNames())
|
||||
{
|
||||
String text = spot.getName();
|
||||
OverlayUtil.renderActorOverlay(graphics, npc, text, color.darker());
|
||||
Point textLocation = npc.getCanvasTextLocation(graphics, text, npc.getLogicalHeight() + 40);
|
||||
if (textLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, text, color.darker());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private BufferedImage getFishImage(FishingSpot spot)
|
||||
{
|
||||
BufferedImage fishImage = itemManager.getImage(spot.getFishSpriteId());
|
||||
return fishImage;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user