Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Script made by Kets!
- * Proud to be Dutch!
- * DON'T STEAL THIS SCRIPT
- *
- * Cool Mouse Animation: MHTY
- * Help Credits:
- * BOOL
- * Mouchicc
- *
- * FIXED and updated by SLAVEN
- */
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Point;
- import java.awt.event.KeyEvent;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import org.rsbot.bot.Bot;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = { "Kets and Slaven" }, category = "Combat", name = "FIXED Mystic Ogre Ranger", version = 2.0, description = "<head><style type='text/css'> hr {color: white} p {margin-left: 20px}</style></head><body><center><b><font size='5' color='red'>FIXED Mystic Ogre Ranger v 2.0 </font></b><br><b><font size='4' color='red'>By Kets, fixed by Slaven</font></b><br></center><center><table border='0'><tr><td colspan='2'><center><font size='4'><b>~~ Script Settings ~~</b></font></center></td></tr><tr><td colspan='2'><hr></td></tr><tr><td><tr><td><b>Start at King Lathas Training Ground</b></td><td><center><tr><td><b>Use Paint:</b></td><td><center><input type='checkbox' name='ShowPaint' value='true'> Yes<tr><td><b>Hit Predictor:</b></td><td><center><input type='checkbox' name='ShowHit' value='true'> Yes<tr><td><b>Use Range Potions (broken):</b></td><td><center><input type='checkbox' name='Potions' value='true'> Yes<tr><td><b>Grab Seeds:</b></td><td><center><input type='checkbox' name='Seed' value='true'> Yes<tr><td><b>Use AntiBan (broken):</b></td><td><center><input type='checkbox' name='AntiBan' value='true'> Yes<tr><td><b>Use SafeTele (unconfirmed):</b></td><td><center><input type='checkbox' name='Tele' value='true'> Yes<tr><td><b>Food ID (unconfirmed):</b></td><td><center><input type='text' name='foodid'></table></center></body></html>")
- public class FIXEDMysticOgreRanger extends Script implements ServerMessageListener,
- PaintListener {
- final ScriptManifest properties = getClass().getAnnotation(
- ScriptManifest.class);
- // Local Settings
- RSTile StartSpot;
- int MONSTER = 2801;
- boolean AntiBan = false;
- int SettingTele = 10;
- boolean ActivateTele = false;
- int LawRune = 563;
- int AirRune = 556;
- int Ardougne = 8011;
- // Eating
- boolean Eating = false;
- int FoodID;
- int EatAT = 20;
- // AntiBan
- public int currenttab;
- public int GambleInt;
- public int checkTime, checkTime1 = random(240000, 480000);
- public int speed = 300;
- public int walkSpeed = 300;
- public long lastCheck = -1, lastcheck1 = -1, lastCheck2,
- lastCheck3 = System.currentTimeMillis();
- public Point mousePos;
- // Potion Support
- int[] RangePotion = { 169, 170, 171, 172, 173, 174, 2444, 2445, 11509,
- 11510, 11511, 11512 };
- int EmptyVial = 229;
- boolean Potions = false;
- // Seeds
- int GotSeed;
- boolean Seed = false;
- int RanarrID = 5295;
- int WaterID = 5321;
- int SnapeID = 5300;
- int KwuarmID = 5299;
- int LimpID = 5100;
- int StrawbID = 5323;
- int LoopkID = 987;
- int ToothkID = 985;
- int ToadfID = 5296;
- int[] totalSeeds = {RanarrID, WaterID, SnapeID, KwuarmID, LimpID,
- StrawbID, LoopkID, ToothkID, ToadfID};
- // Paint Settings
- long startTime = System.currentTimeMillis();
- int StartXP = skills.getCurrentSkillExp(Constants.STAT_RANGE);
- int StartLVL = skills.getCurrentSkillLevel(Constants.STAT_RANGE);
- boolean ShowPaint = false;
- boolean HitCalc = false;
- int Profit;
- GEItemInfo PriceKw = grandExchange.loadItemInfo(KwuarmID);
- GEItemInfo PriceWa = grandExchange.loadItemInfo(WaterID);
- GEItemInfo PriceSn = grandExchange.loadItemInfo(SnapeID);
- GEItemInfo PriceRa = grandExchange.loadItemInfo(RanarrID);
- GEItemInfo PriceLi = grandExchange.loadItemInfo(LimpID);
- GEItemInfo PriceLK = grandExchange.loadItemInfo(LoopkID);
- GEItemInfo PriceTK = grandExchange.loadItemInfo(ToothkID);
- GEItemInfo PriceSt = grandExchange.loadItemInfo(StrawbID);
- GEItemInfo PriceTo = grandExchange.loadItemInfo(ToadfID);
- // HIT Predictor
- int back2zerorng = 0;
- double rnghit;
- int rng1 = 0;
- int rng2 = 0;
- int rng3 = 0;
- int range1 = 0;
- int range2 = 0;
- // SCRIPT
- public boolean onStart(Map<String, String> args) {
- StartSpot = getMyPlayer().getLocation();
- if (args.get("ShowPaint") != null) {
- ShowPaint = true;
- }
- if (args.get("Potions") != null && inventoryContains(RangePotion)) {
- Potions = true;
- }
- if (args.get("AntiBan") != null) {
- AntiBan = true;
- }
- if (args.get("Seed") != null && inventoryContains(LawRune)
- && inventoryContains(AirRune)) {
- Seed = true;
- }
- if (args.get("Tele") != null && inventoryContains(Ardougne)) {
- ActivateTele = true;
- }
- if (args.get("foodid").equals("")) {
- Eating = false;
- } else {
- Eating = true;
- FoodID = Integer.parseInt(args.get("foodid"));
- }
- if (args.get("ShowHit") != null) {
- HitCalc = true;
- }
- return true;
- }
- public void onFinish() {
- return;
- }
- // Method edited so it doesnt open the inventorytab always <-- MOUCHICC
- @Override
- public RSInterfaceChild getInventoryInterface() {
- if (getInterface(Constants.INVENTORY_COM_X).isValid()) {
- return RSInterface.getChildInterface(Constants.INVENTORY_COM_X,
- Constants.INVENTORY_COM_Y);
- }
- return RSInterface.getChildInterface(Constants.INVENTORY_X,
- Constants.INVENTORY_Y);
- }
- private boolean ATTACKNPC(final RSNPC npc, final String action) {
- final RSTile tile = npc.getLocation();
- tile.randomizeTile(1, 1);
- try {
- final int hoverRand = random(8, 13);
- for (int i = 0; i < hoverRand; i++) {
- final Point screenLoc = npc.getScreenLocation();
- if (!pointOnScreen(screenLoc)) {
- setCameraRotation(getCameraAngle() + random(-35, 150));
- return true;
- }
- moveMouse(screenLoc, 15, 15);
- final List<String> menuItems = getMenuItems();
- if (menuItems.isEmpty() || menuItems.size() <= 1) {
- continue;
- }
- if (menuItems.get(0).toLowerCase().contains(
- npc.getName().toLowerCase())
- && getMyPlayer().getInteracting() == null) {
- clickMouse(true);
- return true;
- } else {
- for (int a = 1; a < menuItems.size(); a++) {
- if (menuItems.get(a).toLowerCase().contains(
- npc.getName().toLowerCase())
- && getMyPlayer().getInteracting() == null) {
- clickMouse(false);
- return atMenu(action);
- }
- }
- }
- }
- } catch (final Exception e) {
- log.warning("ATTACKNPC(RSNPC, String) error: " + e);
- return false;
- }
- return false;
- }
- private boolean clickInventoryArray(int[] itemID, String option) {
- if (getCurrentTab() != TAB_INVENTORY
- && !RSInterface.getInterface(INTERFACE_BANK).isValid()
- && !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
- openTab(TAB_INVENTORY);
- }
- int[] items = getInventoryArray();
- java.util.List<Integer> possible = new ArrayList<Integer>();
- for (int X = 0; X < itemID.length; X++) {
- for (int i = 0; i < items.length; i++) {
- if (items[i] == itemID[X]) {
- possible.add(i);
- }
- }
- }
- if (possible.size() == 0) {
- return false;
- } else {
- int IDE = random(0, possible.size());
- int idx = possible.get(IDE);
- Point t = getInventoryItemPoint(idx);
- clickMouse(t, 5, 5, false);
- return atMenu(option);
- }
- }
- public void checkForLevelUpMessage() {
- if (RSInterface.getInterface(INTERFACE_LEVELUP).isValid()) {
- wait(random(800, 2000));
- atInterface(INTERFACE_LEVELUP, 3);
- wait(random(1000, 2000));
- }
- }
- public boolean CheckSeed() {
- RSTile Ranarr = getGroundItemByID(5295);
- RSTile Water = getGroundItemByID(5321);
- RSTile Snape = getGroundItemByID(5300);
- RSTile Kwuarm = getGroundItemByID(5299);
- RSTile Strawb = getGroundItemByID(5323);
- RSTile Toothk = getGroundItemByID(985);
- RSTile Loopk = getGroundItemByID(987);
- RSTile Limp = getGroundItemByID(5100);
- RSTile Toadf = getGroundItemByID(5296);
- if (Seed) {
- if (Ranarr != null || Water != null || Snape != null
- || Kwuarm != null || Limp != null || Strawb != null
- || Toothk != null || Loopk != null || Limp != null
- || Toadf != null) {
- return false;
- }
- }
- return true;
- }
- public boolean Safe() {
- int Hp = skills.getCurrentSkillLevel(STAT_HITPOINTS);
- int TeleAt = random(SettingTele, (SettingTele + 3));
- if (Hp <= TeleAt) {
- return true;
- }
- return false;
- }
- public void hpCheck() {
- int curHP = skills.getCurrentSkillLevel(STAT_HITPOINTS);
- int eat = random(EatAT, (EatAT + 5));
- if (curHP <= eat && getInventoryCount(FoodID) > 0) {
- atInventoryItem(FoodID, "Eat");
- }
- }
- public boolean rightClickTile(RSTile tile, String action) {
- Point p = Calculations.tileToScreen(tile);
- clickMouse(p, false);
- wait(random(500, 800));
- return atMenu(action);
- }
- @Override
- public int loop() {
- if (distanceTo(StartSpot) > 3) {
- walkTileMM(StartSpot);
- }
- {
- checkForLevelUpMessage();
- hpCheck();
- }
- if (Safe() && ActivateTele) {
- openTab(Constants.TAB_INVENTORY);
- if (getCurrentTab() == Constants.TAB_INVENTORY) {
- atInventoryItem(Ardougne, "Break");
- }
- }
- if (Seed) {
- RSTile Ranarr = getGroundItemByID(RanarrID);
- RSTile Water = getGroundItemByID(WaterID);
- RSTile Snape = getGroundItemByID(SnapeID);
- RSTile Kwuarm = getGroundItemByID(KwuarmID);
- RSTile Limp = getGroundItemByID(LimpID);
- RSTile Strawb = getGroundItemByID(StrawbID);
- RSTile Toothk = getGroundItemByID(ToothkID);
- RSTile Loopk = getGroundItemByID(LoopkID);
- RSTile Toadf = getGroundItemByID(ToadfID);
- if (Toadf != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Toadf, "Grab -> Toadflax");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Ranarr != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Ranarr, "Grab -> Ranarr");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Loopk != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Loopk, "Grab -> Loop");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Toothk != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Toothk, "Grab -> Tooth");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Strawb != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Strawb, "Grab -> Strawberry");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Water != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Water, "Grab -> Watermelon");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Snape != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Snape, "Grab -> Snapdragon");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Kwuarm != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Kwuarm, "Grab -> Kwuarm");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- if (Limp != null) {
- openTab(Constants.TAB_MAGIC);
- if (getCurrentTab() == Constants.TAB_MAGIC) {
- castSpell(Constants.SPELL_TELEKINETIC_GRAB);
- rightClickTile(Limp, "Grab -> Limp");
- GotSeed++;
- openTab(Constants.TAB_INVENTORY);
- wait(random(1400, 2200));
- }
- }
- }
- if (Potions) {
- if (skills.getCurrentSkillLevel(Constants.STAT_RANGE) == skills
- .getRealSkillLevel(Constants.STAT_RANGE)
- && getInventoryCount(RangePotion) != 0) {
- clickInventoryArray(RangePotion, "Drink");
- wait(random(1457, 2757));
- }
- }
- if (CheckSeed() && getMyPlayer().getInteracting() == null
- && getNearestFreeNPCByID(MONSTER) != null) {
- ATTACKNPC(getNearestFreeNPCByID(MONSTER), "Attack");
- }
- if (AntiBan) {
- AntiBan();
- }
- return 800;
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String message = e.getMessage();
- if (message.contains("There is no ammo left in your quiver.")) {
- log("No Arrows!!");
- stopScript();
- }
- if (message.contains("That was your last one!")) {
- log("No knives!!");
- stopScript();
- }
- }
- public boolean activateCondition() {
- if (getMyPlayer().isMoving()) {
- return random(1, walkSpeed) == 1;
- } else {
- return random(1, speed) == 1;
- }
- }
- public int AntiBan() {
- if (!bank.getInterface().isValid()) {
- if (System.currentTimeMillis() - lastCheck2 >= checkTime) {
- lastCheck2 = System.currentTimeMillis();
- checkTime = random(300000, 700000);
- wait(random(300, 500));
- mousePos = getMouseLocation();
- currenttab = getCurrentTab();
- openTab(random(0, 13));
- wait(random(300, 500));
- turnCamera();
- wait(random(300, 500));
- openTab(currenttab);
- wait(random(300, 500));
- moveMouse(mousePos, 7, 7);
- wait(random(100, 200));
- }
- GambleInt = random(1, 8);
- switch (GambleInt) {
- case 1: // Camera Rotation
- mousePos = getMouseLocation();
- moveMouse(random(0, 450), random(0, 450));
- wait(random(1000, 1500));
- moveMouse(mousePos, 7, 7);
- return -1;
- case 2: // Move mouse & come back to original mouse location &
- // Camera Rotation
- final int xA = random(0, 750);
- final int yA = random(0, 500);
- mousePos = getMouseLocation();
- moveMouse(xA, yA);
- wait(random(800, 1500));
- moveMouse(mousePos, 7, 7);
- wait(random(100, 200));
- turnCamera();
- return -1;
- case 3: // Inventory Tab Selection & Camera Rotation
- if (getCurrentTab() != Constants.TAB_INVENTORY) {
- currenttab = getCurrentTab();
- openTab(Constants.TAB_INVENTORY);
- wait(random(900, 1500));
- }
- return -1;
- case 4: // Checks the bones, then cancel
- RSTile Bone = getGroundItemByID(532);
- if (Bone != null) {
- rightClickTile(Bone, "Cancel");
- }
- return -1;
- case 5: // Camera Rotation & Move mouse & come back to original
- // mouse location
- wait(random(300, 500));
- final int xB = random(0, 750);
- final int yB = random(0, 500);
- mousePos = getMouseLocation();
- moveMouse(xB, yB);
- wait(random(900, 1500));
- moveMouse(mousePos, 7, 7);
- return -1;
- case 6: // Camera Rotation
- turnCamera();
- return -1;
- case 7: // Open different tab and go back to original tab
- mousePos = getMouseLocation();
- currenttab = getCurrentTab();
- openTab(random(0, 13));
- wait(random(300, 500));
- openTab(currenttab);
- wait(random(1300, 1600));
- moveMouse(mousePos, 7, 7);
- return -1;
- case 8: // Move mouse && come back to original mouse location
- mousePos = getMouseLocation();
- moveMouse(random(0, 450), random(0, 450));
- wait(random(1200, 1600));
- moveMouse(mousePos, 7, 7);
- return -1;
- }
- }
- return -1;
- }
- public void turnCamera() {
- char[] LR = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT };
- char[] UD = new char[] { KeyEvent.VK_DOWN, KeyEvent.VK_UP };
- char[] LRUD = new char[] { KeyEvent.VK_LEFT, KeyEvent.VK_RIGHT,
- KeyEvent.VK_UP, KeyEvent.VK_UP };
- int random2 = random(0, 2);
- int random1 = random(0, 2);
- int random4 = random(0, 4);
- if (random(0, 3) == 0) {
- Bot.getInputManager().pressKey(LR[random1]);
- try {
- Thread.sleep(random(100, 400));
- } catch (Exception e) {
- }
- Bot.getInputManager().pressKey(UD[random2]);
- try {
- Thread.sleep(random(300, 600));
- } catch (Exception e) {
- }
- Bot.getInputManager().releaseKey(UD[random2]);
- try {
- Thread.sleep(random(100, 400));
- } catch (Exception e) {
- }
- Bot.getInputManager().releaseKey(LR[random1]);
- } else {
- Bot.getInputManager().pressKey(LRUD[random4]);
- if (random4 > 1) {
- try {
- Thread.sleep(random(300, 600));
- } catch (Exception e) {
- }
- } else {
- try {
- Thread.sleep(random(500, 900));
- } catch (Exception e) {
- }
- }
- Bot.getInputManager().releaseKey(LRUD[random4]);
- }
- }
- public int CalcProfit(int ID, int Price) {
- int Total = 0;
- if (getInventoryCount(ID) >= 1) {
- Total = getInventoryCount(ID) * Price;
- // log("Prijs: " + ID + " " + Price);
- return Total;
- }
- return -1;
- }
- public void onRepaint(Graphics g) {
- if (isLoggedIn()) {
- if (ShowPaint) {
- long millis = System.currentTimeMillis() - startTime;
- long seconds = millis / 1000 % 60;
- long minutes = millis / (1000 * 60) % 60;
- long hours = millis / (1000 * 60 * 60) % 24;
- int percentage = skills
- .getPercentToNextLevel(Constants.STAT_RANGE);
- int expGained = skills.getCurrentSkillExp(Constants.STAT_RANGE)
- - StartXP;
- Profit = CalcProfit(RanarrID, PriceRa.getMarketPrice())
- + CalcProfit(KwuarmID, PriceKw.getMarketPrice())
- + CalcProfit(WaterID, PriceWa.getMarketPrice())
- + CalcProfit(SnapeID, PriceSn.getMarketPrice())
- + CalcProfit(StrawbID, PriceSt.getMarketPrice())
- + CalcProfit(ToothkID, PriceTK.getMarketPrice())
- + CalcProfit(LimpID, PriceLi.getMarketPrice())
- + CalcProfit(ToadfID, PriceTo.getMarketPrice())
- + CalcProfit(LoopkID, PriceLK.getMarketPrice());
- Point Point = getMouseLocation();
- long timeSince = Bot.getClient().getMouse().getMousePressTime();
- if (timeSince > System.currentTimeMillis() - 500) {
- g.setColor(new Color(255, 255, 255, 125));
- }else{
- g.setColor(new Color(0, 0, 0, 150));
- }
- g.drawLine(0, Point.y, 762, Point.y);
- g.drawLine(Point.x, 0, Point.x, 500);
- g.setColor(new Color(0, 0, 0, 200));
- g.fillRect(520, 0, 245, 168);
- g.setColor(Color.RED);
- g.drawString("Mystic Ogre Ranger" + " v " + properties.version(),
- 530 + 1, 20 + 1);
- g.setColor(Color.WHITE);
- g.drawString("Mystic Ogre Ranger" + " v " + properties.version(),
- 530, 20);
- g.drawString("Run Time: " + hours + ":" + minutes + ":"
- + seconds, 530, 40);
- g.drawString("Seeds: " + GotSeed, 530, 60);
- g.drawString("Current Level: "
- + skills.getRealSkillLevel(Constants.STAT_RANGE)
- + " - (" + percentage + "%)", 530, 80);
- g.drawString("Gained: " + expGained + " EXP", 530, 100);
- if (Seed) {
- g.drawString("Profit: " + Profit + " GP", 530, 120);
- } else {
- g.drawString("Profit: 0", 530, 120);
- }
- if (HitCalc) {
- // HIT Predictor
- if (range1 == 0) {
- range1 = skills.getCurrentSkillExp(STAT_RANGE);
- range2 = 0;
- rng1 = range1;
- back2zerorng = 40;
- }
- if (range2 == 0) {
- if ((range1 != 0)
- && (range1 != skills.getCurrentSkillExp(STAT_RANGE))) {
- range2 = skills.getCurrentSkillExp(STAT_RANGE);
- rng2 = range2;
- range1 = 0;
- range2 = 0;
- back2zerorng = 40;
- }
- }
- if ((rng2 - rng1 != 0)) {
- rng3 = rng2 - rng1;
- rnghit = rng3 * 0.25;
- rnghit = Math.round(rnghit);
- back2zerorng = 40;
- }
- if (back2zerorng <= 0) {
- rnghit = 0;
- }
- back2zerorng--;
- // Hit Predictor Text
- g.setColor(new Color(0, 0, 0, 150));
- g.fill3DRect(410, 7, 90, 20, true);
- g.setColor(Color.WHITE);
- g.drawString("Next Hit: " + rnghit, 413, 22);
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment