Vilius Posted December 6, 2016 Share Posted December 6, 2016 (edited) My friend asked for a wine of zamorak grabber, so I threw one up real quick. What it does: Grabs wines, moves the mouse on the desk for faster pickup. Banks at Falador west. Logs out if no runes I added a basic painter: Time ran Money gained (Not profit, doesnt count (wine price - rune price)) Magic xp gained Current state Pic: You can modify it or do w/e. Download: https://www.mediafire.com/?c4drcl4i1fzdcyr src for those who want it, its a basic state based script. import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Optional; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Vilius", info = "", logo = "", name = "Zammy wines", version = 1.0) public class WineOfZamorak extends Script { public static Area area = new Area(2933, 3513, 2930, 3517); public static Position pos = new Position(2930, 3515, 0); public static String state; private Optional<Integer> price; private long startTime; private long itemCount = 0; private long currentItemCount = -1; @ Override public void onStart() { price = getPrice(245); log(price); startTime = System.currentTimeMillis(); getExperienceTracker().start(Skill.MAGIC); } @ Override public int onLoop() throws InterruptedException { if (getInventory().contains("Law rune")) { for (States state : States.values()) if (state.canProcess(this)) state.process(this); recountItems(); } else { stop(); } return 33; } enum States { GRAB { @ Override public boolean canProcess(MethodProvider mp) { return area.contains(mp.myPlayer()) && !mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) { GroundItem wine = mp.getGroundItems().closest("Wine of zamorak"); if (mp.getMagic().isSpellSelected()) { if (wine != null && wine.isVisible()) { wine.interact("Cast"); state = "Interacting"; } else { Rectangle rect = pos.getPolygon(mp.getBot()).getBounds(); mp.getMouse().move(rect.x + (rect.width / 2), rect.y + (rect.height / 2)); state = "Moving mouse to center"; } } else { state = "Casting"; mp.getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB); } } }, WALK { @ Override public boolean canProcess(MethodProvider mp) { return !Banks.FALADOR_WEST.contains(mp.myPlayer()) && mp.getInventory().isFull() || !area.contains(mp.myPlayer()) && !mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) { state = "Walking"; if (!Banks.FALADOR_WEST.contains(mp.myPlayer())) mp.getWalking().webWalk(Banks.FALADOR_WEST); else mp.getWalking().webWalk(area); } }, BANK { @ Override public boolean canProcess(MethodProvider mp) { return Banks.FALADOR_WEST.contains(mp.myPlayer()) && mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) throws InterruptedException { if (mp.getBank().isOpen()) { state = "Depositing"; mp.getBank().depositAll("Wine of zamorak"); } else { state = "Opening bank"; mp.getBank().open(); new ConditionalSleep(1000) { @[member='Override'] public boolean condition() throws InterruptedException { return mp.getBank().isOpen(); } }; } } }; public abstract boolean canProcess(MethodProvider mp) throws InterruptedException; public abstract void process(MethodProvider mp) throws InterruptedException; } public void onPaint(Graphics2D g) { Graphics2D cursor = (Graphics2D) g.create(); Graphics2D paint = (Graphics2D) g.create(); final long runTime = System.currentTimeMillis() - startTime; Point mP = getMouse().getPosition(); Rectangle rect = pos.getPolygon(getBot()).getBounds(); Color tBlack = new Color(0, 0, 0, 128); paint.setFont(new Font("Arial", Font.PLAIN, 12)); paint.setColor(tBlack); paint.fillRect(0, 255, 200, 80); paint.setColor(Color.WHITE); paint.drawRect(0, 255, 200, 80); paint.drawString("Vilius wine grabber " + getVersion(), 5, 270); paint.drawString("Time running: " + formatTime(runTime), 5, 285); paint.drawString("Magic xp gained: " + formatValue(getExperienceTracker().getGainedXP(Skill.MAGIC)), 5, 300); paint.drawString("Gained money: " + formatValue(price.get() * itemCount), 5, 315); paint.drawString("State: " + state, 5, 330); cursor.setColor(Color.WHITE); cursor.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5); cursor.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5); cursor.drawPolygon(pos.getPolygon(getBot())); cursor.drawString("x", rect.x + (rect.width / 2), rect.y + (rect.height / 2)); } private Optional<Integer> getPrice(int id) { Optional<Integer> price = Optional.empty(); try { URL url = new URL("http://api.rsbuddy.com/grandExchange?a=guidePrice&i=" + id); URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); con.setUseCaches(true); BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); String[] data = br.readLine().replace("{", "").replace("}", "").split(","); br.close(); price = Optional.of(Integer.parseInt(data[0].split(":")[1])); } catch (Exception e) { e.printStackTrace(); } return price; } public final String formatValue(final long l) { return (l > 1_000_000) ? String.format("%.2fm", (double) (l / 1_000_000)) : (l > 1000) ? String.format("%.1fk", (double) (l / 1000)) : l + ""; } public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } public void recountItems() { long amt = getInventory().getAmount("Wine of zamorak"); if (currentItemCount == -1) currentItemCount = amt; else if (amt < currentItemCount) { currentItemCount = amt; } else { itemCount += amt - currentItemCount; currentItemCount = amt; } } } Edited December 6, 2016 by Vilius 7 Quote Link to comment Share on other sites More sharing options...
merloman Posted December 6, 2016 Share Posted December 6, 2016 Ooh good script thanks! Quote Link to comment Share on other sites More sharing options...
studying Posted December 6, 2016 Share Posted December 6, 2016 thank you! Quote Link to comment Share on other sites More sharing options...
El Manny Posted December 6, 2016 Share Posted December 6, 2016 Will have to give this a go - thanks! Quote Link to comment Share on other sites More sharing options...
Winnie Posted December 6, 2016 Share Posted December 6, 2016 Vilius strikes again 1 Quote Link to comment Share on other sites More sharing options...
Krys Posted December 6, 2016 Share Posted December 6, 2016 well done Quote Link to comment Share on other sites More sharing options...
Bamboozled Posted December 7, 2016 Share Posted December 7, 2016 BACK AT IT AGAIN !!! Quote Link to comment Share on other sites More sharing options...
Bashar Al Asaad Posted December 26, 2016 Share Posted December 26, 2016 If your looking to make profit of this script then i have some bad news for you this bot is insta ban. Quote Link to comment Share on other sites More sharing options...
gearing Posted December 26, 2016 Share Posted December 26, 2016 My friend asked for a wine of zamorak grabber, so I threw one up real quick. What it does: Grabs wines, moves the mouse on the desk for faster pickup. Banks at Falador west. Logs out if no runes I added a basic painter: Time ran Money gained (Not profit, doesnt count (wine price - rune price)) Magic xp gained Current state Pic: You can modify it or do w/e. Download: https://www.mediafire.com/?c4drcl4i1fzdcyr src for those who want it, its a basic state based script. import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.Optional; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.map.constants.Banks; import org.osbot.rs07.api.model.GroundItem; import org.osbot.rs07.api.ui.Skill; import org.osbot.rs07.api.ui.Spells; import org.osbot.rs07.script.MethodProvider; import org.osbot.rs07.script.Script; import org.osbot.rs07.script.ScriptManifest; import org.osbot.rs07.utility.ConditionalSleep; @ScriptManifest(author = "Vilius", info = "", logo = "", name = "Zammy wines", version = 1.0) public class WineOfZamorak extends Script { public static Area area = new Area(2933, 3513, 2930, 3517); public static Position pos = new Position(2930, 3515, 0); public static String state; private Optional<Integer> price; private long startTime; private long itemCount = 0; private long currentItemCount = -1; @ Override public void onStart() { price = getPrice(245); log(price); startTime = System.currentTimeMillis(); getExperienceTracker().start(Skill.MAGIC); } @ Override public int onLoop() throws InterruptedException { if (getInventory().contains("Law rune")) { for (States state : States.values()) if (state.canProcess(this)) state.process(this); recountItems(); } else { stop(); } return 33; } enum States { GRAB { @ Override public boolean canProcess(MethodProvider mp) { return area.contains(mp.myPlayer()) && !mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) { GroundItem wine = mp.getGroundItems().closest("Wine of zamorak"); if (mp.getMagic().isSpellSelected()) { if (wine != null && wine.isVisible()) { wine.interact("Cast"); state = "Interacting"; } else { Rectangle rect = pos.getPolygon(mp.getBot()).getBounds(); mp.getMouse().move(rect.x + (rect.width / 2), rect.y + (rect.height / 2)); state = "Moving mouse to center"; } } else { state = "Casting"; mp.getMagic().castSpell(Spells.NormalSpells.TELEKINETIC_GRAB); } } }, WALK { @ Override public boolean canProcess(MethodProvider mp) { return !Banks.FALADOR_WEST.contains(mp.myPlayer()) && mp.getInventory().isFull() || !area.contains(mp.myPlayer()) && !mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) { state = "Walking"; if (!Banks.FALADOR_WEST.contains(mp.myPlayer())) mp.getWalking().webWalk(Banks.FALADOR_WEST); else mp.getWalking().webWalk(area); } }, BANK { @ Override public boolean canProcess(MethodProvider mp) { return Banks.FALADOR_WEST.contains(mp.myPlayer()) && mp.getInventory().isFull(); } @ Override public void process(MethodProvider mp) throws InterruptedException { if (mp.getBank().isOpen()) { state = "Depositing"; mp.getBank().depositAll("Wine of zamorak"); } else { state = "Opening bank"; mp.getBank().open(); new ConditionalSleep(1000) { @[member='Override'] public boolean condition() throws InterruptedException { return mp.getBank().isOpen(); } }; } } }; public abstract boolean canProcess(MethodProvider mp) throws InterruptedException; public abstract void process(MethodProvider mp) throws InterruptedException; } public void onPaint(Graphics2D g) { Graphics2D cursor = (Graphics2D) g.create(); Graphics2D paint = (Graphics2D) g.create(); final long runTime = System.currentTimeMillis() - startTime; Point mP = getMouse().getPosition(); Rectangle rect = pos.getPolygon(getBot()).getBounds(); Color tBlack = new Color(0, 0, 0, 128); paint.setFont(new Font("Arial", Font.PLAIN, 12)); paint.setColor(tBlack); paint.fillRect(0, 255, 200, 80); paint.setColor(Color.WHITE); paint.drawRect(0, 255, 200, 80); paint.drawString("Vilius wine grabber " + getVersion(), 5, 270); paint.drawString("Time running: " + formatTime(runTime), 5, 285); paint.drawString("Magic xp gained: " + formatValue(getExperienceTracker().getGainedXP(Skill.MAGIC)), 5, 300); paint.drawString("Gained money: " + formatValue(price.get() * itemCount), 5, 315); paint.drawString("State: " + state, 5, 330); cursor.setColor(Color.WHITE); cursor.drawLine(mP.x - 5, mP.y + 5, mP.x + 5, mP.y - 5); cursor.drawLine(mP.x + 5, mP.y + 5, mP.x - 5, mP.y - 5); cursor.drawPolygon(pos.getPolygon(getBot())); cursor.drawString("x", rect.x + (rect.width / 2), rect.y + (rect.height / 2)); } private Optional<Integer> getPrice(int id) { Optional<Integer> price = Optional.empty(); try { URL url = new URL("http://api.rsbuddy.com/grandExchange?a=guidePrice&i=" + id); URLConnection con = url.openConnection(); con.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"); con.setUseCaches(true); BufferedReader br = new BufferedReader(new InputStreamReader(con.getInputStream())); String[] data = br.readLine().replace("{", "").replace("}", "").split(","); br.close(); price = Optional.of(Integer.parseInt(data[0].split(":")[1])); } catch (Exception e) { e.printStackTrace(); } return price; } public final String formatValue(final long l) { return (l > 1_000_000) ? String.format("%.2fm", (double) (l / 1_000_000)) : (l > 1000) ? String.format("%.1fk", (double) (l / 1000)) : l + ""; } public final String formatTime(final long ms) { long s = ms / 1000, m = s / 60, h = m / 60; s %= 60; m %= 60; h %= 24; return String.format("%02d:%02d:%02d", h, m, s); } public void recountItems() { long amt = getInventory().getAmount("Wine of zamorak"); if (currentItemCount == -1) currentItemCount = amt; else if (amt < currentItemCount) { currentItemCount = amt; } else { itemCount += amt - currentItemCount; currentItemCount = amt; } } } does it tele to falador or walks? Quote Link to comment Share on other sites More sharing options...
Vilius Posted December 26, 2016 Author Share Posted December 26, 2016 does it tele to falador or walks?Walks there. Quote Link to comment Share on other sites More sharing options...
gearing Posted December 26, 2016 Share Posted December 26, 2016 Walks there. idk why but it logged out after collecting 130wines, can you make it relog until its out of runes? Quote Link to comment Share on other sites More sharing options...
Vilius Posted December 26, 2016 Author Share Posted December 26, 2016 idk why but it logged out after collecting 130wines, can you make it relog until its out of runes?It only logs out if its out of law runes. If you want to change anything its up to you to do so. Quote Link to comment Share on other sites More sharing options...
leechsgetstiches Posted December 29, 2016 Share Posted December 29, 2016 thanks for giving us a good f2p money maker! much appricated 1 Quote Link to comment Share on other sites More sharing options...
Juggles Posted January 19, 2017 Share Posted January 19, 2017 Good stuff. Will help out the community Quote Link to comment Share on other sites More sharing options...
Cleaned Posted March 2, 2017 Share Posted March 2, 2017 Getting 33 mage on several accounts as we speak! Quote Link to comment Share on other sites More sharing options...