Guest User

Untitled

a guest
Dec 16th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.30 KB | None | 0 0
  1. mport java.util.*;
  2. import java.awt.*;
  3. import org.rsbot.bot.Bot;
  4. import org.rsbot.event.listeners.PaintListener;
  5. import org.rsbot.event.listeners.ServerMessageListener;
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.methods.Calculations;
  9. import org.rsbot.script.methods.Game;
  10. import org.rsbot.script.methods.Bank;
  11. import org.rsbot.script.wrappers.RSArea;
  12. import org.rsbot.script.wrappers.RSItem;
  13. import org.rsbot.script.wrappers.RSNPC;
  14. import org.rsbot.script.wrappers.RSObject;
  15. import org.rsbot.script.wrappers.RSTile;
  16. import org.rsbot.script.methods.GroundItems;
  17. import org.rsbot.script.wrappers.RSGroundItem;
  18. import org.rsbot.script.wrappers.RSComponent;
  19. import org.rsbot.script.methods.Mouse;
  20.  
  21. @ScriptManifest(authors = { "Cody0520" }, keywords = { "Hunter" }, name = "Lizardraper", version = 0.1, description = "catches and banks swamp lizards at canfis!");
  22. public class Lizardraper extends Script implements PaintListener {
  23. RSTile Tree1 = new RSTile(3553, 3450);
  24. RSTile Tree2 = new RSTile(3553, 3453);
  25. int Lizards = 0;
  26.  
  27. public String getAuthor() {
  28. return "Cody0520";
  29. }
  30.  
  31. public String getName() {
  32. return "Lizardraper";
  33. }
  34.  
  35. public double getVersion() {
  36. return 0.1;
  37. }
  38.  
  39. public String getScriptCategory() {
  40. return "Hunter";
  41. }
  42.  
  43. public boolean onStart() { // Loads any commands needed when the script is
  44. // started
  45. //Bot.getEventManager().addListener(this);
  46. //Bot.getEventManager().addListener(this);
  47. return true;
  48. }
  49.  
  50. public void onFinish() {
  51. //Bot.getEventManager().removeListener(this);
  52. //Bot.getEventManager().removeListener(this);
  53. }
  54.  
  55. int checkTime;
  56. long lastCheck;
  57. boolean powerMode = false;
  58. int randomRun = random(40, 75);
  59. int rockCount;
  60. int oldRockCount; // /////////CREDS TO AELIN
  61. int xpPerRock;
  62. long avoidedCombat;
  63. long avoidedSmokingRocks;
  64. int startExp = 0;
  65. int oldExp;
  66. int countToNext;
  67. int oldLevels;
  68. long lastAvgCheck;
  69. int avgPerHour;
  70. int Points = 0;
  71. int StartPoints = 0;
  72. String PointsString = "LuLWuT?";
  73. public int startLevel = 0;
  74. public int startXP = 0;
  75. public long startTime = System.currentTimeMillis();
  76. public long time = System.currentTimeMillis();
  77.  
  78. public void onRepaint(Graphics g) {
  79. // if (isLoggedIn()) {
  80.  
  81. // Ty to AELIN for these
  82. // local objects:
  83. int index = 21;
  84. int exp = 0;
  85. int levels;
  86. long hours = 0, minutes = 0, seconds = 0;
  87. long time;
  88.  
  89. // Has start time been previously set?
  90. if (startTime == 0) {
  91. startTime = System.currentTimeMillis();
  92. }
  93.  
  94. // Calculate hours, minutes and seconds.
  95. time = System.currentTimeMillis() - startTime;
  96. seconds = time / 1000;
  97. if (seconds >= 60) {
  98. minutes = seconds / 60;
  99. seconds -= minutes * 60;
  100. }
  101. if (minutes >= 60) {
  102. hours = minutes / 60;
  103. minutes -= hours * 60;
  104. }
  105.  
  106. // Has variables been previously defined?
  107. if (startLevel == 0 || startExp == 0) {
  108. // No, so define them now.
  109. startLevel = skills.getCurrentLevel(21);
  110. startExp = skills.getCurrentExp(21);
  111. oldExp = 0;
  112. }
  113.  
  114. // Calculate catches based on experience changes.
  115. exp = skills.getCurrentExp(21) - startExp;
  116. if (exp > oldExp) {
  117. xpPerRock = exp - oldExp;
  118. oldExp = exp;
  119. rockCount++;
  120. countToNext = skills.getExpToNextLevel(21) / xpPerRock + 1;
  121. }
  122.  
  123. // Calculate levels gained.
  124. levels = skills.getCurrentLevel(index) - startLevel;
  125. if (levels > oldLevels) {
  126. oldLevels = levels;
  127. }
  128.  
  129. //
  130. if (System.currentTimeMillis() - lastAvgCheck >= 60000) {
  131. lastAvgCheck = System.currentTimeMillis();
  132. avgPerHour = (rockCount - oldRockCount) * 60;
  133. oldRockCount = rockCount;
  134. }
  135.  
  136. Color BG = new Color(0, 0, 0, 75);
  137. Color RED = new Color(255, 0, 0, 255);
  138. Color GREEN = new Color(0, 255, 0, 255);
  139. Color BLACK = new Color(0, 0, 0, 255);
  140.  
  141. //int GotPoints = Points - StartPoints;
  142. int type = 21;
  143. long millis = System.currentTimeMillis() - startTime;
  144. millis -= hours * 1000 * 60 * 60;
  145. millis -= minutes * 1000 * 60;
  146. //int XPChange = skills.getCurrentExp(type) - startXP;
  147. //int Kills = XPChange / 240;
  148. //int KillsToLvl = skills.getExpToNextLevel(type) / 288;
  149. int LevelChange = skills.getCurrentLevel(type) - startLevel;
  150. int perNextLvl = skills.getPercentToNextLevel(type);
  151. int nextLvl = skills.getCurrentLevel(type) + 1;
  152. g.setColor(BG);
  153. g.fill3DRect(5, 25, 205, 143, true);
  154. g.setColor(Color.white);
  155. g.drawString(getName() + " v." + getVersion() + " by Drizzt1112", 10,
  156. 40);
  157. g.drawString("Running for: " + hours + "h " + minutes + "m " + seconds
  158. + "s", 10, 60);
  159. g.drawString("XP Gained: " + exp + " Lvls Gained: " + LevelChange,
  160. 10, 80);
  161. g.drawString("XP To next lvl: " + skills.getExpToNextLevel(type), 10,
  162. 100);
  163. g.drawString("Progress to next lvl:", 10, 120);
  164. g.setColor(RED);
  165. g.fill3DRect(10, 130, 100, 10, true);
  166. g.setColor(GREEN);
  167. g.fill3DRect(10, 130, perNextLvl, 10, true); // This is how progress
  168. // bars are made
  169. g.setColor(BLACK);
  170. g.drawString(perNextLvl + "% to " + nextLvl, 40, 139);
  171. g.setColor(Color.white);
  172. g.drawString("Lizards Caught: " + Lizards / 2, 10, 160);
  173.  
  174. }
  175.  
  176. int NormalTree = 19679;
  177. int Trapped = 19678;
  178. int Caught = 19675;
  179. int Lizard = 10149;
  180. int Rope = 954;
  181. int Net = 303;
  182. int FailCount = 0;
  183.  
  184. public int loop() { // This is the area of the script where you code out the
  185. // things you want the bot to do
  186. RSObject Trap1 = objects.getTopAt(Tree1);
  187. RSObject Trap2 = objects.getTopAt(Tree2);
  188. if (FailCount > 20) {
  189. log("Failed");
  190. // logout();
  191. // stopAllScripts();
  192. }
  193. if (calc.distanceTo(Tree1) < 18) {
  194. if (getMyPlayer().getAnimation() == 5215
  195. || getMyPlayer().getAnimation() == 5207) {
  196. FailCount = 0;
  197. return random(200, 400);
  198. }
  199. if (inventory.contains(Lizard) && inventory.getCount() > 25) {
  200. FailCount = 0;
  201. inventory.getItem(Lizard).doAction("Release");
  202. sleep(random(200, 900));
  203. return random(200, 400);
  204. }
  205. RSObject rope = objects.getNearest(Rope);
  206. if (rope != null && !inventory.isFull()) {
  207. FailCount = 0;
  208. atTileTake(rope.getLocation(), "Take");
  209. sleep(random(200, 900));
  210. return random(200, 400);
  211. }
  212. RSObject net = objects.getNearest(Net); //getGroundItemByID(Net);
  213. if (net != null && !inventory.isFull()) {
  214. atTileTake(net.getLocation(), "Take");
  215. sleep(random(200, 900));
  216. return random(200, 400);
  217. }
  218. if (Trap1.getID() == NormalTree && inventory.contains(Rope)
  219. && inventory.contains(Net)) {
  220. atTileDrizzt(Tree1, "Set-Trap");
  221. FailCount = 0;
  222. sleep(random(1400, 1900));
  223. return random(200, 400);
  224. }
  225. if (Trap2.getID() == NormalTree && inventory.contains(Rope)
  226. && inventory.contains(Net)) {
  227. atTileDrizzt(Tree2, "Set-Trap");
  228. FailCount = 0;
  229. sleep(random(1400, 1900));
  230. return random(200, 400);
  231. }
  232. if (Trap1.getID() == Caught) {
  233. atTileDrizzt(Tree1, "Check");
  234. FailCount = 0;
  235. sleep(random(1000, 1400));
  236. return random(200, 400);
  237. }
  238. if (Trap2.getID() == Caught) {
  239. atTileDrizzt(Tree2, "Check");
  240. FailCount = 0;
  241. sleep(random(1000, 1400));
  242. return random(200, 400);
  243. }
  244. if (inventory.contains(Lizard)) {
  245. inventory.getItem(Lizard).doAction("Release");
  246. sleep(random(200, 900));
  247. return random(200, 400);
  248. }
  249. if (Trap1.getID() == Trapped) {
  250. sleep(random(100, 140));
  251. return random(200, 400);
  252. }
  253. if (Trap2.getID() == Trapped) {
  254. sleep(random(100, 140));
  255. return random(200, 400);
  256. }
  257. }
  258. FailCount++;
  259. log("Failed " + FailCount + " Times");
  260. sleep(random(3000, 8000));
  261. return random(100, 150);
  262. }
  263.  
  264. public boolean atTileDrizzt(RSTile tile, String action) {
  265. AntiBan(random(1, 50), false);
  266. camera.moveRandomly(800);
  267. int TempCounter = 0;
  268. while (true) {
  269. if (!getMyPlayer().isMoving())
  270. break;
  271. sleep(random(200, 400));
  272. }
  273. try {
  274. Point location = calc.tileToScreen(tile);
  275. if (location.x == -1 || location.y == -1)
  276. return false;
  277. mouse.move(location, random(3, 6), random(-25, -15));
  278. while (!menu.getItems().toString().toLowerCase()
  279. .contains(action.toLowerCase())
  280. && TempCounter < 7) {
  281. location = calc.tileToScreen(tile);
  282. mouse.move(location, random(-8, 8), random(-45, -15));
  283. TempCounter++;
  284. }
  285. sleep(random(50, 100));
  286. mouse.click(true);
  287. return true;
  288. } catch (Exception e) {
  289. return false;
  290. }
  291. }
  292.  
  293. public boolean atTileTake(RSTile tile, String action) {
  294. int TempCounter = 0;
  295. while (true) {
  296. if (!getMyPlayer().isMoving())
  297. break;
  298. sleep(random(200, 400));
  299. }
  300. try {
  301. Point location = calc.tileToScreen(tile);
  302. if (location.x == -1 || location.y == -1)
  303. return false;
  304. mouse.move(location, 8, 8);
  305. sleep(random(50, 100));
  306. while (!menu.getItems().toString().toLowerCase()
  307. .contains(action.toLowerCase())
  308. && TempCounter < 5) {
  309. location = calc.tileToScreen(tile);
  310. mouse.move(location, 8, 8);
  311. TempCounter++;
  312. }
  313. if (menu.getItems().toString().toLowerCase()
  314. .contains(action.toLowerCase())) {
  315. mouse.click(true);
  316. } else {
  317. mouse.click(false);
  318. menu.doAction(action);
  319. }
  320. sleep(random(50, 100));
  321. return true;
  322. } catch (Exception e) {
  323. return false;
  324. }
  325. }
  326.  
  327. boolean AntiBanDebug = true;
  328.  
  329. public void AntiBan(int r, boolean Random) { // Made By Drizzt1112
  330. if (Random) {
  331. r = random(0, 7);
  332. }
  333. if (AntiBanDebug) {
  334. log("Antiban Case: " + r);
  335. }
  336. switch ® { // Ewww i am using case -.-
  337. case 1:
  338. camera.setAngle(random(1, 359));
  339. return;
  340. case 2:
  341. camera.setPitch(random(1, 99));
  342. return;
  343. case 3:
  344. mouse.move(random(1, 760), random(1, 499));
  345. return;
  346. case 4:
  347. game.openTab(random(0, 12));
  348. return;
  349. case 5:
  350. camera.setAngle(random(1, 359));
  351. camera.setPitch(random(1, 99));
  352. return;
  353. case 6:
  354. sleep(random(50, 150));
  355. return;
  356. case 7:
  357. if (game.getCurrentTab() != 2) {
  358. game.openTab(2);
  359. }
  360. mouse.click(random(716, 721), random(415, 430), true);
  361. mouse.move(random(613, 633), random(421, 441));
  362. sleep(random(1000, 2000));
  363. return;
  364. default:
  365. return;
  366. }
  367. }
Add Comment
Please, Sign In to add comment