m4rr3co 67 Posted June 16, 2020 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
Traidyy 0 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; } }
Recommended Posts
Archived
This topic is now archived and is closed to further replies.