Add WorldPoint::getRegionID

This commit is contained in:
Max Weber
2018-04-21 08:54:58 -06:00
committed by Adam
parent f0b1f0e8b0
commit 16aca14f7f
3 changed files with 7 additions and 6 deletions

View File

@@ -165,4 +165,9 @@ public class WorldPoint
{
return new Point(x, y);
}
public int getRegionID()
{
return ((x >> 6) << 8) | (y >> 6);
}
}

View File

@@ -62,9 +62,7 @@ public class LocationOverlay extends Overlay
WorldPoint localWorld = client.getLocalPlayer().getWorldLocation();
LocalPoint localPoint = client.getLocalPlayer().getLocalLocation();
int regionX = localWorld.getX() >> 6;
int regionY = localWorld.getY() >> 6;
int regionID = regionX << 8 | regionY;
int regionID = localWorld.getRegionID();
if (client.isInInstancedRegion())
{

View File

@@ -342,9 +342,7 @@ public class GroundMarkerPlugin extends Plugin
worldPoint = WorldPoint.fromLocal(client, localPoint);
}
int regionX = worldPoint.getX() >> 6;
int regionY = worldPoint.getY() >> 6;
int regionId = regionX << 8 | regionY;
int regionId = worldPoint.getRegionID();
GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getX() & 0x3f, worldPoint.getY() & 0x3f, client.getPlane());
log.debug("Updating point: {} - {}", point, worldPoint);