GroundMarkers: add 4 additional markers (#1418)

* Update GroundMarkerConfig.java

* Update GroundMarkerPlugin.java

* Update GroundMarkerPlugin.java

* Update GroundMarkerOverlay.java

* Update GroundMarkerMinimapOverlay.java

* groundmarkers: Amount of groups
This commit is contained in:
Kyle
2019-08-25 17:34:40 +01:00
committed by GitHub
parent 53cf50074f
commit caae6a7e3a
4 changed files with 176 additions and 10 deletions

View File

@@ -27,6 +27,7 @@
package net.runelite.client.plugins.groundmarkers;
import java.awt.Color;
import lombok.RequiredArgsConstructor;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
@@ -36,11 +37,52 @@ import net.runelite.client.config.Range;
@ConfigGroup("groundMarker")
public interface GroundMarkerConfig extends Config
{
@RequiredArgsConstructor
enum amount
{
ONE("1"),
TWO("2"),
THREE("3"),
FOUR("4"),
FIVE("5"),
SIX("6"),
SEVEN("7"),
EIGHT("8");
private final String name;
@Override
public String toString()
{
return name;
}
public int toInt()
{
return Integer.parseInt(name);
}
}
@ConfigItem(
position = 0,
keyName = "amount",
name = "Amount of groups",
description = "The amount of inventory groups"
)
default amount getAmount()
{
return amount.FOUR;
}
@Alpha
@ConfigItem(
position = 1,
keyName = "markerColor",
name = "Default Marked tile Color",
description = "Configures the default color of marked tiles"
description = "Configures the default color of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "1 || 2 || 3 || 4 || 5 || 6 || 7 || 8"
)
default Color markerColor()
{
@@ -49,9 +91,13 @@ public interface GroundMarkerConfig extends Config
@Alpha
@ConfigItem(
position = 3,
keyName = "markerColor2",
name = "Group 2 tile color",
description = "Configures the color of the 2nd group of marked tiles"
description = "Configures the color of the 2nd group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "2 || 3 || 4 || 5 || 6 || 7 || 8"
)
default Color markerColor2()
{
@@ -60,9 +106,13 @@ public interface GroundMarkerConfig extends Config
@Alpha
@ConfigItem(
position = 4,
keyName = "markerColor3",
name = "Group 3 tile color",
description = "Configures the color of the 3rd group of marked tiles"
description = "Configures the color of the 3rd group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "3 || 4 || 5 || 6 || 7 || 8"
)
default Color markerColor3()
{
@@ -71,16 +121,81 @@ public interface GroundMarkerConfig extends Config
@Alpha
@ConfigItem(
position = 5,
keyName = "markerColor4",
name = "Group 4 tile color",
description = "Configures the color of the 4th group of marked tiles"
description = "Configures the color of the 4th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "4 || 5 || 6 || 7 || 8"
)
default Color markerColor4()
{
return Color.GREEN;
}
@Alpha
@ConfigItem(
position = 6,
keyName = "markerColor5",
name = "Group 5 tile color",
description = "Configures the color of the 5th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "5 || 6 || 7 || 8"
)
default Color markerColor5()
{
return Color.BLACK;
}
@Alpha
@ConfigItem(
position = 7,
keyName = "markerColor6",
name = "Group 6 tile color",
description = "Configures the color of the 6th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "6 || 7 || 8"
)
default Color markerColor6()
{
return Color.GRAY;
}
@Alpha
@ConfigItem(
position = 8,
keyName = "markerColor7",
name = "Group 7 tile color",
description = "Configures the color of the 7th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "7 || 8"
)
default Color markerColor7()
{
return Color.WHITE;
}
@Alpha
@ConfigItem(
position = 9,
keyName = "markerColor8",
name = "Group 8 tile color",
description = "Configures the color of the 8th group of marked tiles",
hidden = true,
unhide = "amount",
unhideValue = "8"
)
default Color markerColor8()
{
return Color.MAGENTA;
}
@ConfigItem(
position = 10,
keyName = "showMinimap",
name = "Show on minimap",
description = "Shows marked tiles on the minimap"
@@ -95,6 +210,7 @@ public interface GroundMarkerConfig extends Config
max = 100
)
@ConfigItem(
position = 11,
keyName = "minimapOpacity",
name = "Minimap opacity",
description = "The opacity of the minimap markers"
@@ -103,4 +219,4 @@ public interface GroundMarkerConfig extends Config
{
return 100;
}
}
}

View File

@@ -89,6 +89,18 @@ class GroundMarkerMinimapOverlay extends Overlay
break;
case 4:
color = plugin.getMarkerColor4();
break;
case 5:
color = plugin.getMarkerColor5();
break;
case 6:
color = plugin.getMarkerColor6();
break;
case 7:
color = plugin.getMarkerColor7();
break;
case 8:
color = plugin.getMarkerColor8();
}
int opacity = (int) floor(plugin.getMinimapOverlayOpacity() * 2.55);
@@ -117,4 +129,4 @@ class GroundMarkerMinimapOverlay extends Overlay
OverlayUtil.renderMinimapRect(client, graphics, posOnMinimap, TILE_WIDTH, TILE_HEIGHT, color);
}
}
}

View File

@@ -101,7 +101,19 @@ public class GroundMarkerOverlay extends Overlay
break;
case 4:
color = plugin.getMarkerColor4();
break;
case 5:
color = plugin.getMarkerColor5();
break;
case 6:
color = plugin.getMarkerColor6();
break;
case 7:
color = plugin.getMarkerColor7();
break;
case 8:
color = plugin.getMarkerColor8();
}
OverlayUtil.renderPolygon(graphics, poly, color);
}
}
}

View File

@@ -144,6 +144,7 @@ public class GroundMarkerPlugin extends Plugin
{
}
private GroundMarkerConfig.amount amount;
@Getter(AccessLevel.PACKAGE)
private Color markerColor;
@Getter(AccessLevel.PACKAGE)
@@ -153,6 +154,14 @@ public class GroundMarkerPlugin extends Plugin
@Getter(AccessLevel.PACKAGE)
private Color markerColor4;
@Getter(AccessLevel.PACKAGE)
private Color markerColor5;
@Getter(AccessLevel.PACKAGE)
private Color markerColor6;
@Getter(AccessLevel.PACKAGE)
private Color markerColor7;
@Getter(AccessLevel.PACKAGE)
private Color markerColor8;
@Getter(AccessLevel.PACKAGE)
private boolean showMinimap;
@Getter(AccessLevel.PACKAGE)
private int minimapOverlayOpacity;
@@ -309,7 +318,7 @@ public class GroundMarkerPlugin extends Plugin
MenuEntry[] menuEntries = client.getMenuEntries();
int lastIndex = menuEntries.length;
menuEntries = Arrays.copyOf(menuEntries, lastIndex + 4);
menuEntries = Arrays.copyOf(menuEntries, lastIndex + this.amount.toInt());
final Tile tile = client.getSelectedSceneTile();
if (tile == null)
@@ -319,7 +328,7 @@ public class GroundMarkerPlugin extends Plugin
final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation());
final int regionId = loc.getRegionID();
for (int i = 4; i > 0; i--)
for (int i = this.amount.toInt(); i > 0; i--)
{
MenuEntry menuEntry = menuEntries[lastIndex] = new MenuEntry();
@@ -438,6 +447,18 @@ public class GroundMarkerPlugin extends Plugin
break;
case 4:
color = this.markerColor4;
break;
case 5:
color = this.markerColor5;
break;
case 6:
color = this.markerColor6;
break;
case 7:
color = this.markerColor7;
break;
case 8:
color = this.markerColor8;
}
return color;
@@ -453,11 +474,16 @@ public class GroundMarkerPlugin extends Plugin
private void updateConfig()
{
this.amount = config.getAmount();
this.markerColor = config.markerColor();
this.markerColor2 = config.markerColor2();
this.markerColor3 = config.markerColor3();
this.markerColor4 = config.markerColor4();
this.markerColor5 = config.markerColor5();
this.markerColor6 = config.markerColor6();
this.markerColor7 = config.markerColor7();
this.markerColor8 = config.markerColor8();
this.showMinimap = config.showMinimap();
this.minimapOverlayOpacity = config.minimapOverlayOpacity();
}
}
}