Features:
Fast Cow switching -
Crafting guild -
Update: Logs When A Level is gained, Now Eats also when at A Lower HP! If You want it to eat!
No Other features, but Tested and gives 30k xp an hour if noone else there! Sometimes i Think it works too good, Can wipe out all cows next to crafting guild with 40 str before they all spawn again
The Script: Save as CowOwn3r.java - Exact caps
Code:
import java.awt.*;
import java.util.*;
import java.util.List;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
import com.speljohan.rsbot.event.listeners.ServerMessageListener;
import com.speljohan.rsbot.accessors.*;
public class CowOwn3r extends Script {
private final int KILLCOWS = 0;
private final int KILLSCRIPT = 1;
private int action = 0;
private RSTile playerPosition = null;
private int standingCount = 0;
private int[] COWID = {1767,81,1768,1766,397,2310, 1767};
private int FEATHERID = 314;
private int[] STEELARROW = {886};
private RSTile CowTile = new RSTile(2924,3275);
public String getAuthor( ) {
return "xX Nicole Xx";
}
public String getName() {
return "Cow Own3r";
}
public String getScriptCategory() {
return "Combat";
}
public double getVersion() {
return 1.0;
}
public boolean onStart(Map < String, String > args) {
log("Started CowOwn3r");
try {
if (args.get("eatsies").equals("") ){
log("You don't want to eat");
wants2Eat = false;
}
else {
food = Integer.parseInt( args.get("eatsies") );
log("You want to eat");
wants2Eat = true;
}
} catch (Exception e) {
}
return true;
}
public void checkEat() {
int cHealth = skills.getCurrentSkillLevel( STAT_HITPOINTS );
int randomInt = random(7, 9);
if (cHealth <= randomInt) {
atInventoryItem(food, "Eat");
}
}
public void serverMessageRecieved(ServerMessageEvent e) {
if(e.getMessage().contains("You've just advanced a Strength level!"))
log("Strength Level Gained!");
if(e.getMessage().contains("You've just advanced a Defence level!")) {
log("Defence Level Gained!");
}
if(e.getMessage().contains("You've just advanced an Attack level!")) {
log("Attack Level Gained!");
}
if(e.getMessage().contains("You've just advanced a Hitpoints level!")) {
log("Hitpoints Level Gained!");
}
if(e.getMessage().contains("You've just reached Combat level")) {
log("Combat Level Gained!");
}
}
public String getScriptDescription( ) {
String html = "";
html += "<html>\n";
html += "<body>\n";
html += "<h2>" + getName() + " version" + getVersion() + "</h2><br>\n";
html += "Author: " + getAuthor() + "<br><br>\n";
html += "Start At Cows next to crafting Guild";
html += "<br>Based off Ruski's Chicken killer for Fast switching";
html += "<br>We do Not make any guarantees of Bans.";
html += "<br>When using this Please use All Antiban. Or similar.";
html += "<br>This will kill cows next to Crafting guild ONLY";
html += "<br>It Will NOT get Cow hides, Just amazingly Fast EXP!";
html += "<br>Enter the ID of food Or just leave blank if you Don't Want to eat<br>";
html += "ID of food: <input type=\"text\" name=\"eatsies\"><br>";
html += "</body>\n";
html += "</html\n";
return(html);
}
public boolean wants2Eat;
public int food;
public int loop() {
if (wants2Eat) {
if (inventoryContains(food) ) {
checkEat();
}
}
action = getAction();
switch(action) {
case KILLCOWS:
runControl();
RSItemTile arrow = getNearestGroundItemByID(5,STEELARROW);
int randomNum = random(0, 5);
if(randomNum > 4 && arrow != null) {
atTile(arrow, "Steel arrow");
return random(900, 1400);
}
if(getMyPlayer().getInteracting() != null) {
return random(300, 450);
}
RSNPC cow = getNearestNextNPCByID(COWID);
if(cow != null) {
if(cow.getInteracting() != null && getMyPlayer().getInteracting() == null) {
return random(100, 200);
}
if(getMyPlayer().getInteracting() == null) {
clickNPC(cow, "attack");
return random(800, 1400);
}
return random(200, 400);
}
return random(500, 1000);
case KILLSCRIPT:
log("Stopping scripts - Wrong Tile Position, Please move to Crafting Guild");
stopAllScripts();
return random(100, 200);
}
return random(400, 800);
}
private int getAction() {
if(distanceTo(CowTile) < 50) {
return KILLCOWS;
} else {
return KILLSCRIPT;
}
}
private void checkPlayerPosition(RSPlayer player) {
try {
RSTile currentPosition = player.getLocation();
if (currentPosition.equals(playerPosition)) {
standingCount++;
}
if (!currentPosition.equals(playerPosition)) {
playerPosition = currentPosition;
standingCount = 0;
}
switch (standingCount) {
case 15:
setCameraRotation(getCameraAngle() + random(30, 180));
break;
case 30:
if(canReach(CowTile , false)) {
walkTileMM(CowTile);
wait(400, 600);
}
break;
case 50:
log("Standing still for too long, stopping script");
action = KILLSCRIPT;
break;
}
} catch (Exception e) {
System.out.print("checkPlayerPosition(RSPlayer) error: " + e);
}
}
private void runControl() {
if (!isRunning() && getEnergy() > random(20, 30)) {
setRun(true);
}
}
public RSItemTile getNearestGroundItemByID(int range, int[] ids) {
int pX = getMyPlayer().getLocation().getX();
int pY = getMyPlayer().getLocation().getY();
int minX = pX - range;
int minY = pY - range;
int maxX = pX + range;
int maxY = pY + range;
int dist = 100;
RSItemTile nItem = null;
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
if (Calculations.canReach(new RSTile(x,y), false)){
RSItemTile[] items = getGroundItemsAt(x, y);
for (RSItemTile item : items) {
int iId = item.getItem().getID();
for (int id : ids) {
if (iId == id) {
// log(""+id+" at "+x+","+y);
if (distanceTo(new RSTile(x,y)) < dist){
dist = distanceTo(new RSTile(x,y));
nItem = item;
}
}
}
}
}
}
}
return nItem;
}
private RSNPC getNearestNextNPCByID(int... ids) {
int Dist = 20;
RSNPC closest = null;
int[] validNPCs = Bot.getClient().getNPCIndexArray();
NPC[] npcs = Bot.getClient().getNPCArray();
for (int element : validNPCs) {
if (npcs[element] == null) {
continue;
}
RSNPC Monster = new RSNPC(npcs[element]);
try {
for (int id : ids) {
if (id != Monster.getID() || Monster.isInCombat() || Monster.getInteracting() != null) {
continue;
}
int distance = getRealDistanceTo(Monster.getLocation(), false);
if (distance < Dist) {
Dist = distance;
closest = Monster;
}
}
} catch (Exception e) {}
}
return closest;
}
private boolean clickNPC(RSNPC npc, String action) {
if (npc == null) {
return false;
}
RSTile tile = npc.getLocation();
if (!tile.isValid()) {
return false;
}
try {
Point screenLoc = npc.getScreenLocation();
if (distanceTo(tile) > 6 || !pointOnScreen(screenLoc)) {
turnToTile(tile);
}
if (distanceTo(tile) > 20) {
walkTileMM(tile);
return false;
}
for (int i = 0; i < 12; i++) {
screenLoc = npc.getScreenLocation();
if (!npc.isValid() || !pointOnScreen(screenLoc)) {
return false;
}
moveMouse(screenLoc, 5, 5);
if (getMenuItems().get(0).toLowerCase().contains(npc.getName().toLowerCase())) {
break;
}
if (getMouseLocation().equals(screenLoc)) {
break;
}
}
List<String> menuItems = getMenuItems();
if (menuItems.isEmpty()) {
return false;
}
for (int a = 0; a < menuItems.size(); a++) {
if (menuItems.get(a).toLowerCase().contains(npc.getName().toLowerCase())) {
if (menuItems.get(0).toLowerCase().contains(action.toLowerCase())) {
clickMouse(true);
return true;
} else {
clickMouse(false);
return atMenu(action);
}
}
}
} catch (Exception e) {
System.out.print("clickNPC(RSNPC, String) error: " + e);
return false;
}
return false;
}
}
Enjoy!
This was made off of Seagullown3r - Ruski's chicken killer. Edited by me to use different methods but also The right npc ids, All the IDS of all cows, The Other ids not at Crafting guild are lumby, Will be editing soon.
Credits: Ruski, Alche001 - 70%, Me 30% for Converting!