Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.awt.*;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Script;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Bank;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.methods.Calculations;
- import org.rsbot.script.methods.GroundItems;
- import org.rsbot.script.wrappers.RSGroundItem;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.methods.Mouse;
- import org.rsbot.event.listeners.PaintListener;
- @ScriptManifest(authors = { "Brianpsv1" }, keywords = { "Money Making" }, name = "Anti-Dragon Shield Collector", version = 1.01, description = "A Anti-Dragon Shield Collector!")
- public class AntiDragonCollector extends Script implements PaintListener {
- public RSTile[] toNPC2 = { new RSTile(3208, 3320), new RSTile(3206, 3224), new RSTile(3206, 3229) };
- public RSTile[] toBank2 = { new RSTile(3208, 3323) };
- public RSTile[] toBank1 = { new RSTile(3206, 3224), new RSTile(3206, 3228) };
- public RSTile[] toNPC1 = { new RSTile(3207, 3222) };
- public RSTile[] goNPC = { new RSTile(3210, 3222) };
- public RSTile[] toDoor = { new RSTile(3206, 3222) };
- public RSArea NPCarea = new RSArea(new RSTile(3209, 3219), new RSTile(3212, 3225));
- public RSArea STAIRarea = new RSArea(new RSTile(3205, 3224), new RSTile(3207, 3228));
- public RSArea DoorArea = new RSArea(new RSTile(3206, 3220), new RSTile(3209, 3224));
- public long startTime = System.currentTimeMillis();
- int floor = 0;
- int count = 0;
- int duke = 741;
- int none = 0;
- int bankBooth = 36786;
- int notedShield = 1541;
- int unnotedShield = 1540;
- int downstairs = 36778;
- int upstairs = 36777;
- int opendoor = 36845;
- int closedoor = 36844;
- int banked = 0;
- public boolean onStart(){
- log("Brian's Anti-Dragon Shield Collector");
- startTime = System.currentTimeMillis();
- return true;
- }
- public void onRepaint(Graphics g) {
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- long minutes2 = minutes + (hours * 60);
- g.setColor(new Color(0, 0, 0, 154));
- g.fillRect(378, 304, 138, 34);
- g.setFont(new Font("Comic Sans MS", 0, 11));
- g.setColor(new Color(255, 0, 0));
- g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds , 383, 316);
- g.setColor(new Color(255, 255, 0));
- g.drawRect(378, 303, 139, 34);
- g.setFont(new Font("Comic Sans MS", 0, 11));
- g.setColor(new Color(255, 0, 0));
- g.drawString("Collected: " + banked, 384, 331);
- }
- public int loop(){
- try {
- if ( walking.getEnergy() > random(60,70)) {
- walking.setRun(true);
- }
- floor = game.getPlane();
- if(inventory.isFull()){
- } else {
- if( floor == 1) {
- if(count == 4) {
- RSGroundItem shield1 = groundItems.getNearest(notedShield);
- if (shield1 != null) {
- shield1.doAction("Take");
- }
- if(inventory.getCount() > 0) {
- count = 5;
- }
- return 1500;
- }
- if(count == 8) {
- // We Collected 10 shields so we should go bank :D
- // But first we pick them up.
- RSGroundItem shield1 = groundItems.getNearest(notedShield);
- RSGroundItem shield2 = groundItems.getNearest(unnotedShield);
- if (shield1 != null) {
- shield1.doAction("Take");
- } else if (shield2 != null) {
- shield2.doAction("Take");
- }
- if(shield1 == null && shield2 == null) {
- // We took all dropped sheild so we should go banking.
- RSObject checkDoor1 = objects.getNearest(opendoor);
- RSObject checkDoor2 = objects.getNearest(closedoor);
- RSObject theStairs = objects.getNearest(upstairs);
- if (checkDoor1 != null) {
- if ( DoorArea.contains(checkDoor1.getLocation())) {
- // Walk to Stairs
- if(calc.distanceTo(theStairs) < 3) {
- try {
- camera.turnToObject(theStairs);
- } catch (NullPointerException e) {
- }
- theStairs.doAction("Climb-up");
- } else {
- walking.walkPathMM(toBank1, 0 ,0);
- }
- }
- }
- if ( NPCarea.contains(getMyPlayer().getLocation())) {
- if (checkDoor2 != null) {
- if ( DoorArea.contains(checkDoor2.getLocation())) {
- try {
- camera.turnToObject(checkDoor2);
- } catch (NullPointerException e) {
- }
- checkDoor2.doAction("Open");
- // OpenDoor
- }
- }
- } else {
- if(calc.distanceTo(theStairs) < 3) {
- try {
- camera.turnToObject(theStairs);
- } catch (NullPointerException e) {
- }
- theStairs.doAction("Climb-up");
- } else {
- walking.walkPathMM(toBank1, 0 ,0);
- }
- }
- //
- }
- }
- if ( NPCarea.contains(getMyPlayer().getLocation())) {
- // Get Shield
- if(count == 8) {
- } else {
- if (!interfaces.getComponent(242, 6).isValid() && !interfaces.getComponent(519, 2).isValid() && !interfaces.getComponent(64, 5).isValid() && !interfaces.getComponent(65, 6).isValid() && !interfaces.getComponent(230, 2).isValid() && !interfaces.getComponent(241, 5).isValid()) {
- // Not Talking :(
- inventory.dropAllExcept(none);
- RSNPC DukeHaz = npcs.getNearest(duke);
- if (DukeHaz != null && DukeHaz.isOnScreen()) {
- DukeHaz.doAction("Talk-to");
- } else {
- camera.turnToCharacter(DukeHaz);
- }
- }
- if (interfaces.getComponent(242, 6).isValid()){
- interfaces.getComponent(242, 6).doAction("Continue");
- }
- if (interfaces.getComponent(519, 2).isValid()){
- interfaces.getComponent(519, 2).doAction("Continue");
- count = count + 1;
- banked++;
- sleep(300);
- inventory.dropAllExcept(none);
- }
- if (interfaces.getComponent(64, 5).isValid()){
- interfaces.getComponent(64, 5).doAction("Continue");
- }
- if (interfaces.getComponent(65, 6).isValid()){
- interfaces.getComponent(65, 6).doAction("Continue");
- }
- if (interfaces.getComponent(230, 2).isValid()){
- interfaces.getComponent(230, 2).doAction("Continue");
- }
- if (interfaces.getComponent(241, 5).isValid()){
- interfaces.getComponent(241, 5).doAction("Continue");
- }
- }
- } else {
- if(count == 8) {
- } else {
- RSObject checkDoor1 = objects.getNearest(opendoor);
- RSObject checkDoor2 = objects.getNearest(closedoor);
- if (checkDoor1 != null) {
- if ( DoorArea.contains(checkDoor1.getLocation())) {
- // Walk into Area
- walking.walkPathMM(goNPC, 0 ,0);
- }
- }
- if (checkDoor2 != null) {
- if ( DoorArea.contains(checkDoor2.getLocation())) {
- try {
- camera.turnToObject(checkDoor2);
- } catch (NullPointerException e) {
- }
- if(calc.distanceTo(checkDoor2) < 3) {
- // Open door
- checkDoor2.doAction("Open");
- } else {
- walking.walkPathMM(toDoor, 0 ,0);
- }
- }
- }
- }
- }
- }
- if ( floor == 2) {
- if (inventory.getCount() > 2) {
- RSObject theBank = objects.getNearest(bankBooth);
- if(calc.distanceTo(theBank) < 3) {
- if (!bank.isOpen()) {
- try {
- camera.turnToObject(theBank);
- } catch (NullPointerException e) {
- }
- theBank.doAction("Use-quickly");
- }
- if (bank.isOpen()) {
- bank.depositAllExcept(none);
- bank.setWithdrawModeToNote();
- bank.withdraw(1540, 1000000);
- bank.close();
- count = 0;
- }
- } else {
- RSTile goTheBank = new RSTile(theBank.getLocation().getX(), theBank.getLocation().getY());
- walking.walkTo(goTheBank);
- }
- } else {
- RSObject goDown = objects.getNearest(downstairs);
- if(goDown != null) {
- if(calc.distanceTo(goDown) < 3) {
- goDown.doAction("Climb-down");
- // Climb Down
- } else {
- walking.walkPathMM(toNPC2, 0 ,0);
- }
- }
- }
- }
- }
- } catch (NullPointerException e) {
- }
- return random(1400, 1500);
- }
- private void dropAll(){
- }
- public void onFinish(){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement