WinZipimport com.speljohan.rsbot.script.Script; import com.speljohan.rsbot.script.Constants; import com.speljohan.rsbot.script.Calculations; import com.speljohan.rsbot.script.wrappers.*; import com.speljohan.rsbot.event.listeners.PaintListener?Create; import com.speljohan.rsbot.event.listeners.ServerMessageListener?Create; import com.speljohan.rsbot.event.events.ServerMessageEvent?Create; import com.speljohan.rsbot.bot.Bot;
/**
* Created by IntelliJ?Create IDEA. * User: Zenzie * Date: 13-jun-2009 * Time: 18:54:06 */public class OgreCage?Create extends Script implements PaintListener?Create, ServerMessageListener?Create {
//Script?Create start time
long startTime = System.currentTimeMillis?Create();
//Your?Create hp?
int myHp = skills.getCurrentSkillLevel?Create(3);
int eatAt = 20;
//Food?Create
static int[] eatType = {339,351,333,329,379,7946,385,1891,1893,1895};
//Walk?Create tiles
private RSTile walkToCage?Create = new RSTile(2523 + random(0,8), 3371 + random(0,1));
private RSTile walkAway = new RSTile(2517 + random(0,4), 3373 + random(0,7));
private RSTile toRailing = new RSTile(2524 + random(-1,+1), 3375 + random(-1,+1));
//Levels?Create
int trainingSkill = STAT_RANGE;
String fightType;
int startXP = skills.getCurrentSkillExp?Create(trainingSkill);
int startLvl = skills.getCurrentSkillLevel?Create(trainingSkill);
//Potions?Create
static int[] magePot = {3040, 3042, 3044, 3046};
static int[] rangePot = {2444, 169, 171, 173};
static int[] teleGrabItems?Create = {5295,5300,5321};
//Ids?Create of range stuff
static int[]knives = {867,869,864,863,866,868,865};
static int[]bows = {859,851,845,847,855,849,853,843,857,861,841};
static int[]crossbows = {9183,13081,9174,9177,9181,9185,9179,};
static int[]arrows = {882,890,11212,884,888,2866};
static int[]bolts = {9143,13083,877,9340,9341,9338,9140};
//Potions?Create , telegrab , antiban
boolean drinkMagePotion?Create;
boolean drinkRangePotion?Create;
boolean telegrab;
boolean antiwhoat;
boolean isUnderAttack?Create = false;
boolean[] PICKUP_ITEMS = {true, true};
//Auto?Create Responder
public String farewells[] = {"Bye","Bai","Cu","Cya","Later"};
public String greetings[] = {"Hi","Hey","Hello","Hai","Sup","Aloha","Hiya"};
public String askingRange[] = {"U?","You?","Yours?","Urs?"};
public String firstElement;
public String[] oldQ = {""};
boolean autoResponder = false;
//Magic?Create
String spellType = "Wind";
String spellLevel = "Strike";
int wutX = 0;
int wutY = 0;
public int loop() {
int antiBanOrNot?Create = random(0,6);
if(drinkMagePotion?Create || drinkRangePotion?Create) {
checkPotion();
}
if(autoResponder) {
reply();
}
if(telegrab) {
TeleGrabItem?Create();
}
if(isUnderAttack?Create)
{
walkTileMM?Create(walkAway);
wait(random(7500,12000));
isUnderAttack?Create = false;
}
if(myHp <= eatAt) {
for (final int eat : OgreCage?Create.eatType){
if (getInventoryCount?Create(eat) > 0){
clickInventoryItem?Create(eatType, "Eat");
wait(random(5500, 7500));
}
isUnderAttack?Create = true;
}
}
if (playerInArea?Create(2531, 3372, 2523, 3371) && getMyPlayer?Create().getInteracting() == null
&& getNearestFreeNPCByID?Create(2801) != null) {
ATTACKNPC(getNearestFreeNPCByID?Create(2801), "Attack");
wait(random(1500,2500));
}
if(!playerInArea?Create(2531, 3372, 2523, 3371) && !isUnderAttack?Create) {
walkTileMM?Create(walkToCage?Create);
}
if(antiwhoat && antiBanOrNot?Create == 2)
{
antiBan();
}
return 0;
}
@Override
public String getAuthor() {
return "Zenzie";
}
@Override
public String getName() {
return "Ogre Cager";
}
@Override
public String getScriptCategory?Create() {
return "Combat";
}
@Override
public double getVersion() {
return 1.3;
}
@Override
public boolean onStart(final Map<String, String> args)
{
log("Ogre Cager Script" + getVersion() + " started!");
drinkMagePotion?Create = args.get("magepot") != null;
drinkRangePotion?Create = args.get("rangepot") != null;
telegrab = args.get("telegrab") != null;
spellLevel = args.get("spellLevel");
spellType = args.get("spellType");
fightType = args.get("fighttype");
antiwhoat = args.get("antiwhoat") != null;
autoResponder = args.get("respond") != null;
intializeFightType?Create();
if(fightType.equals("Maging")){
selectAutoCast?Create();
}
return true; }
public void createRandomSentence?Create(int WhichCase?Create)
{
String randomResult;
switch(WhichCase?Create){
case 1: //Hello?Create
firstElement = greetings[random(0,greetings.length)];
sendText(firstElement,true);
break;
case 2://Bye?Create bye
firstElement = farewells[random(0,farewells.length)];
sendText(firstElement,true);
break;
case 3 ://Your?Create range level?
firstElement = askingRange[random(0,askingRange.length)];
sendText(firstElement,true);
break;
}
}
public boolean parseInComingData?Create(String text)
{
if(text.equals("Hey") || text.equals("Hi") || text.equals("Hai") || text.equals("Hello")
|| text.equals("Howdy")|| text.equals("Hiya")) {
createRandomSentence?Create(1);
}
else if(text.contains("Bye") || text.contains("Brb") || text.contains("Cya") || text.contains("Ciao")
|| text.contains("Later")|| text.contains("Bai"))
{
createRandomSentence?Create(2);
}
else if((text.contains("Range?") || text.contains("Range level?") || text.contains("What level?") || text.contains("Range lvl?")
|| text.contains("lvel")))
{
int rangeLevel = skills.getRealSkillLevel?Create(trainingSkill);
sendText(String.valueOf(rangeLevel), true);
wait(random(5000,7500));
createRandomSentence?Create(3);
}
return true;
}
//Reads?Create text of interface
//@Credits Mike, ToshiXZ?Create for this
public String getChildText?Create(int iface, int child) {
return RSInterface.getInterface(iface).getChild(child).getText();
}
public String[] getChatMessages?Create(boolean stripName) {
String[] temp = new String[100];
int tempi=0;
for(int i=155; i >= 56; i--)
if(getChildText?Create(137,i).contains("<col=0000ff>")) {
if(stripName) {
temp[tempi] = getChildText?Create(137,i).substring(getChildText?Create(137,i).indexOf("<col=0000ff>")+12);
tempi++;
} else {
temp[tempi] = getChildText?Create(137,i).replaceAll("<col=0000ff>", "");
tempi++;
}
}
return temp;
}
String oldChat = "";
String[] chat = new String[200];
String[] chat2 = new String[200];
public void reply() {
chat = getChatMessages?Create(true);
chat2 = getChatMessages?Create(false);
if(chat[0] == null || oldChat.equalsIgnoreCase?Create(chat2[0]))
return;
if (oldQ[0].equalsIgnoreCase?Create(chat2[0]))
return;
String temp=chat2[0];
String name = temp.substring(0,temp.indexOf(":"));
if(name.equalsIgnoreCase?Create(getMyPlayer?Create().getName()))
return;
if(parseInComingData?Create(chat[0]))
{
oldQ[0] = chat2[0];
}
}
public void selectAutoCast?Create()
{
clickMouse(530 + random(0,25),175 + random(0,23),true);
clickMouse(657 + random(0,50), 315 + random(0,34), true);
wait(random(500,1000));
if(spellType.equals("Wind")) {
wutX = 578;
} else if (spellType.equals("Water")) {
wutX = 618;
} else if (spellType.equals("Earth")) {
wutX = 658;
} else if (spellType.equals("Fire")) {
wutX = 696;
}
if (spellLevel.equals("Strike")) {
wutY = 230;
} else if (spellLevel.equals("Bolt")) {
wutY = 290;
} else if (spellLevel.equals("Blast")) {
wutY = 353;
} else if (spellLevel.equals("Wave")) {
wutY = 413;
}
clickMouse(wutX + random(0,10) , wutY + random(0,10) , true);
}
public int TeleGrabItem?Create() {
RSTile RSEED = getGroundItemByID?Create(5295); //5295 is ranarr seed, wich is 25k
RSTile WSEED = getGroundItemByID?Create(5321); //watermelon seed, 4k
RSTile SSEED = getGroundItemByID?Create(5300); //snap dragon, i think they dont drop but..
if (!telegrab){
return -1;
}
if(!inventoryContains(563)){
telegrab = false;
log("Out of law runes.");
return -1;
}
if(!inventoryContains(556)){
log("Out of air runes.");
telegrab = false;
return -1;
}
if (WSEED != null) {
if(getCurrentTab?Create() != TAB_MAGIC) {
openTab(TAB_MAGIC);
}
wait(400);
clickMouse(690 + random(-7, 7), 275 + random(-6, 6), true);
wait(1120);
atTile(WSEED ,"Cast Telekinetic Grab -> Watermelon");
wait(2100);
openTab(TAB_INVENTORY);
log("Telegrabbed watermelon seed");
return 0;
}
if (SSEED != null) {
if(getCurrentTab?Create() != TAB_MAGIC) {
openTab(TAB_MAGIC);
}
wait(400);
clickMouse(690 + random(-7, 7), 275 + random(-6, 6), true);
wait(420);
atTile(SSEED ,"Cast Telekinetic Grab -> Snapdragon");
wait(2100);
openTab(TAB_INVENTORY);
log("Telegrabbed snapdragon seed");
}
if (RSEED != null) {
if(getCurrentTab?Create() != TAB_MAGIC) {
openTab(TAB_MAGIC);
}
wait(400);
clickMouse(690 + random(-7, 7), 275 + random(-6, 6), true);
wait(420);
atTile(RSEED ,"Cast Telekinetic Grab -> Ranarr");
wait(2100);
openTab(TAB_INVENTORY);
log("Telegrabbed ranarr seed");
}
return 0;
}
private int antiBan() {
final int randomAction = random(0, 6);
switch (randomAction) {
case 0:
if (getCurrentTab?Create() != Constants.TAB_INVENTORY) {
openTab(Constants.TAB_INVENTORY);
wait(random(310, 610));
final Point invPoint = new Point(random(558, 723), random(215,
440));
moveMouse(invPoint);
return random(510, 2300);
} else {
final int random = random(0, 10);
final Point rndPoint = new Point(random(558, 723), random(215,
440));
if (random == 0) {
if (getCurrentTab?Create() != Constants.TAB_STATS) {
openTab(Constants.TAB_STATS);
wait(random(310, 610));
}
moveMouse(rndPoint);
return random(200, 2300);
} else if (random >= 1 && random <= 6) {
final int randomTab = random(0, 13);
if (randomTab != getCurrentTab?Create()) {
openTab(random(0, 13));
wait(random(310, 610));
}
moveMouse(rndPoint);
return random(300, 1600);
} else {
final int randomTab = random(0, 13);
if (randomTab != getCurrentTab?Create()) {
openTab(random(0, 13));
return random(310, 2000);
}
}
}
case 1:
Point randomMouse = null;
final int rndMovement = random(1, 5);
for (int a = 0; a < rndMovement; a++) {
randomMouse = new Point(random(15, 730), random(15, 465));
moveMouse(randomMouse);
wait(random(50, 800));
}
return random(130, 810);
case 2:
final int currentAngle = getCameraAngle?Create();
switch (random(0, 1)) {
case 0:
setCameraRotation?Create(currentAngle + random(0, 650));
return random(710, 1700);
case 1:
setCameraRotation?Create(currentAngle - random(0, 650));
return random(710, 1700);
}
case 3:
final int currentAlt = Bot.getClient().getCamPosZ?Create();
final int random = random(0, 10);
if (random <= 7) {
setCameraAltitude?Create(currentAlt - random(0, 100));
return random(410, 2130);
} else {
setCameraAltitude?Create(currentAlt + random(0, 100));
return random(410, 2130);
}
case 4:
int currentAngle2 = getCameraAngle?Create();
Bot.getClient().getCamPosZ?Create();
switch (random(0, 1)) {
case 0:
setCameraRotation?Create(currentAngle2 + random(0, 650));
setCameraAltitude?Create(random(80, 100));
return random(410, 2130);
case 1:
setCameraRotation?Create(currentAngle2 - random(0, 650));
setCameraAltitude?Create(random(40, 80));
return random(410, 2130);
}
case 5:
return random(310, 2400);
case 6:
final int currentAlt2 = Bot.getClient().getCamPosZ?Create();
final int random2 = random(0, 2);
if (random2 <= 2) {
setCameraAltitude?Create(currentAlt2 - random(-100, +100));
return random(410, 2130);
} else {
setCameraAltitude?Create(currentAlt2 + random(-100, +100));
return random(410, 2130);
}
}
return random(100, 200);
}
public boolean inArea(RSTile tile) {
int x = tile.getX();
int y = tile.getY();
if(x >= 3014 && y >= 3282 && x <= 3020 && y <= 3295){
return true;
} else {
return false;
}
}
public void intializeFightType?Create()
{
if(fightType.equals("Ranging"))
{
trainingSkill = STAT_RANGE;
} else if(fightType.equals("Maging"))
{
trainingSkill = STAT_MAGIC;
}
}
public void serverMessageRecieved?Create(ServerMessageEvent?Create re)
{
String Msg = re.getMessage();
if(Msg.contains("That was your last one!")) {
log("Out of knives! Stopping script!");
logout();
stopAllScripts?Create();
}
if(Msg.contains("Runes to cast this spell"))
{
log("Out of runes! Stopping script!");
logout();
stopAllScripts?Create();
}
}
public void onRepaint(final Graphics g) {
int PercentToNextLevel?Create = skills.getPercentToNextLevel?Create(trainingSkill);
int expGained = skills.getCurrentSkillExp?Create(trainingSkill) - startXP;
int lvlsGained = skills.getCurrentSkillLevel?Create(trainingSkill) - startLvl;
long millis = (System.currentTimeMillis?Create() - startTime);
long seconds=(millis/1000)%60;
long minutes=(millis/(1000*60))%60;
long hours=(millis/(1000*60*60))%24;
int barsize = 100;
int barheight = 15;
int percentage = skills.getPercentToNextLevel?Create(trainingSkill);
int transparancy = 160;
int xBar = 12;
int yBar = 312;
g.setColor(new Color(0, 0, 0, 175));
g.fillRoundRect?Create(0, 155, 180, 175, 10, 10);
g.setColor( Color.WHITE );
g.drawString(getName() + " V" + getVersion(), 12, 168);
g.drawString(fightType + " Ogres", 12, 200);
g.drawString("Run Time: " + hours + ":" + minutes + ":" + seconds, 12, 232);
g.drawString("Gained " + expGained + " expierence",12, 248);
g.drawString("Gained: " + lvlsGained + " levels" ,12, 264);
g.drawString("Current level: " + skills.getRealSkillLevel?Create(trainingSkill), 12, 280);
g.drawString(String.valueOf(percentage) + "% Untill next level", 12, 296);
g.setColor(new Color(255, 0, 0, transparancy));
g.fillRect(xBar, yBar, barsize, barheight);
g.setColor(new Color(0, 255, 0, transparancy));
g.fillRect(xBar, yBar, barsize/100*percentage, barheight);
g.setColor(new Color(255, 255, 255, transparancy));
g.drawRect(xBar, yBar, barsize, barheight);
}
private boolean playerInArea?Create(int maxX, int maxY, int minX, int minY) {
int x = getMyPlayer?Create().getLocation().getX();
int y = getMyPlayer?Create().getLocation().getY();
if (x >= minX && x <= maxX && y >= minY && y <= maxY)
{
return true;
}
return false;
}
public String getScriptDescription?Create() {
String html = "";
html += "";
html += "";
html += "";
html += "";
html += "";
html += "" + getName() + " v"
+ getVersion() + "
";
html += "By " + getAuthor()+ "
";
html += " ";
html += ":: Script Settings ::
";
html += " Start at cage : Staff , Bow equiped ";
html += "How to cage:
";
html += " ";
html += "";
return html; }
public int getEquipmentCountKnives?Create() {
int count = 0;
int knives[] = {867,869,864,863,866,868,865};
for (final int item : knives) {
if (item != -1) {
count++;
}
}
return count;
}
public int getEquipmentCountArrowsOrBolts?Create() {
int count = 0;
int arrowsOrBolts?Create[] = {882,890,11212,884,888,2866,9143,13083,877,9340,9341,9338,9140};
for (final int item : arrowsOrBolts?Create) {
if (item != -1) {
count++;
}
}
return count;
}
public void checkPotion()
{
if(drinkRangePotion?Create && skills.getCurrentSkillLevel?Create(Constants.STAT_RANGE)
- skills.getRealSkillLevel?Create(Constants.STAT_RANGE) <= random(2, 3))
{
for (final int id : OgreCage?Create.rangePot)
{
if (getInventoryCount?Create(id) > 0) {
clickInventoryItem?Create(rangePot,"Drink");
}
}
}
if(drinkMagePotion?Create && skills.getCurrentSkillLevel?Create(Constants.STAT_MAGIC)
- skills.getRealSkillLevel?Create(Constants.STAT_MAGIC) <= random(2, 3))
{
for (final int id : OgreCage?Create.magePot)
{
if (getInventoryCount?Create(id) > 0)
{
clickInventoryItem?Create(magePot,"Drink");
}
}
}
}
private boolean clickInventoryItem?Create(final int[] ids, final String command) {
try {
if (getCurrentTab?Create() != Constants.TAB_INVENTORY
&& !RSInterface.getInterface(Constants.INTERFACE_BANK)
.isValid()
&& !RSInterface.getInterface(Constants.INTERFACE_STORE)
.isValid()) {
openTab(Constants.TAB_INVENTORY);
}
final int[] items = getInventoryArray?Create();
final java.util.List<Integer> possible = new ArrayList?Create<Integer>();
for (int i = 0; i < items.length; i++) {
for (final int item : ids) {
if (items[i] == item) {
possible.add(i);
}
}
}
if (possible.size() == 0) {
return false;
}
final int idx = possible.get(random(0, possible.size()));
final Point t = getInventoryItemPoint?Create(idx);
moveMouse(t, 5, 5);
wait(random(100, 290));
if (getMenuActions?Create().get(0).equals(command)) {
clickMouse(true);
return true;
} else {
return atMenu(command);
}
} catch (final Exception e) {
log("error clicking inventory");
return false;
}
}
private boolean ATTACKNPC(final RSNPC npc, final String action) {
final RSTile tile = npc.getLocation();
tile.randomizeTile(1, 1);
try {
final int hoverRand = random(8, 13);
for (int i = 0; i < hoverRand; i++) {
final Point screenLoc = npc.getScreenLocation?Create();
if (!pointOnScreen?Create(screenLoc)) {
setCameraRotation?Create(getCameraAngle?Create() + random(-35, 150));
return true;
}
moveMouse(screenLoc, 15, 15);
final java.util.List<String> menuItems = getMenuItems?Create();
if (menuItems.isEmpty() || menuItems.size() <= 1) {
continue;
}
if (menuItems.get(0).toLowerCase?Create().contains(
npc.getName().toLowerCase?Create())
&& getMyPlayer?Create().getInteracting() == null) {
clickMouse(true);
return true;
} else {
for (int a = 1; a < menuItems.size(); a++) {
if (menuItems.get(a).toLowerCase?Create().contains(
npc.getName().toLowerCase?Create())
&& getMyPlayer?Create().getInteracting() == null) {
clickMouse(false);
return atMenu(action);
}
}
}
}
} catch (final Exception e) {
log.warning("ATTACKNPC(RSNPC, String) error: " + e);
return false;
}
return false;
}
}
Progs :
|
Interested in Avatar122303?