Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.util.Map;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.event.listeners.PaintListener;
- 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.wrappers.RSWeb;
- import org.rsbot.script.web.*;
- @ScriptManifest(authors = "NEXBot", name = "BananaOwner", version = 1.4, description = "Start by the deposit box in Port Sarim. Banks Bananas, and picks them.")
- public class BananaOwner extends Script implements PaintListener {
- long Time = System.currentTimeMillis();
- int officerID = 380;
- int[] TreesId = { 2073, 2074, 2075, 2076, 2077 };
- int Bannana = 1963;
- int TheDude = 378;
- int GangPlank = 2084;
- int GangPlankMofo = 2082;
- int Deposit = 36788;
- int BananasOwned = 0;
- int BananasOwned2 = 0;
- int Profit = 0;
- int Price = 81;
- String ActionString="NULL";
- RSTile randomplaces = new RSTile(2920, 3060, 0);
- RSTile bann2 = new RSTile(3048, 3236, 0);
- RSTile TheBox = new RSTile(3048, 3236, 0);
- RSTile DudeKaramj = new RSTile(2954, 3147, 0);
- RSTile DudeToKaramj = new RSTile(2954, 3147, 0);
- RSTile DropOff = new RSTile(3046, 3236, 0);
- RSTile TheKaramjThing = new RSTile(2925, 3157, 0);
- RSTile SeaMan = new RSTile(3028, 3218, 0);
- RSTile TheNext = new RSTile(3027, 3215, 0);
- RSTile TheNexter = new RSTile(3038, 3231, 0);
- RSTile Retrace = new RSTile(2920, 3163, 0);
- public boolean onStart(){
- ActionString = "Starting...";
- log("Hello Nelson.");
- return true;
- }
- //private/publics:
- private void PickBan() {
- RSObject ban = objects.getNearest(TreesId);
- if (ban.isOnScreen()) {
- BananasOwned2 = inventory.getCount(Bannana);
- ActionString = "Picking bananas";
- ban.doAction("Pic");
- sleep(300);
- }
- if (ActionString.equals("Looking for bananas")) {
- RSObject bann = objects.getNearest(TreesId);
- camera.turnTo(bann);
- }
- if (!ban.isOnScreen()) {
- ActionString = "Looking for bananas";
- }
- }
- private void CameraTurn() {
- ActionString = "Turning camera";
- RSNPC Thresnorr = npcs.getNearest(TheDude);
- camera.turnTo(Thresnorr);
- }
- private void CameraTurn2() {
- ActionString = "Turning camera";
- RSNPC ZE = npcs.getNearest(officerID);
- camera.turnTo(ZE);
- }
- private boolean KarmDudePlaceAREA(){
- RSArea area = new RSArea(new RSTile(2917, 3142), new RSTile(2958, 3155));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean KarmDudePlaceAccuAREA(){
- RSArea area = new RSArea(new RSTile(2949, 3146), new RSTile(2959, 3151));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean ShipAREA(){
- RSArea area = new RSArea(new RSTile(3032, 3212, 1), new RSTile(3036, 3224, 1));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean SeaGuyArea(){
- RSArea area = new RSArea(new RSTile(3026, 3212), new RSTile(3029, 3225));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean Dock(){
- RSArea area = new RSArea(new RSTile(3026, 3217), new RSTile(3044, 3236));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean DepositBox(){
- RSArea area = new RSArea(new RSTile(3043, 3234), new RSTile(3051, 3237));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean TREESAREA(){
- RSArea area = new RSArea(new RSTile(2891, 3144), new RSTile(2936, 3175));
- return area.contains(getMyPlayer().getLocation());
- }
- private boolean BANKAREA() {
- RSArea area = new RSArea(new RSTile(3154,3479), new RSTile (3176,3497));
- return area.contains(getMyPlayer().getLocation());
- }
- //on finish
- public void onFinish(){
- ActionString = "Bye!";
- log("Goodbye.");
- }
- @Override
- public int loop() {
- mouse.setSpeed(5);
- if (Dock() && inventory.isFull()){
- ActionString = "Going to bank yo";
- RSWeb ToDeposit = web.getWeb(getMyPlayer().getLocation(), TheBox);
- ToDeposit.step();
- }
- if (SeaGuyArea() && !inventory.isFull()){
- sleep(3000);
- CameraTurn();
- RSNPC Thresnor = npcs.getNearest(TheDude);
- if (Thresnor.isOnScreen()) {
- ActionString = "Paying a fare to Karamja";
- Thresnor.interact("pay-fare");
- ActionString = "Making sure you paid";
- Thresnor.interact("pay-fare");
- Profit = BananasOwned * Price - 30;
- ActionString = "Looking for a gangplank";
- sleep(random(10000,15000));
- }
- else if (!Thresnor.isOnScreen()) {
- ActionString = "Dude, I can't find Thresnor, waiting..";
- sleep(4000);
- }
- }
- if (Dock() && !inventory.isFull()){
- ActionString = "Walking to the sea dude";
- RSWeb ToSeaGuy = web.getWeb(getMyPlayer().getLocation(), SeaMan);
- ToSeaGuy.step();
- }
- if (TREESAREA() && inventory.isFull()) {
- BananasOwned = BananasOwned + BananasOwned2;
- BananasOwned2 = 0;
- ActionString = "Walking to sea dude";
- RSWeb ToDude1 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
- ToDude1.step();
- }
- if (KarmDudePlaceAREA() && !inventory.isFull()){
- ActionString = "To the trees";
- RSWeb ToTheTrees = web.getWeb(getMyPlayer().getLocation(), TheKaramjThing);
- ToTheTrees.step();
- sleep(4000);
- }
- if (KarmDudePlaceAREA() && inventory.isFull()){
- ActionString = "Going to the dude";
- RSWeb ToDude5 = web.getWeb(getMyPlayer().getLocation(), DudeKaramj);
- ToDude5.step();
- }
- if (KarmDudePlaceAccuAREA() && inventory.isFull()){
- sleep(random(2000,3000));
- ActionString = "Turning camera";
- CameraTurn2();
- RSNPC TheDudtre = npcs.getNearest(officerID);
- if (TheDudtre.isOnScreen()) {
- ActionString = "Paying";
- TheDudtre.doAction("pay-fare");
- ActionString = "Making sure you paid";
- TheDudtre.doAction("pay-fare");
- ActionString = "Looking for a gangplank";
- sleep(random(10000,15000));
- }
- else if (!TheDudtre.isOnScreen()) {
- ActionString = "Looking for the officer..";
- sleep(2000);
- }
- else {
- ActionString = "Re-routing";
- CameraTurn2();
- RSWeb ToNext22 = web.getWeb(getMyPlayer().getLocation(), TheNexter);
- ToNext22.step();
- CameraTurn2();
- if (TheDudtre.isOnScreen()) {
- ActionString = "Paying";
- TheDudtre.doAction("pay-fare");
- ActionString = "Making sure you paid";
- TheDudtre.doAction("pay-fare");
- Profit = BananasOwned * Price - 30;
- ActionString = "Looking for a gangplank";
- sleep(random(10000,15000));
- }
- }
- }
- if (DepositBox() && inventory.isFull()){
- sleep(random(4000,5000));
- RSObject Box = objects.getNearest(Deposit);
- ActionString = "Depositing";
- Box.interact("deposit");
- sleep(random(2000,3000));
- bank.deposit(Bannana, 27);
- sleep(1000);
- //sleep(random(1000, 2000));
- //ActionString = "Closing bank";
- //bank.close();
- //sleep(random(1000,2000));
- ActionString = "Going to the dude";
- RSWeb ToNext = web.getWeb(getMyPlayer().getLocation(), TheNext);
- ToNext.step();
- }
- if (DepositBox() && !inventory.isFull()){
- ActionString = "Going to the dude";
- RSWeb ToNext = web.getWeb(getMyPlayer().getLocation(), TheNext);
- ToNext.step();
- }
- if (TREESAREA() && !inventory.isFull()) {
- ActionString = "Picking bananas";
- RSWeb ToTheRandoms = web.getWeb(getMyPlayer().getLocation(), randomplaces);
- RSWeb Retracer = web.getWeb(getMyPlayer().getLocation(), Retrace);
- PickBan();
- if (ActionString.equals("Looking for bananas")) {
- if (Retracer != null && !Retracer.finished()) {
- if (!getMyPlayer().isMoving()
- || calc.distanceTo(walking.getDestination()) < 4) {
- try {
- Retracer.step();
- sleep(7000);
- } catch (Exception ignored) {
- }
- }
- }
- }
- }
- else {
- try {
- RSObject Gangplank8 = objects.getNearest(GangPlankMofo);
- if (Gangplank8.isOnScreen()) {
- Gangplank8.interact("cross");
- sleep(random(2000,3000));
- }
- } catch (Exception ignored) {
- }
- try {
- RSObject Gangplank9 = objects.getNearest(GangPlank);
- if (Gangplank9.isOnScreen()) {
- Gangplank9.interact("cross");
- sleep(random(2000,3000));
- }
- } catch (Exception ignored) {
- }
- }
- return (random(50, 200));
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(255, 255, 255);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(230, 227, 179);
- private final Color color4 = new Color(224, 8, 0);
- private final Color color5 = new Color(51, 51, 255);
- private final Color color6 = new Color(1, 1, 1);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 15);
- public void onRepaint(Graphics g1) {
- if (game.isLoggedIn()) {
- long Mill = System.currentTimeMillis() - Time;
- long Hrs = Mill / (1000 * 60 * 60);
- Mill -= Hrs * (1000 * 60 * 60);
- long Min = Mill / (1000 * 60);
- Mill -= Min * (1000 * 60);
- long Sec = Mill / 1000;
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(10, 458, 139, 15);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(10, 458, 139, 15);
- g.setColor(color3);
- g.fillRect(9, 346, 489, 108);
- g.setColor(color2);
- g.drawLine(500, 458, 515, 471);
- g.setColor(color4);
- g.fillRect(152, 459, 346, 14);
- g.setColor(color2);
- g.drawRect(152, 459, 346, 14);
- g.setFont(font1);
- g.setColor(color5);
- g.drawString("NEXBots Banana Owner V1.4", 305, 453);
- g.drawString("Current action:", 306, 410);
- g.setColor(color6);
- g.drawString("Run time:", 14, 364);
- g.drawString(Hrs+":"+Min+":"+Sec, 83, 365);
- g.setColor(color4);
- g.drawString(ActionString, 307, 426);
- g.setColor(color5);
- g.drawString("Bananas Owned since first full inventory: " + BananasOwned, 13, 389);
- g.drawString("Profit: " + Profit, 13, 420);
- }
- }
- }
Add Comment
Please, Sign In to add comment