Java Code Examples for net.runelite.api.Player#getInteracting()
The following examples show how to use
net.runelite.api.Player#getInteracting() .
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: IdleNotifierPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private void resetTimers() { final Player local = client.getLocalPlayer(); // Reset animation idle timer lastAnimating = null; if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getAnimation() != lastAnimation) { lastAnimation = IDLE; } // Reset interaction idle timer lastInteracting = null; if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getInteracting() != lastInteract) { lastInteract = null; } }
Example 2
Source File: IdleNotifierPlugin.java From runelite with BSD 2-Clause "Simplified" License | 6 votes |
private void resetTimers() { final Player local = client.getLocalPlayer(); // Reset animation idle timer lastAnimating = null; if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getAnimation() != lastAnimation) { lastAnimation = IDLE; } // Reset interaction idle timer lastInteracting = null; if (client.getGameState() == GameState.LOGIN_SCREEN || local == null || local.getInteracting() != lastInteract) { lastInteract = null; } }
Example 3
Source File: SceneOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
private void renderValidMovement(Graphics2D graphics) { Player player = client.getLocalPlayer(); List<NPC> npcs = client.getNpcs(); for (NPC npc : npcs) { if (player.getInteracting() != npc && npc.getInteracting() != player) { continue; } for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (dx == 0 && dy == 0) { continue; } renderTileIfValidForMovement(graphics, npc, dx, dy); } } } for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (dx == 0 && dy == 0) { continue; } renderTileIfValidForMovement(graphics, player, dx, dy); } } }
Example 4
Source File: IdleNotifierPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean checkInteractionIdle(Duration waitDuration, Player local) { if (lastInteract == null) { return false; } final Actor interact = local.getInteracting(); if (interact == null) { if (lastInteracting != null && Instant.now().compareTo(lastInteracting.plus(waitDuration)) >= 0 && lastCombatCountdown == 0) { lastInteract = null; lastInteracting = null; // prevent animation notifications from firing too lastAnimation = IDLE; lastAnimating = null; return true; } } else { lastInteracting = Instant.now(); } return false; }
Example 5
Source File: RandomEventPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
@Subscribe private void onInteractingChanged(InteractingChanged event) { Actor source = event.getSource(); Actor target = event.getTarget(); Player player = client.getLocalPlayer(); // Check that the npc is interacting with the player and the player isn't interacting with the npc, so // that the notification doesn't fire from talking to other user's randoms if (player == null || target != player || player.getInteracting() == source || !(source instanceof NPC) || !EVENT_NPCS.contains(((NPC) source).getId())) { return; } log.debug("Random event spawn: {}", source.getName()); currentRandomEvent = (NPC) source; if (client.getTickCount() - lastNotificationTick > RANDOM_EVENT_TIMEOUT) { lastNotificationTick = client.getTickCount(); if (shouldNotify(currentRandomEvent.getId())) { notifier.notify("Random event spawned: " + currentRandomEvent.getName()); } } }
Example 6
Source File: SceneOverlay.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private void renderValidMovement(Graphics2D graphics) { Player player = client.getLocalPlayer(); List<NPC> npcs = client.getNpcs(); for (NPC npc : npcs) { if (player.getInteracting() != npc && npc.getInteracting() != player) { continue; } for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (dx == 0 && dy == 0) { continue; } renderTileIfValidForMovement(graphics, npc, dx, dy); } } } for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { if (dx == 0 && dy == 0) { continue; } renderTileIfValidForMovement(graphics, player, dx, dy); } } }
Example 7
Source File: IdleNotifierPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean checkInteractionIdle(Duration waitDuration, Player local) { if (lastInteract == null) { return false; } final Actor interact = local.getInteracting(); if (interact == null) { if (lastInteracting != null && Instant.now().compareTo(lastInteracting.plus(waitDuration)) >= 0 && lastCombatCountdown == 0) { lastInteract = null; lastInteracting = null; // prevent animation notifications from firing too lastAnimation = IDLE; lastAnimating = null; return true; } } else { lastInteracting = Instant.now(); } return false; }
Example 8
Source File: RandomEventPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onInteractingChanged(InteractingChanged event) { Actor source = event.getSource(); Actor target = event.getTarget(); Player player = client.getLocalPlayer(); // Check that the npc is interacting with the player and the player isn't interacting with the npc, so // that the notification doesn't fire from talking to other user's randoms if (player == null || target != player || player.getInteracting() == source || !(source instanceof NPC) || !EVENT_NPCS.contains(((NPC) source).getId())) { return; } log.debug("Random event spawn: {}", source.getName()); currentRandomEvent = (NPC) source; if (client.getTickCount() - lastNotificationTick > RANDOM_EVENT_TIMEOUT) { lastNotificationTick = client.getTickCount(); if (shouldNotify(currentRandomEvent.getId())) { notifier.notify("Random event spawned: " + currentRandomEvent.getName()); } } }
Example 9
Source File: DpsCounterPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe public void onHitsplatApplied(HitsplatApplied hitsplatApplied) { Player player = client.getLocalPlayer(); Actor actor = hitsplatApplied.getActor(); if (!(actor instanceof NPC)) { return; } Hitsplat hitsplat = hitsplatApplied.getHitsplat(); if (hitsplat.isMine()) { int hit = hitsplat.getAmount(); // Update local member PartyMember localMember = partyService.getLocalMember(); // If not in a party, user local player name final String name = localMember == null ? player.getName() : localMember.getName(); DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); dpsMember.addDamage(hit); // broadcast damage if (localMember != null) { final DpsUpdate specialCounterUpdate = new DpsUpdate(hit); specialCounterUpdate.setMemberId(localMember.getMemberId()); wsClient.send(specialCounterUpdate); } // apply to total } else if (hitsplat.isOthers()) { final int npcId = ((NPC) actor).getId(); boolean isBoss = BOSSES.contains(npcId); if (actor != player.getInteracting() && !isBoss) { // only track damage to npcs we are attacking, or is a nearby common boss return; } // apply to total } else { return; } unpause(); total.addDamage(hitsplat.getAmount()); }
Example 10
Source File: DpsCounterPlugin.java From runelite with BSD 2-Clause "Simplified" License | 4 votes |
@Subscribe public void onHitsplatApplied(HitsplatApplied hitsplatApplied) { Player player = client.getLocalPlayer(); Actor actor = hitsplatApplied.getActor(); if (!(actor instanceof NPC)) { return; } Hitsplat hitsplat = hitsplatApplied.getHitsplat(); if (hitsplat.isMine()) { int hit = hitsplat.getAmount(); // Update local member PartyMember localMember = partyService.getLocalMember(); // If not in a party, user local player name final String name = localMember == null ? player.getName() : localMember.getName(); DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); dpsMember.addDamage(hit); // broadcast damage if (localMember != null) { final DpsUpdate specialCounterUpdate = new DpsUpdate(hit); specialCounterUpdate.setMemberId(localMember.getMemberId()); wsClient.send(specialCounterUpdate); } // apply to total } else if (hitsplat.isOthers()) { final int npcId = ((NPC) actor).getId(); boolean isBoss = BOSSES.contains(npcId); if (actor != player.getInteracting() && !isBoss) { // only track damage to npcs we are attacking, or is a nearby common boss return; } // apply to total } else { return; } unpause(); total.addDamage(hitsplat.getAmount()); }