@Override public void execute() { // TODO Auto-generated method stub try { SceneObject well = SceneEntities.getNearest(Constants.WELL_ID); Timer wait = new Timer(1000); if (!Constants.edgevillArea.contains(Players.getLocal())) { Teleport.teleportTo(Teleport.EDGEVILL); } if (well != null) { if (well.isOnScreen()) { if (Bank.isOpen()) Bank.close(); if (Widgets.get(905, 14).validate()) { boolean isInteracted = false; if (Widgets.get(905, 14).getBoundingRectangle().contains(Mouse.getLocation())) { Mouse.click(true); isInteracted = true; } else { Widgets.get(905, 14).interact("Make All"); isInteracted = true; } Task.sleep(1000); if (isInteracted) { Utilities.showDebug( "Softening clays for profit of " + Progress.profitSoftening + "gp each."); softeningTimer.setEndIn(2500); } } else { if (!softeningTimer.isRunning()) { if (Inventory.selectItem(Constants.CLAY_ID)) { if (well.interact("Use")) { Utilities.showDebug("Interacting well."); Mouse.move(271, 475, 5, 5); } } wait.setEndIn(2000); while (wait.isRunning() && !Widgets.get(905, 14).validate()) { if (Players.getLocal().isMoving()) wait.setEndIn(1000); Task.sleep(100); } } } } else { Utilities.showDebug("Found well but not on screen. Walking.."); Walking.walk(Walking.findPath(well).getEnd()); wait.setEndIn(3000); while (wait.isRunning() && !well.isOnScreen()) { Task.sleep(300); } } } } catch (Exception e) { } ; }
/** * Clicks a tile on the minimap. * * @param mobile The mobile to click (global). * @return <tt>true</tt> if the mobile was clicked; otherwise <tt>false</tt>. */ public static boolean walk(final Locatable mobile) { Tile stepDirection = mobile.getLocation(); if (!stepDirection.isOnMap()) { stepDirection = getClosestOnMap(stepDirection); } final Tile tile = stepDirection; return Mouse.apply( new ViewportEntity() { public Point getCentralPoint() { return Calculations.worldToMap(tile.getX(), tile.getY()); } public Point getNextViewportPoint() { return getCentralPoint(); } public boolean contains(final Point point) { return getCentralPoint().distance(point) <= 2; } public boolean validate() { return tile.isOnMap(); } }, new Filter<Point>() { public boolean accept(final Point point) { Mouse.click(true); return true; } }); }
@Override public void run() { Filter attackingGhoul = new Filter<NPC>() { public boolean accept(NPC npc) { return npc.getName().equals("Hellhound") && npc.getInteracting() == Players.getLocal(); } }; Filter freeGhoulToAttack = new Filter<NPC>() { public boolean accept(NPC npc) { return !npc.isInCombat() && npc.getName().equals("Hellhound"); } }; if (NPCs.getNearest(attackingGhoul) != null) Main.Hellhound = NPCs.getNearest(attackingGhoul); else Main.Hellhound = NPCs.getNearest(freeGhoulToAttack); if (Main.Hellhound.isOnScreen()) { if (Main.Hellhound.getInteracting() == null && !underAttack() && Main.Hellhound.isOnScreen() && Main.Hellhound != null) { Mouse.move(Main.Hellhound.getCentralPoint().x, Main.Hellhound.getCentralPoint().y); Time.sleep(50); if (!Menu.select("Attack")) { Mouse.move(Main.Hellhound.getCentralPoint().x, Main.Hellhound.getCentralPoint().y); Time.sleep(50); Menu.select("Attack"); } } } else { if (Calculations.distance(Players.getLocal().getLocation(), Main.Hellhound.getLocation()) <= 5) { Camera.turnTo(Main.Hellhound); } else { Walking.walk(Main.Hellhound.getLocation()); } } Time.sleep(Random.nextInt(1000, 1200)); while (Players.getLocal().isMoving() && !Main.Hellhound.isInCombat()) { Time.sleep(100); } }
public boolean interact(final String action, final String option) { return Mouse.apply( this, new Filter<Point>() { public boolean accept(final Point point) { return Menu.select(action, option); } }); }
public boolean hover() { return Mouse.apply( this, new Filter<Point>() { public boolean accept(final Point point) { return true; } }); }
public boolean click(final boolean left) { return Mouse.apply( this, new Filter<Point>() { public boolean accept(final Point point) { Mouse.click(left); return true; } }); }
void executeAntiban() { int dx, dy; int r = Random.nextInt(0, 4); switch (r) { case 0: case 1: default: Status = "AntiBan"; Camera.setAngle(Random.nextInt(20, 300)); break; case 2: case 3: Status = "AntiBan"; dx = Random.nextInt(-30, 30); dy = Random.nextInt(-30, 30); Mouse.move(Mouse.getX() + dx, Mouse.getY() + dy); Task.sleep(20, 150); break; } }
boolean interact(Entity entity, int lowerBound, int upperBound, String action) { while (!Mouse.isReady()) ; if (entity == null || !entity.validate()) { return false; } Point entityPoint = new Point( entity.getCentralPoint().x + Random.nextInt(lowerBound, upperBound), entity.getCentralPoint().y + Random.nextInt(lowerBound, upperBound)); while (!Mouse.getLocation().equals(entityPoint)) { Mouse.hop( entity.getCentralPoint().x + Random.nextInt(lowerBound, upperBound), entity.getCentralPoint().y + Random.nextInt(lowerBound, upperBound)); } if (Mouse.getLocation().equals(entityPoint)) { Mouse.click(false); if (Menu.contains(action)) { Menu.select(action); } } return true; }
void dropAllExcept(int lowerBound, int upperBound, int... dontDropThis) { for (Item i : Inventory.getItems()) { for (int id : dontDropThis) { if (!(i.getId() == id)) { Mouse.hop( i.getWidgetChild().getAbsoluteX() + Random.nextInt(lowerBound, upperBound), i.getWidgetChild().getAbsoluteY() + Random.nextInt(lowerBound, upperBound)); i.getWidgetChild().interact("Drop"); Status = "Dropping logs"; } } } }
public void setPrayer(boolean b) { if (Tabs.getCurrent() != Tabs.PRAYER) { Tabs.PRAYER.open(); Mouse.hop(prayerWidget.getAbsoluteX(), prayerWidget.getAbsoluteY()); if (b == true) { if (Menu.contains("Activate")) { if (prayerWidget.interact("Activate")) {} } else { return; } } else { if (Menu.contains("Deactivate")) { if (prayerWidget.interact("Deactivate")) {} } } } }
// Author: Zasz public static void takeitem(GroundItem item) { Point point = item.getCentralPoint(); point = new Point(point.x - 3, point.y - 10); boolean taken = false; for (int i = 0; i < 7; i++) { Mouse.move(point.x, point.y); Time.sleep(50); // log.info(item.getGroundItem().getName()); if (Menu.select("Take", item.getGroundItem().getName())) { Sleeping.waitWhileMoving(); taken = true; break; } if (i > 5) { Camera.setAngle(Camera.getAngleTo(Random.nextInt(15, 25))); } point = new Point(point.x + i, point.y + i); } if (taken) { addLootTaken(item.getGroundItem(), item.getGroundItem().getStackSize()); } }
@Override public void execute() { switch (Random.nextInt(0, 200)) { case 0: Camera.setAngle(Random.nextInt(10, 80)); break; case 1: Camera.setAngle(Random.nextInt(80, 220)); break; case 2: Tabs.STATS.open(); Mouse.move(644, 465); sleep(1000, 2000); Tabs.INVENTORY.open(); break; case 3: Tabs.FRIENDS.open(); sleep(1000, 2000); Tabs.INVENTORY.open(); break; } }
public static void evokeMouse(Graphics g) { g.setColor(Color.RED); g.drawLine(Mouse.getX() - 5, Mouse.getY() - 5, Mouse.getX() + 5, Mouse.getY() + 5); g.drawLine(Mouse.getX() - 5, Mouse.getY() + 5, Mouse.getX() + 5, Mouse.getY() - 5); }
public boolean paint(Graphics graphics) { if (!Game.isLoggedIn()) return false; try { Graphics2D g = (Graphics2D) graphics; PComponent clayout = null; try { clayout = new PColumnLayout( 227, 404, infoColumnValues, infoColumnData, new Font("Arial", 0, 9), PColumnLayout.ColorScheme.WHITE); } catch (Exception e) { e.printStackTrace(); } getFrame("options").removeComponent(firstLayout); getFrame("options").removeComponent(secondLayout); int secondColx = -1; int bestLength = -1; firstColumn.clear(); secondColumn.clear(); if (checkBoxes.size() <= 6) firstColumn.putAll(checkBoxes); else { for (int i = 0; i < checkBoxes.size(); i++) { if (i <= 5) { String text; Iterator it = checkBoxes.keySet().iterator(); for (int j = 0; j < i; j++) it.next(); text = (String) it.next(); int length = SwingUtilities.computeStringWidth(g.getFontMetrics(g.getFont()), text); if (length > bestLength) bestLength = length; firstColumn.put(text, checkBoxes.get(text)); } else { String text; Iterator it = checkBoxes.keySet().iterator(); for (int j = 0; j < i; j++) it.next(); text = (String) it.next(); secondColumn.put(text, checkBoxes.get(text)); } } } secondColx = 8 + bestLength; firstLayout = new PCheckBoxLayout( 8, 407, firstColumn .keySet() .toArray(new String[(firstColumn.size() > 6) ? 6 : firstColumn.size()]), firstColumn .values() .toArray(new PCheckBox[(firstColumn.size() > 6) ? 6 : firstColumn.size()]), new Font("Arial", 0, 11), PCheckBoxLayout.ColorScheme.WHITE); secondLayout = new PCheckBoxLayout( secondColx + 12, 407, secondColumn .keySet() .toArray(new String[(secondColumn.size() > 6) ? 6 : secondColumn.size()]), secondColumn .values() .toArray(new PCheckBox[(secondColumn.size() > 6) ? 6 : secondColumn.size()]), new Font("Arial", 0, 11), PCheckBoxLayout.ColorScheme.WHITE); getFrame("options").addComponent(firstLayout); getFrame("options").addComponent(secondLayout); if (showPaint) { Paint p = g.getPaint(); g.setPaint( new GradientPaint( 0, 1000, new Color(55, 55, 55, 240), 512, 472, new Color(15, 15, 15, 240))); g.fillRect(7, 396, 505, 128); final Point loc = Mouse.getLocation(); if (Mouse.isPressed()) { g.fillOval(loc.x - 5, loc.y - 5, 10, 10); g.drawOval(loc.x - 5, loc.y - 5, 10, 10); } g.drawLine(0, loc.y + 1, 766, loc.y + 1); g.drawLine(0, loc.y - 1, 766, loc.y - 1); g.drawLine(loc.x + 1, 0, loc.x + 1, 505); g.drawLine(loc.x - 1, 0, loc.x - 1, 505); g.setPaint(p); } if (clayout != null) getFrame("info").addComponent(clayout); PaintController.onRepaint(graphics); if (clayout != null) getFrame("info").removeComponent(clayout); if (!showPaint) return false; String infoTxt = name + " - " + "v" + version; g.drawString( infoTxt, 510 - SwingUtilities.computeStringWidth(g.getFontMetrics(g.getFont()), infoTxt), 468); int offset = 0; for (Skill skill : skills) { if (skill.xpGained() > 0) { PSkill skillComp = new PSkill(8, 397 + offset, skill.getSkill(), PSkill.ColorScheme.GRAPHITE); if (!getFrame("info").containsComponent(skillComp)) { getFrame("info").addComponent(skillComp); } offset += 20; } } // == Mouse == if (Mouse.isPressed()) { g.setColor(new Color(255, 252, 0, 150)); g.setColor(new Color(255, 252, 0, 100)); } else { g.setColor(new Color(255, 252, 0, 50)); } g.setColor(new Color(0, 0, 0, 50)); // == End mouse == } catch (Exception ignored) { // if (Utils.isDevMode()) // ignored.printStackTrace(); } return true; }