Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.util.Filter;
- import org.rsbot.script.util.Timer;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.methods.*;
- import java.awt.*;
- import java.applet.*;
- import java.util.HashSet;
- import java.util.Set;
- import java.util.EventListener;
- @ScriptManifest(authors = "Cyrus",
- name = "PureStarter",
- version = 0.2,
- description = "Kills bitch ass cows")
- /*
- * Must start with:
- * A log you have the firemaking to light or an empty space
- * A hatchet you have the Woodcutting level to use
- * A tinderbox
- * Your fight-type already selected
- */
- public class PureStarter extends Script implements MessageListener{
- public enum ScriptState {
- FINDING, KILLING, LOOTING, TOTREES, CUTTING, LIGHTING, COOKING, DROPPING, TOCOWS
- }
- boolean finding = false;
- boolean killing = false;
- boolean looting = false;
- boolean totrees = false;
- boolean cutting = false;
- boolean lighting = false;
- boolean cooking = false;
- boolean dropping = false;
- boolean tocows = false;
- private static final RSArea northGuildPen = new RSArea (2918, 3275, 2927, 3291);
- private static final RSArea southGuildPen = new RSArea (2923, 3270, 2938, 3275);
- private static final RSTile guildGate = new RSTile (2923, 3292);
- private static final int[] cowIDs = {
- 81, 397, 2310, 12362, 12364, 12365, 1766, 1767, 1768, 2310};
- private static final int[] hatchetIDs = {
- 1351, 1349, 1353, 1361, 1355, 1357, 1359, 6739};
- //1351 = Bronze
- //1349 = Iron
- //1353 = Steel
- //1361 = Black
- //1355 = Mith
- //1357 = Adamant
- //1359 = Rune
- //6739 = Dragon
- //3082/3247 = ???
- private static final int[] logIDs = {
- 1511, 1521, 1519, 1517, 1515, 1513};
- private static final int treeID = 1276;
- private static final int fireID = 2732;
- private static final int cowHide = 1739; //Safe to drop item
- private static final int bones = 526; //Safe to drop
- private static final int[] safeToDropItems = {
- 1739, 526, 2146};
- private static final int rawBeef = 2132;
- private static final int cookedBeef = 2142;
- private static final int burntBeef = 2146; //Safe to drop item
- private static final int tinderBox = 590;
- private boolean fireLit = false;
- private int lastConstitutionXP;
- private int lastAttackXP;
- private int lastStrengthXP;
- private int lastDefenseXP;
- private int lastRangeXP;
- private int lastMageXP;
- private String fightType;
- private RSNPC cow;
- public boolean onStart() {
- log("Cyrus is the greatest. ");
- if (!haveUsableHatchet() || !inventory.contains(tinderBox) || (inventory.isFull() && haveUsableLogs() == false)) {
- log("Read the directions, dumbass");
- return false;
- }
- lastAttackXP = skills.getCurrentExp(Skills.ATTACK);
- lastStrengthXP = skills.getCurrentExp(Skills.STRENGTH);
- lastDefenseXP = skills.getCurrentExp(Skills.DEFENSE);
- lastRangeXP = skills.getCurrentExp(Skills.RANGE);
- lastMageXP = skills.getCurrentExp(Skills.MAGIC);
- cow = null;
- return true;
- }
- public void messageReceived (MessageEvent e) {
- if (e.getID() == MessageEvent.MESSAGE_SERVER && e.getMessage().contains("The fire catches")) {
- fireLit = true;
- }
- }
- private void dealWithGate() {
- RSObject gate = objects.getTopAt(guildGate);
- if (gate != null) {
- if (!gate.isOnScreen()) {
- log("Walking to gate");
- walking.walkTo(gate.getLocation());
- }
- log("Opening gate");
- gate.doClick();
- sleep(random(1000,2000));
- }
- else
- log("gate null");
- }
- private boolean haveUsableLogs() {
- int fmLevel = skills.getRealLevel(Skills.FIREMAKING);
- if (fmLevel >= 75 && inventory.containsOneOf(logIDs)) {
- return true;
- }
- if (fmLevel >= 60 && inventory.containsOneOf(1511, 1521, 1519, 1517, 1515)) {
- return true;
- }
- if (fmLevel >=45 && inventory.containsOneOf(1511, 1521, 1519, 1517)) {
- return true;
- }
- if (fmLevel >=30 && inventory.containsOneOf(1511, 1521, 1519)) {
- return true;
- }
- if (fmLevel >=15 && inventory.containsOneOf(1511, 1521)) {
- return true;
- }
- if (inventory.contains(1511)) {
- return true;
- }
- return false;
- }
- private boolean haveUsableHatchet() {
- int wcLevel = skills.getRealLevel(Skills.WOODCUTTING);
- if (wcLevel >= 61 && inventory.containsOneOf(hatchetIDs)) {
- return true;
- }
- if (wcLevel >= 41 && inventory.containsOneOf(1351, 1353, 1361, 1355, 1357, 1359)) {
- return true;
- }
- if (wcLevel >= 31 && inventory.containsOneOf(1351, 1349, 1353, 1361, 1355, 1357)) {
- return true;
- }
- if (wcLevel >= 21 && inventory.containsOneOf(1351, 1349, 1353, 1361, 1355)) {
- return true;
- }
- if (wcLevel >= 11 && inventory.containsOneOf(1351, 1349, 1353, 1361)) {
- return true;
- }
- if (wcLevel >= 6 && inventory.containsOneOf(1351, 1349, 1353)) {
- return true;
- }
- if (inventory.containsOneOf(1351, 1349)) {
- return true;
- }
- return false;
- }
- //TYVM Taw (#RSCode), walked me through filters, if you are hot female
- //and you like this script, sex him.
- private Filter cowFilter = new Filter <RSNPC>() {
- public boolean accept (RSNPC all) {
- for (int i=0; i < cowIDs.length; i++) {
- if (all.getID() == cowIDs[i]) {
- return !all.isInCombat();
- }
- }
- return false;
- }
- };
- private RSNPC getCow() {
- RSNPC nearestCow = npcs.getNearest(cowFilter);
- return nearestCow;
- }
- private void attackCows() {
- boolean lootReady = false;
- if (cow == null || !cow.isValid()) {
- cow = getCow();
- }
- if (cow != null) {
- if (cow.isOnScreen()) {
- cow.doAction("Attack");
- }
- else {
- walking.walkTo(cow.getLocation());
- sleep(random(1500,2300));
- cow.doAction("Attack");
- }
- }
- sleep(random(1500,2000));
- if (cow != null) {
- while (getMyPlayer().isInCombat()) {
- if (lootReady != true) {
- lootReady = true;
- }
- sleep(random(50,100));
- }
- if (lootReady == true) {
- if (!inventory.isFull()) {
- lootBeef();
- }
- if (!getMyPlayer().isInCombat()) {
- cow = null;
- }
- }
- }
- }
- private boolean lootBeef() {
- //Thank you biking11
- int originalBeefs = inventory.getCount(false, rawBeef);
- int iFailAtJavaNaming = originalBeefs + 1;
- RSGroundItem loot = groundItems.getNearest(rawBeef);
- for (int i = 1; i < 3 && loot != null; i++) {
- loot.doAction("Take");
- if (inventory.getCount(false, rawBeef) == iFailAtJavaNaming) {
- return true;
- }
- }
- return false;
- }
- private boolean getLogs() {
- RSObject tree = null;
- for (int i = 0; i < 5; i++) {
- tree = objects.getNearest(treeID);
- if (tree == null) {
- continue;
- }
- if (!tree.isOnScreen()) {
- walking.walkTo(tree.getLocation());
- sleep(random(1000,2500));
- }
- if (tree != null) {
- tree.doAction("Chop");
- sleep (random(2000,5000));
- if (haveUsableLogs()) {
- return true;
- }
- }
- }
- return false;
- }
- private boolean walkOneTile() {
- RSTile originalLocation = getMyPlayer().getLocation();
- int xValue = originalLocation.getX();
- int yValue = originalLocation.getY();
- for (int i = 0; i < 3; i++) {
- switch (random(1,4)) {
- case 1: //North
- RSTile northTile = new RSTile (xValue, (yValue+1));
- walking.walkTileOnScreen(northTile);
- if (getMyPlayer().getLocation() == northTile) {
- return true;
- }
- break;
- case 2: //East
- RSTile eastTile = new RSTile ((xValue + 1), yValue);
- walking.walkTileOnScreen(eastTile);
- if (getMyPlayer().getLocation() == eastTile) {
- return true;
- }
- break;
- case 3: //South
- RSTile southTile = new RSTile (xValue, (yValue-1));
- walking.walkTileOnScreen(southTile);
- if (getMyPlayer().getLocation() == southTile) {
- return true;
- }
- break;
- case 4: //West
- RSTile westTile = new RSTile ((xValue-1), yValue);
- walking.walkTileOnScreen(westTile);
- if (getMyPlayer().getLocation() == westTile) {
- return true;
- }
- break;
- }
- }
- return false;
- }
- private boolean lightLogs() {
- RSItem log = inventory.getItem(logIDs);
- RSItem tinderbox = inventory.getItem(tinderBox);
- RSTile originalLocation = getMyPlayer().getLocation();
- for (int i = 0; i < 2; i++) {
- if (!canLightOn(originalLocation)) {
- walkOneTile();
- originalLocation = getMyPlayer().getLocation();
- }
- }
- for (int i = 0; i < 2 || fireLit != true;i++) {
- inventory.useItem (log, tinderbox);
- sleep(random(4000,9000));
- //if (objects.getNearest(fireID).getLocation().equals(originalLocation)) {
- if (objects.getTopAt(originalLocation) != null) {
- return true;
- }
- }
- return false;
- }
- boolean canLightOn(RSTile tile) {
- for (int i = 0; i < 2; i++) {
- if (objects.getTopAt(tile) == null) {
- return true;
- }
- else
- walkOneTile();
- }
- return false;
- }
- private boolean cookBeef () {
- RSObject fire = objects.getNearest(fireID);
- RSItem[] allBeef = inventory.getItems(rawBeef);
- if (fire == null || allBeef == null) {
- log(fire);
- log(allBeef);
- return false;
- }
- RSItem beef = allBeef[random(0, allBeef.length)];
- for (int i = 0; i < 2; i++) {
- if (beef.doAction("Use")) {
- sleep(random(600,800));
- mouse.move(calc.tileToScreen(fire.getLocation()));
- mouse.click(true);
- sleep(random(1500,3000));
- if (interfaces.get(905).isValid()) {
- log("Interface is valid");
- interfaces.getComponent (905, 14).doClick();
- while(inventory.contains(rawBeef)) {
- sleep(random(50,3000));
- }
- fireLit = false;
- if (!inventory.contains(rawBeef)) {
- return true;
- }
- }
- else
- log("Interface is not valid");
- }
- }
- return true;
- }
- private void dropUnwantedItems() {
- inventory.dropAllExcept(safeToDropItems);
- }
- public int loop() {
- if (!inventory.isFull()) {
- if (haveUsableLogs() && inventory.contains(cookedBeef)) {
- attackCows();
- }
- if (!haveUsableLogs()) {
- dealWithGate();
- sleep(random(25,100));
- if (!getLogs()) {
- log("Can't get logs");
- stopScript();
- }
- if (haveUsableLogs()) {
- return 0;
- }
- }
- else if (inventory.isFull()) {
- if (haveUsableLogs() && inventory.contains(cookedBeef)) {
- attackCows();
- }
- else if (!haveUsableLogs() && inventory.containsOneOf(safeToDropItems)) {
- RSItem itemToDrop = inventory.getItem(safeToDropItems);
- itemToDrop.doAction("Drop");
- dealWithGate();
- if (!getLogs()) {
- log("Can't get logs");
- stopScript();
- }
- if (haveUsableLogs()) {
- return 0;
- }
- }
- else if (!haveUsableLogs() && !inventory.containsOneOf(safeToDropItems) && inventory.containsOneOf(rawBeef)) {
- RSItem itemToDrop = inventory.getItem(rawBeef);
- itemToDrop.doAction("Drop");
- return 0;
- }
- else if (haveUsableLogs()) {
- lightLogs();
- cookBeef();
- dropUnwantedItems();
- return 0;
- }
- }
- else {
- log("Your shit's fucked up, yo");
- stopScript();
- }
- walkOneTile();
- return random(50,1000);
- }
- return 0;
- }
- public void onFinish() {
- log("Goodbye!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement