Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.52 KB | None | 0 0
  1.  
  2. import impsoft.bots.ColorBot;
  3. import impsoft.bots.input.MouseCommand;
  4. import impsoft.bots.reflection.Interface;
  5. import impsoft.bots.reflection.NPC;
  6. import impsoft.bots.reflection.NPCIterator;
  7. import impsoft.bots.reflection.PhysicalObject;
  8. import impsoft.scripting.ibot.builtin.itemrec.ItemSlot;
  9. import impsoft.scripting.ibot.builtin.tabs.TabSkelton;
  10. import impsoft.scripting.ibot.clusters.HeatCluster;
  11. import impsoft.scripting.ibot.enums.Skill;
  12. import impsoft.scripting.ibot.interfaces.AutoPaint;
  13. import impsoft.scripting.ibot.interfaces.ChatListener;
  14. import impsoft.scripting.ibot.itemrec.ItemCondition;
  15. import impsoft.scripting.ibot.itemrec.ItemIdExact;
  16. import impsoft.scripting.ibot.itemrec.ItemNameExact;
  17. import impsoft.scripting.ibot.structs.AryanTile;
  18. import impsoft.scripting.ibot.structs.AryanTileZone;
  19. import impsoft.scripting.ibot.structs.XY;
  20. import impsoft.scripting.types.ColorScript;
  21. import impsoft.scripting.types.parallel.scriptjobs.ScriptJob;
  22. import impsoft.utils.general.Timer;
  23. import impsoft.utils.ibot.RandomGenerator;
  24. import impsoft.utils.uber.UberClickOptions;
  25. import impsoft.utils.uber.UberScriptUtils;
  26. import impsoft.values.constant.Areas;
  27. import impsoft.values.constant.SC;
  28.  
  29. import java.awt.Color;
  30. import java.awt.Font;
  31. import java.awt.Graphics;
  32. import java.awt.Rectangle;
  33. import java.awt.event.KeyEvent;
  34. import java.io.IOException;
  35. import java.net.URL;
  36. import java.util.ArrayList;
  37. import java.util.EnumSet;
  38. import java.util.HashMap;
  39. import java.util.List;
  40. import java.util.regex.Pattern;
  41.  
  42. import javax.imageio.ImageIO;
  43. import javax.swing.JFrame;
  44. import javax.swing.JOptionPane;
  45. import javax.swing.UIManager;
  46.  
  47. import java.awt.*;
  48. import java.text.DecimalFormat;
  49. import impsoft.scripting.types.parallel.scriptjobs.WorldObjectClickingScriptJobV2;
  50. import impsoft.utils.ruler.RulerClickOptions;
  51. import impsoft.utils.ruler.RulerScriptUtils;
  52.  
  53.  
  54.  
  55. import bergCoder.BergUtils;
  56. import bergCoder.Object3D;
  57.  
  58. public class ZAltarPrayer extends ColorScript implements AutoPaint {
  59.  
  60.     public ZAltarPrayer(ColorBot c) {
  61.         super(c);
  62.     }
  63.  
  64.     BergUtils util = new BergUtils(this);
  65.     RulerScriptUtils Ruler = new RulerScriptUtils();
  66.  
  67.  
  68.  
  69.     public static String author = "zbubblez";
  70.     public static String description = "Uses ur bonez";
  71.     public static double version = 1;
  72.  
  73.  
  74.  
  75.     Timer Time = new Timer(0);
  76.     Timer f = new Timer((random(15, 54)) * (1000 * 60));
  77.     long scriptStartTIME = System.currentTimeMillis();
  78.     Timer t2 = new Timer(10000L);
  79.     Timer KyattTimer = new Timer((random(35, 45)) * (1000 * 60));
  80.    
  81.    
  82.     String bones;
  83.     String altarGuy;
  84.     String Status = "Waiting......";
  85.    
  86.     boolean POH = false;
  87.     boolean Go = false;
  88.     boolean First = true;
  89.    
  90.     int StartXP = 0;
  91.     int Tries = 0;
  92.     int CurrentXP = 0;
  93.     int Runs = 0;
  94.     int a = 0;
  95.    
  96.     int[] Doors = {};
  97.    
  98.     public int altars[] = {
  99.             13194, 13197, 13198, 13199
  100.         };
  101.    
  102.     AryanTileZone Enter = new AryanTileZone(new AryanTile(2542,3096),new AryanTile(2547,3094));
  103.     public AryanTile houseTile;
  104.    
  105.     public void script() throws InterruptedException, Exception {
  106.         XPThread.start();
  107.         AntiBan.start();
  108.         CheckPlayer.start();
  109.         try
  110.         {
  111.         while(!isLoggedIn())
  112.         {
  113.             sleep(1000);
  114.             log("Waiting for login.");
  115.         }
  116.         log("Version 1.00");
  117.         StartXP = theTabs.Statistics.getStatExperience(Skill.PRAYER);
  118.         altarGuy = JOptionPane.showInputDialog("Whats the name of the Altar owner? (me = using your altar)");
  119.         bones = JOptionPane.showInputDialog("What bones? (Bones, Big bones, Dragon bones)");
  120.         if(altarGuy == "me")
  121.         {
  122.             POH = true;
  123.             log("POH = true");
  124.         }
  125.         else
  126.         {
  127.             POH = false;
  128.             log("POH = false");
  129.         }
  130.         log("Using "+bones+" Bones");
  131.         if(theTabs.Inventory.count(bones) != 0)
  132.         {
  133.             Walk();
  134.         }
  135.         else
  136.         {
  137.             Bank();
  138.         }  
  139.         }
  140.         catch(InterruptedException interruptedexception)
  141.         {
  142.            log("We Gained: "+(CurrentXP - StartXP)+" XP!");
  143.             throw interruptedexception;
  144.         }
  145.        
  146.        
  147.     }
  148.    
  149.     public void Walk() throws InterruptedException, Exception {
  150.         Status = "Walking";
  151.         while(!Enter.isInZone(getLocation()))
  152.         {
  153.             theWorldMap.walkTo(Enter.random());        
  154.         }
  155.         PhysicalObject Entrance = util.getInteractiveObject(15482);
  156.         while(Entrance == null)
  157.         {
  158.             sleep(400, 600);           
  159.         }        
  160.                
  161.             while(!this.isInterfaceNotNullAndValid(232,2) || !this.isInterfaceNotNullAndValid(232,4))
  162.             {              
  163.                 RulerScriptUtils.clickWorldObject(this, null,
  164.                         Entrance, null,
  165.                         Pattern.compile(Entrance.toString(), Pattern.CASE_INSENSITIVE),
  166.                         Pattern.compile(".*Enter.*", Pattern.CASE_INSENSITIVE),
  167.                         EnumSet.of(RulerClickOptions.WALK_USING_ANY,
  168.                                 RulerClickOptions.GOAL_MENU_CLICK));
  169.                 sleep(3000, 4000);
  170.             }
  171.             if(POH == true)
  172.             {
  173.                 mouseClickLeft(new Rectangle(199,386,119, 10));
  174.                 sleep(1000, 2000);
  175.             }
  176.             else
  177.             {
  178.                 mouseClickLeft(new Rectangle(184,425,150, 11));
  179.                 sleep(1000, 2000);
  180.                 if(First == true)
  181.                 {
  182.                 SendText(altarGuy);
  183.                 sleep(1, 400);
  184.                 SendKey(10);
  185.                 First = false;
  186.                 }
  187.                 else
  188.                 {
  189.                     mouseClickLeft(new Rectangle(186,453,143, -7));
  190.                 }
  191.             }  
  192.             sleep(7000, 9000); 
  193.         Grind();
  194.        
  195.     }
  196.    
  197.     public void Grind() throws InterruptedException, Exception {
  198.         Status = "Grinding bones";
  199.         PhysicalObject Altar = util.getInteractiveObject(altars, null);    
  200.         if(Altar != null)
  201.         {      
  202.          theWorldMap.walkTo(Altar.getLocation());
  203.          util.sleepUntilNotMoving();
  204.         }
  205.        
  206.         while(theTabs.Inventory.countEmptySlots() != 28)
  207.         {  
  208.             if(Altar != null)
  209.             {
  210.             if(Altar.getGameScreenLocation() == null)
  211.             {
  212.                 if(Altar != null)
  213.                 {      
  214.                  theWorldMap.walkTo(Altar.getLocation());
  215.                  util.sleepUntilNotMoving();
  216.                 }
  217.             }  
  218.             }
  219.                        
  220.                 theTabs.Inventory.doAction(bones, "Use", 1, false);
  221.                 sleep(1000, 2500);
  222.                 if(theTabs.Inventory.isAItemSelected())
  223.                 {          
  224.                 RulerScriptUtils.clickWorldObject(this, null,
  225.                         Altar, null,
  226.                         Pattern.compile(Altar.toString(), Pattern.CASE_INSENSITIVE),
  227.                         Pattern.compile(".*-> Altar.*", Pattern.CASE_INSENSITIVE),
  228.                         EnumSet.of(RulerClickOptions.WALK_USING_ANY,
  229.                                 RulerClickOptions.GOAL_MENU_CLICK));
  230.                 sleep(3000, 4000); 
  231.                 mouseClickRight(new Rectangle(234,393,41, 31));
  232.                 theMenuFinder.doMenu("All");
  233.                 Go = false;
  234.                 }
  235.                                
  236.                 while(Go == false)
  237.                 {
  238.                     a = theTabs.Inventory.count(bones);
  239.                     sleep(6000, 8000);
  240.                     if(theTabs.Inventory.count(bones) == a)
  241.                     {
  242.                         log("DoingAction = false");                        
  243.                         Go = true;
  244.                     }
  245.                 }
  246.                
  247.             sleep(500, 1000);
  248.         }
  249.    
  250.         Bank();
  251.     }
  252.    
  253.    
  254.     public void Bank() throws InterruptedException, Exception {
  255.         Status = "Banking";
  256.         for(; theTabs.Inventory.count(bones) == 0 && Enter.random().distanceTo(getLocation()) > 200; sleep(6000, 7500))
  257.         {
  258.             theCamera.setCameraToTile(new AryanTile(getLocation().x + random(-10, 10), getLocation().y + random(-10, 10)));
  259.             util.clickInteractiveObject(new int[] {
  260.                 13405
  261.             }, null, "Portal", "Enter", new Object3D(-20, 20, -20, 20, 0, 50, true));
  262.         }
  263.         theWorldMap.walkToBank();
  264.         theBank.open();
  265.         if(theTabs.Inventory.countEmptySlots() != 28)
  266.         {
  267.             theBank.doDepositAll();
  268.         }
  269.         theBank.doWithDrawAll(bones, false);
  270.         theBank.exit();
  271.         Runs++;
  272.         Walk();
  273.     }
  274.    
  275.  
  276.     Thread CheckPlayer = new Thread() {
  277.         public void run() {
  278.             log("Running Thread Started!");
  279.             while (getHandler().isScriptRunning()) {
  280.  
  281.                 try {
  282.                     if (theMiniMapIndicators.getEnergy() > (random(40, 55))) {
  283.                         util.setFastRun(true);
  284.                     }
  285.                     if (!theTabs.Inventory.isSelected() && !theTabs.Attack.isSelected()) {                         
  286.                         if(!theTabs.Inventory.isSelected())
  287.                         {
  288.                         theTabs.Inventory.click();
  289.                         }
  290.                     }
  291.                     sleep(2000, 3000);
  292.                 } catch (InterruptedException e) {
  293.                     // TODO Auto-generated catch block
  294.                     e.printStackTrace();
  295.                 }
  296.                 try {
  297.                     switch (random(0, 350)) {
  298.                     case 4:
  299.                         theCamera.setYawRandom();
  300.                         break;
  301.                     case 23:
  302.                         theCamera.setYawRandom();
  303.                         break;
  304.                     case 37:
  305.                         theCamera.setYawRandom();
  306.                         break;
  307.                     case 55:
  308.                         theCamera.setYawRandom();
  309.                         break;
  310.                     case 64:
  311.                         theCamera.setYawRandom();
  312.                         break;
  313.                     case 78:
  314.                         theCamera.setYawRandom();
  315.                         break;
  316.                     case 99:
  317.                         theCamera.setYawRandom();
  318.                         break;
  319.                     case 105:
  320.                         theCamera.setYawRandom();
  321.                         break;
  322.                     case 173:
  323.                         theCamera.setYawRandom();
  324.                         break;
  325.                     case 244:
  326.                         theCamera.setYawRandom();
  327.                         break;
  328.                     case 285:
  329.                         theCamera.setYawRandom();
  330.                         break;
  331.                     case 299:
  332.                         theCamera.setYawRandom();
  333.                         break;
  334.                     }
  335.                     sleep(random(3000, 20000));
  336.                 } catch (InterruptedException e) {
  337.                     // TODO Auto-generated catch block
  338.                     e.printStackTrace();
  339.                 }
  340.  
  341.             }
  342.         }
  343.     };
  344.  
  345.  
  346.     Thread XPThread = new Thread() {
  347.         public void run() {
  348.             log("XP Thread Started!");
  349.             while (getHandler().isScriptRunning()) {
  350.  
  351.                 try {
  352.                     CurrentXP = theTabs.Statistics.getStatExperience(Skill.PRAYER);
  353.                     sleep(500, 1000);
  354.                 } catch (InterruptedException e) {
  355.                     // TODO Auto-generated catch block
  356.                     e.printStackTrace();
  357.                 }
  358.             }
  359.         }
  360.     };
  361.    
  362.  
  363.  
  364.  
  365.  
  366.  
  367.     Thread AntiBan = new Thread() {
  368.         public void run() {
  369.             log("AntiBan Thread Started!");
  370.             while (getHandler().isScriptRunning()) {
  371.  
  372.                 try {
  373.                     switch (random(0, 200)) {
  374.                     case 12:
  375.                         mouseMove(Areas.GAME);
  376.                         break;
  377.                     case 25:
  378.                         theCamera.setYawRandom();
  379.                         break;
  380.                     case 29:
  381.                         theCamera.setYawRandom();
  382.                         break;
  383.                     case 36:
  384.                         mouseMove(Areas.ENTIRE);
  385.                         break;
  386.                     case 44:
  387.                         switch (random(1, 5)) {
  388.                         case 1:
  389.                             theTabs.Friends.click();
  390.                             break;
  391.                         case 2:
  392.                             theTabs.Statistics.click();
  393.                             break;
  394.                         case 3:
  395.                             theTabs.Attack.click();
  396.                             break;
  397.                         case 4:
  398.                             theTabs.Options.click();
  399.                             break;
  400.                         case 5:
  401.                             break;
  402.  
  403.                         }
  404.                         break;
  405.                     case 58:
  406.                         theCamera.setYawRandomNormal();
  407.                         break;
  408.                     case 63:
  409.                         theCamera.setYawRandom();
  410.                         break;
  411.                     case 77:
  412.                         mouseMove(Areas.ENTIRE);
  413.                         break;
  414.                     case 91:
  415.                         theCamera.setYawRandom();
  416.                         break;
  417.                     case 114:
  418.                         mouseMove(Areas.ENTIRE);
  419.                         break;
  420.                     case 133:
  421.                         theCamera.setYawRandom();
  422.                         break;
  423.                     case 145:
  424.                         theCamera.setYawRandom();
  425.                         break;
  426.                     case 166:
  427.                         theCamera.setYawRandom();
  428.                         break;
  429.                     case 178:
  430.                         theCamera.setYawRandom();
  431.                         break;
  432.                     case 184:
  433.                         theCamera.setYawRandom();
  434.                         break;
  435.                     case 200:
  436.                         theCamera.setYawRandom();
  437.                         break;
  438.  
  439.                     }
  440.                     sleep(1000, 6000);
  441.  
  442.                 } catch (InterruptedException e) {
  443.                     // TODO Auto-generated catch block
  444.                     e.printStackTrace();
  445.                 }
  446.             }
  447.         }
  448.     };
  449.    
  450.    
  451.    
  452.    
  453.     public void paint(Graphics g) {
  454.         final StringBuilder gg = new StringBuilder();
  455.         final long runtime = Time.timePassed();
  456.         final long TotalSec = runtime / 1000;
  457.         final long TotalMin = TotalSec / 60;
  458.         final long TotalHour = TotalMin / 60;
  459.         final int second = (int) TotalSec % 60;
  460.         final int minute = (int) TotalMin % 60;
  461.         final int hour = (int) TotalHour % 60;
  462.  
  463.         long runTime = 0;
  464.         runTime = System.currentTimeMillis() - scriptStartTIME;
  465.         int mPerHour = 0;
  466.         if ((runTime / 1000) > 0) {
  467.             mPerHour = (int) ((3600000.0 / (double) runTime) * (Runs));
  468.         }
  469.         int PerHour = 0;
  470.         if ((runTime / 1000) > 0) {
  471.             PerHour = (int) ((3600000.0 / (double) runTime) * ((CurrentXP - StartXP)));
  472.         }
  473.  
  474.         if (hour < 10)
  475.             gg.append("0");
  476.         gg.append(hour);
  477.         gg.append(" : ");
  478.         if (minute < 10)
  479.             gg.append("0");
  480.         gg.append(minute);
  481.         gg.append(" : ");
  482.         if (second < 10)
  483.             gg.append("0");
  484.         gg.append(second);
  485.    
  486.    
  487.     int Y = 280;   
  488.    
  489.     g.setColor(new Color(0, 0, 0, 200));
  490.     g.fillRect(255, 245, 258, 90);
  491.     g.setColor(new Color(0, 204, 204, 129));
  492.     g.fillRect(258, 247, 252, 85);
  493.     g.setFont(new Font("LilyUPC", 0, 35));
  494.     g.setColor(new Color(0, 0, 0));
  495.     g.drawString("ZAltarPrayer", 324, 266);
  496.     g.setFont(new Font("LilyUPC", 0, 22));
  497.     g.setColor(new Color(0, 0, 0));
  498.     g.drawString("Time Running: "+String.valueOf(gg.toString()), 260, Y);
  499.     g.drawString("XP Gained: "+(CurrentXP - StartXP)+"  ("+PerHour+"/H)", 260, Y+15);
  500.     g.drawString("Runs Made: "+Runs+"  ("+mPerHour+"/H)", 260, Y+30);
  501.     g.drawString("Status: "+Status, 260, Y+45);
  502.    
  503.     }
  504.    
  505.    
  506.    
  507. }//END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement