Guest User

Untitled

a guest
Jan 19th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.98 KB | None | 0 0
  1. import org.rsbuddy.tabs.Attack;
  2. import com.rsbuddy.script.ActiveScript;
  3. import com.rsbuddy.script.Manifest;
  4. import com.rsbuddy.script.methods.Camera;
  5. import com.rsbuddy.script.methods.Environment;
  6. import com.rsbuddy.script.methods.Game;
  7. import com.rsbuddy.script.methods.GroundItems;
  8. import com.rsbuddy.script.methods.Inventory;
  9. import com.rsbuddy.script.methods.Magic;
  10. import com.rsbuddy.script.methods.Magic.Book;
  11. import com.rsbuddy.script.methods.Mouse;
  12. import com.rsbuddy.script.methods.Npcs;
  13. import com.rsbuddy.script.methods.Players;
  14. import com.rsbuddy.script.methods.Skills;
  15. import com.rsbuddy.script.methods.Walking;
  16. import com.rsbuddy.script.methods.Widgets;
  17. import com.rsbuddy.script.util.Filter;
  18. import com.rsbuddy.script.util.Random;
  19. import com.rsbuddy.script.wrappers.GroundItem;
  20. import com.rsbuddy.script.wrappers.Item;
  21. import com.rsbuddy.script.wrappers.Npc;
  22. import com.rsbuddy.script.wrappers.Tile;
  23. import com.rsbuddy.script.wrappers.Widget;
  24.  
  25. @Manifest(name = "TehOgreRanger",
  26. description = "Trains Range At King Lathas Training Ground",
  27. authors = "TehBotter",
  28. version = 0.1 )
  29. public class TehOgreRanger extends ActiveScript{
  30.  
  31.  
  32. //=========================onStart================================
  33.  
  34. public boolean onStart() {
  35. log ("Thanks For Choosing TehOgreRanger");
  36. log ("Please, Make Sure You Have Started Infront Of The Ogre Cage In King Lathas Training Ground");
  37. return true;
  38. }
  39. //=======================END onStart======================================
  40. //=================================LOOP===========================================
  41.  
  42. public int loop() {
  43. checkHp();
  44. if (Widgets.canContinue()){
  45. Widgets.clickContinue();
  46. }
  47. if (atArea()){
  48. walkToFrontCage();
  49. }
  50. else{ walkToArea();
  51. }
  52. if (atFrontCage()){
  53. teleGrabLoot();
  54. drinkPotions();
  55. attackOgres();
  56. doSpecial();
  57. dropVials();
  58. doAntiBan();
  59. }
  60. else{ walkToFrontCage();
  61.  
  62. }
  63. return Random.nextInt(150, 350);
  64. }
  65. //=================================END LOOP=======================================
  66.  
  67.  
  68. //=======================================INT===================================
  69.  
  70. public final int ogreId = 2801;
  71. public int randOneToTen = Random.nextInt(2, 17);
  72. public final int lawRune = 563;
  73. public final int airRune = 556;
  74. public final int torstolId = 5304;
  75. public final int houseTeleportTab = 8013;
  76. public final int emptyVialId = 229;
  77. //========================================END INT===============================
  78.  
  79.  
  80. //======================================TILES=====================================
  81. private Tile frontCageTile = (new Tile ( Random.nextInt(2526, 2529), 3372));
  82. private final Tile areaTile = (new Tile (Random.nextInt(2526, 2529), Random.nextInt(3369, 3371)));
  83. //=================================END TILES======================================
  84.  
  85. //================================NPCS============================================
  86.  
  87. //=================================END NPCS=======================================
  88.  
  89.  
  90. //================================BOOLEANS========================================
  91. public boolean atArea(){
  92. if(Players.getLocal().getLocation().getY() >= 3369 & Players.getLocal().getLocation().getY() <= 3372){
  93. if(Players.getLocal().getLocation().getX() >= 2523 & Players.getLocal().getLocation().getX() <= 2532){
  94. return true;
  95. }
  96. }
  97. return false;
  98. }
  99.  
  100. public boolean atFrontCage(){
  101. if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2525){
  102. return true;
  103. }
  104. else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2525){
  105. return true;
  106. }
  107. else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2526){
  108. return true;
  109. }
  110. else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2527){
  111. return true;
  112. }
  113. else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2528){
  114. return true;
  115. }
  116. else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2529){
  117. return true;
  118. }
  119. else
  120. return false;
  121. }
  122.  
  123. //==============================END BOOLEANS======================================
  124.  
  125. //===================================VOIDS========================================
  126. public void onFinish(){
  127. log("Thank You For Using TehOgreRanger");
  128. Environment.saveScreenshot(false);
  129. }
  130.  
  131. public void walkToFrontCage(){
  132. Walking.findPath(frontCageTile).traverse();
  133. sleep (Random.nextInt(150, 300));
  134. }
  135.  
  136. public void attackOgres(){
  137. final Filter<Npc> ogreFilter = new Filter <Npc>() {
  138. public boolean accept(Npc npc) {
  139. return npc != null && npc.getName().equals("Ogre") && npc.getHpPercent() > 10 && !npc.isInCombat();
  140. }
  141. };
  142. Npc Ogre = Npcs.getNearest(ogreFilter);
  143. if (!Players.getLocal().isInCombat()){
  144. if ( !Ogre.isDead()&& Players.getLocal().getInteracting() == null)
  145. if (!Ogre.isInCombat()){
  146. Camera.turnTo(Ogre);
  147. Ogre.interact("Attack Ogre");
  148. Mouse.moveSlightly();
  149. sleep(Random.nextInt(1000, 2000));
  150. }
  151. }
  152. }
  153.  
  154.  
  155. public void walkToArea(){
  156. Walking.findPath(areaTile).traverse();
  157. sleep (Random.nextInt(150, 300));
  158. }
  159.  
  160. @SuppressWarnings("deprecation")
  161. public void teleGrabLoot(){
  162. GroundItem torstol = GroundItems.getNearest(torstolId);
  163. if(GroundItems.getNearest(torstolId) != null){
  164. if (torstol.isOnScreen()){
  165. if (Inventory.contains(lawRune) && Inventory.contains(airRune)){
  166. if (!Inventory.isFull()){
  167. if(Game.getCurrentTab() != Game.TAB_MAGIC){
  168. Game.openTab(Game.TAB_MAGIC);
  169. if(Magic.Book.MODERN != null){
  170. Camera.turnTo(torstol);
  171. Magic.castSpell(Magic.SPELL_TELEKINETIC_GRAB);
  172. sleep (Random.nextInt(180, 250));
  173. torstol.interact("Cast Telekinetic Grab -> Torstol Seed");
  174. sleep(500, 2000);
  175. }
  176. }
  177. }
  178. }
  179. }
  180. }
  181. }
  182.  
  183. public void doSpecial(){
  184. if(!Attack.isSpecialEnabled()){
  185. if(Attack.getSpecialEnergy() == 100){
  186. Attack.setSpecial(true);
  187. sleep(Random.nextInt(300, 1000));
  188. if(Game.getCurrentTab() != Game.TAB_INVENTORY){
  189. Game.openTab(Game.TAB_INVENTORY);
  190. Mouse.moveRandomly(30);
  191. sleep(Random.nextInt(300, 1000));
  192. }
  193. }
  194. }
  195. }
  196. @SuppressWarnings("deprecation")
  197. public void checkHp(){
  198. if(Players.getLocal().getHpPercent() <= 15){
  199. if(Inventory.contains(houseTeleportTab)){
  200. Item teleTab = Inventory.getItem(houseTeleportTab);
  201. teleTab.interact("Break");
  202. sleep (2000, 3000);
  203. stop();
  204. }
  205. }
  206. }
  207.  
  208.  
  209. private final int potion4Id = 2444;
  210. private final int potion3Id = 169;
  211. private final int potion2Id = 171;
  212. private final int potion1Id = 173;
  213.  
  214. private int Potions [] = {potion1Id, potion2Id, potion3Id, potion4Id};
  215.  
  216.  
  217. @SuppressWarnings("deprecation")
  218. public void drinkPotions(){
  219. Item allPotions = Inventory.getItem(Potions);
  220. if(Skills.getCurrentLevel(Skills.RANGE) <= Skills.getRealLevel(Skills.RANGE)){
  221. if(Inventory.containsOneOf(Potions)){
  222. allPotions.interact("Drink");
  223. }
  224. }
  225. }
  226. @SuppressWarnings("deprecation")
  227. public void dropVials(){
  228. Item vial = Inventory.getItem(emptyVialId);
  229. if(Inventory.containsOneOf(emptyVialId)){
  230. vial.interact("Drop");
  231. }
  232. }
  233. //=================================END VOIDS======================================
  234.  
  235. //=========================================ANTI-BAN===============================
  236.  
  237. public void doAntiBan(){
  238. int b = Random.nextInt(0, 20);
  239. switch (b) {
  240. case 1:
  241. if (Random.nextInt(0, 100) == 17) {
  242. log("[Antiban] move mouse");
  243.  
  244. Mouse.moveSlightly();
  245. sleep(200, 600);
  246. Mouse.moveRandomly(150, 350);
  247. }
  248. break;
  249. case 2:
  250. if (Random.nextInt(0, 100) == 24) {
  251.  
  252. log("[Antiban] Turn screen");
  253.  
  254. Camera.setCompassAngle(Random.nextInt(30, 180));
  255. sleep(400, 1200);
  256.  
  257. }
  258. break;
  259. case 3:
  260. if (Random.nextInt(0, 100) == 76) {
  261.  
  262. log("[Antiban] mouse off screen");
  263. Mouse.moveOffScreen();
  264. sleep(Random.nextInt(600, Random.nextInt(1200, 2000)));
  265. }
  266. break;
  267.  
  268. case 5:
  269.  
  270. if (Random.nextInt(0, 100) == 12) {
  271. log("[Antiban] Checking Exp");
  272. if(Game.getCurrentTab() != Game.TAB_STATS){
  273. Game.openTab(Game.TAB_STATS);
  274. Skills.hover(Skills.COMPONENT_RANGE);
  275. sleep (Random.nextInt(400, 3000));
  276. Game.openTab(Game.TAB_INVENTORY);
  277. Mouse.moveRandomly(30);
  278. sleep(Random.nextInt(300, 1000));
  279. }
  280.  
  281. else {
  282. Skills.hover(Skills.COMPONENT_RANGE);
  283. sleep (Random.nextInt(400, 3000));
  284. Game.openTab(Game.TAB_INVENTORY);
  285. Mouse.moveRandomly(30);
  286. sleep(Random.nextInt(300, 1000));
  287. }
  288. }
  289. break;
  290.  
  291. case 6:
  292. if (Random.nextInt(0, 100) == 91) {
  293. log("[Antiban] Checking Exp");
  294. if(Game.getCurrentTab() != Game.TAB_STATS){
  295. Game.openTab(Game.TAB_STATS);
  296. Skills.hover(Skills.COMPONENT_CONSTITUTION);
  297. sleep (Random.nextInt(400, 3000));
  298. Game.openTab(Game.TAB_INVENTORY);
  299. Mouse.moveRandomly(30);
  300. sleep(Random.nextInt(300, 1000));
  301. } else {
  302. Skills.hover(Skills.COMPONENT_CONSTITUTION);
  303. sleep (Random.nextInt(400, 3000));
  304. Game.openTab(Game.TAB_INVENTORY);
  305. Mouse.moveRandomly(30);
  306. sleep(Random.nextInt(300, 1000));
  307. }
  308. }
  309. break;
  310.  
  311. case 7:
  312. if (Random.nextInt(0, 100) == 72) {
  313. log("[Antiban] Move Mouse Off Screen");
  314. Mouse.moveOffScreen();
  315. sleep (Random.nextInt(400, 3000));
  316. }
  317. break;
  318. default:
  319. break;
  320. }
  321.  
  322. }
  323.  
  324.  
  325. //===================================END ANTI-BAN=================================
  326. }
Add Comment
Please, Sign In to add comment