Advertisement
Guest User

Untitled

a guest
Sep 19th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 7.87 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.Map;
  3. import org.rsbot.script.Script;
  4. import org.rsbot.script.ScriptManifest;
  5. import org.rsbot.event.listeners.PaintListener;
  6. import org.rsbot.script.wrappers.RSObject;
  7. import org.rsbot.script.wrappers.RSTile;
  8. import org.rsbot.script.wrappers.RSArea;
  9. import org.rsbot.script.wrappers.RSNPC;
  10. import org.rsbot.script.wrappers.RSWeb;
  11.  
  12. @ScriptManifest(authors = "NEXBot", name = "BananaOwner", version = 1.0, description = "Banks Bannanas, and picks them")
  13. public class BananaOwner extends Script implements PaintListener {
  14.     long Time = System.currentTimeMillis();
  15.     int officerID = 380;
  16.     int[] TreesId = { 2073, 2074, 2075, 2076, 2077 };
  17.     int Bannana = 1963;
  18.     int TheDude = 378;
  19.     int GangPlank = 2084;
  20.     int GangPlankMofo = 2082;
  21.     int Deposit = 36788;
  22.     int BananasOwned = 0;
  23.     int BananasOwned2 = 0;
  24.     String ActionString="NULL";
  25.     RSTile TheBox = new RSTile(3048, 3236, 0);
  26.     RSTile DudeKaramj = new RSTile(2954, 3147, 0);
  27.     RSTile DudeToKaramj = new RSTile(2954, 3147, 0);
  28.     RSTile DropOff = new RSTile(3046, 3236, 0);
  29.     RSTile TheKaramjThing = new RSTile(2925, 3157, 0);
  30.     RSTile SeaMan = new RSTile(3028, 3218, 0);
  31.     RSTile TheNext = new RSTile(3038, 3235, 0);
  32.     RSTile TheNexter = new RSTile(3038, 3231, 0);
  33.     public boolean onStart(){
  34.         ActionString = "Starting...";
  35.         log("Hello");
  36.         return true;
  37.     }
  38.     //private/publics:
  39.     private void PickBan() {
  40.         RSObject ban = objects.getNearest(TreesId);
  41.         if (ban != null && getMyPlayer().getAnimation() == -1) {
  42.             BananasOwned2 = inventory.getCount(Bannana);
  43.             ActionString = "Picking banana";
  44.             ban.doAction("Pic");
  45.         }
  46.         else {
  47.             ActionString = "Looking for bananas";
  48.         }
  49.     }
  50.     private void CameraTurn() {
  51.         ActionString = "Turning camera";
  52.         RSNPC Thresnorr = npcs.getNearest(TheDude);
  53.         camera.turnTo(Thresnorr);
  54.     }
  55.     private void CameraTurn2() {
  56.         ActionString = "Turning camera";
  57.         RSNPC ZE = npcs.getNearest(officerID);
  58.         camera.turnTo(ZE);
  59.     }
  60.     private boolean KarmDudePlaceAREA(){
  61.         RSArea area = new RSArea(new RSTile(2917, 3142), new RSTile(2958, 3155));
  62.         return area.contains(getMyPlayer().getLocation());
  63.     }
  64.     private boolean KarmDudePlaceAccuAREA(){
  65.         RSArea area = new RSArea(new RSTile(2949, 3146), new RSTile(2959, 3151));
  66.         return area.contains(getMyPlayer().getLocation());
  67.     }
  68.     private boolean ShipAREA(){
  69.         RSArea area = new RSArea(new RSTile(3032, 3212, 1), new RSTile(3036, 3224, 1));
  70.         return area.contains(getMyPlayer().getLocation());
  71.     }
  72.     private boolean SeaGuyArea(){
  73.         RSArea area = new RSArea(new RSTile(3026, 3212), new RSTile(3029, 3225));
  74.         return area.contains(getMyPlayer().getLocation());
  75.     }
  76.     private boolean Dock(){
  77.         RSArea area = new RSArea(new RSTile(3026, 3217), new RSTile(3044, 3236));
  78.         return area.contains(getMyPlayer().getLocation());
  79.     }
  80.     private boolean DepositBox(){
  81.         RSArea area = new RSArea(new RSTile(3043, 3234), new RSTile(3051, 3237));
  82.         return area.contains(getMyPlayer().getLocation());
  83.     }
  84.     private boolean TREESAREA(){
  85.         RSArea area = new RSArea(new RSTile(2905, 3153), new RSTile(2936, 3175));
  86.         return area.contains(getMyPlayer().getLocation());
  87.     }
  88.     private boolean BANKAREA() {
  89.         RSArea area = new RSArea(new RSTile(3154,3479), new RSTile (3176,3497));
  90.         return area.contains(getMyPlayer().getLocation());
  91.     }
  92.  
  93.     //on finish
  94.     public void onFinish(){
  95.         ActionString = "Bye!";
  96.         log("Goodbye.");
  97.     }
  98.     @Override
  99.     public int loop() {
  100.         if (Dock() && inventory.isFull()){
  101.             ActionString = "Going to bank yo";
  102.             RSWeb ToDeposit = web.getWeb(getMyPlayer().getLocation(), TheBox);
  103.             ToDeposit.step();
  104.         }
  105.         if (SeaGuyArea() && !inventory.isFull()){
  106.             sleep(3000);
  107.             CameraTurn();
  108.             RSNPC Thresnor = npcs.getNearest(TheDude);
  109.             if (Thresnor.isOnScreen()) {
  110.                 ActionString = "Paying a fare to Karamja";
  111.                 Thresnor.interact("pay-fare");
  112.                 ActionString = "Looking for a gangplank";
  113.                 sleep(random(14000,17000));
  114.                 RSObject Gangplank2 = objects.getNearest(GangPlankMofo);
  115.                 ActionString = "Crossing the plank";
  116.                 Gangplank2.interact("cross");
  117.             }
  118.         }
  119.         if (Dock() && !inventory.isFull()){
  120.             ActionString = "Walking to the sea dude";
  121.             RSWeb ToSeaGuy = web.getWeb(getMyPlayer().getLocation(), SeaMan);
  122.             ToSeaGuy.step();
  123.         }
  124.         if (TREESAREA() && inventory.isFull()) {
  125.             BananasOwned = BananasOwned + BananasOwned2;
  126.             BananasOwned2 = 0;
  127.             ActionString = "Walking to sea dude";
  128.             RSWeb ToDude1 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
  129.             ToDude1.step();
  130.         }
  131.         if (KarmDudePlaceAREA() && !inventory.isFull()){
  132.             ActionString = "To the trees";
  133.             RSWeb ToTheTrees = web.getWeb(getMyPlayer().getLocation(), TheKaramjThing);
  134.             ToTheTrees.step();
  135.         }
  136.         if (KarmDudePlaceAREA() && inventory.isFull()){
  137.             ActionString = "Going to the dude";
  138.             RSWeb ToDude5 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
  139.             ToDude5.step();
  140.         }
  141.         if (KarmDudePlaceAccuAREA() && inventory.isFull()){
  142.             sleep(random(4000,5000));
  143.             ActionString = "Turning camera";
  144.             CameraTurn2();
  145.             RSNPC TheDudtre = npcs.getNearest(officerID);
  146.             if (TheDudtre.isOnScreen()) {
  147.                 ActionString = "Paying";
  148.                 TheDudtre.doAction("pay-fare");
  149.                 ActionString = "Looking for a gangplank";
  150.                 sleep(random(14000,17000));
  151.                 RSObject Gangplank1 = objects.getNearest(GangPlank);
  152.                 ActionString = "Crossing the plank";
  153.                 Gangplank1.interact("cross");
  154.             }
  155.             else {
  156.                 ActionString = "Re-routing";
  157.                 RSWeb ToNext22 = web.getWeb(getMyPlayer().getLocation(), TheNexter);
  158.                 ToNext22.step();
  159.             }
  160.         }
  161.         if (DepositBox() && inventory.isFull()){
  162.             sleep(random(1000,2000));
  163.             RSObject Box = objects.getNearest(Deposit);
  164.             ActionString = "Depositing";
  165.             Box.interact("deposit");
  166.             sleep(random(4000, 6000));
  167.             bank.deposit(Bannana, 27);
  168.             sleep(random(1000, 2000));
  169.             ActionString = "Closing bank";
  170.             bank.close();
  171.             sleep(random(1000,2000));
  172.             ActionString = "Going to the dude";
  173.             RSWeb ToNext = web.getWeb(getMyPlayer().getLocation(), TheNext);
  174.             ToNext.step();
  175.         }
  176.         if (TREESAREA() && !inventory.isFull()) {
  177.             ActionString = "Picking bananas";
  178.             PickBan();
  179.         }
  180.         return (random(300, 950));
  181.     }
  182.     //START: Code generated using Enfilade's Easel
  183.     private final Color color1 = new Color(255, 255, 255);
  184.     private final Color color2 = new Color(0, 0, 0);
  185.     private final Color color3 = new Color(230, 227, 179);
  186.     private final Color color4 = new Color(224, 8, 0);
  187.     private final Color color5 = new Color(51, 51, 255);
  188.     private final Color color6 = new Color(1, 1, 1);
  189.  
  190.     private final BasicStroke stroke1 = new BasicStroke(1);
  191.  
  192.     private final Font font1 = new Font("Arial", 0, 15);
  193.  
  194.     public void onRepaint(Graphics g1) {
  195.         if (game.isLoggedIn()) {
  196.             long Mill = System.currentTimeMillis() - Time;
  197.             long Hrs = Mill / (1000 * 60 * 60);
  198.             Mill -= Hrs * (1000 * 60 * 60);
  199.             long Min = Mill / (1000 * 60);
  200.             Mill -= Min * (1000 * 60);
  201.             long Sec = Mill / 1000;
  202.             Graphics2D g = (Graphics2D)g1;
  203.             g.setColor(color1);
  204.             g.fillRect(10, 458, 139, 15);
  205.             g.setColor(color2);
  206.             g.setStroke(stroke1);
  207.             g.drawRect(10, 458, 139, 15);
  208.             g.setColor(color3);
  209.             g.fillRect(9, 346, 489, 108);
  210.             g.setColor(color2);
  211.             g.drawLine(500, 458, 515, 471);
  212.             g.setColor(color4);
  213.             g.fillRect(152, 459, 346, 14);
  214.             g.setColor(color2);
  215.             g.drawRect(152, 459, 346, 14);
  216.             g.setFont(font1);
  217.             g.setColor(color5);
  218.             g.drawString("NEXBots Banana Owner V1.1", 305, 453);
  219.             g.drawString("Current action:", 306, 410);
  220.             g.setColor(color6);
  221.             g.drawString("Run time:", 14, 364);
  222.             g.drawString(Hrs+":"+Min+":"+Sec, 83, 365);
  223.             g.setColor(color4);
  224.             g.drawString(ActionString, 307, 426);
  225.             g.setColor(color5);
  226.             g.drawString("Bananas Owned since last full inventory: " + BananasOwned, 13, 389);
  227.         }
  228.     }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement