private boolean depositAll() { ScreenModel[] box = ScreenModels.find(1518040783L); if (box.length > 0) { Point P = new Point( box[0].base_point.x + randomRange(-3, 3), box[0].base_point.y + randomRange(-3, 3)); Mouse.move(P); if (Timing.waitUptext("deposit box", 1000)) { Mouse.click(1); if (waitBoxScreen(5000)) { Point BP = new Point(298 + randomRange(0, 25), 320 + randomRange(0, 16)); Mouse.move(BP); Mouse.click(1); return true; } } else { attempt++; if (attempt < maxAttempt) { if (depositAll()) { attempt = 0; } } } } return false; }
private void gluttonousBehemoth() { long bossID = 2081911231L, foodSourceID = 1561638623L; Point MSC = new Point(259, 220); ScreenModel[] boss = ScreenModels.find(bossID); if (boss.length > 0) { ScreenModel[] food = ScreenModels.find(foodSourceID); if (food.length > 0) { int foodDist = Math.abs(MSC.x - food[0].base_point.x) + Math.abs(MSC.y - food[0].base_point.y); println("Food dist: " + foodDist); if (foodDist < 110) { Point BP = new Point(boss[0].base_point); Mouse.move(BP); if (Timing.waitUptext("behemoth", 500)) { Mouse.click(BP, 1); } } else { println("We need to move near the food source!"); Point FP = new Point(food[0].base_point); Mouse.click(FP, 1); } } } }
private boolean interact(Obstacle obstacle) { ArrayList<Point> ptList = new ArrayList<Point>(); Point[] pts = obstacle.getPoints(); for (Point p : pts) { double distance = p.distance(msc.x, msc.y); if (distance > 25 && distance < 75) { ptList.add(p); } } if (ptList.size() > 0) { long t = System.currentTimeMillis(); int attempts = 0; while (attempts < 5 && Timing.timeFromMark(t) < 5000) { int r = General.random(0, ptList.size() - 1); Point p = ptList.get(r); Mouse.move(p); if (waitUptext(obstacle.getUptext(), 200)) { Mouse.click(1); return true; } attempts++; } } return false; }
/** * Waits a certain amount of time until we have no more willow logs * * @param startAmount starting amount * @param ms time to wait * @return true if current amount lower than start amount */ private boolean waitSellWillows(int startAmount, int ms) { long t = System.currentTimeMillis(); while (Timing.timeFromMark(t) < ms) { if (Inventory.find(willowID).length < startAmount) { return true; } General.sleep(ms / 20, ms / 10); } return false; }
/** * Waits a certain amount of time for the store screen to open * * @param ms amount of time to wait in ms * @return True if store opened within time limit */ private boolean waitStoreOpen(int ms) { long t = System.currentTimeMillis(); while (Timing.timeFromMark(t) < ms) { if (isStoreOpen()) { return true; } else if (Player.isMoving()) { t = System.currentTimeMillis(); } General.sleep(ms / 20, ms / 10); } return false; }
private void icyBones() { long bossID = 3076383209L; ScreenModel[] boss = ScreenModels.find(bossID); if (boss.length > 0) { Point BP = new Point(boss[0].base_point); Mouse.move(BP); if (Timing.waitUptext("bones", 500)) { Mouse.click(BP, 1); } } }
// BEER BUYING private boolean talkToSeller() { long ID = 2955713843L; Point P = getNearestPoint(ID); if (P != null) { Point BP = new Point(P.x + randomRange(-5, 5), P.y - randomRange(5, 15)); Mouse.move(BP); if (Timing.waitUptext("Emily", 200) || Timing.waitUptext("Kaylee", 200)) { Mouse.click(1); waitUntilNotMoving(); return true; } else { attempt++; if (attempt < maxAttempt) { if (talkToSeller()) { attempt = 0; } } } } return false; }
private boolean waitUptext(String text, long time) { long t = System.currentTimeMillis(); while (Timing.timeFromMark(t) < time) { String uptext = Game.getUptext(); if (uptext != null) { if (uptext.contains(text)) { println("Found uptext: " + text); return true; } } sleep(10, 20); } return false; }
/** * Waits a certain amount of time for the right selling option to appear and click * * @param amount inventory willow amount * @param ms time to wait * @return true if clicked the right sell option */ private boolean waitSellOption(int amount, int ms) { long t = System.currentTimeMillis(); while (Timing.timeFromMark(t) < ms) { String[] options = ChooseOption.getOptions(); for (String option : options) { if (option.contains("Sell willow")) { int number = amount >= 10 ? 10 : 5; if (ChooseOption.select("Sell " + number + " willow")) { return true; } } } General.sleep(ms / 20, ms / 10); } return false; }
public void onPaint(Graphics g) { g.setColor(new Color(31, 31, 31)); g.fill3DRect(0, 54, 185, 85, true); g.setFont(new Font("Verdana", Font.BOLD, 15)); g.setColor(new Color(0, 95, 0)); g.drawString("JJ's Beer Buyer", 5, 68); g.setFont(new Font("Verdana", Font.PLAIN, 9)); g.setColor(new Color(240, 135, 0)); g.drawString( "Running for: " + Timing.msToString(System.currentTimeMillis() - startTime), 5, 80); g.drawString("Status: " + status, 5, 90); g.drawString("Beers collected: " + beers, 5, 100); g.drawString("Beers per hour: " + toHour(beers), 5, 110); g.drawString("Profit made: " + (beers * profit) + " gp", 5, 120); g.drawString("Profit per hour: " + toHour(beers * profit) + " gp", 5, 130); }