Guest User

Untitled

a guest
Jun 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.92 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import com.kbot2.scriptable.Script;
  4. import com.kbot2.scriptable.Random;
  5. import com.kbot2.scriptable.methods.Calculations;
  6. import com.kbot2.scriptable.methods.data.Walking;
  7. import com.kbot2.scriptable.methods.data.Interfaces;
  8. import com.kbot2.scriptable.methods.data.Skills;
  9. import com.kbot2.scriptable.methods.wrappers.Interface;
  10. import com.kbot2.scriptable.methods.wrappers.Obj;
  11. import com.kbot2.scriptable.methods.wrappers.Tile;
  12. import com.kbot2.scriptable.methods.wrappers.NPC;
  13. import com.kbot2.handlers.eventSystem.eventListeners.RandomListener;
  14. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  15.  
  16. import javax.swing.*;
  17. import java.awt.*;
  18. import java.text.*;
  19. import java.awt.event.ActionEvent;
  20. import java.awt.event.ActionListener;
  21.  
  22. import org.apache.commons.lang.ArrayUtils;
  23.  
  24. public class AntibanTester extends Script {
  25.  
  26.  
  27. public boolean onStart(){
  28. log("Antiba script test");
  29. return true;
  30. }
  31.  
  32. public String getName() {
  33. return "AntibanTester";
  34. }
  35. public String getAuthor() {
  36. return "DDMFat";
  37. }
  38.  
  39. public String getDescription() {
  40. return "tests antiban.";
  41. }
  42.  
  43. private long timeToNext;
  44.  
  45. //Made by DDM
  46. public void actHuman() {
  47. if(timePassed(timeToNext)){
  48. int roll = (int) (Math.random() * 1000);
  49. if (timeToNext < System.currentTimeMillis()) {
  50. if (roll > 995) {
  51. highlightRandomPlayer();
  52. } else if (roll > 990 && getInventoryCount() < 23) {
  53. checkSkills();
  54. timeToNext = nextTime(2000, 4000);
  55. } else if (roll > 985 && getInventoryCount() < 23 && !RSInterface.getInterface(751).getChild(15).getText().contains("Off")) {
  56. checkFriendsList();
  57. timeToNext = nextTime(2000, 4000);
  58. } else if (roll > 960) {
  59. turnCameraRandom();
  60. } else if (roll > 940) {
  61. timeToNext = nextTime(2000, 4000);
  62. openTab(TAB_INVENTORY);
  63. } else if (roll > 890 && !isRunning() && getMyPlayer().isMoving() && !isResting()) {
  64. if(getEnergy() > 50)
  65. clickMouse(random(707, 762), random(90, 121), true);
  66. else {
  67. rest();
  68. while(isResting() && getEnergy() < 100){
  69. loop();
  70. wait(15);
  71. }
  72. wait(random(300, 800));
  73. clickMouse(random(707, 762), random(90, 121), true);
  74. }
  75. } else if (roll > 780) {
  76. moveMouseRandomly(500);
  77. timeToNext = nextTime(500, 7500);
  78. }
  79. }
  80. }
  81. }
  82.  
  83. /**
  84. * VERY Human like method - great for anti bans!
  85. * This will move the mouse around the screen at a random distance between
  86. * 1 and maxDistance, but will sometimes move it more than one, like a human
  87. * would, resulting in cool effects like cursor circling and more.
  88. * @param maxDistance
  89. * @return true if it is going to call on itself again, false otherwise
  90. * (returns false to you every time)
  91. */
  92. public boolean moveMouseRandomly(int maxDistance) {
  93. if (maxDistance == 0) {
  94. return false;
  95. }
  96. maxDistance = random(1, maxDistance);
  97. Point p = new Point(getRandomMouseX(maxDistance), getRandomMouseY(maxDistance));
  98. if (p.x < 1 || p.y < 1) {
  99. p.x = p.y = 1;
  100. }
  101. moveMouse(p);
  102. if (random(0, 2) == 0) {
  103. return false;
  104. }
  105. return moveMouseRandomly(maxDistance / 2);
  106. }
  107.  
  108. /**
  109. * Gives a X position on the screen within the maxDistance.
  110. * @param maxDistance the maximum distance the cursor will move on the X axis
  111. * @return A random int that represents a X coordinate for the
  112. * moveMouseRandomly method.
  113. */
  114. public int getRandomMouseX(int maxDistance) {
  115. Point p = getMousePos();
  116. if (random(0, 2) == 0) {
  117. return p.x - random(0, p.x < maxDistance ? p.x : maxDistance);
  118. } else {
  119. return p.x + random(1, (762 - p.x < maxDistance) ? 762 - p.x : maxDistance);
  120. }
  121. }
  122.  
  123. /**
  124. * Gives a Y position on the screen within the maxDistance.
  125. * @param maxDistance the maximum distance the cursor will move on the Y axis
  126. * @return A random int that represents a Y coordinate for the
  127. * moveMouseRandomly method.
  128. */
  129. public int getRandomMouseY(int maxDistance) {
  130. Point p = getMousePos();
  131. if (random(0, 2) == 0) {
  132. return p.y - random(0, p.y < maxDistance ? p.y : maxDistance);
  133. } else {
  134. return p.y + random(1, (500 - p.y < maxDistance) ? 500 - p.y : maxDistance);
  135. }
  136. }
  137.  
  138. }
Add Comment
Please, Sign In to add comment