net.runelite.api.events.NpcDespawned Java Examples

The following examples show how to use net.runelite.api.events.NpcDespawned. 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: BossTimersPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	int npcId = npc.getId();

	Boss boss = Boss.find(npcId);

	if (boss == null)
	{
		return;
	}

	// remove existing timer
	infoBoxManager.removeIf(t -> t instanceof RespawnTimer && ((RespawnTimer) t).getBoss() == boss);

	RespawnTimer timer = new RespawnTimer(boss, itemManager.getImage(boss.getItemSpriteId()), this);
	timer.setTooltip(npc.getName());
	infoBoxManager.addInfoBox(timer);
}
 
Example #2
Source File: SpecialCounterPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC actor = npcDespawned.getNpc();
	
	// if the NPC despawns before the hitsplat is shown
	if (lastSpecTarget == actor)
	{
		lastSpecTarget = null;
	}


	if (actor.isDead() && interactedNpcIds.contains(actor.getId()))
	{
		removeCounters();
	}
}
 
Example #3
Source File: TimersPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	int npcId = npc.getId();

	if (npcId == NpcID.ZOMBIFIED_SPAWN || npcId == NpcID.ZOMBIFIED_SPAWN_8063)
	{
		removeGameTimer(ICEBARRAGE);
	}
}
 
Example #4
Source File: ClueScrollPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
public void onNpcDespawned(final NpcDespawned event)
{
	final boolean removed = npcsToMark.remove(event.getNpc());

	if (removed)
	{
		if (npcsToMark.isEmpty())
		{
			client.clearHintArrow();
		}
		else
		{
			// Always set hint arrow to first seen NPC
			client.setHintArrow(npcsToMark.get(0));
		}
	}
}
 
Example #5
Source File: XpTrackerPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	for (Skill skill : COMBAT)
	{
		final XpUpdateResult updateResult = xpState.updateNpcKills(skill, npc, npcManager.getHealth(npc.getId()));
		final boolean updated = XpUpdateResult.UPDATED.equals(updateResult);
		xpPanel.updateSkillExperience(updated, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill));
	}

	xpPanel.updateTotal(xpState.getTotalSnapshot());
}
 
Example #6
Source File: XpTrackerPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	for (Skill skill : COMBAT)
	{
		final XpUpdateResult updateResult = xpState.updateNpcKills(skill, npc, npcManager.getHealth(npc.getId()));
		final boolean updated = XpUpdateResult.UPDATED.equals(updateResult);
		xpPanel.updateSkillExperience(updated, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill));
	}

	xpPanel.updateTotal(xpState.getTotalSnapshot());
}
 
Example #7
Source File: TimersPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	int npcId = npc.getId();

	if (npcId == NpcID.ZOMBIFIED_SPAWN || npcId == NpcID.ZOMBIFIED_SPAWN_8063)
	{
		removeGameTimer(ICEBARRAGE);
	}
}
 
Example #8
Source File: ClueScrollPlugin.java    From runelite with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Subscribe
public void onNpcDespawned(final NpcDespawned event)
{
	final boolean removed = npcsToMark.remove(event.getNpc());

	if (removed)
	{
		if (npcsToMark.isEmpty())
		{
			client.clearHintArrow();
		}
		else
		{
			// Always set hint arrow to first seen NPC
			client.setHintArrow(npcsToMark.get(0));
		}
	}
}
 
Example #9
Source File: NpcIndicatorsPlugin.java    From plugins with GNU General Public License v3.0 6 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	final NPC npc = npcDespawned.getNpc();

	if (memorizedNpcs.containsKey(npc.getIndex()))
	{
		despawnedNpcsThisTick.add(npc);
		MemorizedNpc mn = memorizedNpcs.get(npc.getIndex());

		if (!mn.getPossibleRespawnLocations().isEmpty())
		{
			pendingNotificationNpcs.add(mn);
		}
	}

	highlightedNpcs.remove(npc);
}
 
Example #10
Source File: RunecraftPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();
	if (npc == darkMage)
	{
		darkMage = null;
	}
}
 
Example #11
Source File: BasicBossSwapper.java    From ExternalPlugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();

	if (npc.getId() == NpcID.NYLOCAS_VASILIAS)
	{
		nylo = null;
	}
}
 
Example #12
Source File: DriftNetPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();
	fish.remove(npc);
	taggedFish.remove(npc);
}
 
Example #13
Source File: SpecialCounterPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC actor = npcDespawned.getNpc();

	if (lastSpecTarget == actor)
	{
		lastSpecTarget = null;
	}

	if (actor.isDead() && interactedNpcIds.contains(actor.getId()))
	{
		removeCounters();
	}
}
 
Example #14
Source File: TelekineticRoom.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	NPC npc = event.getNpc();

	if (npc == guardian)
	{
		guardian = null;
	}
}
 
Example #15
Source File: CorpPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (npc == corp)
	{
		log.debug("Corporeal beast despawn: {}", npc);
		corp = null;
		players.clear();

		if (npc.isDead())
		{
			// Show kill stats
			String message = new ChatMessageBuilder()
				.append(ChatColorType.NORMAL)
				.append("Corporeal Beast: Your damage: ")
				.append(ChatColorType.HIGHLIGHT)
				.append(Integer.toString(yourDamage))
				.append(ChatColorType.NORMAL)
				.append(", Total damage: ")
				.append(ChatColorType.HIGHLIGHT)
				.append(Integer.toString(totalDamage))
				.build();

			chatMessageManager.queue(QueuedMessage.builder()
				.type(ChatMessageType.CONSOLE)
				.runeLiteFormattedMessage(message)
				.build());
		}
	}
	else if (npc == core)
	{
		core = null;
	}
}
 
Example #16
Source File: FishingPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	final NPC npc = npcDespawned.getNpc();

	fishingSpots.remove(npc);

	MinnowSpot minnowSpot = minnowSpots.remove(npc.getIndex());
	if (minnowSpot != null)
	{
		log.debug("Minnow spot {} despawned", npc);
	}
}
 
Example #17
Source File: NpcIndicatorsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	final NPC npc = npcDespawned.getNpc();

	if (memorizedNpcs.containsKey(npc.getIndex()))
	{
		despawnedNpcsThisTick.add(npc);
	}

	highlightedNpcs.remove(npc);
}
 
Example #18
Source File: ImplingsPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	if (implings.isEmpty())
	{
		return;
	}

	NPC npc = npcDespawned.getNpc();
	implings.remove(npc);
}
 
Example #19
Source File: RandomEventPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (npc == currentRandomEvent)
	{
		currentRandomEvent = null;
	}
}
 
Example #20
Source File: DpsCounterPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (npc.isDead() && BOSSES.contains(npc.getId()))
	{
		log.debug("Boss has died!");

		if (dpsConfig.autopause())
		{
			pause();
		}
	}
}
 
Example #21
Source File: FishingPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	final NPC npc = npcDespawned.getNpc();

	fishingSpots.remove(npc);

	MinnowSpot minnowSpot = minnowSpots.remove(npc.getIndex());
	if (minnowSpot != null)
	{
		log.debug("Minnow spot {} despawned", npc);
	}
}
 
Example #22
Source File: BossTimersPlugin.java    From runelite with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (!npc.isDead())
	{
		return;
	}

	int npcId = npc.getId();

	Boss boss = Boss.find(npcId);

	if (boss == null)
	{
		return;
	}

	// remove existing timer
	infoBoxManager.removeIf(t -> t instanceof RespawnTimer && ((RespawnTimer) t).getBoss() == boss);

	log.debug("Creating spawn timer for {} ({} seconds)", npc.getName(), boss.getSpawnTime());

	RespawnTimer timer = new RespawnTimer(boss, itemManager.getImage(boss.getItemSpriteId()), this);
	timer.setTooltip(npc.getName());
	infoBoxManager.addInfoBox(timer);
}
 
Example #23
Source File: RunecraftPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();

	if (npc != null && npc == darkMage)
	{
		darkMage = null;
	}
}
 
Example #24
Source File: SlayerPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();
	boolean contained = highlightedTargets.remove(npc);
	if (contained)
	{
		NPCPresence lingeringPresence = NPCPresence.buildPresence(npc);
		lingeringPresences.add(lingeringPresence);
	}
}
 
Example #25
Source File: BarbarianAssaultPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned event)
{
	if (!isInGame())
	{
		return;
	}

	healers.remove(event.getNpc().getIndex());
}
 
Example #26
Source File: ZalcanoPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	switch (npcDespawned.getNpc().getId())
	{
		case NpcID.ZALCANO:
			zalcano = null;
			break;
		case NpcID.GOLEM_9051:
			golem = null;
			break;
	}
}
 
Example #27
Source File: SpawnTimerPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned n)
{
	final NPC npc = n.getNpc();
	if (highlightedNpcs.contains(npc))
	{
		highlightedNpcs.remove(npc);
		//currentTick = 0;
		ticks.removeIf(t -> t.getNpc() == npc);
	}
}
 
Example #28
Source File: TelekineticRoom.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void addSubscriptions()
{
	eventBus.subscribe(GameTick.class, this, this::onGameTick);
	eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
	eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
	eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned);
	eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
	eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
}
 
Example #29
Source File: TelekineticRoom.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
private void onNpcDespawned(NpcDespawned event)
{
	NPC npc = event.getNpc();

	if (npc == guardian)
	{
		guardian = null;
	}
}
 
Example #30
Source File: CorpPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();

	if (npc == corp)
	{
		log.debug("Corporeal beast despawn: {}", npc);
		corp = null;
		players.clear();

		if (npc.isDead())
		{
			// Show kill stats
			String message = new ChatMessageBuilder()
				.append(ChatColorType.NORMAL)
				.append("Corporeal Beast: Your damage: ")
				.append(ChatColorType.HIGHLIGHT)
				.append(Integer.toString(yourDamage))
				.append(ChatColorType.NORMAL)
				.append(", Total damage: ")
				.append(ChatColorType.HIGHLIGHT)
				.append(Integer.toString(totalDamage))
				.build();

			chatMessageManager.queue(QueuedMessage.builder()
				.type(ChatMessageType.CONSOLE)
				.runeLiteFormattedMessage(message)
				.build());
		}
	}
	else if (npc == core)
	{
		core = null;
	}
}