Advertisement
Guest User

Untitled

a guest
May 22nd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.07 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import com.quirlion.script.*;
  4. import com.quirlion.script.types.*;
  5.  
  6. //_Collin
  7. //Version 0.0.1
  8. //only use bronze
  9.  
  10. public class lumbridgePower extends Script {
  11.  
  12.     public int[] treeIDs = new int[] { 1276, 1278 };
  13.     boolean walkback = false, sold = false;
  14.     int theStatusATM = 0;
  15.  
  16.     public String theStatus = "Start of script.";
  17.     public String location = "";
  18.     private Location[] lumbridgeToShop = new Location[] {
  19.         new Location(3222,3221), new Location(3234,3219), new Location(3236,3211),
  20.         new Location(3236,3204), new Location(3230,3203) };
  21.        
  22.     private Location[] lumbridgeToTrees = new Location[] {
  23.         new Location(3222,3221), new Location(3234,3219), new Location(3230,3231),
  24.         new Location(3223,3237), new Location(3220,3245), new Location(3210,3246),
  25.         new Location(3198,3247), new Location(3190,3244), new Location(3186,3245)};
  26.        
  27.     private Location[] treesToStore = new Location[] {
  28.         new Location(3193,3245), new Location(3202,3248), new Location(3214,3241)};
  29.        
  30.     private Location[] storeToTrees = new Location[] {
  31.         new Location(3214,3243), new Location(3202,3248), new Location(3193,3245)};
  32.  
  33.     public int loop() {
  34.         if(players.getCurrent().isMoving()) return 500;
  35.         if(!walkback) theStatusATM = status();
  36.         switch(theStatusATM) {
  37.             case 0: {
  38.                 declareStatus("Checking for axe.");
  39.                 if(!equipment.isItemEquipped(1351)) {
  40.                     declareStatus("Missing axe. Walking to shop.");
  41.                     players.getCurrent().walkPathMM(lumbridgeToShop);
  42.                 } else {
  43.                     declareStatus("Walking to trees.");
  44.                     players.getCurrent().walkPathMM(lumbridgeToTrees);
  45.                 }
  46.             } break;
  47.             case 1: {
  48.                 declareStatus("Buying an axe.");
  49.                
  50.                 if(npcs.getNearestByID(519).click("Trade")) {
  51.                     declareStatus("Successful trade.");
  52.                     break;
  53.                 }
  54.             } break;
  55.             case 2: {
  56.                 if(inventory.getCount() == 28) {
  57.                     walkback = true;
  58.                     declareStatus("Inventory Full. Walking to store.");
  59.                     if(returnLocation() == 3) walkback = false;
  60.                     players.getCurrent().walkPathMM(treesToStore);
  61.                     sold = false;      
  62.                 } else {
  63.                     declareStatus("Chopping Trees.");
  64.                     if(players.getCurrent().getAnimation() == -1) {
  65.                         Thing tree = things.getNearest(treeIDs);
  66.                         tree.click("Chop");
  67.                     }
  68.                 }
  69.             } break;
  70.             case 3: { //520, 521
  71.                 //declareStatus("In shop.");
  72.                 if(sold) {
  73.                     walkback = true;
  74.                     players.getCurrent().walkPathMM(storeToTrees);
  75.                     if(returnLocation() == 2) walkback = false;
  76.                 } else {
  77.                     declareStatus("Selling Logs");
  78.                     if(interfaces.get(620,20) != null) {
  79.                         inventory.clickItem(1511,"Sell 50");
  80.                         sold = true;
  81.                     } else {
  82.                         declareStatus("Trading I guess");
  83.                         NPC shopKeeper = npcs.getNearestByName("Shopkeeper","Shop assistant");
  84.                         shopKeeper.click("Trade");
  85.                         return calculations.random(1000,2000);
  86.                     }  
  87.                 }
  88.             } break;
  89.         }
  90.         return calculations.random(500,1500);
  91.     }
  92.    
  93.     public void declareStatus(String s) {
  94.         if(!s.equals(theStatus)) {
  95.             theStatus = s;
  96.         }
  97.         switch(returnLocation()) {
  98.             case 1: location = "lumbridge"; break;
  99.             case 2: location = "forest"; break;
  100.             case 3: location = "shop"; break;
  101.             case 4: location = "axe shop"; break;
  102.             case 5: location = "no fuxing clue"; break;
  103.         }
  104.     }
  105.    
  106.     public int status() {
  107.         if(returnLocation() == 1) return 0;
  108.         if(returnLocation() == 4) return 1;
  109.         if(returnLocation() == 2) return 2;
  110.         if(returnLocation() == 3) return 3;
  111.         return 0;
  112.     }
  113.    
  114.     //1 is lumbriddge
  115.     //2 is trees
  116.     //3 is shop
  117.     //4 is axe shop
  118.     //5 is unknown
  119.     public int returnLocation() {
  120.         if(calculations.getDistanceTo(new Location(3221, 3219)) < 10) return 1;
  121.         if(calculations.getDistanceTo(new Location(3185, 3245)) < 15) return 2;
  122.         if(calculations.getDistanceTo(new Location(3214, 3241)) < 3) return 3;
  123.         if(calculations.getDistanceTo(new Location(3230, 3203)) < 4) return 4;
  124.         return 5;
  125.     }
  126.  
  127.     public void paint(Graphics g) {
  128.         g.setColor(new Color(0, 0, 0, 255));
  129.         g.drawString("Lumbridge Power", 26, 184);
  130.         g.drawString("Status: " + theStatus, 26, 199);
  131.         g.drawString("Location: " + location, 26, 220);
  132.     }  
  133. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement