Java Code Examples for net.runelite.api.Player#getWorldLocation()
The following examples show how to use
net.runelite.api.Player#getWorldLocation() .
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: StealingArtefactsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private boolean isPlayerInStealingArtefactsRegion() { Player player = client.getLocalPlayer(); if (player == null) { return false; } WorldPoint worldPoint = player.getWorldLocation(); if (worldPoint == null) { return false; } return REGION_IDS.contains(worldPoint.getRegionID()); }
Example 2
Source File: StealingArtefactsPlugin.java From plugins with GNU General Public License v3.0 | 6 votes |
private boolean isPlayerInRegion(int regionId) { Player player = client.getLocalPlayer(); if (player == null) { return false; } WorldPoint worldPoint = player.getWorldLocation(); if (worldPoint == null) { return false; } return worldPoint.getRegionID() == regionId; }
Example 3
Source File: KourendLibraryTutorialOverlay.java From plugins with GNU General Public License v3.0 | 5 votes |
@Override public Dimension render(Graphics2D graphics) { if (!config.showTutorialOverlay()) { return null; } Player player = client.getLocalPlayer(); if (player == null) { return null; } WorldPoint playerLoc = player.getWorldLocation(); if (playerLoc.getRegionID() != KourendLibraryPlugin.REGION) { return null; } switch (library.getState()) { case NO_DATA: panelComponent.getChildren().add(noDataMessageComponent); break; case INCOMPLETE: panelComponent.getChildren().add(incompleteMessageComponent); panelComponent.getChildren().add(sidebarMessageComponent); break; case COMPLETE: panelComponent.getChildren().add(completeMessageComponent); panelComponent.getChildren().add(sidebarMessageComponent); break; } return super.render(graphics); }
Example 4
Source File: IdleNotifierPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean checkMovementIdle(Duration waitDuration, Player local) { if (lastPosition == null) { lastPosition = local.getWorldLocation(); return false; } WorldPoint position = local.getWorldLocation(); if (lastPosition.equals(position)) { if (notifyPosition && local.getAnimation() == IDLE && Instant.now().compareTo(lastMoving.plus(waitDuration)) >= 0) { notifyPosition = false; // Return true only if we weren't just breaking out of an animation return lastAnimation == IDLE; } } else { notifyPosition = true; lastPosition = position; lastMoving = Instant.now(); } return false; }
Example 5
Source File: CombatCounter.java From plugins with GNU General Public License v3.0 | 5 votes |
private int calculateDistance(Player p, NPC npc) { int size = 1; NPCDefinition comp = npc.getTransformedDefinition(); if (comp != null) { size = comp.getSize(); } WorldPoint wpPlayer = p.getWorldLocation(); WorldPoint wpNPC = npc.getWorldLocation(); int distance = wpNPC.distanceTo(wpPlayer); if (size > 1) { for (int x = 0; x < size; x++) { for (int y = 0; y < size; y++) { WorldPoint wpNPCB = WorldPoint.fromRegion(wpNPC.getRegionID(), wpNPC.getRegionX() + x, wpNPC.getRegionY() + y, wpNPC.getPlane()); int distB = wpNPCB.distanceTo(wpPlayer); if (distB >= 1 && distB < distance) { distance = distB; } } } } return distance; }
Example 6
Source File: AgilityPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean isInAgilityArena() { Player local = client.getLocalPlayer(); if (local == null) { return false; } WorldPoint location = local.getWorldLocation(); return location.getRegionID() == AGILITY_ARENA_REGION_ID; }
Example 7
Source File: MenuEntrySwapperPlugin.java From plugins with GNU General Public License v3.0 | 5 votes |
private boolean isPuroPuro() { Player player = client.getLocalPlayer(); if (player == null) { return false; } else { WorldPoint location = player.getWorldLocation(); return location.getRegionID() == PURO_PURO_REGION_ID; } }
Example 8
Source File: KourendLibraryTutorialOverlay.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Override public Dimension render(Graphics2D graphics) { if (!config.showTutorialOverlay()) { return null; } Player player = client.getLocalPlayer(); if (player == null) { return null; } WorldPoint playerLoc = player.getWorldLocation(); if (playerLoc.getRegionID() != KourendLibraryPlugin.REGION) { return null; } switch (library.getState()) { case NO_DATA: panelComponent.getChildren().add(noDataMessageComponent); break; case INCOMPLETE: panelComponent.getChildren().add(incompleteMessageComponent); panelComponent.getChildren().add(sidebarMessageComponent); break; case COMPLETE: panelComponent.getChildren().add(completeMessageComponent); panelComponent.getChildren().add(sidebarMessageComponent); break; } return super.render(graphics); }
Example 9
Source File: IdleNotifierPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean checkMovementIdle(Duration waitDuration, Player local) { if (lastPosition == null) { lastPosition = local.getWorldLocation(); return false; } WorldPoint position = local.getWorldLocation(); if (lastPosition.equals(position)) { if (notifyPosition && local.getAnimation() == IDLE && Instant.now().compareTo(lastMoving.plus(waitDuration)) >= 0) { notifyPosition = false; // Return true only if we weren't just breaking out of an animation return lastAnimation == IDLE; } } else { notifyPosition = true; lastPosition = position; lastMoving = Instant.now(); } return false; }
Example 10
Source File: TimersPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
@Subscribe public void onGameTick(GameTick event) { loggedInRace = false; Player player = client.getLocalPlayer(); WorldPoint currentWorldPoint = player.getWorldLocation(); if (freezeTimer != null) { // assume movement means unfrozen if (freezeTime != client.getTickCount() && !currentWorldPoint.equals(lastPoint)) { removeGameTimer(freezeTimer.getTimer()); freezeTimer = null; } } lastPoint = currentWorldPoint; if (!widgetHiddenChangedOnPvpWorld) { return; } widgetHiddenChangedOnPvpWorld = false; Widget widget = client.getWidget(PVP_WORLD_SAFE_ZONE); if (widget != null && !widget.isSelfHidden()) { log.debug("Entered safe zone in PVP world, clearing Teleblock timer."); removeTbTimers(); } }
Example 11
Source File: AgilityPlugin.java From runelite with BSD 2-Clause "Simplified" License | 5 votes |
private boolean isInAgilityArena() { Player local = client.getLocalPlayer(); if (local == null) { return false; } WorldPoint location = local.getWorldLocation(); return location.getRegionID() == AGILITY_ARENA_REGION_ID; }
Example 12
Source File: TimersPlugin.java From plugins with GNU General Public License v3.0 | 4 votes |
@Subscribe private void onGameTick(GameTick event) { loggedInRace = false; Player player = client.getLocalPlayer(); if (player == null) { return; } WorldPoint currentWorldPoint = player.getWorldLocation(); final boolean isSkulled = player.getSkullIcon() != null && player.getSkullIcon() != SkullIcon.SKULL_FIGHT_PIT; if (isSkulled != skulledLastTick && config.showSkull()) { skulledLastTick = isSkulled; if (isSkulled) { createGameTimer(SKULL); } else { removeGameTimer(SKULL); } } if (freezeTimer != null && // assume movement means unfrozen freezeTime != client.getTickCount() && !currentWorldPoint.equals(lastPoint)) { removeGameTimer(freezeTimer.getTimer()); freezeTimer = null; } lastPoint = currentWorldPoint; if (!widgetHiddenChangedOnPvpWorld) { return; } widgetHiddenChangedOnPvpWorld = false; Widget widget = client.getWidget(PVP_WORLD_SAFE_ZONE); if (widget != null && !widget.isSelfHidden()) { log.debug("Entered safe zone in PVP world, clearing Teleblock timer."); removeTbTimers(); } }