public boolean type(char key, java.awt.event.KeyEvent ev) { if (Config.userazerty) key = Utils.azerty2qwerty(key); if ((key >= '0') && (key <= '9')) { int opt = (key == '0') ? 10 : (key - '1'); if (opt < opts.length) { choose(opts[opt]); kg.remove(); } return (true); } else if (key == 27) { choose(null); kg.remove(); return (true); } return (false); }
public void run() { stop: while (running) { BotUtils.sysMsg("Carrot Farmer Started", Color.WHITE); window = BotUtils.gui().add(new StatusWindow(), 300, 200); for (Gob gob : gobs) { GameUI gui = HavenPanel.lui.root.findchild(GameUI.class); IMeter.Meter stam = gui.getmeter("stam", 0); if (stam.a <= 30) { BotUtils.drink(); } BotUtils.pfRightClick(gob, 0); while (ui.root.findchild(FlowerMenu.class) == null) { sleep(100); } @SuppressWarnings("deprecation") FlowerMenu menu = ui.root.findchild(FlowerMenu.class); if (menu != null) { for (FlowerMenu.Petal opt : menu.opts) { if (opt.name.equals("Harvest")) { menu.choose(opt); menu.destroy(); } } } while (BotUtils.findObjectById(gob.id) != null) { sleep(100); } // Some better method should be implemented, but now it just waits a bit for items // to appear on inventory and stuff sleep(100); GItem item = BotUtils.getItemAtHand(); if (item == null) { Inventory inv = BotUtils.playerInventory(); for (Widget w = inv.child; w != null; w = w.next) { if (w instanceof GItem && isCarrot((GItem) w)) { item = (GItem) w; break; } } BotUtils.takeItem(item); } // Planttaa, siemen käteen tähän vaiheeseen mennessä BotUtils.mapInteractClick(1); while (BotUtils.findNearestStageCrop(5, 0, "gfx/terobjs/plants/carrot") == null) { sleep(100); } // TODO Droppaa kaikki siemenet tms. invistä + kädestä = saa toimimaan kaikkiin // siemeniin joku hieno // juttu jolla saa valittua mitä kasvia farmaa jne. } running = false; } window.destroy(); }
public boolean mousedown(Coord c, int button) { if (!anims.isEmpty()) return (true); if (!super.mousedown(c, button)) choose(null); return (true); }