Advertisement
Guest User

Untitled

a guest
Jul 17th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 34.49 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Container;
  3. import java.awt.Dimension;
  4. import java.awt.Font;
  5. import java.awt.Graphics;
  6. import java.awt.Graphics2D;
  7. import java.awt.Insets;
  8. import java.awt.Point;
  9. import java.awt.Rectangle;
  10. import java.awt.SystemColor;
  11. import java.awt.event.MouseAdapter;
  12. import java.awt.event.MouseEvent;
  13. import java.awt.event.MouseListener;
  14. import java.beans.PropertyChangeEvent;
  15. import java.beans.PropertyChangeListener;
  16. import java.io.BufferedReader;
  17. import java.io.BufferedWriter;
  18. import java.io.FileWriter;
  19. import java.io.IOException;
  20. import java.io.InputStreamReader;
  21. import java.net.URL;
  22. import java.net.URLConnection;
  23. import java.util.ArrayList;
  24. import java.util.Arrays;
  25. import javax.swing.DefaultComboBoxModel;
  26. import javax.swing.JButton;
  27. import javax.swing.JCheckBox;
  28. import javax.swing.JComboBox;
  29. import javax.swing.JEditorPane;
  30. import javax.swing.JFileChooser;
  31. import javax.swing.JFrame;
  32. import javax.swing.JLabel;
  33. import javax.swing.JMenu;
  34. import javax.swing.JMenuBar;
  35. import javax.swing.JMenuItem;
  36. import javax.swing.JOptionPane;
  37. import javax.swing.JPanel;
  38. import javax.swing.JSlider;
  39. import javax.swing.JTabbedPane;
  40. import javax.swing.WindowConstants;
  41. import org.rsbot.event.events.ServerMessageEvent;
  42. import org.rsbot.event.listeners.PaintListener;
  43. import org.rsbot.event.listeners.ServerMessageListener;
  44. import org.rsbot.script.Script;
  45. import org.rsbot.script.ScriptManifest;
  46. import org.rsbot.script.util.Timer;
  47. import org.rsbot.script.wrappers.RSArea;
  48. import org.rsbot.script.wrappers.RSInterface;
  49. import org.rsbot.script.wrappers.RSComponent;
  50. import org.rsbot.script.wrappers.RSGroundItem;
  51. import org.rsbot.script.wrappers.RSItem;
  52. import org.rsbot.script.wrappers.RSNPC;
  53. import org.rsbot.script.wrappers.RSObject;
  54. import org.rsbot.script.wrappers.RSTile;
  55. import org.rsbot.script.wrappers.GEItemInfo;
  56. @ScriptManifest(authors = "Rapid", name = "AutoPapayaSpawn2", keywords = "Summoning", version = 1.30, description = "Spawns Fruits.")
  57. public class AutoPapayaSpawn2 extends Script implements PaintListener, ServerMessageListener{
  58. private int totalProfit, totalExpenses, profitPerHour, papayaPrice, potionPrice, orangePrice, scrollPrice, dosesDrank, totalOrange, totalPapaya, potTotal, scrollTotal;
  59. private int PapayaID = 5972;
  60. private int OrangeID = 2108;
  61. private int WatermelonID = 5982;
  62. private int WatermelonseedID = 5321;
  63. private int CoconutID = 5974;
  64. private int ScrollID = 12423;
  65. private int PouchID = 12033;
  66. private int SumPot4 = 12140;
  67. private int SumPot3 = 12142;
  68. private int SumPot2 = 12144;
  69. private int SumPot1 = 12146;
  70.  
  71. private ArrayList<RSGroundItem> PapayaList = new ArrayList<RSGroundItem>();
  72.  
  73. private int[] objBankID = {11758, 11402, 34752, 35647, 2213, 25808, 2213, 26972, 27663, 4483, 14367, 19230, 29085, 12759, 6084, 24914, 52589};//done
  74. private int ChestID = 4483;
  75. private int[] ObeliskID = {29954, 29959};
  76.  
  77. private RSTile EdgeEastSpawn = new RSTile(3102, 3498);
  78. private RSTile EdgeEastBank = new RSTile(3097, 3498);
  79. private RSArea EdgevilleBankArea = new RSArea(new RSTile(3091, 3488), new RSTile(3098, 3499));
  80. private RSArea EdgevilleFurnace = new RSArea(new RSTile(3106, 3498), new RSTile(3109, 3502));
  81. private RSTile EdgeWestSpawn = new RSTile(3087, 3491);
  82. private RSTile EdgeWestBank = new RSTile(3093, 3491);
  83. private RSTile EdgeObelisk = new RSTile(3128, 3517);
  84.  
  85. private RSTile CastleWarsSpawn = new RSTile(2461, 3090);
  86. private RSTile CastleWarsBank = new RSTile(2442, 3084);
  87. private RSArea CastleWarsBankArea = new RSArea(new RSTile(2440, 3082), new RSTile(2445, 3087));
  88. private RSTile CastleWarsObelisk = new RSTile(2462, 3088);
  89. private RSTile ZanarisSpawn = new RSTile(2390, 4450);//done
  90. private RSTile ZanarisBank = new RSTile(2383, 4458);//done
  91. private RSArea ZanarisBankArea = new RSArea(new RSTile(2384, 4455), new RSTile(2378, 4462));//done
  92. private RSTile ZanarisObelisk = new RSTile(2405, 4444);//done
  93.  
  94. private RSArea BankArea;
  95. private RSTile SpawnTile;
  96. private RSTile BankTile;
  97. private RSTile ObeliskTile;
  98.  
  99. private boolean getPouch = false;
  100. private boolean getDrink = false;
  101. private boolean outOfPoints = false;
  102. private boolean doCall;
  103.  
  104. private boolean usePotion;
  105.  
  106. private int StartScrollCount;
  107. private int CurrentScrollCount;
  108. private int StartExp;
  109. private long StartTime;
  110. private int PapayasCollected;
  111. private int OrangesCollected;
  112. private String Status;
  113.  
  114. private int toCast = 1;
  115. private int casted;
  116. private int errorCount = 0;
  117.  
  118. //AntiBan variables
  119. private AntiBan antiban;
  120. private int sleepTimer;
  121. private int minChange;
  122. private int maxChange;
  123. private int minHeight;
  124. private int maxHeight;
  125.  
  126. //GUI Variables
  127. public boolean waitGUI = true;
  128. public boolean stopScript = false;
  129. public String location;
  130.  
  131. private enum State{
  132. SUMMON, SPAWN, BANK, WALK_TO_OBELISK, USE_OBELISK, DRINK, SLEEP, PICK_UP, WALK_TO_SPAWN;
  133. }
  134.  
  135. private enum Location{
  136. EDGE_NORTH, EDGE_SOUTH
  137. }
  138.  
  139. public AutoPapayaSpawn2(){
  140. this.antiban = new AntiBan(this);
  141. }
  142.  
  143. class AntiBan extends Thread {
  144. private AutoPapayaSpawn2 parent;
  145. AntiBan(AutoPapayaSpawn2 parent){
  146. this.parent = parent;
  147. }
  148. @Override
  149. public void run(){
  150. try{
  151. while(parent.isActive()){
  152. if (!parent.isPaused()){
  153. int CameraHeight = camera.getPitch(), CameraAngle = camera.getAngle();
  154. int rnd = random(0, 10);
  155. switch (rnd){
  156. case 1:
  157. if (CameraHeight >= 50){
  158. camera.setPitch(CameraHeight - random(minChange, maxChange));
  159. }else{
  160. camera.setPitch(CameraHeight + random(minHeight, maxHeight));
  161. }
  162. camera.setAngle(CameraAngle + random(minHeight, maxHeight));
  163. sleep(random(1000, 1500));
  164. break;
  165. case 2:
  166. if (CameraHeight >= 50){
  167. camera.setPitch(CameraHeight - random(minHeight, maxHeight));
  168. }else{
  169. camera.setPitch(CameraHeight + random(minHeight, maxHeight));
  170. }
  171. camera.setAngle(CameraAngle - random(minChange, maxChange));
  172. sleep(random(1000, 1500));
  173. break;
  174. }
  175. sleep(random(sleepTimer - 1000, sleepTimer + 1000));
  176. }
  177. }
  178. }catch(Exception e){
  179. log("Exception");
  180. }
  181. }
  182. }
  183.  
  184. public double getVersion(){
  185. return 1.275;
  186. }
  187.  
  188. public boolean onStart(){
  189. final GEItemInfo PapayaGE = grandExchange.loadItemInfo(PapayaID);
  190. papayaPrice = PapayaGE.getMarketPrice();
  191. log("Price of Papypa: " + papayaPrice);
  192.  
  193. final GEItemInfo OrangeGE = grandExchange.loadItemInfo(OrangeID);
  194. orangePrice = OrangeGE.getMarketPrice();
  195. log("Price of Orange: " + orangePrice);
  196.  
  197. final GEItemInfo ScrollGE = grandExchange.loadItemInfo(ScrollID);
  198. scrollPrice = ScrollGE.getMarketPrice();
  199. log("Price of Scroll: " + scrollPrice);
  200.  
  201. final GEItemInfo PotGE = grandExchange.loadItemInfo(SumPot4);
  202. potionPrice = PotGE.getMarketPrice();
  203. log("Price of Summoning Potion (4): " + potionPrice);
  204.  
  205. mouse.setSpeed (4);
  206.  
  207. TestGUI1 gui = new TestGUI1();
  208. gui.setVisible(true);
  209. while (waitGUI){
  210. sleep(random(100, 200));
  211. minChange = gui.angleChange.getValue() - 20;
  212. maxChange = gui.angleChange.getValue() + 20;
  213. minHeight = gui.maxHeight.getValue() - 20;
  214. maxHeight = gui.maxHeight.getValue() + 20;
  215. sleepTimer = gui.sleepTimer.getValue();
  216. gui.lblSleep.setText("Sleep timer (Current max: " + (sleepTimer + 1000) + " Current min: " + (sleepTimer - 1000) + ")");
  217. gui.lblAngle.setText("Average angle change (Current max: " + maxChange + " Current min: " + minChange + ")");
  218. gui.lblHeight.setText("Average height change (Current max: " + maxHeight + " Current min: " + minHeight + ")");
  219. usePotion = gui.checkSummoning.isSelected();
  220. }
  221. if (stopScript == true){
  222. return false;
  223. }else{
  224. log(location);
  225. if (location == "Edgeville East"){
  226. BankTile = EdgeEastBank;
  227. SpawnTile = EdgeEastSpawn;
  228. BankArea = EdgevilleBankArea;
  229. ObeliskTile = EdgeObelisk;
  230. }else if (location == "Edgeville West"){
  231. BankTile = EdgeWestBank;
  232. SpawnTile = EdgeWestSpawn;
  233. BankArea = EdgevilleBankArea;
  234. ObeliskTile = EdgeObelisk;
  235. }else if (location == "Zanaris"){//done
  236. BankTile = ZanarisBank;//done
  237. SpawnTile = ZanarisSpawn;//done
  238. BankArea = ZanarisBankArea;//done
  239. ObeliskTile = ZanarisObelisk;//done
  240. }else if (location == "Castle Wars"){
  241. BankTile = CastleWarsBank;
  242. SpawnTile = CastleWarsSpawn;
  243. BankArea = CastleWarsBankArea;
  244. ObeliskTile = CastleWarsObelisk;
  245. }else{
  246. return false;
  247. }
  248. }
  249. antiban.start();
  250. StartTime = System.currentTimeMillis();
  251. return true;
  252. }
  253.  
  254. void depositAllExcept(int[] notBank){
  255. for (RSItem temp : inventory.getItems()){
  256. boolean bank = true;
  257. for (int i=0;i<=notBank.length-1;i++){
  258. if (temp.getID() == notBank[i]){
  259. bank = false;
  260. break;
  261. }
  262. }
  263. if (bank == true){
  264. if (inventory.getCount(temp.getID()) == 1){
  265. temp.doAction("Deposit");
  266. sleep(random(500, 800));
  267. }else if (inventory.getCount(temp.getID()) > 1){
  268. temp.doAction("Deposit-All");
  269. sleep(random(500, 800));
  270. }
  271. }
  272. }
  273. }
  274.  
  275. @Override
  276. public int loop() {
  277. if (game.isLoggedIn()){
  278. try{ if (StartScrollCount == 0){ StartScrollCount = inventory.getItem(ScrollID).getStackSize();} }catch(Exception e){}
  279. if (interfaces.get(671) != null){
  280. interfaces.get(671).getComponent(13).doClick();
  281. }
  282. if (interfaces.get(11) != null){
  283. interfaces.get(11).getComponent(15).doClick();
  284. log ("Closed deposit box.");
  285. }
  286. switch(getState()){
  287. case USE_OBELISK:
  288. RSObject obelisk = objects.getNearest(ObeliskID);
  289. if (obelisk != null){
  290. if (obelisk.doClick()){
  291. break;
  292. }else{
  293. return random(100, 300);
  294. }
  295. }
  296. break;
  297. case DRINK:
  298. int[] allPots = {SumPot1, SumPot2, SumPot3, SumPot4};
  299. for (int i=0;i<=allPots.length-1;i++){
  300. if (inventory.getCount(allPots[i]) > 0){
  301. if (inventory.getItem(allPots[i]).doAction("Drink")) {
  302. dosesDrank++;
  303. return random(500, 800);
  304. }
  305. }
  306. }
  307. getDrink = true;
  308. break;
  309.  
  310. case SUMMON:
  311. inventory.getItem(PouchID).doAction("Summon");
  312. return random(1250, 1500);
  313. case BANK:
  314. if (bank.isOpen()){
  315. int[] dontBankwPots = {ScrollID, PouchID, SumPot1, SumPot2, SumPot3, SumPot4};
  316. int[] dontBankwoPots = {ScrollID, PouchID};
  317. int[] dontBank;
  318. if (usePotion){
  319. dontBank = dontBankwPots;
  320. }else{
  321. dontBank = dontBankwoPots;
  322. }
  323. if (inventory.contains(PapayaID)){
  324. PapayasCollected = PapayasCollected + inventory.getCount(PapayaID);
  325. }
  326. if (inventory.contains(OrangeID)){
  327. OrangesCollected = OrangesCollected + inventory.getCount(OrangeID);
  328. }
  329. while (!bankAllExcept2(dontBank)){
  330. errorCount++;
  331. if(errorCount == 8) {
  332. PapayasCollected = PapayasCollected - inventory.getCount(PapayaID); //To reset correct amounts if bank accidentally closes
  333. OrangesCollected = OrangesCollected - inventory.getCount(OrangeID);
  334. //log ("Yikes, banking error.");
  335. break;
  336. }
  337. }
  338. errorCount = 0;
  339. mouse.setSpeed(4);
  340. bank.depositAllFamiliar();//Thank you for this line, Rapid :)
  341. sleep(random(850, 1250));
  342. if (bank.getCount(PouchID) != 0 && getPouch == true){
  343. bank.withdraw(PouchID, 1);
  344. sleep(random(800, 1250));
  345. getPouch = false;
  346. }else if(getPouch == true){
  347. log("Ran out of pouches...");
  348. stopScript();
  349. }
  350. if (getDrink == true || (usePotion && getDoses() < 8)){
  351. int[] sumPots = {SumPot1, SumPot2, SumPot3, SumPot4};
  352. if (bank.getCount(sumPots) > 2){
  353. for (int i=0;i<=sumPots.length-1;i++){
  354. if (bank.getCount(sumPots[i]) > 1){
  355. bank.withdraw(sumPots[i], 2);
  356. getDrink = false;
  357. break;
  358. }
  359. }
  360. }else{
  361. log("Out of potions. Switching to other method.");
  362. getDrink = false;
  363. usePotion = false;
  364. //stopScript();
  365. }
  366. }
  367. if (containsOnly(dontBank))
  368. bank.close();
  369. }else{
  370. RSObject bank1 = objects.getNearest(objBankID);
  371. RSObject bank2 = objects.getNearest(ChestID);
  372. if (bank2 != null){
  373. if (bank2.isOnScreen() && BankArea.contains(getMyPlayer().getLocation())){
  374. if (bank2.doAction("Use")){
  375. sleep(random(1500, 2000));
  376. }else{
  377. return random(100, 300);
  378. }
  379. }else{
  380. walking.walkTileMM(walking.getClosestTileOnMap(bank2.getLocation()), random(0,3), random(0,3));
  381. }
  382. }else if (bank1 != null){
  383. if (bank1.isOnScreen() && BankArea.contains(getMyPlayer().getLocation())){
  384. if (bank1.doAction("Use-quickly")){
  385. sleep(random(1500, 2000));
  386. }else{
  387. return random(100, 300);
  388. }
  389. }else{
  390. walking.walkTileMM(walking.getClosestTileOnMap(bank1.getLocation()), random(0,3), random(0,3));
  391. }
  392. }else{
  393. walking.walkTileMM(walking.getClosestTileOnMap(BankTile), random(0,3), random(0,3));
  394. }
  395. }
  396. break;
  397.  
  398. case WALK_TO_OBELISK:
  399. if (!walking.walkTileMM(walking.getClosestTileOnMap(ObeliskTile), random(0,3), random(0,3))){
  400. walking.walkTo(ObeliskTile);
  401. }
  402. break;
  403.  
  404. case WALK_TO_SPAWN:
  405. if (!walking.walkTileMM(walking.getClosestTileOnMap(SpawnTile), random(0,3), random(0,3))){
  406. walking.walkTo(SpawnTile);
  407. }
  408. break;
  409.  
  410. case SPAWN:
  411. CurrentScrollCount = inventory.getItem(ScrollID).getStackSize();
  412. if (doCall == true){
  413. if (summoning.doCallFollower()){
  414. doCall = false;
  415. return random(1500, 2000);
  416. }else{
  417. return random(100, 300);
  418. }
  419. }else{
  420. if (interfaces.getComponent(747, 2).containsText("Cast")){
  421. if (interfaces.getComponent(747, 2).doClick()){
  422. casted++;
  423. return random(2250, 2500);
  424. }else{
  425. return random(300, 500);
  426. }
  427. }else{
  428. if (interfaces.getComponent(747, 2).doAction("Cast")){
  429. casted++;
  430. return random(2250, 2500);
  431. }else{
  432. return random(300, 500);
  433. }
  434. }
  435. }
  436.  
  437. case SLEEP:
  438. return random(500, 750);
  439.  
  440. case PICK_UP:
  441. try{
  442. int rnd1 = random(0, PapayaList.size());
  443. int distance = 99999;
  444. for (int i = 0; i < PapayaList.size(); i++) {
  445. if(calc.distanceTo(PapayaList.get(i).getLocation()) < distance){
  446. rnd1 = i;
  447. distance = calc.distanceTo(PapayaList.get(i).getLocation());
  448. }else if (calc.distanceTo(PapayaList.get(i).getLocation()) == distance) {
  449. if (random (1,3) < 2) {
  450. rnd1 = i;
  451. distance = calc.distanceTo(PapayaList.get(i).getLocation());
  452. }
  453. }
  454. }
  455. if (!getMyPlayer().isMoving()){
  456. if (PapayaList.get(rnd1).isOnScreen()){
  457. //int rnd = random(0, PapayaList.size());
  458. if (PapayaList.get(rnd1).getItem().getID() == OrangeID){
  459. if (tiles.doAction(PapayaList.get(rnd1).getLocation(),random(0.48, 0.52),random(0.48, 0.52),0,"Take Orange")){
  460. return random(1250, 1500);
  461. }else{
  462. return random(100, 300);
  463. }
  464. }else
  465. if (PapayaList.get(rnd1).getItem().getID() == WatermelonID){
  466. if (tiles.doAction(PapayaList.get(rnd1).getLocation(),random(0.48, 0.52),random(0.48, 0.52),0,"Take Watermelon")){
  467. return random(1250, 1500);
  468. }else{
  469. return random(100, 300);
  470. }
  471. }else
  472. if (PapayaList.get(rnd1).getItem().getID() == PapayaID){
  473. if (tiles.doAction(PapayaList.get(rnd1).getLocation(),random(0.48, 0.52),random(0.48, 0.52),0,"Take Papaya")){
  474. return random(1250, 1500);
  475. }else{
  476. return random(100, 300);
  477. }
  478. }else
  479. if (PapayaList.get(rnd1).getItem().getID() == WatermelonseedID){
  480. if (tiles.doAction(PapayaList.get(rnd1).getLocation(),random(0.48, 0.52),random(0.48, 0.52),0,"Take Watermelon seed")){
  481. return random(1250, 1500);
  482. }else{
  483. return random(100, 300);
  484. }
  485. }else
  486. if (PapayaList.get(rnd1).getItem().getID() == CoconutID){
  487. if (tiles.doAction(PapayaList.get(rnd1).getLocation(),random(0.48, 0.52),random(0.48, 0.52),0,"Take Coconut")){
  488. return random(1250, 1500);
  489. }else{
  490. return random(100, 300);
  491. }
  492. }
  493. }else{
  494. walking.walkTileMM(walking.getClosestTileOnMap(PapayaList.get(rnd1).getLocation()), random(0,2), random(0,2));
  495. }
  496. }
  497. }catch(Exception e){
  498. casted = 0;
  499. toCast = random(2, 5);
  500. }
  501. break;
  502. }
  503. }else{
  504. return random(100, 300);
  505. }
  506. return random(250, 500);
  507. }
  508. private State getState(){
  509. PapayaList.clear();
  510. for (RSGroundItem items : groundItems.getAll()){
  511. if(calc.distanceTo(items.getLocation()) < 8){
  512. if (items.getItem().getID() == PapayaID){
  513. PapayaList.add(items);
  514. }
  515. if (items.getItem().getID() == OrangeID){
  516. PapayaList.add(items);
  517. }
  518. if (items.getItem().getID() == WatermelonID){
  519. PapayaList.add(items);
  520. }
  521. if (items.getItem().getID() == WatermelonseedID){
  522. PapayaList.add(items);
  523. }
  524. if (items.getItem().getID() == CoconutID){
  525. PapayaList.add(items);
  526. }
  527. }
  528. }
  529. if (PapayaList.size() == 0){
  530. toCast = random(3, 6);
  531. casted = 0;
  532. }
  533. if (getMyPlayer().isMoving() && calc.distanceTo(walking.getDestination()) >= 3 || getMyPlayer().getAnimation() == 7660 || getMyPlayer().isMoving() &&
  534.  
  535. BankArea.contains(getMyPlayer().getLocation())){
  536. Status = "SLEEP";
  537. return State.SLEEP;
  538. }else if (bank.isOpen() || inventory.isFull() || getPouch == true || getDrink == true){
  539. Status = "BANK";
  540. return State.BANK;
  541. }else if (!inventory.isFull() && casted >= toCast || (inventory.getCount() + PapayaList.size()) >= 28 && !inventory.isFull()){
  542. Status = "PICK_UP";
  543. return State.PICK_UP;
  544. }else if (summoning.isFamiliarSummoned()){
  545. if (outOfPoints != true){
  546. if (calc.distanceTo(SpawnTile) <= 2 && !BankArea.contains(getMyPlayer().getLocation()) && !EdgevilleFurnace.contains(getMyPlayer().getLocation())){
  547. Status = "SPAWN";
  548. return State.SPAWN;
  549. }else{
  550. Status = "WALK_TO_SPAWN";
  551. return State.WALK_TO_SPAWN;
  552. }
  553. }else{
  554. if (usePotion == true){
  555. outOfPoints = false;
  556. Status = "DRINK";
  557. return State.DRINK;
  558. }else{
  559. outOfPoints = false;
  560. sleep(random(10000, 15000));
  561. Status = "SLEEP_LOW_POINTS";
  562. return State.SLEEP;
  563. }
  564. }
  565. }else if (inventory.contains(PouchID)){
  566. if (summoning.getSummoningPoints() <= 2){
  567. if (usePotion == true){
  568. Status = "DRINK";
  569. return State.DRINK;
  570. }else{
  571. RSObject Obelisk = objects.getNearest(ObeliskID);
  572. if (Obelisk != null){
  573. if (Obelisk.isOnScreen()){
  574. Status = "USE_OBELISK";
  575. return State.USE_OBELISK;
  576. }else{
  577. Status = "WALK_TO_OBELISK";
  578. return State.WALK_TO_OBELISK;
  579. }
  580. }else{
  581. Status = "WALK_TO_OBELISK";
  582. return State.WALK_TO_OBELISK;
  583. }
  584. }
  585. }else{
  586. Status = "SUMMON";
  587. return State.SUMMON;
  588. }
  589. }else{
  590. Status = "BANK";
  591. getPouch = true;
  592. return State.BANK;
  593. }
  594. }
  595.  
  596. public int getDoses () {
  597. return (inventory.getCount(SumPot1) + inventory.getCount(SumPot2)*2 + inventory.getCount(SumPot3)*3 + inventory.getCount(SumPot4)*4);
  598. }
  599.  
  600. public boolean bankAllExcept2 (int... items) {
  601. mouse.setSpeed(6);
  602. RSItem [] invItems = inventory.getItems();
  603. int[] sumPots = {SumPot1, SumPot2, SumPot3, SumPot4};
  604. RSItem toBank;
  605. String bankAction;
  606. RSComponent nextBank = null;
  607. ArrayList<Integer> bankList = new ArrayList<Integer>();
  608. for (RSItem item : invItems) { //Go through all items in inventory
  609. for (int id : items) { //Go through all items not to bank
  610. if (!bankList.contains(item.getID())){
  611. bankList.add(item.getID());
  612. }
  613. if(item.getID() == id) { //If the ID of the inventory item is not on the list
  614. bankList.remove(bankList.size()-1);
  615. break;
  616. }
  617. }
  618. }
  619.  
  620. if (bankList.size() > 0) {
  621. for (int i=0; i< bankList.size(); i++) {
  622. toBank = inventory.getItem(bankList.get(i));
  623. try {
  624. nextBank = inventory.getItem(bankList.get(i+1)).getComponent();
  625. }catch (Exception e) {
  626. nextBank = interfaces.getComponent(bank.INTERFACE_BANK,
  627. bank.INTERFACE_BANK_BUTTON_DEPOSIT_BEAST_INVENTORY);
  628. }
  629. if (toBank != null) {
  630. if (inventory.getCount(bankList.get(i)) > 1) {
  631. bankAction = "Deposit-All";
  632. }else{bankAction = "Deposit";}
  633.  
  634. if (toBank.doAction(bankAction)){
  635. sleep (200,350);
  636. if (nextBank != null)
  637. nextBank.doHover();
  638. for (int w = 0; w < 11; w++) {
  639. if (inventory.contains(bankList.get(i))){
  640. sleep (100,150);
  641. }else{
  642. sleep (500,700);
  643. break;
  644. }
  645. }
  646. }
  647. }
  648. }
  649. }
  650. return containsOnly(items);
  651. }
  652.  
  653. public boolean containsOnly (int[] items) {
  654. RSItem [] invItems = inventory.getItems(); //getItems seems to return all blank item spaces with an item with no name. Sadface.
  655. boolean haveOnly = true;
  656. for (RSItem item : invItems)
  657. for (int i=0; i< items.length; i++){
  658. if (item.getID() == items [i]){
  659. break;
  660. }
  661. if (i == items.length-1){
  662. try {
  663. item.getName().charAt(0);
  664. }catch (Exception e){break;}
  665. haveOnly = false;
  666. }
  667. }
  668. return haveOnly;
  669. }
  670.  
  671. @Override
  672. public void onRepaint(Graphics g1) {
  673. totalPapaya = PapayasCollected * papayaPrice;
  674. totalOrange = OrangesCollected * orangePrice;
  675. scrollTotal = (StartScrollCount - CurrentScrollCount)*scrollPrice;
  676. potTotal = dosesDrank*(potionPrice/4);
  677. totalExpenses = potTotal + scrollTotal;
  678. totalProfit = totalOrange + totalPapaya - totalExpenses;
  679. profitPerHour = (int) ((totalProfit) * 3600000D / (System.currentTimeMillis() - StartTime));
  680. final Color color1 = new Color(0, 0, 0);
  681. final Font font1 = new Font("Arial", 1, 22);
  682. final Font font2 = new Font("Arial", 0, 16);
  683. if (game.isLoggedIn()){
  684. if (StartExp == 0){
  685. StartExp = skills.getCurrentExp(23);
  686. }
  687. g1.setColor(new Color(0,0,0));
  688. //Box paint
  689. g1.setColor(new Color(255, 0, 0, 160));//transparent red
  690. g1.fillRect(300, 4, 216, 158);
  691. g1.setColor(new Color(212, 193, 156));//base color
  692. g1.setColor(new Color(255, 0, 0, 160));//transparent red
  693. //String paints
  694. Graphics2D g = (Graphics2D)g1;
  695. g.setFont(font1);
  696. g.setColor(color1);
  697. g.drawString("AutoPapayaSpawn", 315, 338);
  698. g.setFont(font2);
  699. if (totalProfit > 99999) {
  700. g.drawString("Total Money Gain: " + totalProfit / 1000 + "k",
  701. 315, 55);
  702. } else {
  703. g.drawString("Total Money Gain: " + totalProfit, 315, 55);
  704. }
  705. if (totalExpenses > 99999) {
  706. g.drawString("Total Expenses: " + totalExpenses / 1000 + "k",
  707. 315, 70);
  708. } else {
  709. g.drawString("Total Expenses: " + totalExpenses, 315, 70);
  710. }
  711. if (profitPerHour > 99999) {
  712. g.drawString("Profit Per Hour: " + profitPerHour / 1000 + "k",
  713. 315, 85);
  714. } else {
  715. g.drawString("Profit Per Hour: " + profitPerHour, 315, 85);
  716. }
  717. g.drawString("Runtime: " + Timer.format(System.currentTimeMillis() - StartTime), 315, 25);
  718. g.drawString("Scrolls used: " + (StartScrollCount - CurrentScrollCount), 315, 40);
  719. g.drawString("Experience gained: " + (skills.getCurrentExp(23) - StartExp), 315, 100);
  720. g.drawString("Papayas banked: " + PapayasCollected, 315, 115);
  721. g.drawString("Oranges banked: " + OrangesCollected, 315, 130);
  722. g.drawString("Status: " + Status, 315, 145);
  723. //Mouse paint
  724. int x = mouse.getLocation().x;
  725. int y = mouse.getLocation().y;
  726. g1.drawLine(x, y, x + 1000, y);
  727. g1.drawLine(x, y, x - 1000, y);
  728. g1.drawLine(x, y, x, y + 500);
  729. g1.drawLine(x, y, x, y - 500);
  730. }
  731. }
  732. @Override
  733. public void serverMessageRecieved(ServerMessageEvent e) {
  734. if (e.getMessage().toLowerCase().contains("special move bar is too low")){
  735. outOfPoints = true;
  736. }
  737. if (e.getMessage().toLowerCase().contains("too far away")){
  738. doCall = true;
  739. }
  740. if (e.getMessage().toLowerCase().contains("have been updated")){
  741. log ("Yay, GE items are in!");
  742. }
  743. }
  744.  
  745. public class TestGUI1 extends JFrame {
  746. public TestGUI1() {
  747. initComponents();
  748. lblHeight.setToolTipText("This sets the average height change for the anti-ban. The min and max change are either this value +20, or -20");
  749. lblAngle.setToolTipText("This sets the average angle change for the anti-ban. The min and max change are either this value +20 or -20");
  750. lblSleep.setToolTipText("This is the average sleep for the anti-ban. The higher the value, the more it waits before reactivating");
  751. }
  752. private void startScriptMouseClicked(MouseEvent e) {
  753. waitGUI = false;
  754. location = comboBox1.getModel().getSelectedItem().toString();
  755. dispose();
  756. }
  757. private void cancelScriptMouseClicked(MouseEvent e) {
  758. waitGUI = false;
  759. stopScript = true;
  760. dispose();
  761. }
  762. private void slider1PropertyChange(PropertyChangeEvent e) {
  763. lblSleep.setText("Sleep timer (Currently " + sleepTimer.getValue() + ")");
  764. }
  765. private void sleepTimerPropertyChange(PropertyChangeEvent e) {
  766. lblSleep.setText("Sleep timer (Currently " + sleepTimer.getValue() + ")");
  767. }
  768. private void initComponents() {
  769. // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
  770. // Generated using JFormDesigner Evaluation license - alex maley
  771. menuBar1 = new JMenuBar();
  772. startScript = new JMenu();
  773. cancelScript = new JMenu();
  774. label1 = new JLabel();
  775. tabbedPane1 = new JTabbedPane();
  776. panel1 = new JPanel();
  777. comboBox1 = new JComboBox();
  778. label2 = new JLabel();
  779. label8 = new JLabel();
  780. label9 = new JLabel();
  781. label10 = new JLabel();
  782. editorPane2 = new JEditorPane();
  783. editorPane3 = new JEditorPane();
  784. checkSummoning = new JCheckBox();
  785. panel2 = new JPanel();
  786. editorPane1 = new JEditorPane();
  787. lblSleep = new JLabel();
  788. sleepTimer = new JSlider();
  789. label5 = new JLabel();
  790. angleChange = new JSlider();
  791. lblAngle = new JLabel();
  792. lblHeight = new JLabel();
  793. maxHeight = new JSlider();
  794. //======== this ========
  795. setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  796. setResizable(false);
  797. setTitle("AutoPapayaSpawn");
  798. Container contentPane = getContentPane();
  799. contentPane.setLayout(null);
  800. //======== menuBar1 ========
  801. {
  802. //======== startScript ========
  803. {
  804. startScript.setText("Start Script");
  805. startScript.addMouseListener(new MouseAdapter() {
  806. @Override
  807. public void mouseClicked(MouseEvent e) {
  808. startScriptMouseClicked(e);
  809. }
  810. });
  811. }
  812. menuBar1.add(startScript);
  813. //======== cancelScript ========
  814. {
  815. cancelScript.setText("Cancel");
  816. cancelScript.addMouseListener(new MouseAdapter() {
  817. @Override
  818. public void mouseClicked(MouseEvent e) {
  819. cancelScriptMouseClicked(e);
  820. }
  821. });
  822. }
  823. menuBar1.add(cancelScript);
  824. }
  825. setJMenuBar(menuBar1);
  826. //---- label1 ----
  827. label1.setText("AutoPapayaSpawn");
  828. label1.setFont(new Font("Times New Roman", Font.BOLD, 36));
  829. contentPane.add(label1);
  830. label1.setBounds(new Rectangle(new Point(1, 5), label1.getPreferredSize()));
  831. //======== tabbedPane1 ========
  832. {
  833. //======== panel1 ========
  834. {
  835. // JFormDesigner evaluation mark
  836. panel1.setBorder(new javax.swing.border.CompoundBorder(
  837. new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
  838. "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
  839. javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
  840. java.awt.Color.red), panel1.getBorder())); panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void
  841.  
  842. propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});
  843. panel1.setLayout(null);
  844. //---- comboBox1 ----
  845. comboBox1.setModel(new DefaultComboBoxModel(new String[] {
  846. "Edgeville East",
  847. "Edgeville West",
  848. "Castle Wars",
  849. "Zanaris"
  850. }));
  851. panel1.add(comboBox1);
  852. comboBox1.setBounds(30, 155, comboBox1.getPreferredSize().width, 20);
  853. //---- label2 ----
  854. label2.setText("Location:");
  855. label2.setFont(new Font("Tahoma", Font.BOLD, 11));
  856. panel1.add(label2);
  857. label2.setBounds(20, 135, label2.getPreferredSize().width, 15);
  858. //---- label8 ----
  859. label8.setText("Created by rapid.");
  860. panel1.add(label8);
  861. label8.setBounds(new Rectangle(new Point(240, 10), label8.getPreferredSize()));
  862. //---- label9 ----
  863. label9.setText("How to use:");
  864. label9.setFont(new Font("Tahoma", Font.BOLD, 11));
  865. panel1.add(label9);
  866. label9.setBounds(new Rectangle(new Point(15, 30), label9.getPreferredSize()));
  867. //---- label10 ----
  868. label10.setText("Welcome to AutoPapayaSpawn GUI!");
  869. panel1.add(label10);
  870. label10.setBounds(new Rectangle(new Point(15, 10), label10.getPreferredSize()));
  871. //---- editorPane2 ----
  872. editorPane2.setText("Make sure your by the location you select on the GUI, otherwise the script may run into troubles. Make sure you have a decent supply of scrolls. I
  873.  
  874. suggest 1,000+ since it will use around 400 or so per hour.");
  875. editorPane2.setEditable(false);
  876. editorPane2.setBackground(SystemColor.menu);
  877. panel1.add(editorPane2);
  878. editorPane2.setBounds(20, 50, 320, 70);
  879. //---- editorPane3 ----
  880. editorPane3.setBackground(SystemColor.menu);
  881. editorPane3.setText("Have fun using the bot!");
  882. panel1.add(editorPane3);
  883. editorPane3.setBounds(20, 190, 310, 35);
  884. //---- checkSummoning ----
  885. checkSummoning.setText("Use summoning potions?");
  886. panel1.add(checkSummoning);
  887. checkSummoning.setBounds(new Rectangle(new Point(195, 155), checkSummoning.getPreferredSize()));
  888. }
  889. tabbedPane1.addTab("Main", panel1);
  890.  
  891. //======== panel2 ========
  892. {
  893. panel2.setLayout(null);
  894. //---- editorPane1 ----
  895. editorPane1.setText("Welcome to the fully customise-able Antiban section! Here you can change your antiban to suit you! And you only.");
  896. editorPane1.setEditable(false);
  897. editorPane1.setBackground(SystemColor.menu);
  898. panel2.add(editorPane1);
  899. editorPane1.setBounds(10, 5, 325, 35);
  900. //---- lblSleep ----
  901. lblSleep.setText("Sleep timer (Currently 0)");
  902. panel2.add(lblSleep);
  903. lblSleep.setBounds(15, 45, 320, lblSleep.getPreferredSize().height);
  904. //---- sleepTimer ----
  905. sleepTimer.setMaximum(10000);
  906. sleepTimer.setMinimum(1000);
  907. sleepTimer.setValue(5000);
  908. sleepTimer.addPropertyChangeListener("value", new PropertyChangeListener() {
  909. @Override
  910. public void propertyChange(PropertyChangeEvent e) {
  911. slider1PropertyChange(e);
  912. sleepTimerPropertyChange(e);
  913. }
  914. });
  915. panel2.add(sleepTimer);
  916. sleepTimer.setBounds(new Rectangle(new Point(10, 65), sleepTimer.getPreferredSize()));
  917. //---- label5 ----
  918. label5.setText("Camera Settings:");
  919. label5.setFont(new Font("Tahoma", Font.BOLD, 11));
  920. panel2.add(label5);
  921. label5.setBounds(new Rectangle(new Point(15, 95), label5.getPreferredSize()));
  922. //---- angleChange ----
  923. angleChange.setMaximum(160);
  924. angleChange.setMinimum(20);
  925. angleChange.setValue(90);
  926. panel2.add(angleChange);
  927. angleChange.setBounds(new Rectangle(new Point(15, 135), angleChange.getPreferredSize()));
  928. //---- lblAngle ----
  929. lblAngle.setText("Max Angle Change (Currently 0)");
  930. panel2.add(lblAngle);
  931. lblAngle.setBounds(15, 115, 320, lblAngle.getPreferredSize().height);
  932. //---- lblHeight ----
  933. lblHeight.setText("Max Height Change (Currently 0)");
  934. panel2.add(lblHeight);
  935. lblHeight.setBounds(15, 165, 315, lblHeight.getPreferredSize().height);
  936. //---- maxHeight ----
  937. maxHeight.setMaximum(50);
  938. maxHeight.setMinimum(20);
  939. maxHeight.setValue(35);
  940. panel2.add(maxHeight);
  941. maxHeight.setBounds(new Rectangle(new Point(15, 185), maxHeight.getPreferredSize()));
  942. { // compute preferred size
  943. Dimension preferredSize = new Dimension();
  944. for(int i = 0; i < panel2.getComponentCount(); i++) {
  945. Rectangle bounds = panel2.getComponent(i).getBounds();
  946. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  947. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  948. }
  949. Insets insets = panel2.getInsets();
  950. preferredSize.width += insets.right;
  951. preferredSize.height += insets.bottom;
  952. panel2.setMinimumSize(preferredSize);
  953. panel2.setPreferredSize(preferredSize);
  954. }
  955. }
  956. tabbedPane1.addTab("Antiban", panel2);
  957. }
  958. contentPane.add(tabbedPane1);
  959. tabbedPane1.setBounds(15, 50, 355, 250);
  960. { // compute preferred size
  961. Dimension preferredSize = new Dimension();
  962. for(int i = 0; i < contentPane.getComponentCount(); i++) {
  963. Rectangle bounds = contentPane.getComponent(i).getBounds();
  964. preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
  965. preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
  966. }
  967. Insets insets = contentPane.getInsets();
  968. preferredSize.width += insets.right;
  969. preferredSize.height += insets.bottom;
  970. contentPane.setMinimumSize(preferredSize);
  971. contentPane.setPreferredSize(preferredSize);
  972. }
  973. setSize(395, 370);
  974. setLocationRelativeTo(null);
  975. // JFormDesigner - End of component initialization //GEN-END:initComponents
  976. }
  977. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  978. // Generated using JFormDesigner Evaluation license - alex maley
  979. private JMenuBar menuBar1;
  980. private JMenu startScript;
  981. private JMenu cancelScript;
  982. private JLabel label1;
  983. private JTabbedPane tabbedPane1;
  984. private JPanel panel1;
  985. private JComboBox comboBox1;
  986. private JLabel label2;
  987. private JLabel label8;
  988. private JLabel label9;
  989. private JLabel label10;
  990. private JEditorPane editorPane2;
  991. private JEditorPane editorPane3;
  992. private JCheckBox checkSummoning;
  993. private JPanel panel2;
  994. private JEditorPane editorPane1;
  995. private JLabel lblSleep;
  996. private JSlider sleepTimer;
  997. private JLabel label5;
  998. private JSlider angleChange;
  999. private JLabel lblAngle;
  1000. private JLabel lblHeight;
  1001. private JSlider maxHeight;
  1002. // JFormDesigner - End of variables declaration //GEN-END:variables
  1003. }
  1004. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement