Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Graphics2D;
- import java.awt.Image;
- import java.io.IOException;
- import java.net.URL;
- import org.osbot.rs07.api.model.Entity;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.Script;
- import org.osbot.rs07.script.ScriptManifest;
- import java.awt.*;
- import java.util.concurrent.TimeUnit;
- import javax.imageio.ImageIO;
- import javax.swing.JOptionPane;
- @ScriptManifest(name = "Dubzie's Power Chopper", author = "Dubzieisme23", version = 1.1, info = "", logo = "http://s30.postimg.org/6qt1wvnzx/logo1.png")
- public class main extends Script {
- int[] axes = {1352, 1349, 1353, 1361, 1355, 1357, 1359, 6739};
- int[] logs = {1511, 1521, 1519, 1515, 1513};
- private final Image bg = getImage("http://s13.postimg.org/mhc3szdnr/awesome_signature_dubzieisme23.png");
- private long timeBegan;
- private long timeRan;
- private int beginningXP;
- private int currentXp;
- private int xpGained;
- private int currentLevel;
- private int beginningLevel;
- private int levelsGained;
- private int xpPerHour;
- private int cameraPitch = (0 - 50);
- private double nextLevelXp;
- private double xpTillNextLevel;
- private long timeTNL;
- String input;
- boolean isnotvisable;
- 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
- };
- @Override
- public void onStart() {
- timeTNL = 0;
- beginningLevel = skills.getStatic(Skill.WOODCUTTING);
- timeBegan = System.currentTimeMillis();
- beginningXP = skills.getExperience(Skill.WOODCUTTING);
- input = JOptionPane.showInputDialog("What would you like to cut? " + "Type exact type of tree ex. Tree, Oak, Willow, Yew, Magic");
- }
- private Image getImage(String url)
- {
- try
- {
- return ImageIO.read(new URL(url));
- }
- catch (IOException e) {}
- return null;
- }
- 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())){
- // TODO: Failsafe...
- sleep (random(250, 500));
- }
- mouse.click (false);
- return true;
- }
- @Override
- public void onExit() {
- //Code here will execute after the script ends
- log("Thank you for using a dubzie script.");
- }
- @Override
- public int onLoop() throws InterruptedException {
- Entity Tree = objects.closest(input);
- if(getInventory().isFull()){
- getInventory().dropAllExcept(axes);
- return random(899, 1889);
- }
- if(getInventory().isItemSelected()) {
- getInventory().deselectItem();
- }
- if(canUseRun() && !settings.isRunning()){
- enableRun();
- return random(800, 985);
- }
- if(getCamera().getPitchAngle() != cameraPitch) {
- getCamera().movePitch(random.nextInt(20) + 5);
- }else if(getCamera().getYawAngle() != cameraPitch) {
- getCamera().moveYaw(random.nextInt(25 + 10));
- }
- if(!myPlayer().isAnimating() && !myPlayer().isMoving()) {
- if(Tree != null) {
- if (Tree.isVisible()) {
- Tree.interact("Chop down");
- return(random(250, 1455));
- }else{
- map.walk(Tree);
- return random (800, 1000);
- }
- }
- }
- return 400; //The amount of time in milliseconds before the loop starts over
- }
- @Override
- public void onPaint(Graphics2D g) {
- timeRan = System.currentTimeMillis() - this.timeBegan;
- g.drawImage(bg, 2, 279, null);
- g.setColor(Color.BLACK);
- g.setFont(new Font("Impact", Font.BOLD, 18));
- g.drawString(ft(timeRan), 157, 371);
- currentXp = skills.getExperience(Skill.WOODCUTTING);
- g.drawString("" + xpGained, 157, 420);
- currentLevel = skills.getStatic(Skill.WOODCUTTING);
- levelsGained = currentLevel - beginningLevel;
- 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("" + ft(timeTNL), 157, 464);
- g.drawString("" + beginningLevel, 430, 462);
- g.drawString("" + levelsGained, 413, 419);
- g.drawString("" + currentLevel, 376, 372);
- }
- 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