Jump to content

Satire's Cammy Teleporter with source code


Recommended Posts

Posted (edited)

Basic script, haven't tested it (don't have 45 magic) but I think it'll work lmao.

Requested by @Twisted Staff

If anyone want's to supply some photo's so I can add it to the thread, that'll be grateful.

Download: Link

 

Source code

 

 

 



import org.osbot.rs07.api.ui.Skill;
import org.osbot.rs07.api.ui.Spells;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import org.osbot.rs07.utility.ConditionalSleep;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.Arc2D;
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.stream.Collectors;


@ScriptManifest(author = "Satire", info = "A simple Teleporter", name = "sCammyTeleporter", version = 0, logo = "")

    public class Main extends Script{
    private long timeBegan;
    private long timeRan;
    private int beginningMagicXp;
    private int begginingLevelMagic;
    private int currentMagicXp;
    private int xpToNextLevelMagic;
    private int currentLevelMagic;
    private int xpPerHourMagic;
    private int levelsGainedMagic;
    private int xpGainedMagic;

    private int mX, mY;


    private final Image mousePointer = getImage("http://i.imgur.com/kGJ88Xg.png");


    private Image getImage(String url) {
        try {
            return ImageIO.read(new URL(url));
        } catch (IOException e) {
        }
        return null;
    }

    @Override
    public void onStart() {
        timeBegan = System.currentTimeMillis();
        beginningMagicXp = skills.getExperience(Skill.MAGIC);
        begginingLevelMagic = skills.getStatic(Skill.MAGIC);


    }

    @Override
    public int onLoop() throws InterruptedException {

        if(getMagic().canCast(Spells.NormalSpells.CAMELOT_TELEPORT)){
            new ConditionalSleep(3000, 100) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getMagic().castSpell(Spells.NormalSpells.CAMELOT_TELEPORT);
                }
            }.sleep();

            new ConditionalSleep(1500, 100) {
                @Override
                public boolean condition() throws InterruptedException {
                    return !myPlayer().isAnimating();
                }
            }.sleep();


        }else{
            log("Ran out of runes, logging off");
            new ConditionalSleep(2000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return !myPlayer().isAnimating(); // Wait for anim to finish so we can log off
                }
            }.sleep();
            stop(true);
        }

        return random(500,100);
    }



    @Override
    public void onExit(){
        log("Successfully exited!");
    }

    public int xpToNextLevel(final Skill skill) {
        return skills.experienceToLevel(skill);
    }


    public void onPaint(Graphics2D g){
        Graphics2D gr = g;
        g.setColor(Color.WHITE);
        mX = getMouse().getPosition().x;
        mY = getMouse().getPosition().y;
        g.drawImage(mousePointer, mX - 15, mY - 15, null);
        timeRan = System.currentTimeMillis() - this.timeBegan;
        g.setFont(new Font("SANS_SERIF", Font.BOLD, 12));
        currentLevelMagic = this.skills.getStatic(Skill.MAGIC);
        currentMagicXp = this.skills.getExperience(Skill.MAGIC);
        levelsGainedMagic = currentLevelMagic - begginingLevelMagic;
        xpToNextLevelMagic = xpToNextLevel(Skill.MAGIC);
        xpGainedMagic =  currentMagicXp - beginningMagicXp;
        xpPerHourMagic = (int) (this.xpGainedMagic * 3600000.0 / (System.currentTimeMillis() - this.timeBegan));
        g.setColor(Color.WHITE);
        g.drawString(begginingLevelMagic  + "/" + currentLevelMagic + "(" + levelsGainedMagic + ")" + "  XP Gained: " + xpGainedMagic + "      XP Needed: " + xpToNextLevelMagic
        + "     XP/hr: " + xpPerHourMagic, 14, 329);
        g.setColor(Color.WHITE);

    }




    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) {
            if(hours <=9 && minutes <=9){
                res = ("0" + hours + ":" + "0" + minutes + ":" + seconds);
                return res;
            }else if(hours <=9 && minutes <=9){res = ("0" + hours + ":" + "0" +  minutes + ":" + seconds); return res;}
            else{
                res = (hours + ":"  +  minutes + ":" + seconds);
            }

        }else{
            res = (days + ":" + hours + ":" + minutes + ":" + seconds);
        }

        return res;
    }

}

 

Edited by Satire
Posted
if(getMagic().canCast(Spells.NormalSpells.CAMELOT_TELEPORT)){
            if (new ConditionalSleep(3000, 100) {
                @Override
                public boolean condition() throws InterruptedException {
                    return getMagic().castSpell(Spells.NormalSpells.CAMELOT_TELEPORT);
                }
            }.sleep()) {
                new ConditionalSleep(1500, 100) {
                    @Override
                    public boolean condition() throws InterruptedException {
                        return !myPlayer().isAnimating();
                    }
                }.sleep();
            }
        }else{
            log("Ran out of runes, logging off");
            new ConditionalSleep(2000) {
                @Override
                public boolean condition() throws InterruptedException {
                    return !myPlayer().isAnimating(); // Wait for anim to finish so we can log off
                }
            }.sleep();
            stop(true);
        }

        return random(500,1000);

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...