Java Code Examples for net.runelite.api.GameObject#getId()
The following examples show how to use
net.runelite.api.GameObject#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: BlastFurnacePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onGameObjectSpawned(GameObjectSpawned event) { GameObject gameObject = event.getGameObject(); switch (gameObject.getId()) { case CONVEYOR_BELT: conveyorBelt = gameObject; break; case BAR_DISPENSER: barDispenser = gameObject; break; } }
Example 2
Source File: BlastFurnacePlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject gameObject = event.getGameObject(); switch (gameObject.getId()) { case CONVEYOR_BELT: conveyorBelt = gameObject; break; case BAR_DISPENSER: barDispenser = gameObject; break; } }
Example 3
Source File: DriftNetPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectDespawned(GameObjectDespawned event) { GameObject object = event.getGameObject(); if (object == annette) { annette = null; } for (DriftNet net : NETS) { if (net.getObjectId() == object.getId()) { net.setNet(null); } } }
Example 4
Source File: DriftNetPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject object = event.getGameObject(); if (object.getId() == ObjectID.ANNETTE) { annette = object; } for (DriftNet net : NETS) { if (net.getObjectId() == object.getId()) { net.setNet(object); } } }
Example 5
Source File: PyramidPlunderPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject object = event.getGameObject(); if (SPEARTRAP_ID == object.getId()) { tilesToHighlight.put(object, event.getTile()); } else if (URN_IDS.contains(object.getId()) || GRAND_GOLD_CHEST_ID == object.getId() || SARCOPHAGUS_ID == object.getId()) { objectsToHighlight.add(object); } }
Example 6
Source File: BlastFurnacePlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe private void onGameObjectDespawned(GameObjectDespawned event) { GameObject gameObject = event.getGameObject(); switch (gameObject.getId()) { case CONVEYOR_BELT: conveyorBelt = null; break; case BAR_DISPENSER: barDispenser = null; break; } }
Example 7
Source File: PyramidPlunderPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject object = event.getGameObject(); if (SPEARTRAP_ID == object.getId()) { tilesToHighlight.put(object, event.getTile()); } else if (URN_IDS.contains(object.getId()) || GRAND_GOLD_CHEST_ID == object.getId() || SARCOPHAGUS_ID == object.getId()) { objectsToHighlight.add(object); } }
Example 8
Source File: BatsLocatorPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject gameObject = event.getGameObject(); switch (gameObject.getId()) { case TROUGH: batsLocator.troughSpawnEvent(gameObject); break; case CLOSED: case OPENED_POISON_OR_BATS: case OPENED_WITHOUT_GRUBS: case OPENED_WITH_GRUBS: batsLocator.chestSpawnEvent(gameObject); break; } }
Example 9
Source File: CannonPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { GameObject gameObject = event.getGameObject(); Player localPlayer = client.getLocalPlayer(); if (gameObject.getId() == CANNON_BASE && !cannonPlaced) { if (localPlayer.getWorldLocation().distanceTo(gameObject.getWorldLocation()) <= 2 && localPlayer.getAnimation() == AnimationID.BURYING_BONES) { cannonPosition = gameObject.getWorldLocation(); cannon = gameObject; } } }
Example 10
Source File: ZalcanoUtil.java From plugins with GNU General Public License v3.0 | 6 votes |
List<GameObject> getRedSymbols() { List<GameObject> list = new ArrayList<>(); for (GameObject gameObject : getGameObjects()) { if (gameObject != null) { if (gameObject.getId() == ObjectID.DEMONIC_SYMBOL) { if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400) { Entity entity = gameObject.getEntity(); if (entity instanceof DynamicObject) { list.add(gameObject); } } } } } return list.size() > 0 ? list : null; }
Example 11
Source File: ZalcanoUtil.java From plugins with GNU General Public License v3.0 | 6 votes |
GameObject getGlowingRock() { for (GameObject gameObject : getGameObjects()) { if (gameObject != null) { if (gameObject.getId() == ObjectID.ROCK_FORMATION_GLOWING) { if (client.getLocalPlayer().getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 2400) { Entity entity = gameObject.getEntity(); if (entity instanceof DynamicObject) { if (((DynamicObject) entity).getAnimationID() == AnimationID.ZALCANO_ROCK_GLOWING) { return gameObject; } } } } } } return null; }
Example 12
Source File: BlastFurnacePlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
@Subscribe public void onGameObjectDespawned(GameObjectDespawned event) { GameObject gameObject = event.getGameObject(); switch (gameObject.getId()) { case CONVEYOR_BELT: conveyorBelt = null; break; case BAR_DISPENSER: barDispenser = null; break; } }
Example 13
Source File: DriftNetPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
@Subscribe public void onGameObjectDespawned(GameObjectDespawned event) { GameObject object = event.getGameObject(); if (object == annette) { annette = null; } for (DriftNet net : NETS) { if (net.getObjectId() == object.getId()) { net.setNet(null); } } }
Example 14
Source File: HunterTrap.java From plugins with GNU General Public License v3.0 | 5 votes |
/** * Constructor for a HunterTrap object * * @param gameObject The gameobject thats corresponds with this trap. */ HunterTrap(final GameObject gameObject) { this.state = State.OPEN; this.placedOn = Instant.now(); this.objectId = gameObject.getId(); this.worldLocation = gameObject.getWorldLocation(); }
Example 15
Source File: HunterTrap.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
/** * Constructor for a HunterTrap object * * @param gameObject The gameobject thats corresponds with this trap. */ HunterTrap(GameObject gameObject) { this.state = State.OPEN; this.placedOn = Instant.now(); this.objectId = gameObject.getId(); this.worldLocation = gameObject.getWorldLocation(); }
Example 16
Source File: ClueScrollPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void highlightObjectsForLocation(final WorldPoint location, final int... objectIds) { final LocalPoint localLocation = LocalPoint.fromWorld(client, location); if (localLocation == null) { return; } final Scene scene = client.getScene(); final Tile[][][] tiles = scene.getTiles(); final Tile tile = tiles[client.getPlane()][localLocation.getSceneX()][localLocation.getSceneY()]; for (GameObject object : tile.getGameObjects()) { if (object == null) { continue; } for (int id : objectIds) { if (object.getId() == id) { objectsToMark.add(object); continue; } // Check impostors final ObjectComposition comp = client.getObjectDefinition(object.getId()); final ObjectComposition impostor = comp.getImpostorIds() != null ? comp.getImpostor() : comp; if (impostor != null && impostor.getId() == id) { objectsToMark.add(object); } } } }
Example 17
Source File: AlchemyRoom.java From plugins with GNU General Public License v3.0 | 4 votes |
private void onGameObjectSpawned(GameObjectSpawned event) { if (!inside()) { return; } GameObject spawn = event.getGameObject(); int cupboardId; switch (spawn.getId()) { // Closed and opened versions of each case CUPBOARD_23678: case CUPBOARD_23679: cupboardId = 0; break; case CUPBOARD_23680: case CUPBOARD_23681: cupboardId = 1; break; case CUPBOARD_23682: case CUPBOARD_23683: cupboardId = 2; break; case CUPBOARD_23684: case CUPBOARD_23685: cupboardId = 3; break; case CUPBOARD_23686: case CUPBOARD_23687: cupboardId = 4; break; case CUPBOARD_23688: case CUPBOARD_23689: cupboardId = 5; break; case CUPBOARD_23690: case CUPBOARD_23691: cupboardId = 6; break; case CUPBOARD_23692: case CUPBOARD_23693: cupboardId = 7; break; default: return; } Cupboard cupboard = cupboards[cupboardId]; if (cupboard != null) { cupboard.gameObject = spawn; } else { cupboard = new Cupboard(); cupboard.gameObject = spawn; cupboard.alchemyItem = AlchemyItem.UNKNOWN; cupboards[cupboardId] = cupboard; } }
Example 18
Source File: HunterPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
/** * Iterates over all the traps that were placed by the local player and * checks if the trap is still there. If the trap is gone, it removes * the trap from the local players trap collection. */ @Subscribe private void onGameTick(GameTick event) { // Check if all traps are still there, and remove the ones that are not. Iterator<Map.Entry<WorldPoint, HunterTrap>> it = traps.entrySet().iterator(); Tile[][][] tiles = client.getScene().getTiles(); Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2)); while (it.hasNext()) { Map.Entry<WorldPoint, HunterTrap> entry = it.next(); HunterTrap trap = entry.getValue(); WorldPoint world = entry.getKey(); LocalPoint local = LocalPoint.fromWorld(client, world); // Not within the client's viewport if (local == null) { // Cull very old traps if (trap.getPlacedOn().isBefore(expire)) { log.debug("Trap removed from personal trap collection due to timeout, {} left", traps.size()); it.remove(); continue; } continue; } Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()]; GameObject[] objects = tile.getGameObjects(); boolean containsBoulder = false; boolean containsAnything = false; boolean containsYoungTree = false; for (GameObject object : objects) { if (object != null) { containsAnything = true; if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER) { containsBoulder = true; break; } // Check for young trees (used while catching salamanders) in the tile. // Otherwise, hunter timers will never disappear after a trap is dismantled if (object.getId() == ObjectID.YOUNG_TREE_8732 || object.getId() == ObjectID.YOUNG_TREE_8990 || object.getId() == ObjectID.YOUNG_TREE_9000 || object.getId() == ObjectID.YOUNG_TREE_9341) { containsYoungTree = true; } } } if (!containsAnything || containsYoungTree) { it.remove(); log.debug("Trap removed from personal trap collection, {} left", traps.size()); } else if (containsBoulder) // For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder) { it.remove(); log.debug("Special trap removed from personal trap collection, {} left", traps.size()); // Case we have notifications enabled and the action was not manual, throw notification if (config.maniacalMonkeyNotify() && trap.getObjectId() == ObjectID.MONKEY_TRAP && !trap.getState().equals(HunterTrap.State.FULL) && !trap.getState().equals(HunterTrap.State.OPEN)) { notifier.notify("The monkey escaped."); } } } lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); }
Example 19
Source File: HunterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
/** * Iterates over all the traps that were placed by the local player and * checks if the trap is still there. If the trap is gone, it removes * the trap from the local players trap collection. */ @Subscribe public void onGameTick(GameTick event) { // Check if all traps are still there, and remove the ones that are not. Iterator<Map.Entry<WorldPoint, HunterTrap>> it = traps.entrySet().iterator(); Tile[][][] tiles = client.getScene().getTiles(); Instant expire = Instant.now().minus(HunterTrap.TRAP_TIME.multipliedBy(2)); while (it.hasNext()) { Map.Entry<WorldPoint, HunterTrap> entry = it.next(); HunterTrap trap = entry.getValue(); WorldPoint world = entry.getKey(); LocalPoint local = LocalPoint.fromWorld(client, world); // Not within the client's viewport if (local == null) { // Cull very old traps if (trap.getPlacedOn().isBefore(expire)) { log.debug("Trap removed from personal trap collection due to timeout, {} left", traps.size()); it.remove(); continue; } continue; } Tile tile = tiles[world.getPlane()][local.getSceneX()][local.getSceneY()]; GameObject[] objects = tile.getGameObjects(); boolean containsBoulder = false; boolean containsAnything = false; boolean containsYoungTree = false; for (GameObject object : objects) { if (object != null) { containsAnything = true; if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER) { containsBoulder = true; break; } // Check for young trees (used while catching salamanders) in the tile. // Otherwise, hunter timers will never disappear after a trap is dismantled if (object.getId() == ObjectID.YOUNG_TREE_8732 || object.getId() == ObjectID.YOUNG_TREE_8990 || object.getId() == ObjectID.YOUNG_TREE_9000 || object.getId() == ObjectID.YOUNG_TREE_9341) { containsYoungTree = true; } } } if (!containsAnything || containsYoungTree) { it.remove(); log.debug("Trap removed from personal trap collection, {} left", traps.size()); } else if (containsBoulder) // For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder) { it.remove(); log.debug("Special trap removed from personal trap collection, {} left", traps.size()); // Case we have notifications enabled and the action was not manual, throw notification if (config.maniacalMonkeyNotify() && trap.getObjectId() == ObjectID.MONKEY_TRAP && !trap.getState().equals(HunterTrap.State.FULL) && !trap.getState().equals(HunterTrap.State.OPEN)) { notifier.notify("The monkey escaped."); } } } lastTickLocalPlayerLocation = client.getLocalPlayer().getWorldLocation(); }
Example 20
Source File: AlchemyRoom.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onGameObjectSpawned(GameObjectSpawned event) { if (!inside()) { return; } GameObject spawn = event.getGameObject(); int cupboardId; switch (spawn.getId()) { // Closed and opened versions of each case CUPBOARD_23678: case CUPBOARD_23679: cupboardId = 0; break; case CUPBOARD_23680: case CUPBOARD_23681: cupboardId = 1; break; case CUPBOARD_23682: case CUPBOARD_23683: cupboardId = 2; break; case CUPBOARD_23684: case CUPBOARD_23685: cupboardId = 3; break; case CUPBOARD_23686: case CUPBOARD_23687: cupboardId = 4; break; case CUPBOARD_23688: case CUPBOARD_23689: cupboardId = 5; break; case CUPBOARD_23690: case CUPBOARD_23691: cupboardId = 6; break; case CUPBOARD_23692: case CUPBOARD_23693: cupboardId = 7; break; default: return; } Cupboard cupboard = cupboards[cupboardId]; if (cupboard != null) { cupboard.gameObject = spawn; } else { cupboard = new Cupboard(); cupboard.gameObject = spawn; cupboard.alchemyItem = AlchemyItem.UNKNOWN; cupboards[cupboardId] = cupboard; } }