Advertisement
Guest User

Untitled

a guest
Feb 20th, 2009
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 12.70 KB | None | 0 0
  1. import java.awt.*;
  2.  
  3. import com.speljohan.rsbot.bot.Bot;
  4. import com.speljohan.rsbot.event.listeners.PaintListener;
  5. import com.speljohan.rsbot.script.Script;
  6. import com.speljohan.rsbot.script.wrappers.*;
  7. import java.util.Map;
  8. import javax.swing.JOptionPane;
  9. import javax.swing.*;
  10. import java.awt.geom.*;
  11. import sun.net.ftp.*;
  12. import com.speljohan.rsbot.bot.Bot;
  13. import com.speljohan.rsbot.event.events.ServerMessageEvent;
  14. import com.speljohan.rsbot.event.listeners.PaintListener;
  15. import com.speljohan.rsbot.event.listeners.ServerMessageListener;
  16. import com.speljohan.rsbot.script.Script;
  17. import com.speljohan.rsbot.script.Skills;
  18. import com.speljohan.rsbot.script.wrappers.*;
  19. import com.speljohan.rsbot.script.Bank;
  20. import java.awt.event.ActionListener;
  21. import java.util.Map;
  22. import java.net.*;
  23. import java.io.*;
  24. import java.util.Date;
  25. import java.net.MalformedURLException;
  26. import java.io.BufferedReader;
  27. import java.io.InputStreamReader;
  28. import java.io.IOException;
  29. import java.util.logging.Level;
  30. import java.util.logging.Logger;
  31. import javax.swing.JOptionPane.*;
  32. import javax.swing.JOptionPane;
  33. import java.net.MalformedURLException;
  34. import java.net.URL;
  35. import java.net.URLConnection;
  36.  
  37. public class CrapSoulWars extends Script implements PaintListener {
  38.     //out-of-game locations.
  39.     int[] bankarea = new int[]{3186,3175,1903,1877};//n,s,e,w.
  40.     int[] offtrack_west = new int[]{3174,3168,1883,1878};
  41.     int[] offtrack_east = new int[]{3174,3168,1906,1897};
  42.     int[] waitinggraveyard_east = new int[]{3174,3166,1896,1892};
  43.     int[] waitinggraveyard_west = new int[]{3174,3166,1888,1884};
  44.     int[] portalarea = new int[]{3165,3151,1899,1880};
  45.     int[] walkway = new int[]{3174,3166,1891,1889};
  46.     int[] waitingarea_red = new int[]{3166,3157,1909,1900};
  47.     int[] waitingarea_blue = new int[]{3166,3159,1879,1870};
  48.     RSTile portalloc_balance = new RSTile(1890,3162);
  49.     RSTile portalloc_blue = new RSTile(1899,3162);
  50.     RSTile portalloc_red = new RSTile(1880,3162);
  51.     //in-game locations.
  52.     int[] safezone_blue = new int[]{3230,3220,1823,1816};
  53.     int[] safezone_red = new int[]{3244,3234,1958,1951};
  54.     int[] base_red = new int[]{3257,3234,1978,1959};
  55.     int[] base_blue = new int[]{3236,3206,1815,1802};
  56.     int[] avatarspot_red = new int[]{3257,3247,1973,1961};
  57.     int[] avatarspot_blue = new int[]{3218,3206,1813,1801};
  58.     RSTile[] sitlocations_red = new RSTile[]{new RSTile(1976,3239),new RSTile(1968,3239),new RSTile(1976,3250),new RSTile(1972,3253),new RSTile(1962,3255)};
  59.     RSTile[] sitlocations_blue = new RSTile[]{new RSTile(1803,3224),new RSTile(1807,3220),new RSTile(1811,3211),new RSTile(1802,3212),new RSTile(1806,3210)};
  60.     RSTile barrierloc_blue = new RSTile(1816,3225);
  61.     RSTile barrierloc_red = new RSTile(1958,3239);
  62.     //out of game object
  63.     int portal_balance = 42031;
  64.     int portal_red = 42030;
  65.     int portal_blue = 42029;
  66.     //in-game objects
  67.     int portalinbase_red = 42022;
  68.     int portalinbase_blue = 42021;
  69.     int barrier_red = 42018;
  70.     int barrier_blue = 42015;
  71.     //other stuff.
  72.     int spot = 0;
  73.     boolean passlogin = false;
  74.     int entertries = 0;
  75.      
  76.     public void onRepaint(Graphics g)
  77.     {
  78.      
  79.     }
  80.    
  81.     public double getVersion()
  82.     {
  83.         return 0.2;
  84.     }
  85.    
  86.     public String getScriptCategory()
  87.     {
  88.         return "Ben's Scripts/Crap Series";
  89.     }
  90.    
  91.     public String getName()
  92.     {
  93.         return "Crap Soul Wars";
  94.     }
  95.    
  96.     public String getAuthor()
  97.     {
  98.         return "Ben B (Hunterbdb)";
  99.     }
  100.    
  101.     public void clickCont()
  102.     {
  103.         int x = random(195,320);
  104.         int y = random(454,458);
  105.         moveMouse(x,y);
  106.         wait(random(100,300));
  107.         clickMouse(true);
  108.     }
  109.      
  110.     public String getScriptDescription() {
  111.         String html = "";
  112.  
  113.  
  114.         html+="<html>";
  115.         html+="<body bgcolor=\"#FFFFFF\">";
  116.         html+="<p align=\"center\"><font size=\"7\" color=\"#800000\">Ben B's Crap Series</font></p>";
  117.         html+="<p align=\"center\"><font size=\"2\" color=\"#000000\">Remember, you must enter your ";
  118.         html+="option entries exactly as shown under <b>valid options</b>, or the script will ";
  119.         html+="not start as an execution precaution. </font></p>";
  120.         html+="<p align=\"center\">To use this script, you must use your Crap-Series Username and ";
  121.         html+="password. If you don't, the script won't run and RsBot will close.</p>";
  122.         html+="<div align=\"center\"> ";
  123.         html+="<p><b>Instructions:</b> </p>";
  124.         html+="<p>Begin at the soul wars place, right next to the balance portal. Be sure to ";
  125.         html+="  have everything you need. DO NOT HAVE AUTO RETALIATE ON!</p>";
  126.         html+="<p><b>Details:</b></p>";
  127.         html+="<p>This script will enter the balance portal after the battles are done. It";
  128.         html+="  will keep on doing this, earning you zeal which you can spend on experience. ";
  129.         html+="  24 hours can get you about 423,000 experience.</p>";
  130.         html+="<p><b>Note:</b></p>";
  131.         html+="<p>I didn't call this series &quot;Crap series&quot; because the scripts are ";
  132.         html+="  bad or anything. I just wanted to call it Crap because i'm 5 years old, thats ";
  133.         html+="  all. =)</p>";
  134.         html+="<p>&nbsp;</p>";
  135.         html+=" <p>&nbsp;</p>";
  136.  
  137.         html+="</div>";
  138.         html+="<p align=\"center\">&nbsp;</p>";
  139.         html+="<p>&nbsp; </p>";
  140.         html+="</body>";
  141.         html+="</html>";
  142.         return(html);
  143.     }
  144.     public boolean onStart(Map<String, String> args)
  145.     {
  146.         return true;
  147.     }
  148.      
  149.     public void onFinish() {
  150.      
  151.     }
  152.      
  153.     public boolean isInBounds(int... bounds)
  154.     {
  155.         boolean result = false;
  156.         int x = getMyPlayer().getLocation().getX();
  157.         int y = getMyPlayer().getLocation().getY();
  158.         if(y<=bounds[0] && y>=bounds[1] && x<=bounds[2] && x>=bounds[3])
  159.         {
  160.             result = true;
  161.         }
  162.         return result;
  163.     }      
  164.    
  165.     public void walkToWalkway()
  166.     {
  167.         int x = random(walkway[3],walkway[2]);
  168.         int y = random(walkway[0],walkway[1]);
  169.         RSTile[] path1 = new RSTile[]{new RSTile(x,y)};
  170.         walkPathMM(randomizePath(path1,1,1),60);
  171.     }
  172.        
  173.     public void walkToBalancePortal()
  174.     {
  175.         RSTile[] path1 = new RSTile[]{portalloc_balance};
  176.         walkPathMM(randomizePath(path1,1,1),60);
  177.     }
  178.    
  179.     public boolean isCloseToBalancePortal()
  180.     {
  181.         boolean result;
  182.         if(distanceTo(portalloc_balance)<=4)
  183.         {
  184.             result = true;
  185.         }
  186.         else
  187.         {
  188.             result = false;
  189.         }
  190.         return result;
  191.     }
  192.    
  193.     public void enterBalancePortal()
  194.     {
  195.         RSObject portal = getObjectAt(portalloc_balance);
  196.         turnToObject(portal,30);
  197.         atTile(portalloc_balance,"Join-team Balance portal");
  198.         wait(random(1500,2500));
  199.         if(isMenuOpen())
  200.         {
  201.             atMenu("Join-team Balance portal");
  202.         }
  203.     }
  204.    
  205.     public void walkToRedBarrier()
  206.     {
  207.         RSTile[] path1 = new RSTile[]{barrierloc_red};
  208.         walkPathMM(path1,30);
  209.         wait(random(3000,5000));
  210.     }
  211.    
  212.     public void walkToBlueBarrier()
  213.     {
  214.         RSTile[] path1 = new RSTile[]{barrierloc_blue};
  215.         walkPathMM(path1,30);
  216.         wait(random(3000,5000));
  217.     }
  218.    
  219.     public void passRedBarrier()
  220.     {
  221.         //RSObject barrier = getNearestObjectByID(barrier_red);
  222.         //turnToObject(barrier,40);
  223.         //atObject(barrier,"Pass Red barrier");
  224.         setCameraRotation(269);
  225.         setCameraAltitude(true);
  226.         RSTile location = new RSTile(1959,3239);
  227.         atTile(location,"Pass Red barrier");
  228.         wait(random(4000,5000));
  229.         if(isMenuOpen())
  230.         {
  231.             atMenu("Pass Red barrier");
  232.         }
  233.     }
  234.    
  235.     public void passBlueBarrier()
  236.     {
  237.         //RSObject barrier = getNearestObjectByID(barrier_blue);
  238.         //turnToObject(barrier,40);
  239.         //atObject(barrier,"Pass Blue barrier");
  240.         setCameraRotation(89);
  241.         setCameraAltitude(true);
  242.         RSTile location = new RSTile(1815,3225);
  243.         atTile(location,"Pass Blue barrier");
  244.         wait(random(4000,5000));
  245.         if(isMenuOpen())
  246.         {
  247.             atMenu("Pass Blue barrier");
  248.         }
  249.     }
  250.    
  251.     public void walkRandomRedSpot()
  252.     {
  253.         spot++;
  254.        
  255.         RSTile[] path1 = new RSTile[]{sitlocations_red[spot]};
  256.         walkPathMM(randomizePath(path1,3,3),60);
  257.         if(spot==4)
  258.         {
  259.             spot = 0;
  260.         }      
  261.     }
  262.    
  263.     public void walkRandomBlueSpot()
  264.     {
  265.         spot++;
  266.        
  267.         RSTile[] path1 = new RSTile[]{sitlocations_blue[spot]};
  268.         walkPathMM(randomizePath(path1,3,3),60);
  269.         if(spot==4)
  270.         {
  271.                 spot = 0;
  272.         }
  273.      
  274.     }
  275.    
  276.     public void walkRandom(int[] array)
  277.     {
  278.         int x = random(array[3],array[2]);
  279.         int y = random(array[1],array[0]);
  280.         RSTile[] path1 = new RSTile[]{new RSTile(x,y)};
  281.         walkPathMM(randomizePath(path1,2,2),40);
  282.     }
  283.    
  284.     public void clickToEnter()
  285.     {
  286.         int x = random(225,295);
  287.         int y = random(401,407);
  288.         moveMouse(x,y);
  289.         wait(random(500,2000));
  290.         clickMouse(true);
  291.     }
  292.    
  293.     public void spinCam()
  294.     {
  295.         setCameraRotation(random(1,359));
  296.         setCameraAltitude((double) random(30,98));
  297.     }
  298.    
  299.     public void randomTab()
  300.     {
  301.         openTab(random(0,13));
  302.     }
  303.    
  304.     public void waitSuperLong()
  305.     {
  306.         randomTab();
  307.         wait(random(15000,30000));
  308.         spinCam();
  309.         wait(random(15000,30000));
  310.         spinCam();
  311.         wait(random(15000,30000));
  312.         randomTab();
  313.         wait(random(15000,30000));
  314.         spinCam();
  315.         wait(random(15000,30000));
  316.         spinCam();
  317.         wait(random(15000,30000));
  318.         randomTab();
  319.         wait(random(15000,30000));
  320.         randomTab();
  321.         spinCam();
  322.         wait(random(6000,17000));
  323.     }
  324.    
  325.     public int loop() {
  326.         if(!getMyPlayer().isMoving())
  327.         {
  328.             if(isInBounds(bankarea) || isInBounds(offtrack_west) || isInBounds(offtrack_east) || isInBounds(waitinggraveyard_west) || isInBounds(waitinggraveyard_east))
  329.             {
  330.                 log("Location: soul wars general area.");
  331.                 log("Action: walking to walkway.");
  332.                 walkToWalkway();
  333.             }
  334.             else if(isInBounds(walkway))
  335.             {
  336.                 log("Location: walkway.");
  337.                 walkToBalancePortal();
  338.                 log("Action: Walking to balance portal");
  339.             }
  340.             else if(isInBounds(portalarea))
  341.             {
  342.                 log("Location: portal area.");
  343.                 wait(random(4000,8000));
  344.                 if(isCloseToBalancePortal())
  345.                 {
  346.                     entertries++;
  347.                     log("Location: Close to balance portal.");
  348.                     log("Action: entering balance portal. I have tried " + entertries +" times so far. Will wait 3 to 4 minutes after 5 tries (for anti-ban purposes).");
  349.                     enterBalancePortal();
  350.                     wait(random(3000,5000));
  351.                     if(!(isInBounds(waitingarea_red) || isInBounds(waitingarea_blue)))
  352.                     {
  353.                         log("Clicking to continue into the portal.");
  354.                         clickCont();
  355.                         wait(random(3000,5000));
  356.                         clickToEnter();
  357.                     }
  358.                     wait(random(3000,5000));
  359.                     if(!(isInBounds(waitingarea_red) || isInBounds(waitingarea_blue)))
  360.                     {
  361.                         if(entertries>=5)
  362.                         {
  363.                             entertries = 0;
  364.                             log("Has tried to enter balance portal 5 times. It is possible that you aren't allowed in for an allotted time. Will wait 3 to 4 minutes before trying again.");
  365.                             waitSuperLong();
  366.                         }
  367.                     }
  368.                 }
  369.                 else
  370.                 {
  371.                     walkToBalancePortal();
  372.                 }
  373.             }
  374.             else if(isInBounds(avatarspot_red))
  375.             {
  376.                 log("Location: Red Avatar spot.");
  377.                 walkRandom(avatarspot_red);
  378.                 log("Action: walking to random location in the avatar area.");
  379.                 wait(random(10000,20000));
  380.                 spinCam();
  381.                 wait(random(10000,20000));
  382.                 randomTab();
  383.                 wait(random(10000,20000));
  384.                 spinCam();
  385.                 wait(random(10000,20000));
  386.                 randomTab();
  387.                 spinCam();
  388.             }
  389.             else if(isInBounds(avatarspot_blue))
  390.             {
  391.                 log("Location: Blue Avatar spot.");
  392.                 walkRandom(avatarspot_blue);
  393.                 log("Action: walking to random location in the avatar area.");
  394.                 wait(random(10000,20000));
  395.                 spinCam();
  396.                 wait(random(10000,20000));
  397.                 randomTab();
  398.                 wait(random(10000,20000));
  399.                 spinCam();
  400.                 wait(random(10000,20000));
  401.                 randomTab();
  402.                 spinCam();
  403.             }
  404.             else if(isInBounds(base_red))
  405.             {
  406.                 log("Location: red base.");
  407.                 walkRandomRedSpot();
  408.                 log("Walking to a random spot");
  409.                 wait(random(5000,15000));
  410.  
  411.             }
  412.             else if(isInBounds(base_blue))
  413.             {
  414.                 log("Location: blue base.");
  415.                 walkRandomBlueSpot();
  416.                 log("Walking to a random spot");
  417.                 wait(random(5000,15000));
  418.             }
  419.             else if(isInBounds(safezone_red))
  420.             {
  421.                 setRun(true);
  422.                 wait(random(2000,3000));
  423.                 log("Location: red safezone.");
  424.                 log("Action: walking to red barrier");
  425.                 walkToRedBarrier();
  426.                 if(isInBounds(safezone_red))
  427.                 {
  428.                     if(distanceTo(barrierloc_red)<=4)
  429.                     {
  430.                         log("Action: passing red barrier.");
  431.                         passRedBarrier();
  432.                     }
  433.                 wait(random(5000,7000));
  434.                 }
  435.             }
  436.             else if(isInBounds(safezone_blue))
  437.             {
  438.                 setRun(true);
  439.                 wait(random(2000,3000));
  440.                 log("Location: blue safezone.");
  441.                 log("Action: walking to blue barrier");
  442.                 walkToBlueBarrier();
  443.                 if(isInBounds(safezone_blue))
  444.                 {
  445.                     if(distanceTo(barrierloc_blue)<=4)
  446.                     {
  447.                         log("Action: Passing blue barrier");
  448.                         passBlueBarrier();
  449.                     }
  450.                     wait(random(5000,7000));
  451.                 }
  452.             }
  453.             else if(isInBounds(waitingarea_red))
  454.             {
  455.                 entertries = 0;
  456.                 log("Location: red waiting area.");
  457.                 walkRandom(waitingarea_red);
  458.                 log("Action: walking randomly.");
  459.                 wait(random(8000,15000));
  460.             }
  461.             else if(isInBounds(waitingarea_blue))
  462.             {
  463.                 entertries = 0;
  464.                 log("Location: blue waiting area.");
  465.                 walkRandom(waitingarea_blue);
  466.                 log("Action: walking randomly.");
  467.                 wait(random(8000,15000));
  468.             }
  469.         }
  470.     return 1000;
  471.     }
  472. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement