use of net.runelite.api.GameObject in project runelite by runelite.
the class MotherlodePlugin method onGameObjectDespawned.
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event) {
GameObject gameObject = event.getGameObject();
rocks.remove(gameObject);
}
use of net.runelite.api.GameObject in project runelite by runelite.
the class PohPlugin method onGameObjectDespawned.
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event) {
GameObject gameObject = event.getGameObject();
pohObjects.remove(gameObject);
}
use of net.runelite.api.GameObject in project runelite by runelite.
the class BarrowsPlugin method onGameObjectDespawned.
@Subscribe
public void onGameObjectDespawned(GameObjectDespawned event) {
GameObject gameObject = event.getGameObject();
ladders.remove(gameObject);
}
use of net.runelite.api.GameObject in project runelite by runelite.
the class BarrowsPlugin method onGameObjectChanged.
@Subscribe
public void onGameObjectChanged(GameObjectChanged event) {
GameObject previous = event.getPrevious();
GameObject gameObject = event.getGameObject();
ladders.remove(previous);
if (BARROWS_LADDERS.contains(gameObject.getId())) {
ladders.add(gameObject);
}
}
use of net.runelite.api.GameObject in project runelite by runelite.
the class HunterPlugin method onGameTick.
/**
* 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.getRegion().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.getRegionX()][local.getRegionY()];
GameObject[] objects = tile.getGameObjects();
boolean containsBoulder = false;
boolean containsAnything = false;
for (GameObject object : objects) {
if (object != null) {
containsAnything = true;
if (object.getId() == ObjectID.BOULDER_19215 || object.getId() == ObjectID.LARGE_BOULDER) {
containsBoulder = true;
break;
}
}
}
if (!containsAnything) {
it.remove();
log.debug("Trap removed from personal trap collection, {} left", traps.size());
} else if (// For traps like deadfalls. This is different because when the trap is gone, there is still a GameObject (boulder)
containsBoulder) {
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.");
}
}
}
}
Aggregations