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