Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.osbot.rs07.api.model.Entity;
- import org.osbot.rs07.api.model.NPC;
- import org.osbot.rs07.api.ui.Message;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import org.osbot.rs07.utility.Area;
- import java.awt.*;
- import java.util.Timer;
- import java.util.concurrent.TimeUnit;
- import javax.swing.*;
- @ScriptManifest(name = "Dubzie's Bracelets", author = "Dubzieisme23", version = 1.6, info = "", logo = "")
- public class main6 extends Script {
- gbfilter goldbarm = new gbfilter();
- int goldbar = 2357;
- int mould = 11065;
- int bracelet = 11069;
- int furnace = 16469;
- String keyboard = "33";
- private int BraceletsMade;
- public static Timer runTime;
- public int startExp;
- private int currentLevel;
- private int beginningLevel;
- private int levelsGained;
- private long timeBegan;
- private int xpGained;
- private int xpPerHour;
- private int currentXp;
- private int beginningXp;
- private double nextLevelXp;
- private long timeTNL;
- private double xpTillNextLevel;
- final int[] XP_TABLE = { 0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154,
- 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018,
- 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833,
- 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224,
- 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721,
- 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254,
- 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428,
- 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895,
- 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068,
- 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294,
- 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614,
- 8771558, 9684577, 10692629, 11805606, 13034431, 200000000 };
- private static final Area BANK_AREA = new Area(3098, 3495, 3095, 3494);
- static final Area SMELT_AREA = new Area(3106, 3501, 3110, 3497);
- static final Area BIGBANK_AREA = new Area(3099, 3501, 3090, 3487);
- public void onStart() {
- //Code here will execute before the loop is started
- JOptionPane.showMessageDialog(null, "Welcome to Dubzie's Gold Bracelet Maker Muhaha");
- BraceletsMade = 0;
- timeBegan = System.currentTimeMillis();
- beginningXp = skills.getExperience(Skill.CRAFTING);
- timeTNL = 0;
- runTime = new Timer();
- startExp = getSkills().getExperience(Skill.CRAFTING);
- beginningLevel = skills.getStatic(Skill.CRAFTING);
- }
- private boolean canUseRun(){
- // The coordinates we check for the color
- int x = 588, y = 135;
- // The color when the orb is NOT full at this coordinate (black)
- int runOrbColorEmpty = new Color(11,11,11).getRGB();
- // We have not went below about half (50%) run energy yet
- return (colorPicker.colorAt(x, y).getRGB() != runOrbColorEmpty);
- }
- private boolean enableRun() throws InterruptedException{
- int orbTopLeftX=544, orbTopY=128;
- int orbBotRightX = 593, orbBotY = 151;
- Rectangle rect = new Rectangle(orbTopLeftX, orbTopY, orbBotRightX, orbBotY);
- int mouseX = random (orbTopLeftX, orbBotRightX);
- int mouseY = random (orbTopY, orbBotY);
- mouse.move (mouseX, mouseY);
- while (!rect.contains (mouse.getPosition())){
- sleep (random(250, 500));
- }
- mouse.click (false);
- return true;
- }
- public void onExit() {
- //Code here will execute after the script ends
- }
- public int onLoop() throws InterruptedException {
- Entity Furnace = objects.closest(furnace);
- Entity bank = objects.closest("Bank booth");
- NPC banker = npcs.closest("Banker");
- if (getWidgets().isVisible(446, 44)) {
- log("getting interface");
- getWidgets().interact(446, 44, "Make-X");
- sleep (random(777, 899));
- }
- if(canUseRun() && !settings.isRunning()){
- enableRun();
- return random(2000, 4000);
- }
- if(getInventory().onlyContains(mould, bracelet) && SMELT_AREA.contains(myPlayer())){
- map.walk(BANK_AREA);
- }
- if(!myPlayer().isMoving() && BIGBANK_AREA.contains(myPlayer())){
- if(!getInventory().onlyContains(mould, goldbar) && !getInventory().onlyContains(mould) && getInventory().onlyContains(mould, bracelet) && bank != null && bank.isVisible()){
- log("Depositing Bracelets");
- map.walk(bank);
- bank.interact("Bank");
- sleep (random(1111, 2222));
- getBank().depositAll(bracelet);
- return random(1111, 2222);
- }
- if(getWidgets().isVisible(12, 10) && !myPlayer().isMoving() && getInventory().isEmptyExcept(mould) && bank != null && bank.isVisible()){
- log("Withdrawing Gold Bars");
- sleep (random(444, 687));
- getBank().withdrawAll("Gold bar");
- if(!getWidgets().isVisible(12, 10)){
- bank.interact("Bank");
- }
- }
- }
- if(!SMELT_AREA.contains(myPlayer()) && !myPlayer().isMoving() && getInventory().onlyContains(goldbar, mould)){
- log("Walking to smelt area");
- map.walk(3109, 3499);
- sleep (random(1111, 2222));
- }
- if(myPlayer().isAnimating()){
- log("Not doing squat because i is animating yo");
- return random(4000, 8000);
- }
- if(Furnace != null &&
- Furnace.isVisible() &&
- SMELT_AREA.contains(myPlayer())){
- if(getWidgets().isVisible(446, 44)){
- log("widget is visable not doing sht");
- }
- if(!getWidgets().isVisible(446, 44) &&
- !myPlayer().isAnimating())
- {
- sleep(random(666, 1244));
- getInventory().interact("Use", "Gold bar");
- log("Using gold bar");
- }
- }
- if( Furnace != null &&
- Furnace.isVisible() &&
- SMELT_AREA.contains(myPlayer())){
- if(!getWidgets().isVisible(446, 44) &&
- !myPlayer().isAnimating())
- {
- log("Interacting with furnace");
- sleep(1433);
- Furnace.interact("Use");
- }
- }
- if(getInventory().onlyContains(mould) && !BANK_AREA.contains(myPlayer())){
- log("Walking to bank");
- map.walk(BANK_AREA);
- return random(1111, 3333);
- }
- if (!getWidgets().isVisible(12, 10, 0) && getInventory().onlyContains(mould) && BANK_AREA.contains(myPlayer())){
- log("Getting some gold up in here");
- banker.interact("Bank");
- return random(1111, 3333);
- }
- if (SMELT_AREA.contains(myPlayer()) && getWidgets().isVisible(548, 120)){
- log("Making bracelets");
- getKeyboard().typeString(keyboard);
- return random(1111, 1888);
- }
- return 222;
- }
- public void onPaint(Graphics2D g) {
- //This is where you will put your code for paint(s)
- g.setColor(Color.CYAN);
- g.setFont(new Font("Impact", Font.BOLD, 15));
- currentXp = skills.getExperience(Skill.CRAFTING);
- currentLevel = skills.getStatic(Skill.CRAFTING);
- xpGained = currentXp - beginningXp;
- xpPerHour = (int) (xpGained / ((System.currentTimeMillis() - this.timeBegan) / 3600000.0D));
- nextLevelXp = XP_TABLE[currentLevel + 1];
- xpTillNextLevel = nextLevelXp - currentXp;
- if (xpGained >= 1) {
- timeTNL = (long) ((xpTillNextLevel / xpPerHour) * 3600000);
- }
- g.drawString("Time until level " + ft(timeTNL), 10, 200);
- currentLevel = skills.getStatic(Skill.CRAFTING);
- levelsGained = currentLevel - beginningLevel;
- g.drawString("Beginning Level " + beginningLevel, 10, 225);
- g.drawString("Current Level " + currentLevel, 10, 250);
- g.drawString("Levels Gained " + levelsGained, 10, 275);
- g.drawString("Bracelets Made " + BraceletsMade, 10, 300);
- }
- public void onMessage(Message message)
- throws java.lang.InterruptedException {
- String OreTxt = message.getMessage().toLowerCase();
- if (OreTxt.contains("a bracelet")
- && (getInventory().contains("Gold bracelet"))) {
- BraceletsMade++;
- }
- }
- private String ft(long duration) {
- String res = "";
- long days = TimeUnit.MILLISECONDS.toDays(duration);
- long hours = TimeUnit.MILLISECONDS.toHours(duration)
- - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
- long minutes = TimeUnit.MILLISECONDS.toMinutes(duration)
- - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
- .toHours(duration));
- long seconds = TimeUnit.MILLISECONDS.toSeconds(duration)
- - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
- .toMinutes(duration));
- if (days == 0) {
- res = (hours + ":" + minutes + ":" + seconds);
- } else {
- res = (days + ":" + hours + ":" + minutes + ":" + seconds);
- }
- return res;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement