Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbuddy.tabs.Attack;
- import com.rsbuddy.script.ActiveScript;
- import com.rsbuddy.script.Manifest;
- import com.rsbuddy.script.methods.Camera;
- import com.rsbuddy.script.methods.Environment;
- import com.rsbuddy.script.methods.Game;
- import com.rsbuddy.script.methods.GroundItems;
- import com.rsbuddy.script.methods.Inventory;
- import com.rsbuddy.script.methods.Magic;
- import com.rsbuddy.script.methods.Magic.Book;
- import com.rsbuddy.script.methods.Mouse;
- import com.rsbuddy.script.methods.Npcs;
- import com.rsbuddy.script.methods.Players;
- import com.rsbuddy.script.methods.Skills;
- import com.rsbuddy.script.methods.Walking;
- import com.rsbuddy.script.methods.Widgets;
- import com.rsbuddy.script.util.Filter;
- import com.rsbuddy.script.util.Random;
- import com.rsbuddy.script.wrappers.GroundItem;
- import com.rsbuddy.script.wrappers.Item;
- import com.rsbuddy.script.wrappers.Npc;
- import com.rsbuddy.script.wrappers.Tile;
- import com.rsbuddy.script.wrappers.Widget;
- @Manifest(name = "TehOgreRanger",
- description = "Trains Range At King Lathas Training Ground",
- authors = "TehBotter",
- version = 0.1 )
- public class TehOgreRanger extends ActiveScript{
- //=========================onStart================================
- public boolean onStart() {
- log ("Thanks For Choosing TehOgreRanger");
- log ("Please, Make Sure You Have Started Infront Of The Ogre Cage In King Lathas Training Ground");
- return true;
- }
- //=======================END onStart======================================
- //=================================LOOP===========================================
- public int loop() {
- checkHp();
- if (Widgets.canContinue()){
- Widgets.clickContinue();
- }
- if (atArea()){
- walkToFrontCage();
- }
- else{ walkToArea();
- }
- if (atFrontCage()){
- teleGrabLoot();
- drinkPotions();
- attackOgres();
- doSpecial();
- dropVials();
- doAntiBan();
- }
- else{ walkToFrontCage();
- }
- return Random.nextInt(150, 350);
- }
- //=================================END LOOP=======================================
- //=======================================INT===================================
- public final int ogreId = 2801;
- public int randOneToTen = Random.nextInt(2, 17);
- public final int lawRune = 563;
- public final int airRune = 556;
- public final int torstolId = 5304;
- public final int houseTeleportTab = 8013;
- public final int emptyVialId = 229;
- //========================================END INT===============================
- //======================================TILES=====================================
- private Tile frontCageTile = (new Tile ( Random.nextInt(2526, 2529), 3372));
- private final Tile areaTile = (new Tile (Random.nextInt(2526, 2529), Random.nextInt(3369, 3371)));
- //=================================END TILES======================================
- //================================NPCS============================================
- //=================================END NPCS=======================================
- //================================BOOLEANS========================================
- public boolean atArea(){
- if(Players.getLocal().getLocation().getY() >= 3369 & Players.getLocal().getLocation().getY() <= 3372){
- if(Players.getLocal().getLocation().getX() >= 2523 & Players.getLocal().getLocation().getX() <= 2532){
- return true;
- }
- }
- return false;
- }
- public boolean atFrontCage(){
- if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2525){
- return true;
- }
- else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2525){
- return true;
- }
- else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2526){
- return true;
- }
- else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2527){
- return true;
- }
- else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2528){
- return true;
- }
- else if(Players.getLocal().getLocation().getY() == 3372 & Players.getLocal().getLocation().getX() == 2529){
- return true;
- }
- else
- return false;
- }
- //==============================END BOOLEANS======================================
- //===================================VOIDS========================================
- public void onFinish(){
- log("Thank You For Using TehOgreRanger");
- Environment.saveScreenshot(false);
- }
- public void walkToFrontCage(){
- Walking.findPath(frontCageTile).traverse();
- sleep (Random.nextInt(150, 300));
- }
- public void attackOgres(){
- final Filter<Npc> ogreFilter = new Filter <Npc>() {
- public boolean accept(Npc npc) {
- return npc != null && npc.getName().equals("Ogre") && npc.getHpPercent() > 10 && !npc.isInCombat();
- }
- };
- Npc Ogre = Npcs.getNearest(ogreFilter);
- if (!Players.getLocal().isInCombat()){
- if ( !Ogre.isDead()&& Players.getLocal().getInteracting() == null)
- if (!Ogre.isInCombat()){
- Camera.turnTo(Ogre);
- Ogre.interact("Attack Ogre");
- Mouse.moveSlightly();
- sleep(Random.nextInt(1000, 2000));
- }
- }
- }
- public void walkToArea(){
- Walking.findPath(areaTile).traverse();
- sleep (Random.nextInt(150, 300));
- }
- @SuppressWarnings("deprecation")
- public void teleGrabLoot(){
- GroundItem torstol = GroundItems.getNearest(torstolId);
- if(GroundItems.getNearest(torstolId) != null){
- if (torstol.isOnScreen()){
- if (Inventory.contains(lawRune) && Inventory.contains(airRune)){
- if (!Inventory.isFull()){
- if(Game.getCurrentTab() != Game.TAB_MAGIC){
- Game.openTab(Game.TAB_MAGIC);
- if(Magic.Book.MODERN != null){
- Camera.turnTo(torstol);
- Magic.castSpell(Magic.SPELL_TELEKINETIC_GRAB);
- sleep (Random.nextInt(180, 250));
- torstol.interact("Cast Telekinetic Grab -> Torstol Seed");
- sleep(500, 2000);
- }
- }
- }
- }
- }
- }
- }
- public void doSpecial(){
- if(!Attack.isSpecialEnabled()){
- if(Attack.getSpecialEnergy() == 100){
- Attack.setSpecial(true);
- sleep(Random.nextInt(300, 1000));
- if(Game.getCurrentTab() != Game.TAB_INVENTORY){
- Game.openTab(Game.TAB_INVENTORY);
- Mouse.moveRandomly(30);
- sleep(Random.nextInt(300, 1000));
- }
- }
- }
- }
- @SuppressWarnings("deprecation")
- public void checkHp(){
- if(Players.getLocal().getHpPercent() <= 15){
- if(Inventory.contains(houseTeleportTab)){
- Item teleTab = Inventory.getItem(houseTeleportTab);
- teleTab.interact("Break");
- sleep (2000, 3000);
- stop();
- }
- }
- }
- private final int potion4Id = 2444;
- private final int potion3Id = 169;
- private final int potion2Id = 171;
- private final int potion1Id = 173;
- private int Potions [] = {potion1Id, potion2Id, potion3Id, potion4Id};
- @SuppressWarnings("deprecation")
- public void drinkPotions(){
- Item allPotions = Inventory.getItem(Potions);
- if(Skills.getCurrentLevel(Skills.RANGE) <= Skills.getRealLevel(Skills.RANGE)){
- if(Inventory.containsOneOf(Potions)){
- allPotions.interact("Drink");
- }
- }
- }
- @SuppressWarnings("deprecation")
- public void dropVials(){
- Item vial = Inventory.getItem(emptyVialId);
- if(Inventory.containsOneOf(emptyVialId)){
- vial.interact("Drop");
- }
- }
- //=================================END VOIDS======================================
- //=========================================ANTI-BAN===============================
- public void doAntiBan(){
- int b = Random.nextInt(0, 20);
- switch (b) {
- case 1:
- if (Random.nextInt(0, 100) == 17) {
- log("[Antiban] move mouse");
- Mouse.moveSlightly();
- sleep(200, 600);
- Mouse.moveRandomly(150, 350);
- }
- break;
- case 2:
- if (Random.nextInt(0, 100) == 24) {
- log("[Antiban] Turn screen");
- Camera.setCompassAngle(Random.nextInt(30, 180));
- sleep(400, 1200);
- }
- break;
- case 3:
- if (Random.nextInt(0, 100) == 76) {
- log("[Antiban] mouse off screen");
- Mouse.moveOffScreen();
- sleep(Random.nextInt(600, Random.nextInt(1200, 2000)));
- }
- break;
- case 5:
- if (Random.nextInt(0, 100) == 12) {
- log("[Antiban] Checking Exp");
- if(Game.getCurrentTab() != Game.TAB_STATS){
- Game.openTab(Game.TAB_STATS);
- Skills.hover(Skills.COMPONENT_RANGE);
- sleep (Random.nextInt(400, 3000));
- Game.openTab(Game.TAB_INVENTORY);
- Mouse.moveRandomly(30);
- sleep(Random.nextInt(300, 1000));
- }
- else {
- Skills.hover(Skills.COMPONENT_RANGE);
- sleep (Random.nextInt(400, 3000));
- Game.openTab(Game.TAB_INVENTORY);
- Mouse.moveRandomly(30);
- sleep(Random.nextInt(300, 1000));
- }
- }
- break;
- case 6:
- if (Random.nextInt(0, 100) == 91) {
- log("[Antiban] Checking Exp");
- if(Game.getCurrentTab() != Game.TAB_STATS){
- Game.openTab(Game.TAB_STATS);
- Skills.hover(Skills.COMPONENT_CONSTITUTION);
- sleep (Random.nextInt(400, 3000));
- Game.openTab(Game.TAB_INVENTORY);
- Mouse.moveRandomly(30);
- sleep(Random.nextInt(300, 1000));
- } else {
- Skills.hover(Skills.COMPONENT_CONSTITUTION);
- sleep (Random.nextInt(400, 3000));
- Game.openTab(Game.TAB_INVENTORY);
- Mouse.moveRandomly(30);
- sleep(Random.nextInt(300, 1000));
- }
- }
- break;
- case 7:
- if (Random.nextInt(0, 100) == 72) {
- log("[Antiban] Move Mouse Off Screen");
- Mouse.moveOffScreen();
- sleep (Random.nextInt(400, 3000));
- }
- break;
- default:
- break;
- }
- }
- //===================================END ANTI-BAN=================================
- }
Add Comment
Please, Sign In to add comment