SentyChompys
a chompy bird killer
Download: http://uppit.com/ti1v6btak00u/SentyChompys.jar
>wear ogre bow and ogre arrows
>walk 2 the place in image
>gimme bugs
>scripters pls tell me anywhere i went retard
package sentychompys;
import org.osbot.rs07.script.Script;
import org.osbot.rs07.script.ScriptManifest;
import java.awt.*;
import java.util.concurrent.TimeUnit;
import org.osbot.rs07.api.Chatbox;
import org.osbot.rs07.api.map.Area;
import org.osbot.rs07.utility.ConditionalSleep;
@ScriptManifest(name = "SentyChompys", author = "Sentende", version = 1.0, info = "", logo = "")
public class SentyChompys extends Script {
// NPCS
int npcSwampToad = 1473;
int npcChompyBirdAlive = 1475;
int npcChompyBirdDead = 1476;
// OBJECTS
int objSwampBubbles = 684;
int objBloatedToad = 1474;
// ITEMS
int itemOgreBellowsZero = 2871;
int itemOgreBellowsThree = 2872;
int itemOgreBellowsTwo = 2873;
int itemOgreBellowsOne = 2874;
int itemBloatedToad = 2875;
int itemOgreArrow = 2866;
int itemOgreBow = 2883;
// AREA
Area areaChompyArea = new Area(2392, 3048, 2402, 3039);
// TIMER
private long timeBegan;
private long timeRan;
private enum State {
FILL_BELLOWS, CATCH_TOAD, PLACE_TOAD, KILL_CHOMPY, IDLE
};
private State getState() {
/*
KILL CHOMPY
*/
if (npcs.closest(npcChompyBirdAlive) != null){
return State.KILL_CHOMPY;
}
/*
PLACE TOAD
*/
else if(getInventory().contains(itemBloatedToad) &&
!myPlayer().isAnimating() &&
!myPlayer().isMoving()){
return State.PLACE_TOAD;
}
/*
CATCH TOAD
*/
else if(!getInventory().contains(itemBloatedToad) &&
!myPlayer().isAnimating() &&
!myPlayer().isMoving() &&
bellowsEmpty() != true) {
return State.CATCH_TOAD;
}
/*
FILL BELLOWS
*/
else if(bellowsEmpty() &&
!myPlayer().isAnimating() &&
!myPlayer().isMoving()) {
return State.FILL_BELLOWS;
}
return State.IDLE;
}
@Override
public void onStart() {
timeBegan = System.currentTimeMillis();
}
@Override
public void onExit() {
//Code here will execute after the script ends
}
@Override
public int onLoop() throws InterruptedException {
switch(getState()){
case KILL_CHOMPY:
killChompy();
break;
case PLACE_TOAD:
placeToad();
break;
case CATCH_TOAD:
catchToad();
break;
case FILL_BELLOWS:
fillBellows();
break;
default:
break;
}
return 100;
}
public void killChompy() throws InterruptedException {
if(inventory.isItemSelected()) {
mouse.click(false);
}
if(!npcs.closest(npcChompyBirdAlive).isOnScreen()) {
camera.toEntity(npcs.closest(npcChompyBirdAlive));
}
npcs.closest(npcChompyBirdAlive).interact("Attack");
sleep(random(80, 150));
new ConditionalSleep(4000) {
@Override
public boolean condition() throws InterruptedException {
return (myPlayer().getInteracting().getId() != npcChompyBirdAlive);
}
}.sleep();
}
public void placeToad() {
inventory.interact("Drop", itemBloatedToad);
if(this.chatbox.contains(Chatbox.MessageType.GAME, "There is a bloated toad already placed at this location.")) {
walking.walk(areaChompyArea.getRandomPosition());
}
new ConditionalSleep(4000) {
@Override
public boolean condition() throws InterruptedException {
return (!getInventory().contains(itemBloatedToad));
}
}.sleep();
}
public void catchToad() {
if(! npcs.closest(npcSwampToad).isOnScreen()) {
camera.toEntity(npcs.closest(npcSwampToad));
}
inventory.interact("Use", getOgreBellowsId());
npcs.closest(npcSwampToad).interact(getOgreBellowsString() + "Swamp toad");
mouse.click(false);
new ConditionalSleep(4000) {
@Override
public boolean condition() throws InterruptedException {
return (getInventory().contains(itemBloatedToad) || !myPlayer().isMoving());
}
}.sleep();
}
public void fillBellows() {
if(! objects.closest(objSwampBubbles).isOnScreen()) {
camera.toEntity(objects.closest(objSwampBubbles));
}
inventory.interact("Use", getOgreBellowsId());
objects.closest(objSwampBubbles).hover();
mouse.click(false);
if(this.chatbox.contains(Chatbox.MessageType.GAME, "I can't reach that!")) {
walking.walk(areaChompyArea.getRandomPosition());
}
new ConditionalSleep(4000) {
@Override
public boolean condition() throws InterruptedException {
return (!bellowsEmpty());
}
}.sleep();
}
public boolean bellowsEmpty() {
return getInventory().contains(itemOgreBellowsZero);
}
public int getOgreBellowsId() {
if(getInventory().contains(itemOgreBellowsThree)) {
return itemOgreBellowsThree;
} else if (getInventory().contains(itemOgreBellowsTwo)) {
return itemOgreBellowsTwo;
} else if (getInventory().contains(itemOgreBellowsOne)) {
return itemOgreBellowsOne;
} else if (getInventory().contains(itemOgreBellowsZero)) {
return itemOgreBellowsZero;
} else {
log("Inventory contains no Ogre Bellows");
return 0;
}
}
public String getOgreBellowsString() {
if(getInventory().contains(itemOgreBellowsThree)) {
return "Use Ogre bellows (3) -> ";
} else if (getInventory().contains(itemOgreBellowsTwo)) {
return "Use Ogre bellows (2) -> ";
} else if (getInventory().contains(itemOgreBellowsOne)) {
return "Use Ogre bellows (1) -> ";
} else if (getInventory().contains(itemOgreBellowsZero)) {
return "Use Ogre bellows -> ";
} else {
log("Inventory contains no Ogre Bellows");
return "";
}
}
@Override
public void onPaint(Graphics2D g) {
Graphics2D gr = g;
timeRan = System.currentTimeMillis() - this.timeBegan;
g.drawString("Time: " + ft(timeRan), 10, 60);
g.drawString("State: " + getState().toString().replace('_', ' '), 10, 75);
}
private String ft(long duration)
{
String res = "";
long days = TimeUnit.MILLISECONDS.toDays(duration);
long hours = TimeUnit.MILLISECONDS.toHours(duration) - TimeUnit.DAYS.toHours(TimeUnit.MILLISECONDS.toDays(duration));
long minutes = TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration));
long seconds = TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration));
if (days == 0)
{
res = (hours + ":" + minutes + ":" + seconds);
}
else
{
res = (days + ":" + hours + ":" + minutes + ":" + seconds);
}
return res;
}
}