Merge pull request #1259 from ShaunDreclin/location-devtool-region-highlight

Highlight current region in Location devtool
This commit is contained in:
Adam
2018-04-04 07:44:29 -04:00
committed by GitHub

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.client.plugins.devtools; package net.runelite.client.plugins.devtools;
import java.awt.Color;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import javax.inject.Inject; import javax.inject.Inject;
@@ -60,6 +61,10 @@ public class LocationOverlay extends Overlay
WorldPoint localWorld = client.getLocalPlayer().getWorldLocation(); WorldPoint localWorld = client.getLocalPlayer().getWorldLocation();
int regionX = localWorld.getX() >> 6;
int regionY = localWorld.getY() >> 6;
int regionID = regionX << 8 | regionY;
panelComponent.getLines().add(new PanelComponent.Line( panelComponent.getLines().add(new PanelComponent.Line(
"Tile", "Tile",
localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane() localWorld.getX() + ", " + localWorld.getY() + ", " + client.getPlane()
@@ -70,12 +75,11 @@ public class LocationOverlay extends Overlay
int region = client.getMapRegions()[i]; int region = client.getMapRegions()[i];
panelComponent.getLines().add(new PanelComponent.Line( panelComponent.getLines().add(new PanelComponent.Line(
(i == 0) ? "Map region" : " ", (i == 0) ? "Map regions" : " ", new Color(255, 255, 255, 255),
String.valueOf(region) String.valueOf(region), (region == regionID) ? new Color(0, 255, 0, 255) : new Color(255, 255, 255, 255)
)); ));
} }
return panelComponent.render(graphics); return panelComponent.render(graphics);
} }
} }