Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.48 KB | None | 0 0
  1. import java.awt.*;
  2. import java.awt.event.*;
  3. import javax.swing.*;
  4. import javax.swing.event.*;
  5. import org.rsbot.script.*;
  6. import org.rsbot.script.wrappers.*;
  7. import org.rsbot.event.listeners.PaintListener;
  8. import org.rsbot.script.methods.Game;
  9. import org.rsbot.script.util.Timer;
  10.  
  11. @ScriptManifest(authors = {"Calvin"}, keywords = {"PowerMiner"}, name = "PowerMiner", description = "A basic PowerMiner", version = 1)
  12.  
  13. public class PowerMiner extends Script implements PaintListener{
  14. int [] ironRockID = {11955, 11956, 11957};
  15. int [] pickaxe = {1265, 1267, 1269, 1271, 1273, 1275, 14099, 14107, 15259};
  16. AntiBan AB = new AntiBan();
  17.  
  18. @Override
  19. public boolean onStart() {
  20. AB.setVisible(true);
  21. while(AB.isVisible()){
  22. sleep(200);
  23. }
  24.  
  25. return true;
  26.  
  27. }
  28.  
  29.  
  30.  
  31. public int loop() {
  32.  
  33. AB.antiBanMethod();
  34. if (AB.AFKTimer.isRunning()){return 200;}
  35. if (!inventory.isFull()) {
  36. if (players.getMyPlayer().getAnimation() == -1) {
  37. RSObject rock = objects.getNearest(ironRockID);
  38. if (rock != null) {
  39. rock.doAction("Mine");
  40. }
  41. }
  42. }
  43. if (inventory.isFull()){
  44. inventory.dropAllExcept(pickaxe);
  45. }
  46. return random(500, 1500);
  47. }
  48.  
  49. public void onRepaint(Graphics g) {
  50. //The rest of the scripts onRepaint() method
  51. if (AB.AFKTimer.isRunning()){
  52.  
  53. g.setColor(new Color(51, 51, 51, 150));
  54. g.fillRect(2, 1, 516, 336);
  55. g.setColor(new Color(255, 255, 255));
  56. g.drawRect(2, 1, 516, 336);
  57. g.setFont(new Font("Arial", 0, 12));
  58. g.drawString("Time Left in AFK: " + AB.AFKTimer.toRemainingString(), 147, 176);
  59. }
  60. }
  61.  
  62. @Override
  63. public void onFinish() {
  64. }
  65.  
  66. class AntiBan extends JFrame {
  67.  
  68. /*
  69. @Author Joe Titus
  70. @Date 5/8/2011
  71. */
  72. public Timer antiBanTimer = new Timer(0);
  73. public boolean customAB, AFK, Mouse, Camera, Tabs, LogOut, ABOn;
  74. public int ABFreq;
  75.  
  76. public double ABFreqTime;
  77. Timer AFKTimer = new Timer (0);
  78. public void antiBanMethod(){
  79. if (ABOn){
  80. if (!antiBanTimer.isRunning() && !AFKTimer.isRunning()){
  81. antiBan();
  82. antiBanTimer.setEndIn((int)random(ABFreqTime * .33, ABFreqTime * 1.66));
  83. }
  84. }
  85. }
  86.  
  87.  
  88.  
  89.  
  90. public void antiBan(){
  91. int t = 0;
  92. if (Camera){t++;};
  93. if (Tabs){t++;};
  94. if (AFK){t++;};
  95. if (Mouse){t++;};
  96. t += 0;
  97. switch(random(1, t)){
  98. case 1:
  99. if (Camera){
  100. camera.turnToTile(getMyPlayer().getLocation().randomize(5, 5), 5);
  101. sleep(random(500, 750));
  102. return;
  103. }
  104. case 2:
  105. if (Tabs){
  106. switch(random(1, 4)){
  107. case 1:
  108. game.openTab(Game.TAB_FRIENDS);
  109. mouse.move((585+random(-35, 35)), (330+random(-90, 90)));
  110. sleep(750, 3000);
  111. game.openTab(Game.TAB_INVENTORY);
  112. sleep(random(500, 750));
  113. return;
  114.  
  115. case 2:
  116. game.openTab(Game.TAB_CLAN);
  117. mouse.move((585+random(-35, 35)), (330+random(-90, 90)));
  118. sleep(750, 1500);
  119. game.openTab(Game.TAB_INVENTORY);
  120. sleep(random(500, 750));
  121. return;
  122.  
  123. default:
  124. game.openTab(game.TAB_STATS);
  125. mouse.moveRandomly(random(1, 300));
  126. sleep(750, 1500);
  127. game.openTab(Game.TAB_INVENTORY);
  128. sleep(random(500, 750));
  129. return;
  130. }
  131. }
  132. case 3:
  133. if (AFK){
  134. int r = random(1, 100);
  135. if (r < 75){
  136. AFKTimer.setEndIn(random(3000, 5000));
  137. } else if (r >= 70 && r < 90){
  138. AFKTimer.setEndIn(random(5000, 15000));
  139. } else {
  140. AFKTimer.setEndIn(random(10000, 30000));
  141. }
  142. return;
  143. }
  144. case 4:
  145. if (Mouse){
  146. int s = random(1, 4);
  147. switch(s){
  148. case 1:
  149. mouse.moveOffScreen();
  150. sleep(750, 1500);
  151. return;
  152. case 2:
  153. mouse.moveSlightly();
  154. sleep(500, 1000);
  155. return;
  156. case 3:
  157. mouse.moveRandomly(random(1, 300));
  158. sleep(750, 1500);
  159. return;
  160. default:
  161. return;
  162. }
  163.  
  164. }
  165. default:
  166. return;
  167. }
  168. }
  169. public void setEnabled(boolean a, boolean b, boolean c, boolean d,
  170. boolean e, boolean f, boolean g, boolean h,
  171. boolean i, boolean j, boolean k, boolean l){
  172.  
  173. ABFreqSlider.setEnabled(a);
  174. ABOnOff.setEnabled(b);
  175. customAntiBanButton.setEnabled(c);
  176. ABLevelOptions.setEnabled(d);
  177. separator1.setEnabled(e);
  178. ABFreqLabel.setEnabled(f);
  179. AFKCheck.setEnabled(g);
  180. mouseMoveCheck.setEnabled(h);
  181. camMoveCheck.setEnabled(i);
  182. logOutCheck.setEnabled(j);
  183. openTabsCheck.setEnabled(k);
  184. ABLevelLabel.setEnabled(l);
  185.  
  186. }
  187.  
  188. public void getSettings(){
  189. if (!ABOnOff.isSelected()){
  190. ABOn = true;
  191. if (customAntiBanButton.isSelected()){
  192. customAB = true;
  193. ABFreq = ABFreqSlider.getValue();
  194. AFK = AFKCheck.isSelected();
  195. Mouse = mouseMoveCheck.isSelected();
  196. Camera = camMoveCheck.isSelected();
  197. Tabs = openTabsCheck.isSelected();
  198. LogOut = logOutCheck.isSelected();
  199. } else {
  200. customAB = false;
  201. if (ABLevelOptions.getSelectedItem().toString().contains("Low")) {
  202. ABFreq = 20;
  203. LogOut = true;
  204. Camera = true;
  205. Mouse = true;
  206.  
  207. } else if (ABLevelOptions.getSelectedItem().toString().contains("Medium")) {
  208. ABFreq = 40;
  209. Mouse = true;
  210. LogOut = true;
  211. Camera = true;
  212. AFK = true;
  213.  
  214. } else if (ABLevelOptions.getSelectedItem().toString().contains("High")) {
  215. ABFreq = 60;
  216. LogOut = true;
  217. Camera = true;
  218. Tabs = true;
  219. AFK = true;
  220. Mouse = true;
  221. }
  222. }
  223. log("AntiBan on");
  224. ABFreqTime = ((double)(240 / ABFreq) * 15000);
  225. antiBanTimer = new Timer ((int)random(ABFreqTime * .5, ABFreqTime * 1.5));
  226. } else {
  227. log("AntiBan off");
  228. ABOn = false;
  229. }
  230.  
  231. }
  232. public void ABToggle(){
  233. if ((ABOnOff.isSelected())){
  234. setEnabled(false, true, false, false, false, false, false, false, false, false, false, false);
  235. } else {
  236. if (customAntiBanButton.isSelected()){
  237. setEnabled(true, true, true, false, true, true, true, true, true, false, true, false);
  238. } else {
  239. setEnabled(false, true, true, true, true, false, false, false, false, false, false, true);
  240. }
  241. }
  242. }
  243. public void cantCont(){
  244. if ((customAntiBanButton.isSelected() && !AFKCheck.isSelected() && !mouseMoveCheck.isSelected()
  245. && !camMoveCheck.isSelected() && !openTabsCheck.isSelected()) || ABFreqSlider.getValue() == 0){
  246. contButton.setEnabled(false);
  247. } else {
  248. contButton.setEnabled(true);
  249. }
  250. }
  251.  
  252. public AntiBan() {
  253. initComponents();
  254. }
  255.  
  256. private void ABFreqSliderStateChanged(ChangeEvent e) {
  257. cantCont();
  258. }
  259.  
  260. private void ABOnOffStateChanged(ChangeEvent e) {
  261. ABOnOff.setToolTipText("The AntiBan is currently: " + content());
  262. ABOnOff.setText("Turn AntiBan " + OPcontent());
  263. ABToggle();
  264. cantCont();
  265. }
  266.  
  267. private void customAntiBanButtonStateChanged(ChangeEvent e) {
  268. ABToggle();
  269. cantCont();
  270. }
  271.  
  272. private void AFKCheckStateChanged(ChangeEvent e) {
  273. cantCont();
  274. }
  275.  
  276. private void mouseMoveCheckStateChanged(ChangeEvent e) {
  277. cantCont();
  278. }
  279.  
  280. private void camMoveCheckStateChanged(ChangeEvent e) {
  281. cantCont();
  282. }
  283.  
  284. private void logOutCheckStateChanged(ChangeEvent e) {
  285. cantCont();
  286. }
  287.  
  288. private void openTabsCheckStateChanged(ChangeEvent e) {
  289. cantCont();
  290. }
  291.  
  292. private void contButtonActionPerformed(ActionEvent e) {
  293. getSettings();
  294. setVisible(false);
  295. }
  296.  
  297.  
  298. String content(){
  299. if (ABOnOff.isSelected()){
  300. return "OFF";
  301. } else {
  302. return "ON";
  303. }
  304. }
  305. String OPcontent(){
  306. if (!ABOnOff.isSelected()){
  307. return "OFF";
  308. } else {
  309. return "ON";
  310. }
  311. }
  312. private void initComponents() {
  313. ABFreqSlider = new JSlider();
  314. ABOnOff = new JToggleButton();
  315. customAntiBanButton = new JRadioButton();
  316. ABLevelOptions = new JComboBox();
  317. separator1 = new JSeparator();
  318. ABFreqLabel = new JLabel();
  319. AFKCheck = new JRadioButton();
  320. mouseMoveCheck = new JRadioButton();
  321. camMoveCheck = new JRadioButton();
  322. logOutCheck = new JRadioButton();
  323. openTabsCheck = new JRadioButton();
  324. ABLevelLabel = new JLabel();
  325. contButton = new JButton();
  326.  
  327. addWindowListener(new WindowAdapter() {
  328. public void windowClosing(WindowEvent e) {
  329. stopScript();
  330. }
  331. });
  332. //======== this ========
  333. setTitle("AntiBan");
  334. Container contentPane = getContentPane();
  335. //---- ABFreqSlider ----
  336. ABFreqSlider.setMajorTickSpacing(40);
  337. ABFreqSlider.setSnapToTicks(true);
  338. ABFreqSlider.setPaintTicks(true);
  339. ABFreqSlider.setBackground(new Color(238, 238, 238));
  340. ABFreqSlider.setEnabled(false);
  341. ABFreqSlider.setPaintLabels(true);
  342. ABFreqSlider.setMinorTickSpacing(8);
  343. ABFreqSlider.setMaximum(240);
  344. ABFreqSlider.setValue(60);
  345. ABFreqSlider.setToolTipText("Allows you to select the average amount of AntiBans per hour");
  346. ABFreqSlider.addChangeListener(new ChangeListener() {
  347. @Override
  348. public void stateChanged(ChangeEvent e) {
  349. ABFreqSliderStateChanged(e);
  350. }
  351. });
  352.  
  353. //---- ABOnOff ----
  354. ABOnOff.setText("Turn AntiBan Off");
  355.  
  356. ABOnOff.setToolTipText("The AntiBan is currently: ON");
  357. ABOnOff.addChangeListener(new ChangeListener() {
  358. @Override
  359. public void stateChanged(ChangeEvent e) {
  360. ABOnOffStateChanged(e);
  361. }
  362. });
  363.  
  364. //---- customAntiBanButton ----
  365. customAntiBanButton.setText("Custumized AntiBan");
  366. customAntiBanButton.setToolTipText("Enables you to customize your AntiBan");
  367. customAntiBanButton.addChangeListener(new ChangeListener() {
  368. @Override
  369. public void stateChanged(ChangeEvent e) {
  370. customAntiBanButtonStateChanged(e);
  371. }
  372. });
  373.  
  374. //---- ABLevelOptions ----
  375. ABLevelOptions.setModel(new DefaultComboBoxModel(new String[] {
  376. "Low",
  377. "Medium",
  378. "High"
  379. }));
  380. ABLevelOptions.setSelectedIndex(2);
  381. ABLevelOptions.setToolTipText("Selects the level of AntiBan");
  382. //---- separator1 ----
  383. separator1.setForeground(new Color(100, 100, 100));
  384. //---- ABFreqLabel ----
  385. ABFreqLabel.setText("Avg. AntiBans P/H");
  386. ABFreqLabel.setToolTipText("Average. AntiBans per hour");
  387. ABFreqLabel.setEnabled(false);
  388.  
  389. //---- AFKCheck ----
  390. AFKCheck.setText("AFK's");
  391. AFKCheck.setEnabled(false);
  392. AFKCheck.setToolTipText("If checked, the AntiBan will perform AFK's");
  393. AFKCheck.addChangeListener(new ChangeListener() {
  394. @Override
  395. public void stateChanged(ChangeEvent e) {
  396. AFKCheckStateChanged(e);
  397. }
  398. });
  399.  
  400. //---- mouseMoveCheck ----
  401. mouseMoveCheck.setText("Mouse MoveMents");
  402. mouseMoveCheck.setEnabled(false);
  403. mouseMoveCheck.setToolTipText("If checked, the AntiBan will move the mouse");
  404. mouseMoveCheck.addChangeListener(new ChangeListener() {
  405. @Override
  406. public void stateChanged(ChangeEvent e) {
  407. mouseMoveCheckStateChanged(e);
  408. }
  409. });
  410.  
  411. //---- camMoveCheck ----
  412. camMoveCheck.setText("Camera Movements");
  413. camMoveCheck.setEnabled(false);
  414. camMoveCheck.setToolTipText("If checked, the AntiBan will move the camera");
  415. camMoveCheck.addChangeListener(new ChangeListener() {
  416. @Override
  417. public void stateChanged(ChangeEvent e) {
  418. camMoveCheckStateChanged(e);
  419. }
  420. });
  421.  
  422. //---- logOutCheck ----
  423. logOutCheck.setText("Log Out if Innactive");
  424. logOutCheck.setEnabled(false);
  425. logOutCheck.setVisible(false);
  426. logOutCheck.setToolTipText("Currently under construction");
  427. logOutCheck.addChangeListener(new ChangeListener() {
  428. @Override
  429. public void stateChanged(ChangeEvent e) {
  430. logOutCheckStateChanged(e);
  431. }
  432. });
  433.  
  434. //---- openTabsCheck ----
  435. openTabsCheck.setText("Open Tabs");
  436. openTabsCheck.setEnabled(false);
  437. openTabsCheck.setToolTipText("If checked, the AntiBan will open your friends list tab");
  438. openTabsCheck.addChangeListener(new ChangeListener() {
  439. @Override
  440. public void stateChanged(ChangeEvent e) {
  441. openTabsCheckStateChanged(e);
  442. }
  443. });
  444.  
  445. //---- ABLevelLabel ----
  446. ABLevelLabel.setText("AntiBan Level");
  447. ABLevelLabel.setToolTipText("AntiBan Level");
  448.  
  449. //---- contButton ----
  450. contButton.setText("Continue");
  451. contButton.setToolTipText("Starts the Script");
  452. contButton.addActionListener(new ActionListener() {
  453. @Override
  454. public void actionPerformed(ActionEvent e) {
  455. contButtonActionPerformed(e);
  456. }
  457. });
  458.  
  459. GroupLayout contentPaneLayout = new GroupLayout(contentPane);
  460. contentPane.setLayout(contentPaneLayout);
  461. contentPaneLayout.setHorizontalGroup(
  462. contentPaneLayout.createParallelGroup()
  463. .addGroup(contentPaneLayout.createSequentialGroup()
  464. .addGroup(contentPaneLayout.createParallelGroup()
  465. .addGroup(contentPaneLayout.createSequentialGroup()
  466. .addGap(102, 102, 102)
  467. .addComponent(ABOnOff, GroupLayout.PREFERRED_SIZE, 182, GroupLayout.PREFERRED_SIZE))
  468. .addGroup(contentPaneLayout.createSequentialGroup()
  469. .addContainerGap()
  470. .addGroup(contentPaneLayout.createParallelGroup()
  471. .addGroup(contentPaneLayout.createSequentialGroup()
  472. .addComponent(ABFreqLabel)
  473. .addGap(12, 12, 12)
  474. .addComponent(ABFreqSlider, GroupLayout.PREFERRED_SIZE, 260, GroupLayout.PREFERRED_SIZE))
  475. .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
  476. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
  477. .addComponent(ABLevelLabel)
  478. .addComponent(customAntiBanButton, GroupLayout.PREFERRED_SIZE, 159, GroupLayout.PREFERRED_SIZE))
  479. .addGroup(contentPaneLayout.createParallelGroup()
  480. .addGroup(contentPaneLayout.createSequentialGroup()
  481. .addGap(18, 18, 18)
  482. .addComponent(separator1, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE))
  483. .addGroup(contentPaneLayout.createSequentialGroup()
  484. .addGap(27, 27, 27)
  485. .addComponent(ABLevelOptions, GroupLayout.PREFERRED_SIZE, 140, GroupLayout.PREFERRED_SIZE)))
  486. .addGap(96, 96, 96))))
  487. .addGroup(contentPaneLayout.createSequentialGroup()
  488. .addGap(20, 20, 20)
  489. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
  490. .addGroup(contentPaneLayout.createSequentialGroup()
  491. .addComponent(mouseMoveCheck)
  492. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
  493. .addComponent(logOutCheck))
  494. .addGroup(contentPaneLayout.createSequentialGroup()
  495. .addComponent(openTabsCheck)
  496. .addGap(18, 18, 18)
  497. .addComponent(AFKCheck)
  498. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  499. .addComponent(camMoveCheck))))
  500. .addGroup(contentPaneLayout.createSequentialGroup()
  501. .addGap(109, 109, 109)
  502. .addComponent(contButton, GroupLayout.PREFERRED_SIZE, 167, GroupLayout.PREFERRED_SIZE)))
  503. .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
  504. );
  505. contentPaneLayout.setVerticalGroup(
  506. contentPaneLayout.createParallelGroup()
  507. .addGroup(contentPaneLayout.createSequentialGroup()
  508. .addGap(10, 10, 10)
  509. .addComponent(ABOnOff)
  510. .addGap(18, 18, 18)
  511. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  512. .addComponent(ABLevelLabel)
  513. .addComponent(ABLevelOptions, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  514. .addGroup(contentPaneLayout.createParallelGroup()
  515. .addGroup(contentPaneLayout.createSequentialGroup()
  516. .addGap(18, 18, 18)
  517. .addComponent(customAntiBanButton, GroupLayout.PREFERRED_SIZE, 44, GroupLayout.PREFERRED_SIZE))
  518. .addGroup(contentPaneLayout.createSequentialGroup()
  519. .addGap(35, 35, 35)
  520. .addComponent(separator1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))
  521. .addGroup(contentPaneLayout.createParallelGroup()
  522. .addGroup(contentPaneLayout.createSequentialGroup()
  523. .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
  524. .addComponent(ABFreqSlider, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
  525. .addGroup(contentPaneLayout.createSequentialGroup()
  526. .addGap(26, 26, 26)
  527. .addComponent(ABFreqLabel)))
  528. .addGap(15, 15, 15)
  529. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  530. .addComponent(openTabsCheck)
  531. .addComponent(AFKCheck)
  532. .addComponent(camMoveCheck))
  533. .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
  534. .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
  535. .addComponent(logOutCheck)
  536. .addComponent(mouseMoveCheck))
  537. .addGap(18, 18, 18)
  538. .addComponent(contButton)
  539. .addContainerGap(12, Short.MAX_VALUE))
  540. );
  541. pack();
  542. setLocationRelativeTo(getOwner());
  543. // JFormDesigner - End of component initialization //GEN-END:initComponents
  544. }
  545.  
  546. // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
  547. // Generated using JFormDesigner Evaluation license - Joe Titus
  548. private JSlider ABFreqSlider;
  549. private JToggleButton ABOnOff;
  550. private JRadioButton customAntiBanButton;
  551. private JComboBox ABLevelOptions;
  552. private JSeparator separator1;
  553. private JLabel ABFreqLabel;
  554. private JRadioButton AFKCheck;
  555. private JRadioButton mouseMoveCheck;
  556. private JRadioButton camMoveCheck;
  557. private JRadioButton logOutCheck;
  558. private JRadioButton openTabsCheck;
  559. private JLabel ABLevelLabel;
  560. private JButton contButton;
  561. // JFormDesigner - End of variables declaration //GEN-END:variables
  562. }
  563.  
  564. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement