Guest User

Untitled

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