Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.util.Map;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Bank;
- import org.rsbot.script.Calculations;
- import org.rsbot.script.Constants;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSItemTile;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.event.events.ServerMessageEvent;
- @ScriptManifest(authors = { "SpeedWing" }, category = "Runecraft", name = "RuneSpeed", version = 1.0, description = "<html>\n"
- + "<body style='font-family: Calibri; color:white; padding: 0px; text-align: center; background-color: black;'>"
- + "<h2>"
- + "RuneSpeed 1.0"
- + "</h2>\n"
- + "Author: SpeedWing"
- + "<br><br>\n"
- + "Start this script in The Bank that belongs to the altar"
- + "<br><br>\n"
- + "Select the Rune to Craft "
- + "<select name=\"type\"><option>Air<option>Mind<option>Water<option>Earth<option>Fire<option>Body</select>")
- public class RuneSpeed extends Script implements PaintListener, ServerMessageListener {
- private final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- /////////
- //items//
- /////////
- //runes
- int essence = 1436;
- int Air = 556;
- int Earth = 557;
- int Fire = 554;
- int Water = 555;
- int Mind = 558;
- int Body = 559;
- int AllDone;
- int Rune;
- //Tiara
- int Tiara;
- int AirTiara = 5527;
- int EarthTiara = 5535;
- int FireTiara = 5537;
- int WaterTiara = 5531;
- int MindTiara = 5529;
- int BodyTiara = 5533;
- ///////////
- //objects//
- ///////////
- int CurBank;
- int CurOutside;
- int CurAltar;
- int ExitPortal = 2465;
- //air
- int AirBankID = 11402;
- int AirOutsideID = 2452;
- int AirAltarID = 2478;
- //////////
- //states//
- //////////
- boolean banking;
- boolean bankwalk;
- boolean altarwalk;
- boolean crafting;
- boolean getessence;
- boolean grabitems;
- boolean inbank;
- boolean exitaltar;
- /////////
- //paths//
- /////////
- RSTile[] ToAltar;
- RSTile[] ToBank;
- //air
- RSTile[] AirAltar = {new RSTile(3185, 3436), new RSTile(3184, 3429), new RSTile(3174, 3429),
- new RSTile(3168, 3429), new RSTile(3164, 3424), new RSTile(3159, 3420), new RSTile(3155, 3417),
- new RSTile(3147, 3416), new RSTile(3143, 3412), new RSTile(3136, 3408), new RSTile(3129, 3407)};
- RSTile[] AirBank = {new RSTile(3129, 3407), new RSTile(3136, 3408), new RSTile(3143, 3412),
- new RSTile(3147, 3416), new RSTile(3155, 3417), new RSTile(3159, 3420), new RSTile(3164, 3424),
- new RSTile(3168, 3429), new RSTile(3184, 3429), new RSTile(3185, 3436)};
- //for paint TODO
- long startTime = System.currentTimeMillis();
- long expraise;
- int startLvl = skills.getCurrentSkillLevel(Constants.STAT_RUNECRAFTING);
- public int loop() {
- cameraheight();
- if (banking == true){
- if (openBank(CurBank)){
- banking = false;
- inbank = true;
- return (random(100,150));
- }
- }
- if (inbank == true){
- if (bank.isOpen() == true){
- if (getInventoryCount() > 0 ){
- bank.depositAll();
- }
- inbank = false;
- getessence = true;
- return (random(200,250));
- }
- }
- if (getessence == true){
- if (getInventoryCount(essence) != 0 ){
- getessence = false;
- altarwalk = true;//start walking to altar
- }
- if (getInventoryCount(essence) == 0 && getessence == true){
- bank.atItem(essence, "Withdraw-All");
- return (random(700,760));
- }
- return (random(200,250));
- }
- if (altarwalk == true){
- if (getInventoryCount(essence) == 0){
- banking = true;
- altarwalk = false;
- }
- intoAltar();
- walkPath(ToAltar,false);
- return (random(200,220));
- }
- if (crafting == true && getMyPlayer().getAnimation() == -1){
- craftrunes();
- return (random(1500,1600));
- }
- if (exitaltar == true && getInventoryCount(essence) == 0 && getMyPlayer().getAnimation() == -1){
- if (crafting == true){
- crafting = false;
- }
- leavealtar();
- return (random(1500,1600));
- }
- if (bankwalk == true && getInventoryCount(Rune) > 0){
- if (exitaltar == true){
- exitaltar = false;
- }
- walkPath(ToBank,false);
- /*RSObject bankObj = getNearestObjectByID(CurBank);
- if (bankObj != null && distanceTo(bankObj) <= 7){
- bankwalk = false;
- banking = true;
- }
- */
- return 500;
- }
- return random(100,200);
- }
- //checks the camera
- public void cameraheight(){
- if (Bot.getClient().getCamPosZ() > -1900 ){
- setCameraAltitude(true);
- }
- }
- //counts the amount of runes in the inventory
- public int InvCount(){
- return getInventoryCount(Rune);
- }
- //leave the altar
- private void leavealtar(){
- RSObject ExitPortalObj = getNearestObjectByID(ExitPortal);
- if (ExitPortalObj != null) {
- atObject(ExitPortalObj,"Enter Portal");
- bankwalk = true;
- }
- }
- //craft the runes
- private void craftrunes(){
- RSObject InsideAltar = getNearestObjectByID(CurAltar);
- if (InsideAltar != null) {
- atObject(InsideAltar,"Craft-Rune");
- exitaltar = true;
- }
- }
- //opens the altar
- private void intoAltar(){
- RSObject TheAltar = getNearestObjectByID(CurOutside);
- if (TheAltar != null && distanceTo(TheAltar) <= 4) {
- atObject(TheAltar,"Enter Mysterious ruins");
- crafting = true;
- altarwalk = false;
- }
- }
- //opens up bank
- private boolean openBank(final int obj) {
- final RSTile tile = getNearestObjectByID(obj).getLocation();
- final Point location = Calculations.tileToScreen(tile);
- if (pointOnScreen(location) && location != null) {
- if (!getMyPlayer().isMoving()) {
- if (onTile(tile, "Bank booth", "Use-quickly", 0.5, 0.5, 0)) {
- return true;
- }
- wait(random(500, 780));
- }
- } else {
- if (!getMyPlayer().isMoving()) {
- walkTile(tile);
- return false;
- }
- }
- return false;
- }
- public void serverMessageRecieved(final ServerMessageEvent arg0) {
- final String message = arg0.getMessage();
- /*if someone else already fights the target do not click it again
- if (message.contains("Someone else is fighting that."))
- {
- someonefightsthat = true;
- }
- */
- }
- public void onRepaint(Graphics g) {
- if(isLoggedIn())
- {
- if (startTime == 0)
- {
- startTime = System.currentTimeMillis();
- }
- long millis = System.currentTimeMillis() - startTime;
- final long hours = millis / (1000 * 60 * 60);
- millis -= hours * 1000 * 60 * 60;
- final long minutes = millis / (1000 * 60);
- millis -= minutes * 1000 * 60;
- final long seconds = millis / 1000;
- final int x = 294;// upper left x location
- int y = 4;// upper left y location
- final int xl = 222;// length
- final int yl = 53;// height
- g.setColor(new Color(0, 0, 0, 175));
- g.fillRect(x, y, xl, yl);
- g.setColor(new Color(255, 255, 255));
- g.drawRect(x, y, xl, yl);
- g.setFont(new Font("Calibri", Font.PLAIN, 13));
- g.drawString(properties.name()+ " " + properties.version(),x + 10, y += 15);
- g.drawString("Running for " + hours + ":" + minutes + ":" + seconds,x + 10, y += 15);
- }
- }
- public boolean onTile(final RSTile tile, final String search,
- final String action, final double dx, final double dy,
- final int height) {
- if (!tile.isValid()) {
- return false;
- }
- Point checkScreen;
- checkScreen = Calculations.tileToScreen(tile, dx, dy, height);
- if (!pointOnScreen(checkScreen)) {
- walkTile(tile);
- wait(random(340, 1310));
- }
- try {
- Point screenLoc;
- for (int i = 0; i < 30; i++) {
- screenLoc = Calculations.tileToScreen(tile, dx, dy, height);
- if (!pointOnScreen(screenLoc)) {
- return false;
- }
- if (getMenuItems().get(0).toLowerCase().contains(
- search.toLowerCase())) {
- break;
- }
- if (getMouseLocation().equals(screenLoc)) {
- break;
- }
- moveMouse(screenLoc);
- }
- if (getMenuItems().get(0).toLowerCase().contains(
- action.toLowerCase())) {
- clickMouse(true);
- return true;
- } else {
- clickMouse(false);
- return atMenu(action);
- }
- } catch (final Exception e) {
- e.printStackTrace();
- return false;
- }
- }
- private void walkPath(final RSTile[] path, final boolean reverse) {
- if (!reverse) {
- if (!getMyPlayer().isMoving()
- || distanceTo(getDestination()) <= random(4, 7)) {
- walkPathMM(randomizePath(path, 2, 2), 17);
- }
- } else {
- if (!getMyPlayer().isMoving()
- || distanceTo(getDestination()) <= random(4, 7)) {
- walkPathMM(randomizePath(reversePath(path), 2, 2), 17);
- }
- }
- }
- private void walkTile(final RSTile tile) {
- final Point screen = Calculations.tileToScreen(tile);
- if (pointOnScreen(screen)) {
- moveMouse(screen, 5, 5);
- onTile(tile, "here", "Walk", 0.5, 0.5, 0);
- } else {
- walkTileMM(tile);
- }
- }
- public boolean onStart(Map<String, String> args) {
- banking = true;
- bankwalk = false;
- altarwalk = false;
- crafting = false;
- if (args.get("type").equals("Air")) {
- ToAltar = AirAltar;
- ToBank = AirBank;
- Rune = Air;
- Tiara = AirTiara;
- CurBank = AirBankID;
- CurOutside = AirOutsideID;
- CurAltar = AirAltarID;
- }
- /*
- if (args.get("type").equals("Mind")) {
- ToAltar = MindAltar;
- ToBank = MindBank;
- Rune = Mind;
- Tiara = MindTiara;
- CurBank = MindBankID;
- CurOutside = MindOutsideID;
- CurAltar = MindAltarID;
- }
- if (args.get("type").equals("Water")) {
- ToAltar = WaterAltar;
- ToBank = WaterBank;
- Rune = Water;
- Tiara = WaterTiara;
- CurBank = WaterBankID;
- CurOutside = WaterOutsideID;
- CurAltar = WaterAltarID;
- }
- if (args.get("type").equals("Earth")) {
- ToAltar = EarthAltar;
- ToBank = EarthBank;
- Rune = Earth;
- Tiara = EarthTiara;
- CurBank = EarthBankID;
- CurOutside = EarthOutsideID;
- CurAltar = EarthAltarID;
- }
- if (args.get("type").equals("Fire")) {
- ToAltar = FireAltar;
- ToBank = FireBank;
- Rune = Fire;
- Tiara = FireTiara;
- CurBank = FireBankID;
- CurOutside = FireOutsideID;
- CurAltar = FireAltarID;
- }
- if (args.get("type").equals("Body")) {
- ToAltar = BodyAltar;
- ToBank = BodyBank;
- Rune = Body;
- Tiara = BodyTiara;
- CurBank = BodyBankID;
- CurOutside = BodyOutsideID;
- CurAltar = BodyAltarID;
- }
- */
- return true;
- }
- public void onFinish() {
- //onfinish code
- }
- }
Add Comment
Please, Sign In to add comment