net.runelite.api.TileObject Java Examples
The following examples show how to use
net.runelite.api.TileObject.
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: HerbiboarOverlay.java From plugins with GNU General Public License v3.0 | 6 votes |
private void drawObjectLocation(Graphics2D graphics, TileObject object, Color color) { if (object == null) { return; } if (config.showClickBoxes()) { Shape clickbox = object.getClickbox(); if (clickbox != null) { Color clickBoxColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 20); graphics.setColor(color); graphics.draw(clickbox); graphics.setColor(clickBoxColor); graphics.fill(clickbox); } } else { OverlayUtil.renderTileOverlay(graphics, object, "", color); } }
Example #2
Source File: ExtUtils.java From ExternalPlugins with GNU General Public License v3.0 | 6 votes |
@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 #3
Source File: OverlayUtil.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
public static void renderTileOverlay(Graphics2D graphics, TileObject tileObject, String text, Color color) { Polygon poly = tileObject.getCanvasTilePoly(); if (poly != null) { renderPolygon(graphics, poly, color); } Point minimapLocation = tileObject.getMinimapLocation(); if (minimapLocation != null) { renderMinimapLocation(graphics, minimapLocation, color); } Point textLocation = tileObject.getCanvasTextLocation(graphics, text, 0); if (textLocation != null) { renderTextLocation(graphics, textLocation, text, color); } }
Example #4
Source File: HerbiboarOverlay.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void drawObjectLocation(Graphics2D graphics, TileObject object, Color color) { if (object == null) { return; } if (config.showClickBoxes()) { Shape clickbox = object.getClickbox(); if (clickbox != null) { Color clickBoxColor = new Color(color.getRed(), color.getGreen(), color.getBlue(), 20); graphics.setColor(color); graphics.draw(clickbox); graphics.setColor(clickBoxColor); graphics.fill(clickbox); } } else { OverlayUtil.renderTileOverlay(graphics, object, "", color); } }
Example #5
Source File: ObjectIndicatorsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void checkObjectPoints(TileObject object) { final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID()); if (objectPoints == null) { return; } for (ObjectPoint objectPoint : objectPoints) { if (worldPoint.getRegionX() == objectPoint.getRegionX() && worldPoint.getRegionY() == objectPoint.getRegionY() && worldPoint.getPlane() == objectPoint.getZ()) { // Transform object to get the name which matches against what we've stored ObjectComposition composition = getObjectComposition(object.getId()); if (composition != null && objectPoint.getName().equals(composition.getName())) { log.debug("Marking object {} due to matching {}", object, objectPoint); objects.add(new ColorTileObject(object, objectPoint.getColor())); break; } } } }
Example #6
Source File: RoguesDenPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
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 #7
Source File: HerbiboarMinimapOverlay.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@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 #8
Source File: ObjectIndicatorsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { if (event.getType() != MenuAction.EXAMINE_OBJECT.getId() || !client.isKeyPressed(KeyCode.KC_SHIFT)) { return; } final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()]; final TileObject tileObject = findTileObject(tile, event.getIdentifier()); if (tileObject == null) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); menuEntry.setOption(objects.stream().anyMatch(o -> o.getTileObject() == tileObject) ? UNMARK : MARK); menuEntry.setTarget(event.getTarget()); menuEntry.setParam0(event.getActionParam0()); menuEntry.setParam1(event.getActionParam1()); menuEntry.setIdentifier(event.getIdentifier()); menuEntry.setType(MenuAction.RUNELITE.getId()); client.setMenuEntries(menuEntries); }
Example #9
Source File: ObjectIndicatorsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onMenuOptionClicked(MenuOptionClicked event) { if (event.getMenuAction() != MenuAction.RUNELITE || !(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK))) { return; } Scene scene = client.getScene(); Tile[][][] tiles = scene.getTiles(); final int x = event.getActionParam(); final int y = event.getWidgetId(); final int z = client.getPlane(); final Tile tile = tiles[z][x][y]; TileObject object = findTileObject(tile, event.getId()); if (object == null) { return; } // object.getId() is always the base object id, getObjectComposition transforms it to // the correct object we see ObjectComposition objectDefinition = getObjectComposition(object.getId()); String name = objectDefinition.getName(); // Name is probably never "null" - however prevent adding it if it is, as it will // become ambiguous as objects with no name are assigned name "null" if (Strings.isNullOrEmpty(name) || name.equals("null")) { return; } markObject(objectDefinition, name, object); }
Example #10
Source File: RoguesDenPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject) { obstaclesHull.remove(oldObject); if (newObject != null && Obstacles.OBSTACLE_IDS_HULL.contains(newObject.getId())) { obstaclesHull.put(newObject, tile); } obstaclesTile.remove(oldObject); if (newObject != null && Obstacles.OBSTACLE_IDS_TILE.contains(newObject.getId())) { obstaclesTile.put(newObject, tile); } }
Example #11
Source File: ObjectIndicatorsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
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 #12
Source File: ObjectIndicatorsPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
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 #13
Source File: ClueScrollPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
/** * Checks passed objects against the active clue's object names and regions. If the clue is a * {@link NamedObjectClueScroll} and the object matches its allowable object names and is within its regions, the * object will be stored in the cache of discovered named objects. * * @param clue The active clue scroll * @param object The spawned or scanned object */ private void checkClueNamedObject(@Nullable final ClueScroll clue, @Nonnull final TileObject object) { if (!(clue instanceof NamedObjectClueScroll)) { return; } final NamedObjectClueScroll namedObjectClue = (NamedObjectClueScroll) clue; final String[] objectNames = namedObjectClue.getObjectNames(); final int[] regionIds = namedObjectClue.getObjectRegions(); if (objectNames == null || objectNames.length == 0 || regionIds != null && !ArrayUtils.contains(regionIds, object.getWorldLocation().getRegionID())) { return; } final ObjectComposition comp = client.getObjectDefinition(object.getId()); final ObjectComposition impostor = comp.getImpostorIds() != null ? comp.getImpostor() : comp; for (final String name : objectNames) { if (comp.getName().equals(name) || impostor.getName().equals(name)) { namedObjectsToMark.add(object); } } }
Example #14
Source File: CrypticClue.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { // Mark dig location if (getLocation() != null && getNpc() == null && objectId == -1) { LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); if (localLocation != null) { OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); } } // Mark NPC if (plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); if (plugin.getObjectsToMark() != null) { for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } } }
Example #15
Source File: MapClue.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); if (localLocation == null) { return; } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); if (plugin.getObjectsToMark() != null) { for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } } // Mark tile else { OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); } }
Example #16
Source File: AnagramClue.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { if (!getLocation().isInScene(plugin.getClient())) { return; } // Mark NPC if (objectId == -1 && plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } }
Example #17
Source File: SkillChallengeClue.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { // Mark NPC if (plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark objects if (!challengeCompleted && objectNames.length > 0 && plugin.getNamedObjectsToMark() != null) { final Point mousePosition = plugin.getClient().getMouseCanvasPosition(); for (final TileObject object : plugin.getNamedObjectsToMark()) { if (plugin.getClient().getPlane() != object.getPlane()) { continue; } OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, object.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } }
Example #18
Source File: PestControlPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
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 #19
Source File: MapClue.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); if (localLocation == null) { return; } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); if (plugin.getObjectsToMark() != null) { for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } } // Mark tile else { OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); } }
Example #20
Source File: PestControlPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
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 #21
Source File: ClueScrollPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
/** * Checks passed objects against the active clue's object names and regions. If the clue is a * {@link NamedObjectClueScroll} and the object matches its allowable object names and is within its regions, the * object will be stored in the cache of discovered named objects. * * @param clue The active clue scroll * @param object The spawned or scanned object */ private void checkClueNamedObject(@Nullable final ClueScroll clue, @Nonnull final TileObject object) { if (!(clue instanceof NamedObjectClueScroll)) { return; } final NamedObjectClueScroll namedObjectClue = (NamedObjectClueScroll) clue; final String[] objectNames = namedObjectClue.getObjectNames(); final int[] regionIds = namedObjectClue.getObjectRegions(); if (objectNames == null || objectNames.length == 0 || regionIds != null && !ArrayUtils.contains(regionIds, object.getWorldLocation().getRegionID())) { return; } final ObjectDefinition comp = client.getObjectDefinition(object.getId()); final ObjectDefinition impostor = comp.getImpostorIds() != null ? comp.getImpostor() : comp; for (final String name : objectNames) { if (comp.getName().equals(name) || impostor.getName().equals(name)) { namedObjectsToMark.add(object); } } }
Example #22
Source File: CrypticClue.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { // Mark dig location if (getLocation() != null && getNpc() == null && objectId == -1) { LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation()); if (localLocation != null) { OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getSpadeImage(), Color.ORANGE); } } // Mark NPC if (plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); if (plugin.getObjectsToMark() != null) { for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } } }
Example #23
Source File: HerbiboarMinimapOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
@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 #24
Source File: AnagramClue.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { if (!getLocation().isInScene(plugin.getClient())) { return; } // Mark NPC if (objectId == -1 && plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark game object if (objectId != -1) { net.runelite.api.Point mousePosition = plugin.getClient().getMouseCanvasPosition(); for (TileObject gameObject : plugin.getObjectsToMark()) { OverlayUtil.renderHoverableArea(graphics, gameObject.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, gameObject.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } }
Example #25
Source File: SkillChallengeClue.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin) { // Mark NPC if (plugin.getNpcsToMark() != null) { for (NPC npc : plugin.getNpcsToMark()) { OverlayUtil.renderActorOverlayImage(graphics, npc, plugin.getClueScrollImage(), Color.ORANGE, IMAGE_Z_OFFSET); } } // Mark objects if (!challengeCompleted && objectNames.length > 0 && plugin.getNamedObjectsToMark() != null) { final Point mousePosition = plugin.getClient().getMouseCanvasPosition(); for (final TileObject object : plugin.getNamedObjectsToMark()) { if (plugin.getClient().getPlane() != object.getPlane()) { continue; } OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), mousePosition, CLICKBOX_FILL_COLOR, CLICKBOX_BORDER_COLOR, CLICKBOX_HOVER_BORDER_COLOR); OverlayUtil.renderImageLocation(plugin.getClient(), graphics, object.getLocalLocation(), plugin.getClueScrollImage(), IMAGE_Z_OFFSET); } } }
Example #26
Source File: ObjectIndicatorsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onMenuEntryAdded(MenuEntryAdded event) { if (event.getOpcode() != MenuOpcode.EXAMINE_OBJECT.getId() || !client.isKeyPressed(KeyCode.KC_SHIFT)) { return; } final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getParam0()][event.getParam1()]; final TileObject tileObject = findTileObject(tile, event.getIdentifier()); if (tileObject == null) { return; } MenuEntry[] menuEntries = client.getMenuEntries(); menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); menuEntry.setOption(objects.stream().anyMatch(o -> o.getTileObject() == tileObject) ? UNMARK : MARK); menuEntry.setTarget(event.getTarget()); menuEntry.setParam0(event.getParam0()); menuEntry.setParam1(event.getParam1()); menuEntry.setIdentifier(event.getIdentifier()); menuEntry.setOpcode(MenuOpcode.RUNELITE.getId()); client.setMenuEntries(menuEntries); }
Example #27
Source File: ObjectIndicatorsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onMenuOptionClicked(MenuOptionClicked event) { if (event.getMenuOpcode() != MenuOpcode.RUNELITE || !(event.getOption().equals(MARK) || event.getOption().equals(UNMARK))) { return; } Scene scene = client.getScene(); Tile[][][] tiles = scene.getTiles(); final int x = event.getParam0(); final int y = event.getParam1(); final int z = client.getPlane(); final Tile tile = tiles[z][x][y]; TileObject object = findTileObject(tile, event.getIdentifier()); if (object == null) { return; } // object.getId() is always the base object id, getObjectDefinition transforms it to // the correct object we see ObjectDefinition objectDefinition = getObjectDefinition(object.getId()); String name = objectDefinition.getName(); // Name is probably never "null" - however prevent adding it if it is, as it will // become ambiguous as objects with no name are assigned name "null" if (Strings.isNullOrEmpty(name) || name.equals("null")) { return; } markObject(objectDefinition, name, object); }
Example #28
Source File: ObjectIndicatorsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
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 #29
Source File: ObjectIndicatorsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private void checkObjectPoints(TileObject object) { final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, object.getLocalLocation()); if (worldPoint == null) { return; } final Set<ObjectPoint> objectPoints = points.get(worldPoint.getRegionID()); if (objectPoints == null) { return; } for (ObjectPoint objectPoint : objectPoints) { if (worldPoint.getRegionX() == objectPoint.getRegionX() && worldPoint.getRegionY() == objectPoint.getRegionY() && worldPoint.getPlane() == objectPoint.getZ()) { // Transform object to get the name which matches against what we've stored ObjectDefinition objectDefinition = getObjectDefinition(object.getId()); if (objectDefinition != null && objectPoint.getName().equals(objectDefinition.getName())) { log.debug("Marking object {} due to matching {}", object, objectPoint); objects.add(new ColorTileObject(object, objectPoint.getColor())); break; } } } }
Example #30
Source File: ObjectIndicatorsPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
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; }