Jump to content

better interaction(?)


Recommended Posts

Posted (edited)

This particular one is for npc interaction, you need to modify it for objects, position, item, sprites, 

any criticism welcome.

		if (getMenuAPI().isOpen()) {
			
			Stream<Option> ourOptionStreamFilter = getMenuAPI().getMenu().stream().filter(o -> stripFormatting(o.name).equals(npc.getName()) && stripFormatting(o.action).equals(option) && o.var1 == npc.getIndex());
			Option ourOption = ourOptionStreamFilter.findFirst().orElse(null);
			
			if (ourOption == null) {
				getMouse().moveRandomly();
			} else {
				if (getMenuAPI().getOptionRectangle(getMenuAPI().getMenu().indexOf(ourOption)).contains(getMouse().getPosition())) {
					if (getMouse().click(false)) {
						if (getMouse().getCrossHairColor().equals(CrossHairColor.RED)) {
							setFinished();
						}
					}
				} else {
					if (getMouse().move(new RectangleDestination(getBot(), getMenuAPI().getOptionRectangle(getMenuAPI().getMenu().indexOf(ourOption))))) {
						
					}
				}
			}
		} else {
			if (getMouse().isOnCursor(npc)) {
				if (getMouse().getOnCursorCount() > 1) {
					if (getMouse().click(true)) {
						
					}
				} else {
					if (getMenuAPI().getTooltip().equals(option + " " +npc.getName())) {
						if (getMouse().click(false)) {
							if (getMouse().getCrossHairColor().equals(CrossHairColor.RED)) {
								setFinished();
							}
						}
					}
				}
			} else {
				if (npc.isVisible()) {
					if (getMouse().move(new EntityDestination(getBot(), npc))) {
						
					}
				} else {
					getCamera().toEntity(npc);
				}
			}
		}
Edited by Ayylmao420
  • Like 3

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...