SHOW:
|
|
- or go back to the newest paste.
| 1 | - | public boolean interact(Entity e, String interaction) throws InterruptedException {
|
| 1 | + | public boolean interact(Entity e, String interaction) throws InterruptedException {
|
| 2 | - | if (e == null || !canReach(e) || !e.exists()) |
| 2 | + | if (e == null || !canReach(e) || !e.exists()) |
| 3 | return false; | |
| 4 | - | int distance = e.getPosition().distance(myPlayer().getPosition()); |
| 4 | + | int distance = e.getPosition().distance(myPlayer().getPosition()); |
| 5 | - | if (distance > 10) this.walkMainScreen(e.getPosition(), false); |
| 5 | + | if (distance > 10) this.walkMainScreen(e.getPosition(), false); |
| 6 | - | client.moveCameraToEntity(e); |
| 6 | + | client.moveCameraToEntity(e); |
| 7 | - | List<Entity> entities = client.getEntitiesOnCursor(); |
| 7 | + | List<Entity> entities = client.getEntitiesOnCursor(); |
| 8 | - | client.moveMouse(e.getMouseDestination(), false); |
| 8 | + | client.moveMouse(e.getMouseDestination(), false); |
| 9 | - | if (entities.size() == 1 && entities.contains(e)) {
|
| 9 | + | if (entities.size() > 0 && entities.get(0).equals(e)) {
|
| 10 | - | client.clickMouse(false); |
| 10 | + | client.clickMouse(false); |
| 11 | - | return true; |
| 11 | + | return true; |
| 12 | - | } else {
|
| 12 | + | } else {
|
| 13 | - | if (!entities.contains(e)) |
| 13 | + | if (!entities.contains(e)) |
| 14 | - | client.moveMouse(e.getMouseDestination(), false); |
| 14 | + | client.moveMouse(e.getMouseDestination(), false); |
| 15 | - | client.clickMouse(true); |
| 15 | + | client.clickMouse(true); |
| 16 | - | int slot = getMenuBoxSlot(e, interaction); |
| 16 | + | int slot = getMenuBoxSlot(e, interaction); |
| 17 | - | int x = client.getMenuX() + 15; |
| 17 | + | int x = client.getMenuX() + 15; |
| 18 | - | int y = ((client.getMenuY() + 19) + (slot * 15)); |
| 18 | + | int y = ((client.getMenuY() + 19) + (slot * 15)); |
| 19 | - | int width = client.getMenuWidth() - 20; |
| 19 | + | int width = client.getMenuWidth() - 20; |
| 20 | - | int height = 10; |
| 20 | + | int height = 10; |
| 21 | - | client.moveMouse(new RectangleDestination(x, y, width, height), false); |
| 21 | + | client.moveMouse(new RectangleDestination(x, y, width, height), false); |
| 22 | - | if (slot == -1) {
|
| 22 | + | if (slot == -1) {
|
| 23 | - | if (!containsInteraction(e, interaction)) {
|
| 23 | + | client.moveMouse(new RectangleDestination(520, 170, 750, 500), false); |
| 24 | - | client.moveMouse(new RectangleDestination(520, 170, 750, 500), false); |
| 24 | + | |
| 25 | - | return false; |
| 25 | + | |
| 26 | - | } |
| 26 | + | client.clickMouse(false); |
| 27 | - | return false; |
| 27 | + | return true; |
| 28 | - | } |
| 28 | + | |
| 29 | - | if (containsInteraction(e, interaction)) {
|
| 29 | + | } |
| 30 | - | client.clickMouse(false); |
| 30 | + | |
| 31 | - | return true; |
| 31 | + | public int getMenuBoxSlot(Entity e, String interaction) {
|
| 32 | - | } |
| 32 | + | for (int i = 0; i < client.getMenu().size(); i++) {
|
| 33 | Option option = client.getMenu().get(i); | |
| 34 | if (option.action.equalsIgnoreCase(interaction) && option.noun.contains(e.getName())) | |
| 35 | return i; | |
| 36 | - | |
| 36 | + | |
| 37 | - | public int getMenuBoxSlot(Entity e, String interaction) {
|
| 37 | + | return -1; |
| 38 | - | for (int i = 0; i < client.getMenu().size(); i++) {
|
| 38 | + | } |