Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 29.35 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.GridBagConstraints;
  6. import java.awt.GridBagLayout;
  7. import java.awt.Insets;
  8. import java.awt.Point;
  9. import java.awt.event.ActionEvent;
  10. import java.awt.event.ActionListener;
  11. import java.awt.event.MouseEvent;
  12. import java.awt.event.MouseListener;
  13.  
  14. import java.io.File;
  15. import java.io.FileInputStream;
  16. import java.io.FileOutputStream;
  17.  
  18. import java.util.Properties;
  19.  
  20. import javax.swing.JButton;
  21. import javax.swing.JCheckBox;
  22. import javax.swing.JFrame;
  23. import javax.swing.JLabel;
  24. import javax.swing.JSeparator;
  25. import javax.swing.JTextField;
  26.  
  27. import org.rsbot.event.events.ServerMessageEvent;
  28. import org.rsbot.event.listeners.PaintListener;
  29. import org.rsbot.event.listeners.ServerMessageListener;
  30. import org.rsbot.script.Script;
  31. import org.rsbot.script.ScriptManifest;
  32. import org.rsbot.script.methods.Skills;
  33. import org.rsbot.script.util.Filter;
  34. import org.rsbot.script.wrappers.RSTile;
  35. import org.rsbot.script.wrappers.RSObject;
  36. import org.rsbot.script.wrappers.RSNPC;
  37. import org.rsbot.script.wrappers.RSArea;
  38. import org.rsbot.script.wrappers.RSItem;
  39. import org.rsbot.script.wrappers.RSComponent;
  40. import org.rsbot.util.GlobalConfiguration;
  41.  
  42. @ScriptManifest(name = "konzy's Master Stealer", authors = "konzy", keywords = "Thieving",
  43.         version = 0.7, description = "Master Farmer Thieving by konzy")
  44.        
  45. public class konzyMasterStealer extends Script implements PaintListener, ServerMessageListener , MouseListener
  46. {
  47.  
  48.       final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  49.  
  50.  
  51.         static final RSArea MARKET_AREA = new RSArea(new RSTile(3069, 3245), new RSTile(3086, 3258));
  52.         static final RSArea BANK_AREA = new RSArea(new RSTile(3092,3240),new RSTile(3097,3246));
  53.         static final RSArea WALK_AREA = new RSArea(new RSTile(3088,3247),new RSTile(3097,3250));
  54.         static final RSTile MARKET_TO_BANK[] = {new RSTile(3084,3249), new RSTile(3089,3249), new RSTile(3092,3248), new RSTile(3093,3245)};
  55.         static final RSTile MARKET_TILE = new RSTile(3080,3250);
  56.         static final RSTile BANK_TILE = new RSTile(3093,3244);
  57.         static final RSTile EXIT_TILE = new RSTile(3092,3249);
  58.         static final RSTile CENTRAL_TILE = new RSTile(3085,3249);
  59.         static final RSTile PATH_TO_BANK[] = {CENTRAL_TILE , BANK_TILE};
  60.         static final RSTile PATH_FROM_BANK[] = {EXIT_TILE , CENTRAL_TILE};
  61.        
  62.         static final int KEEP_ID_COUNT = 12;
  63.         static final int DROP_ID_COUNT = 32;
  64.         static final int DONT_DROP_ID_COUNT = 6;
  65.         static final int FARMER_ID = 2234;
  66.         static final int BOOTH_ID = 2213;
  67.         static final int STUNNED_ID = 424;
  68.         static final int GLOVES_OF_SILENCE = 10075;
  69.         static final int GLOVES_REQ_LVL = 54;
  70.        
  71.         static final int[] KEEP_ID = {
  72.             5100, 5295, 5296, 5298, 5299, 5300, 5301, 5302, 5303, 5304,
  73.             5321, 5323};
  74.         static final String KEEP_NAME[] = {
  75.             "impwurt", "anarr", "oadflax", "vantoe", "wuarm",
  76.             "napdragon", "adantine", "antadyme", "warf", "orstol",
  77.             "atermelon", "trawberry"};
  78.         static final int[] DONT_DROP_ID = {
  79.             617, 1733, 1734, 10115, 10076, GLOVES_OF_SILENCE
  80.         };
  81.         static final int[] DROP_ID = {
  82.             5319, 5307, 5305, 5322, 5099, 5310, 5308, 5102, 5294, 5309,
  83.             5101, 5096, 5324, 5306, 5291, 5103, 5292, 5097, 5281, 5098,
  84.             5105, 5106, 5280, 5297, 5311, 5104, 5293, 5318, 5282, 1993,
  85.             5320, 1937};
  86.  
  87.  
  88.  
  89.  
  90.    
  91.     //private boolean guiWait = true, guiExit;
  92.     private boolean dropSeeds = false;
  93.     private boolean failedPick = false;
  94.     private int profit = 0;
  95.     private int withdrawFood = 5;
  96.    
  97.     private int foodPrice = 0;
  98.     private int HP;
  99.     private int startLvl;
  100.     private int gainedLvls;
  101.     private int startXP = 0;
  102.     private int succeedPickpockets = 0;
  103.     private int failPickpockets = 0;
  104.     private int foodEaten = 0;
  105.     private long startTime;
  106.     private String status = "Starting Up";
  107.     private boolean  showPaint, startScript;
  108.     private int completeIDs[][] = new int[3][KEEP_ID_COUNT];
  109.     private int totalComplete = 0;
  110.     private RSItem carriedFood;
  111.     private RSNPC masterFarmer;
  112.     private boolean justAttacked = false;
  113.     private int foodID = 0;
  114.     private int glovesInBankCount = 0;
  115.     private boolean canWearGloves = false;
  116.     private int handID = GLOVES_OF_SILENCE;
  117.     private String lastMsg = "";
  118.    
  119.     @SuppressWarnings("static-access")
  120.     public boolean onStart() {
  121.         if(!game.isLoggedIn()) {
  122.             log("Start logged in.");
  123.             return false;
  124.         }
  125.        
  126.  
  127.         startScript = false;
  128.         konzyMasterStealerGUI gui = new konzyMasterStealerGUI();
  129.         while(!startScript) {
  130.             if(!gui.isVisible())
  131.                 return false;
  132.             sleep(100);
  133.         }
  134.         if(bank.isOpen())
  135.             bank.close();
  136.         if (skills.getRealLevel(Skills.HUNTER) >= GLOVES_REQ_LVL){
  137.             canWearGloves = true;
  138.             log("You can wear Gloves of Silence, checking if they are equipped");
  139.             handID = equipment.getItem(equipment.HANDS).getID();
  140.         }
  141.         if (withdrawFood > 25 || withdrawFood < 1){
  142.             log("You can only withdraw food between 1 and 25");
  143.             return false;
  144.         }
  145.         if(foodID == 0 && carriedFood == null){
  146.             log("Either start with food in your inventory or enter Food Override");
  147.             return false;
  148.         }
  149.         startTime = (int)System.currentTimeMillis();
  150.         startXP = skills.getCurrentExp(Skills.THIEVING);
  151.         startLvl = skills.getCurrentLevel(Skills.THIEVING);
  152.         showPaint = true;
  153.         return true;
  154.        
  155.     }
  156.    
  157.     private RSItem getFood(){
  158.         for(RSItem i : inventory.getItems()) {
  159.             if(i == null || i.getID() == -1)
  160.                 continue;
  161.             if (i.getComponent().getActions() == null || i.getComponent().getActions()[0] == null)
  162.                 continue;
  163.             if (i.getComponent().getActions()[0].contains("Eat")){
  164.                 return i;
  165.             }  
  166.         }
  167.         return null;
  168.     }
  169.  
  170.    
  171.       private void hoverFarmer(){
  172.           if(npcs.getNearest("Master Farmer").isValid()){
  173.               if(npcs.getNearest("Master Farmer").isOnScreen()){
  174.                   Point farmerScreenLoc = npcs.getNearest("Master Farmer").getScreenLocation();
  175.                   int x = mouse.getLocation().x;
  176.                   int y =  mouse.getLocation().y;
  177.                   int x2 = farmerScreenLoc.x;
  178.                   int y2 = farmerScreenLoc.y;
  179.                   int xdiff;
  180.                   int ydiff;
  181.                   if(x > x2)
  182.                       xdiff = x - x2;
  183.                   else
  184.                   xdiff = x2 - x;
  185.                   if(y > y2)
  186.                       ydiff = y - y2;
  187.                   else
  188.                   ydiff = y2 - y;
  189.                  
  190.                   if(ydiff > 75 || xdiff > 75)
  191.                   try{
  192.                       mouse.move(farmerScreenLoc);
  193.                   }catch (Exception e){}
  194.               }
  195.           }
  196.     }
  197.    
  198.       private int getCurrentLifepoint() {
  199.           if (interfaces.get(748).getComponent(8).getText() != null && interfaces.get(748).getComponent(8).isValid()) {
  200.               HP = Integer.parseInt(interfaces.get(748).getComponent(8).getText());
  201.               }
  202.             return HP;
  203.           }
  204.      
  205.     public boolean isHealthLow() {
  206.         int CurrHP = getCurrentLifepoint() / 10;
  207.         int RealHP = skills.getRealLevel(Skills.CONSTITUTION);
  208.         if (CurrHP <= random(RealHP / 2, RealHP / 1.5)) {
  209.             status = "Eating Food";
  210.             return true;
  211.         }
  212.         if (getMyPlayer().getHPPercent() <= 10) {
  213.             log.warning("HP less than 10% Logging out.");
  214.             game.logout(true);
  215.             stopScript(true);
  216.           }    
  217.         return false;
  218.     }
  219.    
  220.     private final Filter<RSNPC> npcFilter = new Filter<RSNPC>() {
  221.         public boolean accept(RSNPC t) {
  222.                 if(t.getName().equals("Master Farmer"))
  223.                     return false;
  224.             return (t.isValid() && t.isInCombat() && t.isInteractingWithLocalPlayer() && t.getHPPercent() != 0);
  225.         }
  226.     };
  227.  
  228.  
  229.    
  230.     public boolean gettingAttacked(){
  231.         RSNPC mGuard[] = npcs.getAll(npcFilter);
  232.         if (mGuard != null && getMyPlayer().isInCombat())
  233.         return true;
  234.    
  235.     return false;
  236.     }
  237.    
  238.     private boolean eatFood() {
  239.         for(int i = 0; i < 3; i++) {
  240.             if(!inventory.contains(foodID)){
  241.                 log("cant find food");
  242.                 break;
  243.             }
  244.             if(carriedFood.doAction("Eat")) {
  245.                 if (foodPrice == 0)
  246.                     foodPrice = grandExchange.getMarketPrice(foodID);
  247.                 profit -= foodPrice;
  248.                 return true;
  249.             }
  250.         }
  251.         return false;
  252.     }
  253.    
  254.     public boolean openBank() {
  255.         status = "Opening Bank";
  256.         if(!bank.isOpen()){
  257.             if (objects.getNearest(BOOTH_ID).isOnScreen()) {
  258.                 final RSObject bankBooth = objects.getNearest(BOOTH_ID);
  259.                 if (bankBooth != null) {
  260.                     bankBooth.doAction("Use-Quickly");
  261.                     }
  262.                 }
  263.             return false;
  264.             }
  265.         return true;
  266.     }
  267.    
  268.     public void dropJunkSeeds(){                   
  269.         if (inventory.containsOneOf(DROP_ID) && dropSeeds) {
  270.             status = "Dropping Seeds";
  271.             int dontDrop[] = new int[KEEP_ID_COUNT + DONT_DROP_ID_COUNT + 2];
  272.             int i;
  273.             for (i = 0; i < KEEP_ID_COUNT ; i++)
  274.                 dontDrop[i] = KEEP_ID[i];
  275.             while ((i - KEEP_ID_COUNT) < DONT_DROP_ID_COUNT){
  276.                 dontDrop[i] = DONT_DROP_ID[i - KEEP_ID_COUNT];
  277.                 i++;
  278.             }
  279.             dontDrop[i + 1] = foodID;
  280.               try {
  281.                 inventory.dropAllExcept(dontDrop);
  282.               } catch (Exception e) {}
  283.             }
  284.         }
  285.  
  286.  
  287.     @SuppressWarnings("static-access")
  288.     public int loop(){
  289.         antiBan(false);
  290.         if(isHealthLow()){
  291.             carriedFood = getFood();
  292.             eatFood();
  293.             return random(25, 50);
  294.         }
  295.         if (justAttacked && !BANK_AREA.contains(getMyPlayer().getLocation())){
  296.             status = "RUN AWAY!!!";
  297.             walking.setRun(true);
  298.             if(walking.walkPathMM(PATH_TO_BANK , 1 , 1)){
  299.                 antiBan(true);
  300.                 return random(3000, 5000);
  301.             }
  302.         }else
  303.             justAttacked = false;
  304.            
  305.     if(carriedFood == null || !inventory.contains(foodID) || inventory.isFull()){
  306.             if(!BANK_AREA.contains(getMyPlayer().getLocation())){
  307.                 status = "Walking To Bank";
  308.                 if(walking.walkPathMM(PATH_TO_BANK , 1 , 1)){}
  309.             }
  310.             else if(!bank.isOpen())
  311.                 openBank();
  312.             else if(inventory.getCount() >= 1){
  313.                 status = "Depositing";
  314.                 bank.depositAll();
  315.             } else if (foodID == 0 && game.isLoggedIn()) {
  316.                 log("Out of food! logging out...");
  317.                 sleep(random(4000, 5000));
  318.                 bank.close();
  319.                 game.logout(true);
  320.                 stopScript(true);
  321.             }else if (withdrawFood > inventory.getCount(foodID) ){
  322.                 status = "Withdrawing Food";
  323.                 int startingFood = inventory.getCount(foodID);
  324.                 try{
  325.                     if (withdrawFood - inventory.getCount(foodID) >= 10){
  326.                         if(bank.getItem(foodID).doAction("Withdraw-10")){}
  327.                     }else if (withdrawFood - inventory.getCount(foodID) >= 5 ){
  328.                         if(bank.getItem(foodID).doAction("Withdraw-5")){}
  329.                     }else if (withdrawFood == 1){
  330.                         if(bank.getItem(foodID).doAction("Withdraw-1")){}
  331.                     }
  332.                     sleep(random(1000 , 2000));
  333.                     int i = 0;
  334.                     while (startingFood == inventory.getCount(foodID) && i < 30){
  335.                         sleep(100);
  336.                         i++;
  337.                     }
  338.                 }catch (Exception e){}
  339.                 if(canWearGloves)
  340.                     glovesInBankCount = bank.getCount(GLOVES_OF_SILENCE);
  341.                 if(carriedFood == null){
  342.                     if(bank.close()){
  343.                         carriedFood = getFood();
  344.                         foodID = carriedFood.getID();
  345.                     }
  346.                 }
  347.             }          
  348.             return random(1500, 2000);
  349.         }//food getting end
  350.         if (canWearGloves){//glove handling
  351.             if(handID != GLOVES_OF_SILENCE){//if we dont have them on our hands
  352.                 if(inventory.getCount(GLOVES_OF_SILENCE) == 0){//get some from bank if none are in inventory
  353.                     if(!BANK_AREA.contains(getMyPlayer().getLocation())){
  354.                         status = "Walking To Bank for gloves";
  355.                         if(walking.walkPathMM(PATH_TO_BANK , 1 , 1)){}
  356.                         return random(1000,1250);
  357.                     }else if(!bank.isOpen()){
  358.                         openBank();
  359.                         glovesInBankCount = bank.getCount(GLOVES_OF_SILENCE);
  360.                         return random(1000 , 1250);
  361.                     }else if (glovesInBankCount > 0){
  362.                         status = "Withdrawing Gloves of Silence";
  363.                         log("Found Gloves of Silence in Bank");
  364.                         try{
  365.                             if(bank.getItem(GLOVES_OF_SILENCE).doAction("Withdraw-1"))
  366.                                 sleep(random(1000 , 2000));
  367.                             int i = 0;
  368.                                 while (inventory.getCount(GLOVES_OF_SILENCE) == 0 && i < 30){
  369.                                     sleep(250);
  370.                                     i++;
  371.                                 }
  372.                         }catch (Exception e){}
  373.                         glovesInBankCount = bank.getCount(GLOVES_OF_SILENCE);
  374.                         if(bank.close())
  375.                             antiBan(true);
  376.                         return random(1000, 2500);
  377.                     }
  378.                 }else{
  379.                     try {
  380.                         if(inventory.getItem(GLOVES_OF_SILENCE).doClick(true))
  381.                             handID = equipment.getItem(equipment.HANDS).getID();
  382.                         log("equipping gloves of silence ");
  383.                     } catch (Exception e) {log("Remove your gloves, how do you expect to wear your gloves of silence?");}
  384.                     return random(1000 , 1500);
  385.                 }
  386.             }
  387.         }
  388.  
  389.         if (BANK_AREA.contains(getMyPlayer().getLocation())){
  390.             status = "Walking Back To Market";
  391.             walking.walkPathMM(PATH_FROM_BANK);
  392.             return random(1000 , 1500);
  393.         }
  394.         if (!MARKET_AREA.contains(getMyPlayer().getLocation())){
  395.             walking.walkTileMM(MARKET_AREA.getNearestTile(getMyPlayer().getLocation()),1,1);
  396.             return random(1000 , 1500);
  397.         }else if (failedPick){
  398.                     status = "failed";
  399.                     if(isHealthLow()){
  400.                         carriedFood = getFood();
  401.                         eatFood();
  402.                         antiBan(true);
  403.                     }
  404.                     dropJunkSeeds();
  405.                     antiBan(true);
  406.                     hoverFarmer();
  407.                     failedPick = false;
  408.             }else
  409.                 try {
  410.                     masterFarmer = npcs.getNearest("Master Farmer");
  411.                     if(masterFarmer.isOnScreen()){
  412.                         status = "Pickpocketing!";
  413.                         masterFarmer.doAction("Pickpocket");
  414.                         antiBan(false);
  415.                         return random(250 , 400);
  416.             } else {
  417.                   status = "Walking to Farmer";
  418.                     walking.walkTo((walking.randomizeTile(masterFarmer.getLocation(),1, 1)));
  419.             }
  420.                
  421.                  
  422.             antiBan(true);
  423.                   return random(200, 500);
  424.                 } catch (Exception e) {return random(250 , 500);}
  425.         return 0;
  426.     }
  427.    
  428.     @SuppressWarnings("static-access")
  429.     private void antiBan(boolean overRide){
  430.         int randomNo = random(1, 20);
  431.         int r = random(1, 12);
  432.         if (randomNo == 3 || overRide) {
  433.             switch(r){
  434.                 case 1:{
  435.                     if(canWearGloves){
  436.                         status = "AB Checking Our Hand Slot";
  437.                    
  438.                         handID = equipment.getItem(equipment.HANDS).getID();
  439.                     }
  440.                 }break;
  441.                 case 2:{
  442.                     status = "AB Open Random Tab 1s - 2s";
  443.                     game.openTab(random(1, 14));
  444.                     sleep(random(1000 , 2000));
  445.                 }break;
  446.                 case 3: {
  447.                     status = "AB Move Mouse Slightly .5s - 1s";
  448.                     mouse.moveSlightly();
  449.                     sleep(random(500 , 1000));
  450.                 }break;
  451.                 case 4: {
  452.                     status = "AB Move Mouse .5s - 1s";
  453.                     mouse.moveRandomly(70, 380);
  454.                     sleep(random(500 , 1000));
  455.                 }break;
  456.                 case 5: {
  457.                     status = "AB Move Off Screen 1.5s - 2s";
  458.                     mouse.moveOffScreen();
  459.                     sleep(1500 , 2000);
  460.                 }break;
  461.                 case 6: {
  462.                     status = "AB Rotate to Master Farmer .5s - 1s";
  463.                     if(npcs.getNearest("Master Farmer") != null)
  464.                         camera.turnToCharacter(npcs.getNearest("Master Farmer"));                
  465.                 }break;
  466.                 case 7: {
  467.                     status = "AB Rotate Camera .5s - 1s";
  468.                     camera.setAngle(random(1, 360));
  469.                     sleep(random(250 , 500));
  470.                 }break;
  471.                 case 8: {
  472.                     status = "AB Rotate Camera .5s - 1s";
  473.                     camera.setAngle(random(80, 230));
  474.                     sleep(random(500 , 1000));
  475.                 }break;
  476.                 case 9: {
  477.                     status = "AB Rotate Camera .5s - 1s";
  478.                     camera.setAngle(random(150, 180));
  479.                     sleep(random(250 , 500));
  480.                 }break;
  481.                 case 10: {
  482.                     status = "AB Rotate Camera .5s - 1s";
  483.                     camera.setAngle(random(250, 360));
  484.                     sleep(random(250 , 500));
  485.                 }break;
  486.                 case 11: {
  487.                     status = "AB Open Skill Tab .5s";
  488.                     if (game.getCurrentTab() != 4) {
  489.                         game.openTab(4);
  490.                         sleep(500,750);
  491.                     } else return;
  492.                 }break;
  493.                 case 12: {
  494.                     status = "AB Look AT Thieving Skill 2s - 4s";
  495.                     if (game.getCurrentTab() != 1) {
  496.                         game.openTab(1);
  497.                         sleep(random(500, 700));
  498.                         mouse.move(random(620 , 665), random(295, 315));
  499.                         sleep(random(1500, 3000));
  500.                     }
  501.                 }break;
  502.             }
  503.         }  
  504.     }
  505.    
  506.    
  507.  
  508.    
  509.     int getItemID (String item){
  510.         int i;
  511.         for(i = 0 ; i < KEEP_ID_COUNT ; i++){
  512.             if(item.contains(KEEP_NAME[i])){
  513.                 return KEEP_ID[i];
  514.             }
  515.         }
  516.         return 0;
  517.     }
  518.    
  519.    
  520.     int itemPrice (int id){
  521.         int p;
  522.         for (int i = 0; i < totalComplete ; i ++ ){
  523.             if (completeIDs[0][i] == id)
  524.                 return completeIDs[1][i];
  525.         }
  526.        
  527.         try {
  528.             status = "Getting Prices";
  529.             p = grandExchange.getMarketPrice(id);
  530.         } catch (Exception e) {return 0;}
  531.         completeIDs[0][totalComplete] = id;
  532.         completeIDs[1][totalComplete] = p;
  533.         totalComplete++;
  534.         return p;
  535.    
  536.    
  537.     }
  538.    
  539.     public void serverMessageRecieved(ServerMessageEvent e) {
  540.  
  541.         String svrmsg = e.getMessage();
  542.         if (svrmsg.contains("combat")) {
  543.             justAttacked = true;
  544.         }
  545.         if (svrmsg.contains("stunned") && !lastMsg.contains("stunned")){
  546.             failedPick = true;
  547.             failPickpockets++;
  548.         }
  549.         if (svrmsg.contains("restores") && !lastMsg.contains("restores"))
  550.             foodEaten++;
  551.  
  552.         if (svrmsg.contains("advanced")) {
  553.             sleep(random(1500, 2500));
  554.             if (interfaces.canContinue()) {
  555.               interfaces.clickContinue();
  556.             }
  557.             gainedLvls++;
  558.             sleep(random(50,100));
  559.         }
  560.         if (svrmsg.contains("You steal")){
  561.             succeedPickpockets++;
  562.             if (svrmsg.contains("seed")) {
  563.                 int seedCount = 1;
  564.                 String splitString[] = svrmsg.split(" " , 10);
  565.                 String seedName = "";
  566.                 if (!splitString[2].contains("a") && !splitString[2].contains("an"))
  567.                     seedCount = Integer.parseInt(splitString[2].trim());
  568.                     seedName = splitString[3];
  569.                 int seedID = getItemID(seedName);
  570.                 if (seedID != 0){
  571.                     if (foodPrice == 0){
  572.                         try {
  573.                             status = "Getting Prices";
  574.                             foodPrice = grandExchange.getMarketPrice(foodID);
  575.                         } catch (Exception e1) {}
  576.                     }
  577.                     profit += (itemPrice(seedID) * seedCount);
  578.                 }
  579.             }
  580.         }
  581.         lastMsg = svrmsg;
  582.     }
  583.  
  584.     @SuppressWarnings("serial")
  585.     public class konzyMasterStealerGUI extends javax.swing.JFrame {
  586.  
  587.         private final File file = new File(GlobalConfiguration.Paths.getSettingsDirectory() + System.getProperty("file.separator") + "konzyMasterStealerProps.txt");
  588.  
  589.        
  590.         private JCheckBox dropJunkSeeds;
  591.         private JTextField foodOverride, foodCount;
  592.         private JLabel jLabel1, jLabel2, jLabel3, jLabel4, jLabel5, jLabel6;
  593.         private JButton jButton1;
  594.         private JSeparator jSeparator1;
  595.        
  596.         //JButton start
  597.        
  598.        
  599.         /** Creates new form NewJFrame */
  600.         public konzyMasterStealerGUI() {
  601.             initComponents();
  602.             pack();
  603.             setVisible(true);
  604.         }
  605.  
  606.         /** This method is called from within the constructor to
  607.          * initialize the form.
  608.          * WARNING: Do NOT modify this code. The content of this method is
  609.          * always regenerated by the Form Editor.
  610.          */
  611.         private void initComponents() {
  612.             GridBagConstraints gridBagConstraints;
  613.  
  614.             Properties props = loadProperties();
  615.            
  616.  
  617.             jButton1 = new JButton();
  618.             jSeparator1 = new JSeparator();
  619.             dropJunkSeeds = new JCheckBox();
  620.             foodCount = new JTextField();
  621.             foodOverride = new JTextField();
  622.             jLabel1 = new JLabel();
  623.             jLabel3 = new JLabel();
  624.             jLabel4 = new JLabel();
  625.             jLabel5 = new JLabel();
  626.             jLabel2 = new JLabel();
  627.             jLabel6 = new JLabel();
  628.            
  629.             dropJunkSeeds.setSelected(false);
  630.             foodCount.setText("10");
  631.            
  632.             if(props.getProperty("dropJunkSeeds") != null) {
  633.                 if(props.getProperty("dropJunkSeeds").equals("true"))
  634.                     dropJunkSeeds.setSelected(true);
  635.             }
  636.             if(props.getProperty("foodOverride") != null) {
  637.                 foodOverride.setText(props.getProperty("foodOverride"));
  638.             }
  639.             if(props.getProperty("foodCount") != null) {
  640.                 foodCount.setText(props.getProperty("foodCount"));
  641.             }
  642.  
  643.             getContentPane().setLayout(new GridBagLayout());
  644.  
  645.             jLabel1.setFont(new Font("Arial", 0, 18)); // NOI18N
  646.             jLabel1.setForeground(new Color(51, 204, 0));
  647.             jLabel1.setText("konzy's Master Stealer");
  648.             gridBagConstraints = new GridBagConstraints();
  649.             gridBagConstraints.gridx = 0;
  650.             gridBagConstraints.gridy = 0;
  651.             gridBagConstraints.gridwidth = 2;
  652.             gridBagConstraints.ipadx = 10;
  653.             gridBagConstraints.insets = new Insets(0, 104, 0, 0);
  654.             getContentPane().add(jLabel1, gridBagConstraints);
  655.            
  656.             jButton1.setText("OK");
  657.             jButton1.addActionListener(onStart);
  658.             gridBagConstraints = new GridBagConstraints();
  659.             gridBagConstraints.gridx = 4;
  660.             gridBagConstraints.gridy = 10;
  661.             gridBagConstraints.gridwidth = 10;
  662.             gridBagConstraints.insets = new Insets(6, 6, 11, 0);
  663.             getContentPane().add(jButton1, gridBagConstraints);
  664.  
  665.             gridBagConstraints = new GridBagConstraints();
  666.             gridBagConstraints.gridx = 0;
  667.             gridBagConstraints.gridy = 1;
  668.             gridBagConstraints.gridwidth = 15;
  669.             gridBagConstraints.ipadx = 461;
  670.             gridBagConstraints.ipady = 9;
  671.             gridBagConstraints.insets = new Insets(6, 0, 0, 0);
  672.             getContentPane().add(jSeparator1, gridBagConstraints);
  673.  
  674.             dropJunkSeeds.setText("Drop Junk Seeds");
  675.             gridBagConstraints = new GridBagConstraints();
  676.             gridBagConstraints.gridx = 1;
  677.             gridBagConstraints.gridy = 6;
  678.             gridBagConstraints.gridwidth = 13;
  679.             gridBagConstraints.gridheight = 2;
  680.             gridBagConstraints.ipadx = 15;
  681.             gridBagConstraints.insets = new Insets(6, 18, 0, 0);
  682.             getContentPane().add(dropJunkSeeds, gridBagConstraints);
  683.  
  684.             gridBagConstraints.gridx = 1;
  685.             gridBagConstraints.gridy = 8;
  686.             gridBagConstraints.gridwidth = 13;
  687.             gridBagConstraints.gridheight = 2;
  688.             gridBagConstraints.ipadx = 114;
  689.             gridBagConstraints.insets = new Insets(6, 18, 0, 0);
  690.             getContentPane().add(foodOverride, gridBagConstraints);
  691.            
  692.             gridBagConstraints = new GridBagConstraints();
  693.             gridBagConstraints.gridx = 1;
  694.             gridBagConstraints.gridy = 4;
  695.             gridBagConstraints.gridwidth = 13;
  696.             gridBagConstraints.gridheight = 2;
  697.             gridBagConstraints.ipadx = 114;
  698.             gridBagConstraints.insets = new Insets(9, 18, 0, 0);
  699.             getContentPane().add(foodCount, gridBagConstraints);
  700.            
  701.             jLabel3.setFont(new Font("Arial", 0, 10));
  702.             jLabel3.setText("Food Override, enter the itemID of the food here");
  703.             gridBagConstraints = new GridBagConstraints();
  704.             gridBagConstraints.gridx = 0;
  705.             gridBagConstraints.gridy = 8;
  706.             gridBagConstraints.insets = new Insets(9, 67, 0, 0);
  707.             getContentPane().add(jLabel3, gridBagConstraints);
  708.  
  709.             jLabel4.setFont(new Font("Arial", 0, 10));
  710.             jLabel4.setText("For speed leave disabled, only drops when stunned");
  711.             gridBagConstraints = new GridBagConstraints();
  712.             gridBagConstraints.gridx = 0;
  713.             gridBagConstraints.gridy = 6;
  714.             gridBagConstraints.insets = new Insets(10, 57, 0, 0);
  715.             getContentPane().add(jLabel4, gridBagConstraints);
  716.  
  717.             jLabel5.setFont(new Font("Arial", 0, 10));
  718.             jLabel5.setText("How much food should be withdrawn from the bank each visit");
  719.             gridBagConstraints = new GridBagConstraints();
  720.             gridBagConstraints.gridx = 0;
  721.             gridBagConstraints.gridy = 4;
  722.             gridBagConstraints.insets = new Insets(9, 10, 0, 0);
  723.             getContentPane().add(jLabel5, gridBagConstraints);
  724.  
  725.             jLabel2.setFont(new Font("Arial", 0, 10)); // NOI18N
  726.             jLabel2.setText("This is my first released script, please give feedback!");
  727.             gridBagConstraints = new GridBagConstraints();
  728.             gridBagConstraints.gridx = 0;
  729.             gridBagConstraints.gridy = 2;
  730.             gridBagConstraints.gridwidth = 5;
  731.             gridBagConstraints.insets = new Insets(6, 38, 0, 0);
  732.             getContentPane().add(jLabel2, gridBagConstraints);
  733.  
  734.             jLabel6.setFont(new Font("Arial", 0, 10));
  735.             jLabel6.setText("Either use the food override, or just put food in your inventory before starting the bot");
  736.             gridBagConstraints = new GridBagConstraints();
  737.             gridBagConstraints.gridx = 0;
  738.             gridBagConstraints.gridy = 3;
  739.             gridBagConstraints.gridwidth = 9;
  740.             gridBagConstraints.insets = new Insets(6, 25, 0, 0);
  741.             getContentPane().add(jLabel6, gridBagConstraints);
  742.            
  743.             setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  744.             setTitle("konzy's Master Stealer");
  745.            
  746.         }
  747.             private Properties loadProperties() {
  748.                 try {
  749.                     if(!file.exists())
  750.                         file.createNewFile();
  751.                     Properties p = new Properties();
  752.                     p.load(new FileInputStream(file));
  753.                     return p;
  754.                 } catch (Exception e) {
  755.                     e.printStackTrace();
  756.                 }
  757.                 return null;
  758.             }
  759.            
  760.             private void saveProperties() {
  761.                 Properties p = new Properties();
  762.                 p.put("dropJunkSeeds", Boolean.toString(dropJunkSeeds.isSelected()));
  763.                 p.put("foodCount", foodCount.getText());
  764.                
  765.                 carriedFood = getFood();
  766.                 if (carriedFood != null){
  767.                     try {
  768.                         foodID = carriedFood.getID();
  769.                         log("The Item ID of your food is " + foodID + " saving this to file");
  770.                     } catch (Exception e) {}
  771.                     p.put("foodOverride", "" + foodID);
  772.                 }else
  773.                     p.put("foodOverride", foodOverride.getText());
  774.                
  775.                 try {
  776.                     p.store(new FileOutputStream(file), "");
  777.                 } catch (Exception e) {
  778.                     e.printStackTrace();
  779.                 }
  780.             }
  781.            
  782.             private ActionListener onStart = new ActionListener() {
  783.                 @Override
  784.                 public void actionPerformed(ActionEvent e) {
  785.                     saveProperties();
  786.                     startScript = true;
  787.                     dropSeeds = dropJunkSeeds.isSelected();
  788.  
  789.                    
  790.                     try {
  791.                         if (Integer.parseInt(foodOverride.getText()) != 0)
  792.                         foodID = Integer.parseInt(foodOverride.getText()); 
  793.                        
  794.                         if (Integer.parseInt(foodCount.getText()) != 0)
  795.                             withdrawFood = Integer.parseInt(foodCount.getText());
  796.                     } catch (NumberFormatException e1) {}              
  797.                     dispose();
  798.                 }
  799.             };
  800.     }
  801.  
  802.     //START: Paint generated using Enfilade's Easel
  803.     private final Color color1 = new Color(0, 0, 0);
  804.     private final Color color2 = new Color(0, 204, 0);
  805.     private final Color color3 = new Color(255, 255, 255);
  806.  
  807.    
  808.     private final Font font1 = new Font("Arial", 0, 13);
  809.    
  810.     public void onRepaint(Graphics g1) {
  811.        
  812.     if(!showPaint){
  813.         Graphics2D g = (Graphics2D)g1;
  814.         g.setFont(font1);
  815.         g.setColor(color3);
  816.         g.drawString("Click Chat To See Paint", 160, 335);
  817.         return;
  818.     }
  819.        
  820.         int runTime = (int) (System.currentTimeMillis() - startTime);
  821.         int hours = (int) runTime / (60 * 1000 * 60);
  822.         int minutes = (int) (runTime - (hours * 60 * 1000 * 60)) / (60 * 1000);
  823.         int seconds = (int) (runTime - (hours * 60 * 1000 * 60) - (minutes * 60 * 1000)) / 1000;
  824.        
  825.         int currentXP = skills.getCurrentExp(Skills.THIEVING);
  826.         int currentLVL = skills.getCurrentLevel(Skills.THIEVING);
  827.         int gainedXP = currentXP - startXP;
  828.         int gainedLVL = currentLVL - startLvl;
  829.         int xpPerHour = (int) ((3600000.0 / (double) runTime) * gainedXP);
  830.         int succeedPickpocketsHour = (int) ((3600000.0 / (double) runTime) * succeedPickpockets);
  831.         int profitPerHour = (int) ((3600000.0 / (double) runTime) * profit);
  832.        
  833.         String dispProfit = "" + profit;
  834.         String dispProfitPerHour = "" + profitPerHour;
  835.         if(profit < 0){
  836.             dispProfit = "(" + (-profit) + ")";
  837.             dispProfitPerHour = "(" + (-profitPerHour) + ")";
  838.         }
  839.         String normMinutes;
  840.         String normSeconds;
  841.        
  842.         if (minutes < 10)
  843.             normMinutes = "0" + minutes;
  844.         else normMinutes = "" + minutes;
  845.         if (seconds < 10)
  846.             normSeconds = "0" + seconds;
  847.         else normSeconds = "" + seconds;
  848.        
  849.         Graphics2D g = (Graphics2D)g1;
  850.         g.setColor(color1);
  851.         g.fillRect(8, 344, 502, 128);
  852.         g.setFont(font1);
  853.         g.setColor(color2);
  854.         g.drawString("konzy's Master Stealer V " + properties.version(), 10, 355);
  855.         g.drawString("XP Gained: " + gainedXP, 10, 370);
  856.         g.drawString("XP/hr: " + xpPerHour, 10, 385);
  857.         g.drawString("Current Level: " + currentLVL, 10, 400);
  858.         g.drawString("% Needed To Level Up: " + (100 - skills.getPercentToNextLevel(Skills.THIEVING)) + "%", 10, 415);
  859.         g.drawString("Levels Gained: " + gainedLVL, 10, 430);
  860.         g.drawString("Run Time: " + hours + ":" + normMinutes + ":" + normSeconds, 10, 445);
  861.         g.drawString("Number of Picks: " + succeedPickpockets, 250, 355);
  862.         g.drawString("Picks per Hour: " + succeedPickpocketsHour, 250, 370);
  863.         g.drawString("Picks Failed: " + failPickpockets, 250, 385);
  864.         g.drawString("Profit: " + dispProfit, 250, 400);
  865.         g.drawString("Profit Per Hour: " + dispProfitPerHour, 250, 415);
  866.         g.drawString("Status: " + status, 250, 430);
  867.         g.drawString("By konzy", 250, 445);
  868.         g.setColor(color3);
  869.         g.drawString("Click Paint To See Chat", 160, 335);
  870.  
  871.     }
  872.     //END: Paint generated using Enfilade's Easel
  873.  
  874.     @Override
  875.     public void mouseClicked(MouseEvent e) {
  876.         RSComponent inter = interfaces.get(137).getComponent(0);
  877.         if(inter.getArea().contains(e.getPoint())) {
  878.             showPaint = !showPaint;
  879.         }
  880.     }
  881.  
  882.     @Override
  883.     public void mousePressed(MouseEvent e) { }
  884.  
  885.     @Override
  886.     public void mouseReleased(MouseEvent e) { }
  887.  
  888.     @Override
  889.     public void mouseEntered(MouseEvent e) { }
  890.  
  891.     @Override
  892.     public void mouseExited(MouseEvent e) { }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement