Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean interact(Entity e, String interaction) throws InterruptedException {
- if (e == null || !canReach(e) || !e.exists())
- return false;
- int distance = e.getPosition().distance(myPlayer().getPosition());
- if (distance > 10) this.walkMainScreen(e.getPosition(), false);
- client.moveCameraToEntity(e);
- List<Entity> entities = client.getEntitiesOnCursor();
- client.moveMouse(e.getMouseDestination(), false);
- if (entities.size() > 0 && entities.get(0) != null && entities.get(0).equals(e)) {
- client.clickMouse(false);
- return true;
- } else {
- client.clickMouse(true);
- int slot = getMenuBoxSlot(e, interaction);
- int x = client.getMenuX() + 15;
- int y = ((client.getMenuY() + 19) + (slot * 15));
- int width = client.getMenuWidth() - 20;
- int height = 10;
- client.moveMouse(new RectangleDestination(x, y, width, height), false);
- if (slot == -1) {
- client.moveMouse(new RectangleDestination(520, 170, 750, 500), false);
- return false;
- }
- client.clickMouse(false);
- return true;
- }
- }
- public int getMenuBoxSlot(Entity e, String interaction) {
- for (int i = 0; i < client.getMenu().size(); i++) {
- Option option = client.getMenu().get(i);
- if (option.action.equalsIgnoreCase(interaction) && option.noun.contains(e.getName()))
- return i;
- }
- return -1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement