Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.KeyEvent;
- import java.util.*;
- import java.util.List;
- import java.util.logging.Level;
- import javax.accessibility.*;
- import javax.swing.*;
- import org.rsbot.bot.Bot;
- import org.rsbot.bot.input.CanvasWrapper;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.event.events.ServerMessageEvent;
- @ScriptManifest(authors = { "Grapes" }, category = "Combat", name = "gYaks", version = 1.00, description = "<html><head></head><body><center><h1>gYaks v1.00</h1></center><br>"
- + "<center><strong>By Grapes</strong></center><br>"
- + "<br>"
- + "<center><strong>ENJOY!</strong></center><br>")
- public class gYaks extends Script implements PaintListener,
- ServerMessageListener {
- // *VARIABLES*\\
- private final ScriptManifest properties = getClass().getAnnotation(
- ScriptManifest.class);
- private final int[] yakID = { 5529 };
- private final int[] foodID = { 6701, 365, 1891, 1897, 2011, 379, 7946, 329,
- 385, 333, 361 };
- public long startTime = System.currentTimeMillis();
- long runTime = System.currentTimeMillis() - startTime;
- public int strengthExp = skills.getCurrentSkillExp(STAT_STRENGTH);
- public int attackExp = skills.getCurrentSkillExp(STAT_ATTACK);
- public int defenseExp = skills.getCurrentSkillExp(STAT_DEFENSE);
- public int rangeExp = skills.getCurrentSkillExp(STAT_RANGE);
- public int hitpointsExp = skills.getCurrentSkillExp(STAT_HITPOINTS);
- public int gainedStrength = skills.getCurrentSkillExp(STAT_STRENGTH)
- - strengthExp;
- public int gainedAttack = skills.getCurrentSkillExp(STAT_ATTACK)
- - attackExp;
- public int gainedDefense = skills.getCurrentSkillExp(STAT_DEFENSE)
- - defenseExp;
- public int gainedRange = skills.getCurrentSkillExp(STAT_RANGE) - rangeExp;
- public int gainedHitpoints = skills.getCurrentSkillExp(STAT_HITPOINTS)
- - hitpointsExp;
- public int totalXpGained = gainedStrength + gainedAttack + gainedDefense
- + gainedRange;
- public int Hp = skills.getCurrentSkillExp(STAT_HITPOINTS);
- int xpPerHour = (int) (3600000.0 / runTime * gainedStrength);
- protected int getMouseSpeed() {
- return (random(6, 9));
- }
- // *START*\\
- public boolean onStart(Map<String, String> args) {
- startTime = System.currentTimeMillis();
- log("Script has begun.");
- return true;
- }
- public boolean run() {
- if (!isRunning() && getEnergy() > 50) {
- setRun(true);
- }
- return true;
- }
- public boolean eat() {
- if (skills.getCurrentSkillLevel(STAT_HITPOINTS) <= (skills
- .getRealSkillLevel(STAT_HITPOINTS) / 4)) {
- for (int i = 0; i < foodID.length; i++) {
- if (getInventoryCount(foodID[i]) != 0) {
- atInventoryItem(foodID[i], "Eat");
- if (getInventoryCount(foodID[i]) != 0) {
- wait(random(436, 669));
- }
- return true;
- }
- if (foodID == null)
- ;
- return false;
- }
- return true;
- }
- return true;
- }
- public boolean attackYak() {
- RSNPC Yak = getNearestFreeNPCToAttackByID(yakID);
- {
- atNPC(Yak, "Attack");
- wait(random(1000, 1500));
- if (getMyPlayer().getInteracting() != null) {
- moveMouseRandomly(random(3000, 10000));
- }
- return true;
- }
- }
- public int loop() {
- {
- while (getMyPlayer().isMoving()) {
- return (random(100, 300));
- }
- if (!isRunning() && getEnergy() > 50) {
- setRun(true);
- }
- if (skills.getCurrentSkillLevel(STAT_HITPOINTS) <= (skills
- .getRealSkillLevel(STAT_HITPOINTS) / 4)) {
- eat();
- }
- if (getMyPlayer().getInteracting() != null) {
- return random(300, 450);
- }
- if (getMyPlayer().getInteracting() == null) {
- attackYak();
- }
- run();
- wait(random(500, 700));
- }
- return 100;
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String msg = e.getMessage();
- if (msg.contains("Oh dear"))
- ;
- stopScript();
- log("You died noob.");
- }
- // *PAINT*\\
- public void onRepaint(Graphics g) {
- if (!isLoggedIn() || isLoginScreen())
- return;
- long millis = System.currentTimeMillis() - startTime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- long minutes2 = minutes + (hours * 60);
- g.setColor(new Color(128, 0, 0, 128));
- g.fillRoundRect(550, 206, 185, 260, 10, 10);
- g.setColor(Color.white);
- g.setFont(new Font("Arial", Font.BOLD, 13));
- g.drawString("gYaks V 1.00", 610, 225);
- g.setFont(new Font("Arial", Font.PLAIN, 12));
- g.drawString("Time Running: " + hours + ":" + minutes + ":" + seconds,
- 560, 255);
- gainedStrength = skills.getCurrentSkillExp(STAT_STRENGTH) - strengthExp;
- gainedAttack = skills.getCurrentSkillExp(STAT_ATTACK) - attackExp;
- gainedDefense = skills.getCurrentSkillExp(STAT_DEFENSE) - defenseExp;
- gainedHitpoints = skills.getCurrentSkillExp(STAT_HITPOINTS)
- - hitpointsExp;
- g.drawString("Strength XP Gained: " + gainedStrength, 560, 295);
- g.drawString("Attack XP Gained: " + gainedAttack, 560, 335);
- g.drawString("Defense XP Gained: " + gainedDefense, 560, 375);
- g.drawString("Hitpoints XP Gained: " + gainedHitpoints, 560, 415);
- float xpPerSec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && totalXpGained > 0) {
- xpPerSec = (float) totalXpGained
- / (float) (seconds + minutes * 60 + hours * 60 * 60);
- }
- final float xpPerMin = xpPerSec * 60;
- final float xpPerHour = xpPerMin * 60;
- totalXpGained = gainedStrength + gainedAttack + gainedDefense
- + gainedRange;
- g.drawString("Exp/Hour: " + xpPerHour, 560, 455);
- }
- // AntiBan
- // Credits to Foulwerp
- public int antiban() {
- int i = random(0, 20);
- if (i == 2) {
- moveMouse(random(5, CanvasWrapper.getGameWidth()), random(0,
- CanvasWrapper.getGameHeight()));
- return random(0, 400);
- } else if (i == 3 || i == 12) {
- char dir = 37;
- if (random(0, 3) == 2) {
- dir = 39;
- }
- Bot.getInputManager().pressKey(dir);
- wait(random(500, 2000));
- Bot.getInputManager().releaseKey(dir);
- return random(0, 500);
- } else if (i == 7 || i == 4) {
- setCameraAltitude(random(35, 150));
- return random(0, 500);
- } else if (i == 5 || i == 10 || i == 11 || i == 13 || i == 18) {
- moveMouseRandomly(random(-4, 4));
- } else if (i == 1 || i == 8 || i == 15 || i == 20) {
- Thread camera = new Thread() {
- @Override
- public void run() {
- char dir = 37;
- if (random(0, 3) == 2)
- dir = 39;
- Bot.getInputManager().pressKey(dir);
- try {
- Thread.sleep(random(500, 2000));
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- Bot.getInputManager().releaseKey(dir);
- }
- };
- Thread mouse = new Thread() {
- @Override
- public void run() {
- moveMouse(random(0, CanvasWrapper.getGameWidth()), random(
- 0, CanvasWrapper.getGameHeight()));
- }
- };
- if (i == 7 || i == 20) {
- camera.start();
- }
- if (i == 1) {
- mouse.start();
- }
- while (camera.isAlive() || mouse.isAlive()) {
- wait(random(100, 300));
- return random(300, 700);
- }
- }
- return random(1000, 1500);
- }
- public void onFinish() {
- log("Script has stopped.");
- }
- }
Add Comment
Please, Sign In to add comment