/** * Get all the spawn of a NPC. * * @param activeChar * @param npcId * @param teleportIndex * @param showposition */ private void findNPCInstances( L2PcInstance activeChar, int npcId, int teleportIndex, boolean showposition) { int index = 0; for (L2Spawn spawn : SpawnTable.getInstance().getSpawns(npcId)) { index++; L2Npc npc = spawn.getLastSpawn(); if (teleportIndex > -1) { if (teleportIndex == index) { if (showposition && (npc != null)) { activeChar.teleToLocation(npc.getLocation(), true); } else { activeChar.teleToLocation(spawn.getLocation(), true); } } } else { if (showposition && (npc != null)) { activeChar.sendMessage( index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + npc.getX() + " " + npc.getY() + " " + npc.getZ()); } else { activeChar.sendMessage( index + " - " + spawn.getTemplate().getName() + " (" + spawn + "): " + spawn.getX() + " " + spawn.getY() + " " + spawn.getZ()); } } } if (index == 0) { activeChar.sendMessage(getClass().getSimpleName() + ": No current spawns found."); } }
protected void checkAndReturnToSpawn() { if (isDead() || isMovementDisabled() || !canReturnToSpawnPoint()) { return; } final L2Spawn spawn = getSpawn(); if (spawn == null) { return; } final int spawnX = spawn.getX(); final int spawnY = spawn.getY(); final int spawnZ = spawn.getZ(); if (!isInCombat() && !isMovementDisabled()) { if (!isInsideRadius( spawnX, spawnY, spawnZ, Math.max(Config.MAX_DRIFT_RANGE, 200), true, false)) { teleToLocation(spawnX, spawnY, spawnZ, false); } } }