Skip to content

Instantly share code, notes, and snippets.

@lawdeedaw
Created April 10, 2015 19:13
Show Gist options
  • Save lawdeedaw/01a02ccd27d7c2cfb714 to your computer and use it in GitHub Desktop.
Save lawdeedaw/01a02ccd27d7c2cfb714 to your computer and use it in GitHub Desktop.
package coure;
import org.dreambot.api.methods.Calculations;
import org.dreambot.api.methods.map.Tile;
import org.dreambot.api.methods.skills.Skill;
import org.dreambot.api.methods.tabs.Tab;
import org.dreambot.api.script.AbstractScript;
import org.dreambot.api.script.Category;
import org.dreambot.api.script.ScriptManifest;
import org.dreambot.api.utilities.Timer;
import org.dreambot.api.wrappers.interactive.NPC;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
@ScriptManifest(name = "LawCurser", author = "lawdeedaw", description = "curses", version = 1, category = Category.MAGIC)
public class Main extends AbstractScript {
private int castCount = 0;
private Timer t = new Timer();
private final Tile castTile = new Tile(3214, 3476, 0);
private final Rectangle p = new Rectangle(655, 244, 24, 24);
private BufferedImage image;
@Override
public void onStart() {
getSkillTracker().start(Skill.MAGIC);
try {
image = ImageIO.read(new URL("http://i.imgur.com/cHG8lN5.jpg"));
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public int onLoop() {
NPC monk = getNpcs().closest("Monk of Zamorak");
if(!getLocalPlayer().getTile().equals(castTile)){
getWalking().walk(castTile);
sleep(500, 2000);
} else {
if(!getTabs().isOpen(Tab.MAGIC)){
getTabs().open(Tab.MAGIC);
} else {
getMouse().move(p);
sleep(10, 60);
getMouse().click();
sleep(10, 60);
}
if(monk.isOnScreen() && monk != null){
getMouse().move(monk);
sleep(10, 60);
getMouse().click();
sleep(10, 60);
}
}
castCount++;
return Calculations.random(500, 2000);
}
@Override
public void onExit() {
log("Thank you for using LawCurser");
}
public void onPaint(Graphics2D g) {
g.drawImage(image, null, 460, 351);
g.setColor(Color.WHITE);
Rectangle p2 = new Rectangle(655, 244, 24, 24);
g.setFont(new Font("Arial", 1, 11));
g.drawString("" + t.formatTime(), 569, 412);
g.drawString("" + getSkillTracker().getGainedExperience(Skill.MAGIC) + " [" + getSkillTracker().getGainedExperiencePerHour(Skill.MAGIC) + "]" + " (+" + getSkillTracker().getGainedLevels(Skill.MAGIC) + ")", 567, 451);
g.drawString("" + castCount, 565, 485);
g.draw(p2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment