fishing plugin: deduplicate spot overlay color logic

This commit is contained in:
Adam
2019-08-20 19:44:03 -04:00
parent b250f9fb2f
commit bd8a31cc0b

View File

@@ -95,7 +95,19 @@ class FishingSpotOverlay extends Overlay
continue;
}
Color color = npc.getGraphic() == GraphicID.FLYING_FISH ? Color.RED : Color.CYAN;
Color color;
if (npc.getGraphic() == GraphicID.FLYING_FISH)
{
color = Color.RED;
}
else if (spot == FishingSpot.COMMON_TENCH && npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING)
{
color = Color.GREEN;
}
else
{
color = Color.CYAN;
}
if (spot == FishingSpot.MINNOW && config.showMinnowOverlay())
{
@@ -127,12 +139,6 @@ class FishingSpotOverlay extends Overlay
{
Polygon poly = npc.getCanvasTilePoly();
if (spot == FishingSpot.COMMON_TENCH
&& npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING)
{
color = Color.GREEN;
}
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, color.darker());
@@ -164,12 +170,6 @@ class FishingSpotOverlay extends Overlay
String text = spot.getName();
Point textLocation = npc.getCanvasTextLocation(graphics, text, npc.getLogicalHeight() + 40);
if (spot == FishingSpot.COMMON_TENCH
&& npc.getWorldLocation().distanceTo2D(client.getLocalPlayer().getWorldLocation()) <= ONE_TICK_AERIAL_FISHING)
{
color = Color.GREEN;
}
if (textLocation != null)
{
OverlayUtil.renderTextLocation(graphics, textLocation, text, color.darker());