Java Code Examples for net.runelite.api.events.NpcDespawned#getNpc()

The following examples show how to use net.runelite.api.events.NpcDespawned#getNpc() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
Source File: DpsCounterPlugin.java    From plugins with GNU General Public License v3.0 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 11
Source File: RandomEventPlugin.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 == currentRandomEvent)
	{
		currentRandomEvent = null;
	}
}
 
Example 12
Source File: ImplingsPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	if (implings.isEmpty())
	{
		return;
	}

	NPC npc = npcDespawned.getNpc();
	implings.remove(npc);

}
 
Example 13
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 14
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 15
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;
	}
}
 
Example 16
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 17
Source File: DriftNetPlugin.java    From plugins with GNU General Public License v3.0 5 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned event)
{
	final NPC npc = event.getNpc();
	fish.remove(npc);
	taggedFish.remove(npc);
}
 
Example 18
Source File: AgilityPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();
	npcs.remove(npc);
}
 
Example 19
Source File: NpcStatusPlugin.java    From plugins with GNU General Public License v3.0 4 votes vote down vote up
@Subscribe
private void onNpcDespawned(NpcDespawned npcDespawned)
{
	final NPC npc = npcDespawned.getNpc();
	memorizedNPCs.removeIf(c -> c.getNpc() == npc);
}
 
Example 20
Source File: SlayerPlugin.java    From runelite with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Subscribe
public void onNpcDespawned(NpcDespawned npcDespawned)
{
	NPC npc = npcDespawned.getNpc();
	highlightedTargets.remove(npc);
}