Java Code Examples for net.runelite.api.TileObject#getId()

The following examples show how to use net.runelite.api.TileObject#getId() . 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: PestControlPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void unlistTileObject(TileObject tileObject)
{
	int tileObjectId = tileObject.getId();

	if (PestControlRepairObject.isRepairableBarricadeId(tileObjectId) ||
		PestControlRepairObject.isRepairableGateId(tileObjectId))
	{
		highlightedRepairList.remove(tileObject);
		return;
	}

	switch (tileObjectId)
	{
		case NOVICE_GANGPLANK:
		{
			noviceGangplankTile = null;
			break;
		}
		case INTERMEDIATE_GANGPLANK:
		{
			intermediateGangplankTile = null;
			break;
		}
		case VETERAN_GANGPLANK:
		{
			veteranGangplankTile = null;
			break;
		}
	}
}
 
Example 2
Source File: PestControlPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void handleTileObject(Tile tile, TileObject tileObject)
{
	int tileObjectId = tileObject.getId();

	if (PestControlRepairObject.isRepairableBarricadeId(tileObjectId) ||
		PestControlRepairObject.isRepairableGateId(tileObjectId))
	{
		highlightedRepairList.add(tileObject);
		return;
	}

	switch (tileObjectId)
	{
		case NOVICE_GANGPLANK:
		{
			noviceGangplankTile = tile;
			break;
		}
		case INTERMEDIATE_GANGPLANK:
		{
			intermediateGangplankTile = tile;
			break;
		}
		case VETERAN_GANGPLANK:
		{
			veteranGangplankTile = tile;
			break;
		}
	}
}
 
Example 3
Source File: ObjectIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private boolean objectIdEquals(TileObject tileObject, int id)
{
	if (tileObject == null)
	{
		return false;
	}

	if (tileObject.getId() == id)
	{
		return true;
	}

	// Menu action EXAMINE_OBJECT sends the transformed object id, not the base id, unlike
	// all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids
	final ObjectDefinition comp = client.getObjectDefinition(tileObject.getId());

	if (comp.getImpostorIds() != null)
	{
		for (int impostorId : comp.getImpostorIds())
		{
			if (impostorId == id)
			{
				return true;
			}
		}
	}

	return false;
}
 
Example 4
Source File: HerbiboarMinimapOverlay.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (!config.isTrailShown() || !plugin.isInHerbiboarArea())
	{
		return null;
	}

	TrailToSpot nextTrail = plugin.getNextTrail();
	int finishId = plugin.getFinishId();
	Set<Integer> shownTrailIds = plugin.getShownTrails();

	for (TileObject tileObject : plugin.getTrails().values())
	{
		int id = tileObject.getId();
		Point minimapLocation = tileObject.getMinimapLocation();

		if (minimapLocation == null)
		{
			continue;
		}

		if (shownTrailIds.contains(id) && (finishId > 0 || nextTrail != null && !nextTrail.getFootprintIds().contains(id)))
		{
			OverlayUtil.renderMinimapLocation(graphics, minimapLocation, config.getTrailColor());
		}
	}
	return null;
}
 
Example 5
Source File: RoguesDenPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void onTileObject(final Tile tile, final TileObject oldObject, final TileObject newObject)
{
	obstaclesHull.remove(oldObject);
	if (newObject != null)
	{
		WorldPoint point = tile.getWorldLocation();

		Obstacles.Obstacle obstacle = Obstacles.TILE_MAP.get(point);
		if (obstacle != null && obstacle.getObjectId() == newObject.getId())
		{
			obstaclesHull.put(newObject, tile);
		}
	}
}
 
Example 6
Source File: HerbiboarMinimapOverlay.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public Dimension render(Graphics2D graphics)
{
	if (!config.isTrailShown() || !plugin.isInHerbiboarArea())
	{
		return null;
	}

	TrailToSpot nextTrail = plugin.getNextTrail();
	int finishId = plugin.getFinishId();
	Set<Integer> shownTrailIds = plugin.getShownTrails();

	for (TileObject tileObject : plugin.getTrails().values())
	{
		int id = tileObject.getId();
		Point minimapLocation = tileObject.getMinimapLocation();

		if (minimapLocation == null)
		{
			continue;
		}

		if (shownTrailIds.contains(id) && (finishId > 0 || nextTrail != null && !nextTrail.getFootprintIds().contains(id)))
		{
			OverlayUtil.renderMinimapLocation(graphics, minimapLocation, config.getTrailColor());
		}
	}
	return null;
}
 
Example 7
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private boolean objectIdEquals(TileObject tileObject, int id)
{
	if (tileObject == null)
	{
		return false;
	}

	if (tileObject.getId() == id)
	{
		return true;
	}

	// Menu action EXAMINE_OBJECT sends the transformed object id, not the base id, unlike
	// all of the GAME_OBJECT_OPTION actions, so check the id against the impostor ids
	final ObjectComposition comp = client.getObjectDefinition(tileObject.getId());

	if (comp.getImpostorIds() != null)
	{
		for (int impostorId : comp.getImpostorIds())
		{
			if (impostorId == id)
			{
				return true;
			}
		}
	}

	return false;
}
 
Example 8
Source File: ObjectIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
/**
 * mark or unmark an object
 *
 * @param objectComposition transformed composition of object based on vars
 * @param name              name of objectComposition
 * @param object            tile object, for multilocs object.getId() is the base id
 */
private void markObject(ObjectDefinition objectComposition, String name, final TileObject object)
{
	final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation());
	if (worldPoint == null)
	{
		return;
	}
	final int regionId = worldPoint.getRegionID();

	Color color = config.objectMarkerColor();
	int opacity = (int) floor(config.objectMarkerAlpha() * 2.55);
	Color objectColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), opacity);

	final ObjectPoint point = new ObjectPoint(
		object.getId(),
		name,
		regionId,
		worldPoint.getRegionX(),
		worldPoint.getRegionY(),
		worldPoint.getPlane(),
		objectColor);

	Set<ObjectPoint> objectPoints = points.computeIfAbsent(regionId, k -> new HashSet<>());

	if (objects.removeIf((o) -> o.getTileObject() == object))
	{
		// Find the object point that caused this object to be marked, there are two cases:
		// 1) object is a multiloc, the name may have changed since marking - match from base id
		// 2) not a multiloc, but an object has spawned with an identical name and a different
		//    id as what was originally marked
		if (!objectPoints.removeIf(op -> ((op.getId() == -1 || op.getId() == object.getId()) || op.getName().equals(objectComposition.getName()))
			&& op.getRegionX() == worldPoint.getRegionX()
			&& op.getRegionY() == worldPoint.getRegionY()
			&& op.getZ() == worldPoint.getPlane()))
		{
			log.warn("unable to find object point for unmarked object {}", object.getId());
		}

		log.debug("Unmarking object: {}", point);
	}
	else
	{
		objectPoints.add(point);
		objects.add(new ColorTileObject(object, color));
		log.debug("Marking object: {}", point);
	}

	savePoints(regionId, objectPoints);
}
 
Example 9
Source File: ObjectIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
/** mark or unmark an object
 *
 * @param objectComposition transformed composition of object based on vars
 * @param name name of objectComposition
 * @param object tile object, for multilocs object.getId() is the base id
 */
private void markObject(ObjectComposition objectComposition, String name, final TileObject object)
{
	final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation());
	final int regionId = worldPoint.getRegionID();
	final Color color = config.markerColor();
	final ObjectPoint point = new ObjectPoint(
		object.getId(),
		name,
		regionId,
		worldPoint.getRegionX(),
		worldPoint.getRegionY(),
		worldPoint.getPlane(),
		color);

	Set<ObjectPoint> objectPoints = points.computeIfAbsent(regionId, k -> new HashSet<>());

	if (objects.removeIf(o -> o.getTileObject() == object))
	{
		// Find the object point that caused this object to be marked, there are two cases:
		// 1) object is a multiloc, the name may have changed since marking - match from base id
		// 2) not a multiloc, but an object has spawned with an identical name and a different
		//    id as what was originally marked
		if (!objectPoints.removeIf(op -> ((op.getId() == -1 || op.getId() == object.getId()) || op.getName().equals(objectComposition.getName()))
			&& op.getRegionX() == worldPoint.getRegionX()
			&& op.getRegionY() == worldPoint.getRegionY()
			&& op.getZ() == worldPoint.getPlane()))
		{
			log.warn("unable to find object point for unmarked object {}", object.getId());
		}

		log.debug("Unmarking object: {}", point);
	}
	else
	{
		objectPoints.add(point);
		objects.add(new ColorTileObject(object, color));
		log.debug("Marking object: {}", point);
	}

	savePoints(regionId, objectPoints);
}