Jump to content

better interaction(?)


Ayylmao420

Recommended Posts

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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

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