public void run() { targetName = (Settings.getFindTargetName() == null) ? "gfx/kritter/dragonfly/dragonfly" : Settings.getFindTargetName(); BotUtils.sysMsg("Target " + targetName, Color.WHITE); window = BotUtils.gui().add(new StatusWindow(), 300, 200); ui.root.findchild(FlowerMenu.class); while (BotUtils.getItemAtHand() == null) { GameUI gui = HavenPanel.lui.root.findchild(GameUI.class); IMeter.Meter stam = gui.getmeter("stam", 0); // Check energy stop if it is lower than 1500 IMeter.Meter nrj = gui.getmeter("nrj", 0); if (nrj.a <= 30) { t.stop(); return; } else if (stam.a <= 30 && nrj.a >= 95) { BotUtils.drink(); } // if (!BotUtils.isMoving()) { Gob gob = BotUtils.findObjectByNames(BotUtils.player().rc, 1000, targetName); if (gob != null) { BotUtils.goToCoord(gob.rc, 200, true); BotUtils.doClick(gob, 3, 0); } // } if (gob.getres().name.contains("terobjs")) { sleep(800); } sleep(800); } window.destroy(); t.stop(); }
public void wdgmsg(Widget sender, String msg, Object... args) { if (sender == this && msg.equals("close")) { Settings.setFindTargetName(null); Settings.setCancelAuto(true); t.stop(); } super.wdgmsg(sender, msg, args); }