net.runelite.api.WallObject Java Examples

The following examples show how to use net.runelite.api.WallObject. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 6 votes vote down vote up
@Nullable
public TileObject findNearestObject(int... ids)
{
	GameObject gameObject = findNearestGameObject(ids);

	if (gameObject != null)
	{
		return gameObject;
	}

	WallObject wallObject = findNearestWallObject(ids);

	if (wallObject != null)
	{
		return wallObject;
	}
	DecorativeObject decorativeObject = findNearestDecorObject(ids);

	if (decorativeObject != null)
	{
		return decorativeObject;
	}

	return findNearestGroundObject(ids);
}
 
Example #2
Source File: MotherlodePlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onWallObjectChanged(WallObjectChanged event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject previous = event.getPrevious();
	WallObject wallObject = event.getWallObject();

	veins.remove(previous);
	if (MINE_SPOTS.contains(wallObject.getId()))
	{
		veins.add(wallObject);
	}
}
 
Example #3
Source File: MotherlodePlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onWallObjectChanged(WallObjectChanged event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject previous = event.getPrevious();
	WallObject wallObject = event.getWallObject();

	veins.remove(previous);
	if (MINE_SPOTS.contains(wallObject.getId()))
	{
		veins.add(wallObject);
	}
}
 
Example #4
Source File: MotherlodePlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject wallObject = event.getWallObject();
	int wallObjectId = wallObject.getId();
	if (MINE_SPOTS.contains(wallObjectId))
	{
		veins.add(wallObject);
	}
	else if (DEPLETED_SPOTS.contains(wallObjectId) && wallObject.getWorldLocation().equals(targetVeinLocation))
	{
		isMining = false;
		resetIdleChecks();
		sendIdleNotification();
	}
}
 
Example #5
Source File: TelekineticRoom.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private Rectangle getBounds(WallObject[] walls)
{
	int minX = Integer.MAX_VALUE;
	int minY = Integer.MAX_VALUE;

	int maxX = Integer.MIN_VALUE;
	int maxY = Integer.MIN_VALUE;

	for (WallObject wall : walls)
	{
		WorldPoint point = wall.getWorldLocation();
		minX = Math.min(minX, point.getX());
		minY = Math.min(minY, point.getY());

		maxX = Math.max(maxX, point.getX());
		maxY = Math.max(maxY, point.getY());
	}

	return new Rectangle(minX, minY, maxX - minX, maxY - minY);
}
 
Example #6
Source File: TelekineticRoom.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private Rectangle getBounds(WallObject[] walls)
{
	int minX = Integer.MAX_VALUE;
	int minY = Integer.MAX_VALUE;

	int maxX = Integer.MIN_VALUE;
	int maxY = Integer.MIN_VALUE;

	for (WallObject wall : walls)
	{
		WorldPoint point = wall.getWorldLocation();
		minX = Math.min(minX, point.getX());
		minY = Math.min(minY, point.getY());

		maxX = Math.max(maxX, point.getX());
		maxY = Math.max(maxY, point.getY());
	}

	return new Rectangle(minX, minY, maxX - minX, maxY - minY);
}
 
Example #7
Source File: BarrowsOverlay.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
private void renderWalls(Graphics2D graphics, WallObject wall)
{
	net.runelite.api.Point minimapLocation = wall.getMinimapLocation();

	if (minimapLocation == null)
	{
		return;
	}

	ObjectDefinition objectComp = client.getObjectDefinition(wall.getId());
	ObjectDefinition impostor = objectComp.getImpostorIds() != null ? objectComp.getImpostor() : null;

	if (impostor != null && impostor.getActions()[0] != null)
	{
		graphics.setColor(Color.green);
	}
	else
	{
		graphics.setColor(Color.gray);
	}

	graphics.fillRect(minimapLocation.getX(), minimapLocation.getY(), 3, 3);
}
 
Example #8
Source File: TelekineticRoom.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{
	final WallObject wall = event.getWallObject();
	if (wall.getId() != TELEKINETIC_WALL)
	{
		return;
	}

	telekineticWalls.add(wall);
}
 
Example #9
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
public List<WallObject> getWallObjects(int... ids)
{
	assert client.isClientThread();

	if (client.getLocalPlayer() == null)
	{
		return new ArrayList<>();
	}

	return new WallObjectQuery()
		.idEquals(ids)
		.result(client)
		.list;
}
 
Example #10
Source File: DevToolsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void renderWallObject(Graphics2D graphics, Tile tile, Player player)
{
	WallObject wallObject = tile.getWallObject();
	if (wallObject != null)
	{
		if (player.getLocalLocation().distanceTo(wallObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, wallObject, "ID: " + wallObject.getId(), GRAY);
		}
	}
}
 
Example #11
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWallObjectChanged(WallObjectChanged event)
{
	WallObject previous = event.getPrevious();
	WallObject wallObject = event.getWallObject();

	objects.removeIf(o -> o.getTileObject() == previous);
	checkObjectPoints(wallObject);
}
 
Example #12
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private TileObject findTileObject(Tile tile, int id)
{
	if (tile == null)
	{
		return null;
	}

	final GameObject[] tileGameObjects = tile.getGameObjects();
	final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
	final WallObject tileWallObject = tile.getWallObject();
	final GroundObject groundObject = tile.getGroundObject();

	if (objectIdEquals(tileWallObject, id))
	{
		return tileWallObject;
	}

	if (objectIdEquals(tileDecorativeObject, id))
	{
		return tileDecorativeObject;
	}

	if (objectIdEquals(groundObject, id))
	{
		return groundObject;
	}

	for (GameObject object : tileGameObjects)
	{
		if (objectIdEquals(object, id))
		{
			return object;
		}
	}

	return null;
}
 
Example #13
Source File: PyramidPlunderPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{
	WallObject object = event.getWallObject();

	if (TOMB_DOOR_WALL_IDS.contains(object.getId()))
	{
		tilesToHighlight.put(object, event.getTile());
	}
}
 
Example #14
Source File: MotherlodeRocksOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void renderVein(Graphics2D graphics, WallObject vein)
{
	Point canvasLoc = Perspective.getCanvasImageLocation(client, vein.getLocalLocation(), miningIcon, 150);

	if (canvasLoc != null)
	{
		graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
	}
}
 
Example #15
Source File: MotherlodePlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject wallObject = event.getWallObject();
	if (MINE_SPOTS.contains(wallObject.getId()))
	{
		veins.add(wallObject);
	}
}
 
Example #16
Source File: MotherlodePlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWallObjectDespawned(WallObjectDespawned event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject wallObject = event.getWallObject();
	veins.remove(wallObject);
}
 
Example #17
Source File: PyramidPlunderPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onWallObjectSpawned(WallObjectSpawned event)
{
	WallObject object = event.getWallObject();

	if (TOMB_DOOR_WALL_IDS.contains(object.getId()))
	{
		tilesToHighlight.put(object, event.getTile());
	}
}
 
Example #18
Source File: ExtUtils.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
public WallObject findNearestWallObject(int... ids)
{
	assert client.isClientThread();

	if (client.getLocalPlayer() == null)
	{
		return null;
	}

	return new WallObjectQuery()
		.idEquals(ids)
		.result(client)
		.nearestTo(client.getLocalPlayer());
}
 
Example #19
Source File: DevToolsOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void renderWallObject(Graphics2D graphics, Tile tile, Player player)
{
	WallObject wallObject = tile.getWallObject();
	if (wallObject != null)
	{
		if (player.getLocalLocation().distanceTo(wallObject.getLocalLocation()) <= MAX_DISTANCE)
		{
			OverlayUtil.renderTileOverlay(graphics, wallObject, "ID: " + wallObject.getId(), GRAY);
		}
	}
}
 
Example #20
Source File: MotherlodePlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event)
{
	if (!inMlm)
	{
		return;
	}

	WallObject wallObject = event.getWallObject();
	veins.remove(wallObject);
}
 
Example #21
Source File: MotherlodeRocksOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void renderVein(Graphics2D graphics, WallObject vein, Boolean shouldRecolor)
{
	Point canvasLoc = Perspective.getCanvasImageLocation(client, vein.getLocalLocation(), miningIcon, 150);

	if (canvasLoc != null && !shouldRecolor)
	{
		graphics.drawImage(miningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
	}
	else if (canvasLoc != null)
	{
		graphics.drawImage(targetMiningIcon, canvasLoc.getX(), canvasLoc.getY(), null);
	}
}
 
Example #22
Source File: BarrowsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWallObjectChanged(WallObjectChanged event)
{
	WallObject previous = event.getPrevious();
	WallObject wallObject = event.getWallObject();

	walls.remove(previous);
	if (BARROWS_WALLS.contains(wallObject.getId()))
	{
		walls.add(wallObject);
	}
}
 
Example #23
Source File: BarrowsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
	WallObject wallObject = event.getWallObject();
	if (BARROWS_WALLS.contains(wallObject.getId()))
	{
		walls.add(wallObject);
	}
}
 
Example #24
Source File: TelekineticRoom.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void onWallObjectSpawned(WallObjectSpawned event)
{
	final WallObject wall = event.getWallObject();
	if (wall.getId() != TELEKINETIC_WALL)
	{
		return;
	}

	telekineticWalls.add(wall);
}
 
Example #25
Source File: ObjectIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private TileObject findTileObject(Tile tile, int id)
{
	if (tile == null)
	{
		return null;
	}

	final GameObject[] tileGameObjects = tile.getGameObjects();
	final DecorativeObject tileDecorativeObject = tile.getDecorativeObject();
	final WallObject tileWallObject = tile.getWallObject();
	final GroundObject groundObject = tile.getGroundObject();

	if (objectIdEquals(tileWallObject, id))
	{
		return tileWallObject;
	}

	if (objectIdEquals(tileDecorativeObject, id))
	{
		return tileDecorativeObject;
	}

	if (objectIdEquals(groundObject, id))
	{
		return groundObject;
	}

	for (GameObject object : tileGameObjects)
	{
		if (objectIdEquals(object, id))
		{
			return object;
		}
	}
	return null;
}
 
Example #26
Source File: ObjectIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWallObjectChanged(WallObjectChanged event)
{
	WallObject previous = event.getPrevious();
	WallObject wallObject = event.getWallObject();

	objects.removeIf(o -> o.getTileObject() == previous);
	checkObjectPoints(wallObject);
}
 
Example #27
Source File: IdleNotifierPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onWallObjectSpawned(WallObjectSpawned event)
{
	WallObject wall = event.getWallObject();

	if (regionCheck())
	{
		if (config.notifyResourceDoor() && wall.getId() == 83 && resourceDoorReady)
		{
			notifier.notify("Door warning! The resource area door has been opened!");
		}
	}
}
 
Example #28
Source File: SceneUploader.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
private void reset(Tile tile)
{
	Tile bridge = tile.getBridge();
	if (bridge != null)
	{
		reset(bridge);
	}

	TilePaint sceneTilePaint = tile.getTilePaint();
	if (sceneTilePaint != null)
	{
		sceneTilePaint.setBufferOffset(-1);
	}

	TileModel sceneTileModel = tile.getTileModel();
	if (sceneTileModel != null)
	{
		sceneTileModel.setBufferOffset(-1);
	}

	WallObject wallObject = tile.getWallObject();
	if (wallObject != null)
	{
		if (wallObject.getEntity1() instanceof Model)
		{
			((Model) wallObject.getEntity1()).setBufferOffset(-1);
		}
		if (wallObject.getEntity2() instanceof Model)
		{
			((Model) wallObject.getEntity2()).setBufferOffset(-1);
		}
	}

	GroundObject groundObject = tile.getGroundObject();
	if (groundObject != null)
	{
		if (groundObject.getEntity() instanceof Model)
		{
			((Model) groundObject.getEntity()).setBufferOffset(-1);
		}
	}

	DecorativeObject decorativeObject = tile.getDecorativeObject();
	if (decorativeObject != null)
	{
		if (decorativeObject.getEntity1() instanceof Model)
		{
			((Model) decorativeObject.getEntity1()).setBufferOffset(-1);
		}
	}

	GameObject[] gameObjects = tile.getGameObjects();
	for (GameObject gameObject : gameObjects)
	{
		if (gameObject == null)
		{
			continue;
		}
		if (gameObject.getEntity() instanceof Model)
		{
			((Model) gameObject.getEntity()).setBufferOffset(-1);
		}
	}
}
 
Example #29
Source File: BarrowsPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onWallObjectDespawned(WallObjectDespawned event)
{
	WallObject wallObject = event.getWallObject();
	walls.remove(wallObject);
}
 
Example #30
Source File: ObjectIndicatorsOverlay.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	for (ColorTileObject colorTileObject : plugin.getObjects())
	{
		TileObject object = colorTileObject.getTileObject();
		Color color = colorTileObject.getColor();

		if (object.getPlane() != client.getPlane())
		{
			continue;
		}

		if (color == null || !config.rememberObjectColors())
		{
			// Fallback to the current config if the object is marked before the addition of multiple colors
			color = config.markerColor();
		}

		final Shape polygon;
		Shape polygon2 = null;

		if (object instanceof GameObject)
		{
			polygon = ((GameObject) object).getConvexHull();
		}
		else if (object instanceof WallObject)
		{
			polygon = ((WallObject) object).getConvexHull();
			polygon2 = ((WallObject) object).getConvexHull2();
		}
		else if (object instanceof DecorativeObject)
		{
			polygon = ((DecorativeObject) object).getConvexHull();
			polygon2 = ((DecorativeObject) object).getConvexHull2();
		}
		else if (object instanceof GroundObject)
		{
			polygon = ((GroundObject) object).getConvexHull();
		}
		else
		{
			polygon = object.getCanvasTilePoly();
		}

		if (polygon != null)
		{
			OverlayUtil.renderPolygon(graphics, polygon, color);
		}

		if (polygon2 != null)
		{
			OverlayUtil.renderPolygon(graphics, polygon2, color);
		}
	}

	return null;
}