Last active
August 29, 2015 14:18
-
-
Save lawdeedaw/37ba405a98383a14d5e2 to your computer and use it in GitHub Desktop.
curser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 org.dreambot.api.wrappers.items.Item; | |
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 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() { | |
//start tracking magic skill, load paint image | |
getSkillTracker().start(Skill.MAGIC); | |
try { | |
image = ImageIO.read(new URL("http://i.imgur.com/K0Vrcv2.png")); | |
} catch (MalformedURLException e) { | |
e.printStackTrace(); | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
@Override | |
public int onLoop() { | |
NPC monk = getNpcs().closest("Monk of Zamorak"); | |
antiBan(); | |
Item waterRune = getInventory().get("Water rune"); | |
//if I don't have enough runes exit | |
if(waterRune.getAmount() < 2 || !getInventory().contains("Body rune") || !getInventory().contains("Water rune")){ | |
log("not enough runes, exiting;"); | |
return -1; | |
} | |
//If im not near the monk, walk to the monk | |
if(!getLocalPlayer().getTile().equals(castTile)){ | |
getWalking().walk(castTile); | |
sleep(500, 2000); | |
} else { | |
//if I am at the monk but my magic tab isn't open, open magic tab | |
if(!getTabs().isOpen(Tab.MAGIC)){ | |
getTabs().open(Tab.MAGIC); | |
} else { | |
//at monk, tab is open, clicks the curse spell | |
getMouse().move(p); | |
sleep(10, 60); | |
getMouse().click(); | |
sleep(10, 60); | |
} | |
//at monk, curse spell is seleceted, if monk is available click the monk. | |
if(monk.isOnScreen() && monk != null){ | |
getMouse().move(monk); | |
sleep(10, 60); | |
getMouse().click(); | |
sleep(10, 60); | |
} | |
} | |
return Calculations.random(500, 2008); // wait .5 - 2 seconds before repeated the loop | |
} | |
private void antiBan(){ | |
int rando = Calculations.random(1, 100); | |
switch(rando){ | |
case 1: getCamera().rotateToPitch(Calculations.random(350, 383)); | |
log("Anti ban activated"); | |
break; | |
case 2: getCamera().rotateToYaw(Calculations.random(1418, 1600)); | |
log("Anti ban activated"); | |
break; | |
case 3: getCamera().rotateToYaw(Calculations.random(433, 675)); | |
log("Anti ban activated"); | |
break; | |
default: | |
} | |
} | |
@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.draw(p2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment