Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //import java.util.*;
- import java.awt.*;
- //import org.rsbot.bot.Bot;
- import org.rsbot.event.listeners.PaintListener;
- //import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- //import org.rsbot.script.methods.Calculations;
- //import org.rsbot.script.methods.Game;
- //import org.rsbot.script.methods.Bank;
- //import org.rsbot.script.wrappers.RSArea;
- //import org.rsbot.script.wrappers.RSItem;
- //import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- //import org.rsbot.script.methods.GroundItems;
- //import org.rsbot.script.wrappers.RSGroundItem;
- //import org.rsbot.script.wrappers.RSComponent;
- //import org.rsbot.script.methods.Mouse;
- @ScriptManifest(authors = { "Facinus", "Cody0520" }, keywords = { "Hunter" }, name = "Lizardraper", version = 0.1, description = "catches and banks swamp lizards at canfis!")
- public class Lizardraper extends Script implements PaintListener {
- RSTile Tree1 = new RSTile(3553, 3450);
- RSTile Tree2 = new RSTile(3553, 3453);
- int Lizards = 0;
- public String getAuthor() {
- return "Cody0520";
- }
- public String getName() {
- return "Lizardraper";
- }
- public double getVersion() {
- return 0.1;
- }
- public String getScriptCategory() {
- return "Hunter";
- }
- public boolean onStart() { // Loads any commands needed when the script is
- // started
- //Bot.getEventManager().addListener(this);
- //Bot.getEventManager().addListener(this);
- return true;
- }
- public void onFinish() {
- //Bot.getEventManager().removeListener(this);
- //Bot.getEventManager().removeListener(this);
- }
- int checkTime;
- long lastCheck;
- boolean powerMode = false;
- int randomRun = random(40, 75);
- int rockCount;
- int oldRockCount; // /////////CREDS TO AELIN
- int xpPerRock;
- long avoidedCombat;
- long avoidedSmokingRocks;
- int startExp = 0;
- int oldExp;
- int countToNext;
- int oldLevels;
- long lastAvgCheck;
- int avgPerHour;
- int Points = 0;
- int StartPoints = 0;
- String PointsString = "LuLWuT?";
- public int startLevel = 0;
- public int startXP = 0;
- public long startTime = System.currentTimeMillis();
- public long time = System.currentTimeMillis();
- public void onRepaint(Graphics g) {
- // if (isLoggedIn()) {
- // Ty to AELIN for these
- // local objects:
- int index = 21;
- int exp = 0;
- int levels;
- long hours = 0, minutes = 0, seconds = 0;
- long time;
- // Has start time been previously set?
- if (startTime == 0) {
- startTime = System.currentTimeMillis();
- }
- // Calculate hours, minutes and seconds.
- time = System.currentTimeMillis() - startTime;
- seconds = time / 1000;
- if (seconds >= 60) {
- minutes = seconds / 60;
- seconds -= minutes * 60;
- }
- if (minutes >= 60) {
- hours = minutes / 60;
- minutes -= hours * 60;
- }
- // Has variables been previously defined?
- if (startLevel == 0 || startExp == 0) {
- // No, so define them now.
- startLevel = skills.getCurrentLevel(21);
- startExp = skills.getCurrentExp(21);
- oldExp = 0;
- }
- // Calculate catches based on experience changes.
- exp = skills.getCurrentExp(21) - startExp;
- if (exp > oldExp) {
- xpPerRock = exp - oldExp;
- oldExp = exp;
- rockCount++;
- countToNext = skills.getExpToNextLevel(21) / xpPerRock + 1;
- }
- // Calculate levels gained.
- levels = skills.getCurrentLevel(index) - startLevel;
- if (levels > oldLevels) {
- oldLevels = levels;
- }
- //
- if (System.currentTimeMillis() - lastAvgCheck >= 60000) {
- lastAvgCheck = System.currentTimeMillis();
- avgPerHour = (rockCount - oldRockCount) * 60;
- oldRockCount = rockCount;
- }
- Color BG = new Color(0, 0, 0, 75);
- Color RED = new Color(255, 0, 0, 255);
- Color GREEN = new Color(0, 255, 0, 255);
- Color BLACK = new Color(0, 0, 0, 255);
- //int GotPoints = Points - StartPoints;
- int type = 21;
- long millis = System.currentTimeMillis() - startTime;
- millis -= hours * 1000 * 60 * 60;
- millis -= minutes * 1000 * 60;
- //int XPChange = skills.getCurrentExp(type) - startXP;
- //int Kills = XPChange / 240;
- //int KillsToLvl = skills.getExpToNextLevel(type) / 288;
- int LevelChange = skills.getCurrentLevel(type) - startLevel;
- int perNextLvl = skills.getPercentToNextLevel(type);
- int nextLvl = skills.getCurrentLevel(type) + 1;
- g.setColor(BG);
- g.fill3DRect(5, 25, 205, 143, true);
- g.setColor(Color.white);
- g.drawString(getName() + " v." + getVersion() + " by Drizzt1112", 10,
- 40);
- g.drawString("Running for: " + hours + "h " + minutes + "m " + seconds
- + "s", 10, 60);
- g.drawString("XP Gained: " + exp + " Lvls Gained: " + LevelChange,
- 10, 80);
- g.drawString("XP To next lvl: " + skills.getExpToNextLevel(type), 10,
- 100);
- g.drawString("Progress to next lvl:", 10, 120);
- g.setColor(RED);
- g.fill3DRect(10, 130, 100, 10, true);
- g.setColor(GREEN);
- g.fill3DRect(10, 130, perNextLvl, 10, true); // This is how progress
- // bars are made
- g.setColor(BLACK);
- g.drawString(perNextLvl + "% to " + nextLvl, 40, 139);
- g.setColor(Color.white);
- g.drawString("Lizards Caught: " + Lizards / 2, 10, 160);
- }
- int NormalTree = 19679;
- int Trapped = 19678;
- int Caught = 19675;
- int Lizard = 10149;
- int Rope = 954;
- int Net = 303;
- int FailCount = 0;
- public int loop() { // This is the area of the script where you code out the
- // things you want the bot to do
- RSObject Trap1 = objects.getTopAt(Tree1);
- RSObject Trap2 = objects.getTopAt(Tree2);
- if (FailCount > 20) {
- log("Failed");
- // logout();
- // stopAllScripts();
- }
- if (calc.distanceTo(Tree1) < 18) {
- if (getMyPlayer().getAnimation() == 5215
- || getMyPlayer().getAnimation() == 5207) {
- FailCount = 0;
- return random(200, 400);
- }
- if (inventory.contains(Lizard) && inventory.getCount() > 25) {
- FailCount = 0;
- inventory.getItem(Lizard).doAction("Release");
- sleep(random(200, 900));
- return random(200, 400);
- }
- RSObject rope = objects.getNearest(Rope);
- if (rope != null && !inventory.isFull()) {
- FailCount = 0;
- atTileTake(rope.getLocation(), "Take");
- sleep(random(200, 900));
- return random(200, 400);
- }
- RSObject net = objects.getNearest(Net); //getGroundItemByID(Net);
- if (net != null && !inventory.isFull()) {
- atTileTake(net.getLocation(), "Take");
- sleep(random(200, 900));
- return random(200, 400);
- }
- if (Trap1.getID() == NormalTree && inventory.contains(Rope)
- && inventory.contains(Net)) {
- atTileDrizzt(Tree1, "Set-Trap");
- FailCount = 0;
- sleep(random(1400, 1900));
- return random(200, 400);
- }
- if (Trap2.getID() == NormalTree && inventory.contains(Rope)
- && inventory.contains(Net)) {
- atTileDrizzt(Tree2, "Set-Trap");
- FailCount = 0;
- sleep(random(1400, 1900));
- return random(200, 400);
- }
- if (Trap1.getID() == Caught) {
- atTileDrizzt(Tree1, "Check");
- FailCount = 0;
- sleep(random(1000, 1400));
- return random(200, 400);
- }
- if (Trap2.getID() == Caught) {
- atTileDrizzt(Tree2, "Check");
- FailCount = 0;
- sleep(random(1000, 1400));
- return random(200, 400);
- }
- if (inventory.contains(Lizard)) {
- inventory.getItem(Lizard).doAction("Release");
- sleep(random(200, 900));
- return random(200, 400);
- }
- if (Trap1.getID() == Trapped) {
- sleep(random(100, 140));
- return random(200, 400);
- }
- if (Trap2.getID() == Trapped) {
- sleep(random(100, 140));
- return random(200, 400);
- }
- }
- FailCount++;
- log("Failed " + FailCount + " Times");
- sleep(random(3000, 8000));
- return random(100, 150);
- }
- public boolean atTileDrizzt(RSTile tile, String action) {
- AntiBan(random(1, 50), false);
- camera.moveRandomly(800);
- int TempCounter = 0;
- while (true) {
- if (!getMyPlayer().isMoving())
- break;
- sleep(random(200, 400));
- }
- try {
- Point location = calc.tileToScreen(tile);
- if (location.x == -1 || location.y == -1)
- return false;
- mouse.move(location, random(3, 6), random(-25, -15));
- while (!menu.getItems().toString().toLowerCase()
- .contains(action.toLowerCase())
- && TempCounter < 7) {
- location = calc.tileToScreen(tile);
- mouse.move(location, random(-8, 8), random(-45, -15));
- TempCounter++;
- }
- sleep(random(50, 100));
- mouse.click(true);
- return true;
- } catch (Exception e) {
- return false;
- }
- }
- public boolean atTileTake(RSTile tile, String action) {
- int TempCounter = 0;
- while (true) {
- if (!getMyPlayer().isMoving())
- break;
- sleep(random(200, 400));
- }
- try {
- Point location = calc.tileToScreen(tile);
- if (location.x == -1 || location.y == -1)
- return false;
- mouse.move(location, 8, 8);
- sleep(random(50, 100));
- while (!menu.getItems().toString().toLowerCase()
- .contains(action.toLowerCase())
- && TempCounter < 5) {
- location = calc.tileToScreen(tile);
- mouse.move(location, 8, 8);
- TempCounter++;
- }
- if (menu.getItems().toString().toLowerCase()
- .contains(action.toLowerCase())) {
- mouse.click(true);
- } else {
- mouse.click(false);
- menu.doAction(action);
- }
- sleep(random(50, 100));
- return true;
- } catch (Exception e) {
- return false;
- }
- }
- boolean AntiBanDebug = true;
- public void AntiBan(int r, boolean Random) { // Made By Drizzt1112
- if (Random) {
- r = random(0, 7);
- }
- if (AntiBanDebug) {
- log("Antiban Case: " + r);
- }
- switch (r) { // Ewww i am using case -.-
- case 1:
- camera.setAngle(random(1, 359));
- return;
- case 2:
- camera.setPitch(random(1, 99));
- return;
- case 3:
- mouse.move(random(1, 760), random(1, 499));
- return;
- case 4:
- game.openTab(random(0, 12));
- return;
- case 5:
- camera.setAngle(random(1, 359));
- camera.setPitch(random(1, 99));
- return;
- case 6:
- sleep(random(50, 150));
- return;
- case 7:
- if (game.getCurrentTab() != 2) {
- game.openTab(2);
- }
- mouse.click(random(716, 721), random(415, 430), true);
- mouse.move(random(613, 633), random(421, 441));
- sleep(random(1000, 2000));
- return;
- default:
- return;
- }
- }
- }
Add Comment
Please, Sign In to add comment