objectindicators: fix not marking objects when loaded on other planes
fromLocalInstance() was returning a world point using the clients plane, however the object may not be on that, causing the plane check in checkObjectPoints() to fail.
This commit is contained in:
@@ -163,6 +163,20 @@ public class WorldPoint
|
|||||||
* @return the tile coordinate containing the local point
|
* @return the tile coordinate containing the local point
|
||||||
*/
|
*/
|
||||||
public static WorldPoint fromLocalInstance(Client client, LocalPoint localPoint)
|
public static WorldPoint fromLocalInstance(Client client, LocalPoint localPoint)
|
||||||
|
{
|
||||||
|
return fromLocalInstance(client, localPoint, client.getPlane());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the coordinate of the tile that contains the passed local point,
|
||||||
|
* accounting for instances.
|
||||||
|
*
|
||||||
|
* @param client the client
|
||||||
|
* @param localPoint the local coordinate
|
||||||
|
* @param plane the plane for the returned point, if it is not an instance
|
||||||
|
* @return the tile coordinate containing the local point
|
||||||
|
*/
|
||||||
|
public static WorldPoint fromLocalInstance(Client client, LocalPoint localPoint, int plane)
|
||||||
{
|
{
|
||||||
if (client.isInInstancedRegion())
|
if (client.isInInstancedRegion())
|
||||||
{
|
{
|
||||||
@@ -181,18 +195,18 @@ public class WorldPoint
|
|||||||
int rotation = templateChunk >> 1 & 0x3;
|
int rotation = templateChunk >> 1 & 0x3;
|
||||||
int templateChunkY = (templateChunk >> 3 & 0x7FF) * CHUNK_SIZE;
|
int templateChunkY = (templateChunk >> 3 & 0x7FF) * CHUNK_SIZE;
|
||||||
int templateChunkX = (templateChunk >> 14 & 0x3FF) * CHUNK_SIZE;
|
int templateChunkX = (templateChunk >> 14 & 0x3FF) * CHUNK_SIZE;
|
||||||
int plane = templateChunk >> 24 & 0x3;
|
int templateChunkPlane = templateChunk >> 24 & 0x3;
|
||||||
|
|
||||||
// calculate world point of the template
|
// calculate world point of the template
|
||||||
int x = templateChunkX + (sceneX & (CHUNK_SIZE - 1));
|
int x = templateChunkX + (sceneX & (CHUNK_SIZE - 1));
|
||||||
int y = templateChunkY + (sceneY & (CHUNK_SIZE - 1));
|
int y = templateChunkY + (sceneY & (CHUNK_SIZE - 1));
|
||||||
|
|
||||||
// create and rotate point back to 0, to match with template
|
// create and rotate point back to 0, to match with template
|
||||||
return rotate(new WorldPoint(x, y, plane), 4 - rotation);
|
return rotate(new WorldPoint(x, y, templateChunkPlane), 4 - rotation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return fromLocal(client, localPoint);
|
return fromLocal(client, localPoint.getX(), localPoint.getY(), plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public class ObjectIndicatorsPlugin extends Plugin
|
|||||||
|
|
||||||
private void checkObjectPoints(TileObject object)
|
private void checkObjectPoints(TileObject object)
|
||||||
{
|
{
|
||||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation());
|
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation(), object.getPlane());
|
||||||
final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID());
|
final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID());
|
||||||
|
|
||||||
if (objectPoints == null)
|
if (objectPoints == null)
|
||||||
|
|||||||
Reference in New Issue
Block a user