m4rr3co 67 Share Posted June 16, 2020 (edited) This snippet is meant to be used at the very first NPC encounter your brand new account have at Tutorial Island when opening Tab.Options isn't available. It will start a conversation with the npc and from then it's normal getDialogues management. if (c.getClientSettings().isResizableActive()) { NPC guide = c.getNpcs().closest(npcName); if (c.getDialogues().getOptions() != null && c.getDialogues().chooseOption(1)) MethodProvider.sleepUntil(() -> c.getDialogues().canContinue(), Calculations.random(3000, 3500)); else if (c.getDialogues().canContinue() && c.getDialogues().spaceToContinue()) MethodProvider.sleepUntil(() -> c.getDialogues().canContinue() || c.getDialogues().getOptions() != null,Calculations.random(3000,3500)); else if(guide != null) { Point p = guide.getModel().calculateCenterPoint(); Rectangle GAME_SCREEN = new Rectangle(5, 5, 511, 333); Rectangle CANVAS = new Rectangle(0, 0, 765, 503); int heightAdjust = 0; int widthAdjust = 0; p.setLocation(p.getX() * (CANVAS.getWidth() / GAME_SCREEN.getWidth())+widthAdjust, p.getY() * (CANVAS.getHeight() / GAME_SCREEN.getHeight())+heightAdjust); c.getMouse().hop(p); if (c.getClient().getMenu().contains("Talk-to")) { c.getMouse().click(); MethodProvider.sleepUntil(() -> c.getDialogues().canContinue(), 10000); } } } Would love to hear opinions on how to optimize this. ps.: i'm not the original author, i just can't find his topic Edited June 16, 2020 by m4rr3co code_zero, wettofu and TheCloakdOne 3 Link to comment Share on other sites More sharing options...
Traidyy 0 Share Posted May 3, 2023 Quote if (c.getClientSettings().isResizableActive()) { NPC guide = c.getNpcs().closest(npcName); boolean canContinue = c.getDialogues().canContinue(); boolean hasOptions = c.getDialogues().getOptions() != null; switch (true) { case hasOptions: if (c.getDialogues().chooseOption(1)) { MethodProvider.sleepUntil(() -> c.getDialogues().canContinue(), Calculations.random(3000, 3500)); } break; case canContinue && c.getDialogues().spaceToContinue(): MethodProvider.sleepUntil(() -> c.getDialogues().canContinue() || c.getDialogues().getOptions() != null, Calculations.random(3000, 3500)); break; case guide != null: Point adjustedPoint = guide.getModel().calculateCenterPoint() .getMatrix(c.getClient()).getPoint(); Rectangle GAME_SCREEN = new Rectangle(5, 5, 511, 333); Rectangle CANVAS = new Rectangle(0, 0, 765, 503); int heightAdjust = 0; int widthAdjust = 0; adjustedPoint.setLocation(adjustedPoint.getX() * (CANVAS.getWidth() / GAME_SCREEN.getWidth()) + widthAdjust, adjustedPoint.getY() * (CANVAS.getHeight() / GAME_SCREEN.getHeight()) + heightAdjust); c.getMouse().hop(adjustedPoint); if (c.getMenu().interact("Talk-to")) { MethodProvider.sleepUntil(() -> c.getDialogues().canContinue(), 10000); } break; default: break; } } Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now