public PathFind( int x, int y, int z, int destX, int destY, int destZ, L2Object obj, int instanceId) { geoIndex = instanceId; startPoint = Config.PATHFIND_BOOST == 0 ? new Location(x, y, z) : GeoEngine.moveCheckWithCollision(x, y, z, destX, destY, true, geoIndex); endPoint = Config.PATHFIND_BOOST != 2 || Math.abs(destZ - z) > 200 ? new Location(destX, destY, destZ) : GeoEngine.moveCheckBackwardWithCollision( destX, destY, destZ, startPoint.x, startPoint.y, true, geoIndex); startPoint.world2geo(); endPoint.world2geo(); startPoint.z = GeoEngine.NgetHeight(startPoint.x, startPoint.y, startPoint.z, false, geoIndex); endPoint.z = GeoEngine.NgetHeight(endPoint.x, endPoint.y, endPoint.z, false, geoIndex); int xdiff = Math.abs(endPoint.x - startPoint.x); int ydiff = Math.abs(endPoint.y - startPoint.y); if (xdiff == 0 && ydiff == 0) { if (Math.abs(endPoint.z - startPoint.z) < 32) { path = new ArrayList<Location>(); path.add(0, startPoint); } return; } int mapSize = 2 * Math.max(xdiff, ydiff); if ((buff = PathFindBuffers.alloc(mapSize)) != null) { buff.offsetX = startPoint.x - buff.mapSize / 2; buff.offsetY = startPoint.y - buff.mapSize / 2; // статистика buff.totalUses++; if (obj != null && obj.isPlayable) buff.playableUses++; findPath(); buff.free(); PathFindBuffers.recycle(buff); } }