import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.*; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Stroke; import java.awt.event.KeyEvent; import java.awt.geom.Line2D; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.RandomAccessFile; import java.net.URL; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.net.MalformedURLException; import java.net.URLConnection; import java.io.BufferedWriter; import java.io.FileWriter; import javax.imageio.ImageIO; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import org.rsbot.bot.Bot; import org.rsbot.bot.input.Mouse; import org.rsbot.event.events.ServerMessageEvent; import org.rsbot.event.listeners.PaintListener; import org.rsbot.event.listeners.ServerMessageListener; import org.rsbot.script.Calculations; import org.rsbot.script.Constants; import org.rsbot.script.GrandExchange; import org.rsbot.script.Script; import org.rsbot.script.ScriptManifest; import org.rsbot.script.Skills; import org.rsbot.script.wrappers.RSInterface; import org.rsbot.script.wrappers.RSInterfaceChild; import org.rsbot.script.wrappers.RSInterfaceComponent; import org.rsbot.script.wrappers.RSItem; import org.rsbot.script.wrappers.RSNPC; import org.rsbot.script.wrappers.RSObject; import org.rsbot.script.wrappers.RSPlayer; import org.rsbot.script.wrappers.RSTile; @ScriptManifest( authors = {"veyo"}, category = "Smithing", name = "AIO Smelter", version = 1.3, description = "\n" + "
" + "| " + " | |
| " + "Location To Smelt In:" + " | " + "" + " |
| " + "Bars To Be Smelted:" + " | " + "" + " |
| "
+ " Does your character has Goldsmith Gaunts equipped? ") public class AIOSmelter extends Script implements PaintListener, ServerMessageListener { final ScriptManifest properties = getClass ().getAnnotation (ScriptManifest.class); RSTile[] FSmithPath = { new RSTile(2951, 3379), new RSTile(2961, 3380), new RSTile(2971, 3378), new RSTile(2973, 3373), new RSTile(2974, 3369) }; RSTile[] FSmithing = cleanPath (fixPath(FSmithPath) ); RSTile[] FBankPath = { new RSTile(2965, 3377), new RSTile(2956, 3381), new RSTile(2951, 3380), new RSTile(2950, 3376), new RSTile(2945, 3371), new RSTile(2947, 3368) }; RSTile[] FBanking = cleanPath (fixPath(FBankPath) ); RSTile[] FDoor = { new RSTile(0000, 0000) }; RSTile[] ASmithPath = { new RSTile(3276, 3173), new RSTile(3275, 3185) }; RSTile[] ASmithing = cleanPath (fixPath(ASmithPath) ); RSTile[] ABankPath = { new RSTile(3276, 3173), new RSTile(3269, 3169) }; RSTile[] ABanking = cleanPath (fixPath(ABankPath) ); RSTile[] ESmithPath = { new RSTile(3098, 3496), new RSTile(3108, 3500) }; RSTile[] ESmithing = cleanPath (fixPath(ESmithPath) ); RSTile[] EBankPath = { new RSTile(3108, 3500), new RSTile(3098, 3496) }; RSTile[] EBanking = cleanPath (fixPath(EBankPath) ); RSTile[] NSmithPath = { new RSTile(2338, 3807), new RSTile(2343, 3810) }; RSTile[] NSmithing = cleanPath (fixPath(NSmithPath) ); RSTile[] NBankPath = { new RSTile(2343, 3810), new RSTile(2338, 3807) }; RSTile[] NBanking = cleanPath (fixPath(NBankPath) ); RSTile[] PSmithPath = { new RSTile(3686, 3479) }; RSTile[] PSmithing = cleanPath (fixPath(PSmithPath) ); RSTile[] PBankPath = { new RSTile(3689, 3473) }; RSTile[] PBanking = cleanPath (fixPath(PBankPath) ); RSTile[] PDoor = { new RSTile(0000, 0000) }; RSTile[] OpenDoor; RSTile[] Banking; RSTile[] Smithing; public int BankBooth; public int Furnace; public int antiBanSpeed = 0; public int smithingXP; public int Rested; public int Child; public int amount; public int trips = 0; public int Theme = 0; public int restSet = 0; public int BarCount; public int Ore1; public int Ore2; public int Ore1Amount; public int Ore2Amount; public int BarAmount; public int BarID; public int startXP; public int startLVL; public long startTime = System.currentTimeMillis(); public int startLvl = skills.getCurrentSkillLevel(Constants.STAT_SMITHING); public int startExp = skills.getCurrentSkillExp(Constants.STAT_SMITHING); public String BarName; public String OreName1; public String OreName2; public String status = ("Game Loading..."); public boolean startScript = false; public boolean setAltitude = false; public long scriptStartTime; public double getVersion(){ return properties.version (); } @Override protected int getMouseSpeed () { return random (8, 10); } public void moveMouses () { final int x = random (0, 750); final int y = random (0, 500); moveMouse (x, y, 10, 10); wait (random (500, 600) ); } public void moveMousesSlightly () { final int x = random (0, 300); final int y = random (0, 200); moveMouse (x, y, 10, 10); wait (random (700, 800) ); moveMouse (x, y, 5, 5); wait (random (700, 800) ); moveMouse (x, y, 2, 2); } public void moveCamera () { int angle = getCameraAngle () + random (-90, 90); if (angle < 0) angle = 0; if (angle > 359) angle = 0; setCameraRotation (angle); } public void moveCameraSlightly () { int angle = getCameraAngle () + random (-45, 45); if (angle < 0) angle = 0; if (angle > 359) angle = 0; setCameraRotation (angle); } public void hoverOverPlayer () { RSPlayer p = getNearestPlayerByLevel (1,130); if ( (p != null) && tileOnScreen (p.getLocation () ) ) { moveMouse (p.getScreenLocation (),40,40); wait (random (850,1250) ); } } public void run () { if (getEnergy() > 40 + random (1, 70) || getEnergy() >= 71) { setRun (true); wait (random (100, 200) ); } } public void antiBan () { antiBanSpeed = random (0 + smithingXP, 100 + smithingXP); switch (random (0, 300) ) { case 1: status = ("Performing Random Mouse..."); moveMouseRandomly (300); break; case 2: status = "Performing Move Camera..."; moveCamera (); break; case 3: status = ("Performing Mouse Move..."); moveMouses (); break; case 4: status = "Performing Slight Camera..."; moveCameraSlightly (); break; case 5: status = "Performing Hover Player..."; hoverOverPlayer (); break; case 6: status = "Performing Camera Move..."; moveCamera (); break; case 7: status = "Performing Slight Camera..."; moveCameraSlightly (); break; case 8: status = "Performing Hover Player..."; hoverOverPlayer (); break; case 9: status = ("Performing Mose Random..."); moveMouseRandomly (300); break; case 10: status = ("Performing Move Mouse..."); moveMouses (); break; case 11: status = "Performing Slight Mouse..."; moveMousesSlightly (); break; case 12: status = "Performing Hover Player..."; hoverOverPlayer (); break; case 13: status = ("Performing Slight Mouse..."); moveMousesSlightly (); break; case 14: status = ("Performing Slight Mouse..."); moveMousesSlightly (); break; case 15: status = "Performing Hover Player..."; hoverOverPlayer (); break; } } private boolean isSmelting () { int j = 0; for (int i = 0; i < 10 && getInventoryCount (Ore1) >= 0; i++) { if (getMyPlayer ().getAnimation () == 3243) { moveMousesSlightly (); j = j + 1; } wait (random (100, 150) ); } if (j > 0) { return true; }else{ return false; } } public int loop () { run (); if (!setAltitude) { setCameraAltitude (true); wait (random (300, 500) ); setAltitude = true; return (50); } if (BarCount > amount - 1){ status = ("Reached " + amount + ", " + BarName + " Bars"); } if (startXP == 0) { startXP = skills.getCurrentSkillExp (Skills.getStatIndex ("smithing") ); startLVL = skills.getCurrentSkillLevel (Skills.getStatIndex ("smithing") ); } if (oreIDCheck () ) { if (atBank () ) { handleBank (); handleWithdraw (); return (5); }else{ if (walkToBank () ); return (5); } }else{ if (atFurnace () ) { handleBars (); }else{ if (walkToFurnace () ); return (5); } } return (5); } @Override public void onFinish () { logProgressReport (); return; } public void serverMessageRecieved (final ServerMessageEvent e) { final String message = e.getMessage (); if (message.contains("The magic of the Varrock armour enables you " + "to smelt 2 bars at the same time") ) { status = ("Smelted a " + BarName + " Bar..."); BarCount++; } if (message.contains("You retrieve a bar") ) { status = ("Smelted a " + BarName + " Bar..."); BarCount++; } if (message.contains("You have run out of") ) { status = ("Out Of Ore..."); trips++; } } public boolean oreIDCheck () {//ORE CHECK status =("Checking Inventory"); return (!inventoryContains (Ore1) || (!inventoryContains (Ore2) ) ); } public boolean atBank () { status = ("Finding Bank"); return (distanceTo(getNearestObjectByID (BankBooth)) < 4); } public boolean handleBank () { int ct = 0; try { if (!bank.isOpen () ) { wait (random (500, 800) ); if (bank.open () ) status = ("Bank Is Open..."); wait (random (300, 500) ); while (!bank.isOpen () ) { wait(180); ct++; if (ct > 30) return false; } } }catch (final Exception e) { } return true; } public void handleWithdraw () { if (bank.isOpen () ) { status = ("Empting Inventory"); if (bank.depositAll () ); wait (random (700, 800) ); if (bank.getCount (Ore1) > 0) { wait (random (600, 800) ); if (getInventoryCount (Ore1) == 0) { wait (random (600, 800) ); status = ("Getting " + OreName1 + "..."); if (bank.atItem (Ore1, "Withdraw-" + Ore1Amount) ) { wait (random (400, 500) ); }else{ bank.atItem (Ore1, "Withdraw-X"); wait (random (900, 1500) ); sendText (String. valueOf (Ore1Amount), true); wait (random (400, 500) ); } } }else{ bank.close (); wait (random (10000, 12000) ); status = ("Logging out in 10 sec"); logout (); stopScript (); } wait (random (200, 300) ); if (Ore2Amount != 0) { wait (random (600, 800) ); if (bank.getCount (Ore2) > 0) { wait (random (600, 800) ); if (getInventoryCount (Ore2) == 0) { status = ("Getting " + OreName2 + "..."); wait (random (600, 800) ); if (bank.atItem (Ore2, "Withdraw-All") ) { wait (random (600, 800) ); bank.close (); waitToMove (800); } } } else {//OUT OF ORE LOG OUT bank.close (); status = ("Logging out in 10 sec"); wait (random (10000, 12000) ); logout (); stopScript (); } } else { wait (random (600, 800) ); status = ("Path Set To Furnace..."); bank.close (); waitToMove (800); } } } public boolean walkToBank () { if (distanceTo(getDestination()) <= random(3, 6) ) { antiBan (); status = ("Going To Bank..."); try { if (!walkPathMM (Banking) ) { walkTo (nextTile (Banking, 12, false) ); } } catch (final Exception e) { } } return true; } public boolean atFurnace () { status = ("Finding Furnace"); return (distanceTo(getNearestObjectByID(Furnace)) < 4); } public void handleBars () { if (!isSmelting () ) { final RSObject furnace = getNearestObjectByID(Furnace); if (!RSInterface.getInterface (311).isValid () ) { atObject (furnace, "Smelt"); } if (RSInterface.getInterface (311).isValid () ) { if (getInventoryCount (Ore1) <= 10 && getInventoryCount (Ore1) > 0) { status = ("Setting Amount To 10..."); wait (random (500, 800) ); atInterface (311, Child, "Smelt 10 " + BarName); } else { atInterface (311, Child, "Smelt X " + BarName); wait (random (2000, 3000) ); String randomAmount = Integer. toString (random (BarAmount, 99) ); status = ("Setting Random Amount..."); sendText (randomAmount, true); } } } } public boolean walkToFurnace () { if (distanceTo(getDestination() ) <= random(3, 6) ) { if (getInventoryCount (Ore1) > 0 && getInventoryCount (Ore2) > 1) { status = ("Going To Furnace..."); antiBan (); try { if (!walkPathMM (Smithing) ) { walkTo (nextTile (Smithing, 12, false) ); } } catch (final Exception e) { } } } else { if (getInventoryCount (Ore1) < 1 && getInventoryCount (Ore2) < 2) { walkToBank (); } } return true; } public void logProgressReport() { final long runTime = System.currentTimeMillis () - scriptStartTime; final int seconds = (int) ( (runTime / 1000) % 60); final int minutes = (int) ( (runTime / 1000) / 60) % 60; final int hours = (int) ( ( (runTime / 1000) / 60) / 60) % 60; final StringBuilder t1 = new StringBuilder (); if (hours < 10) { t1.append('0'); } t1.append(hours); t1.append(":"); if (minutes < 10) { t1.append('0'); } t1.append(minutes); t1.append(":"); if (seconds < 10) { t1.append('0'); } t1.append(seconds); log("Runtime: " + hours + ":" + minutes + ":" + seconds); log("Bars Made: " + BarCount); } private final RenderingHints antialiasing = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); private Image getImage(String url) { try { return ImageIO.read(new URL(url)); } catch(IOException e) { return null; } } private String getFormattedTime(final long timeMillis) { long jmillis = timeMillis; final long seconds2 = jmillis / 1000; final long hours = jmillis / (1000 * 60 * 60); jmillis -= hours * 1000 * 60 * 60; final long minutes = jmillis / (1000 * 60); jmillis -= minutes * 1000 * 60; final long seconds = jmillis / 1000; String hoursString = ""; String minutesString = ""; String secondsString = seconds + ""; String type = "seconds"; if (minutes > 0) { minutesString = minutes + ":"; type = "minutes"; } else if (hours > 0 && seconds2 > 0) { minutesString = "0:"; } if (hours > 0) { hoursString = hours + ":"; type = "hours"; } if (minutes < 10 && !type.equals("seconds")) { minutesString = "0" + minutesString; } if (hours < 10 && type.equals("hours")) { hoursString = "0" + hoursString; } if (seconds < 10 && !type.equals("seconds")) { secondsString = "0" + secondsString; } if (timeMillis == 1000) { type = "second"; } else if (timeMillis == 60000) { type = "minute"; } else if (timeMillis == 3600000) { type = "hour"; } return hoursString + minutesString + secondsString + " " + type; } private final Color color1 = new Color(153, 153, 153, 144); private final Color color2 = new Color(51, 51, 51, 223); private final Color color3 = new Color(0, 0, 0, 196); private final Color color4 = new Color(0, 0, 0); private final BasicStroke stroke1 = new BasicStroke(4); private final Font font1 = new Font("Batang", 1, 16); private final Font font2 = new Font("Batang", 1, 14); private final Font font3 = new Font("Arial", 1, 9); private final Font font4 = new Font("Batang", 1, 16); private final Image img1 = getImage("http://www.global-rs.com/img/gold_ore.gif"); private final Image img2 = getImage("http://www.global-rs.com/img/gold_bar.gif"); public void onRepaint (final Graphics g) { if (!startScript) { g.setColor (new Color(255, 255, 255, 255) ); g.setFont (new Font("arial", Font.BOLD, 12) ); g.drawString ("Please Wait Loading Script...", 330, 19); } else { final Mouse m = Bot.getClient ().getMouse (); if (isLoggedIn () ) { long timeRunning = 0; timeRunning = System.currentTimeMillis() - startTime; final long runTime = System.currentTimeMillis () - scriptStartTime; final int seconds = (int) ( (runTime / 1000) % 60); final int minutes = (int) ( (runTime / 1000) / 60) % 60; final int hours = (int) ( ((runTime / 1000) / 60) / 60) % 60; final StringBuilder t1 = new StringBuilder(); if (hours < 10) { t1.append('0'); } t1.append(hours); t1.append(" : "); if (minutes < 10) { t1.append('0'); } t1.append(minutes); t1.append(" : "); if (seconds < 10) { t1.append('0'); } t1.append(seconds); int barPerHour = 0; final int currentXP = skills.getCurrentSkillExp (Skills.getStatIndex ("smithing") ); final int currentLVL = skills.getCurrentSkillLevel (Skills.getStatIndex ("smithing") ); final int xpTilNext = skills.getXPToNextLevel (STAT_SMITHING); final int percentTilNext = skills.getPercentToNextLevel (STAT_SMITHING); final int XPgained = currentXP - startXP; final int LVLgained = currentLVL - startLVL; final int fillBar = (int) (1.40 * (double) percentTilNext); if ( (runTime / 1000) > 0) { barPerHour = (int) ( (3600000.0 / (double) runTime) * BarCount); } final Graphics2D g2d1 = (Graphics2D) g; if (m.x >= 481 && m.x < 481 + 31 && m.y >= 298 && m.y < 298 + 37) { g.setColor(color1); g.fillRect(263, 222, 249, 112); g.setColor(color2); g.drawRect(261, 220, 254, 115); g.drawImage(img1, 265, 224, null); g.drawImage(img2, 478, 219, null); g.setFont(font1); g.setColor(color3); g.drawString("veyo's AIO Smelter", 306, 243); g.setFont(font2); g.drawString("Smith LVL: " + currentLVL, 300, 263); g.drawString("Exp/Hour: "+ (int) ((skills.getCurrentSkillExp(Constants.STAT_SMITHING) - startExp) * 3600000D / ((double) System.currentTimeMillis() - (double) startTime)), 300, 278); g.drawString("XP Gained: " + XPgained, 300, 293); g.drawString(BarName + " Bars: " + BarCount, 300, 308); g.drawString("Status: " + status, 300, 323); g.setFont(font3); g.setColor(color3); g.drawString ("v " + properties.version (), 270, 328); }else { g.drawImage(img2, 481, 304, null); g.setColor(Color.white); g.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 14)); g.setFont(new Font("Copperplate Gothic Bold", Font.PLAIN, 12)); g.setColor(Color.white); g.drawString(" " + BarCount,485,298); Point mwth = getMouseLocation(); g.setColor(new Color(153, 153, 153, 144)); g.drawRoundRect(mwth.x - 6, mwth.y, 15, 3, 5, 5); g.drawRoundRect(mwth.x, mwth.y - 6, 3, 15, 5, 5); g.fillRoundRect(mwth.x - 6, mwth.y, 15, 3, 5, 5); g.fillRoundRect(mwth.x, mwth.y - 6, 3, 15, 5, 5); } } } } @Override public boolean onStart (final Map |