SRL Archive - Archive

alock - SRL Member Application


alock

2012-02-06 21:33:01

How Long have You Played Runescape?
10 Year(s)


Are you affilated in anyway with Jagex LTD?
No

Were you Referred to SRL?
N/A


What is your general programming knowledge?
C++/C
Security
Java
former USAF Sysadmin


Are you a member of any other communities?
Powerbot
RSBuddy
Former USAF Sysadmin


Tell us about yourself…
From: alock
I have had an affinity for computers since i as a young child and also wanted to serve my country (United States). Im loyal and a very good coder, I am a former USAF Sysadmin and have great knowledge using C++/C



Please show us one (or multiple) of your scripts.
import java.util.Arrays;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.Map;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.wrappers.*;
import java.util.ArrayList;
import org.rsbot.script.util.Filter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import org.rsbot.script.wrappers.*;
import org.rsbot.script.methods.*;
import org.rsbot.script.methods.Game.ChatMode;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JCheckBox;
import javax.swing.DefaultComboBoxModel;
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JSlider;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import org.rsbot.script.Script;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.methods.Bank;



import java.awt.EventQueue;


import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.script.methods.Game;
//import org.rsbot.script.methods.Game.CHAT_MODE;

import org.rsbot.script.methods.Skills;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JTextField;

import java.awt.EventQueue;

import javax.swing.JFrame;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.SwingConstants;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.DefaultComboBoxModel;

import java.awt.Color;
import java.awt.GridBagLayout;
import java.awt.GridBagConstraints;
import java.awt.Insets;
import java.awt.BorderLayout;
import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.LayoutStyle.ComponentPlacement;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Collection;
import javax.swing.SwingUtilities;
import java.net.URL;
import java.net.URLConnection;


//substract travel time from xp/hr calculation
//fix the toodoor sticking situation
//make wait for loot


@ScriptManifest(authors = "emist", name = "eFighter", version = 1.51, description = "Edgeville Dungeon fighter.")
public class EFighter extends Script implements MessageListener, PaintListener, MouseListener {

private enum State { DOOR, TODOOR, TOBANK, BANKING, FIGHTING, LADDER, DEFAULT, ANTIBAN, BREAK };
private double version = 1.51;
private int giant[] = { 4691, 4689, 117, 4692, 4693, 4690 };
private int ladderUp = 29355;
private int ladderDown = 12389;
public boolean showpaint = true;
private int door = 1804;
private RSTile giantTile = new RSTile(3114, 9841);
private RSTile bankTile = new RSTile(3187, 3447);
private RSTile ladderUpTile = new RSTile(3115, 9852);
private String status;
private int brassKey = 983;
private RSTile hobsTile = new RSTile(3124, 9875);
private boolean secondFloor = true;
private int food = 373 ;
private FighterGUI GUI;
private long startBreak, breakTime, nextBreak;
private long startTime, endtime;
private long antiBanRandom = random(50000, 180000);
private long antiBanTime = System.currentTimeMillis() + antiBanRandom;
private AntiBan ab = new AntiBan();
private int attackSet = 0;
private ArrayList<RSTile> bankArr;
private RSTile skeletonTile = new RSTile(3136, 9875);
private RSTile ratTile = new RSTile(3118, 9891);
private RSTile zombieTile = new RSTile(3127, 9862);
private int doors[] = { 29316, 29315, 29319, 29320 };
private JCheckBox useFoodBox, pinBox, breakBox, lootValuableBox;
private JButton startButton;
private JComboBox trainingType;
private boolean useFood;
private Items itemsTable;
private HashMap<String, ItemWrapper> lootableItems;

JCheckBox makeSpaceBox;
JComboBox foodQtyBox;
JSlider foodAmtSlider;
//Items itemsTable;

private RSTile lostTile = new RSTile(3123, 9875);
private int[] keepers;

JComboBox foodType;
JCheckBox lootCoinsBox;
JCheckBox buryBonesBox;
JCheckBox specialBox;
JComboBox specComboBox;
JComboBox attackModes;

private int hobLife = 290;
private int giantLife = 350;
private int zombieLife = 300;
private int skeletonLife = 170;
private int mobKilled = 0;

private int swordFish = 373;
private int salmon = 329;
private int lobster = 379;
private int tuna = 361;

private final Color color1 = new Color(0, 0, 0, 122);
private final Color color2 = new Color(0, 0, 0, 16);
private final Color color3 = new Color(204, 0, 0);
private final Color color4 = new Color(240, 255, 240);
private final Color color5 = new Color(102, 102, 255);
private final Color color6 = new Color(0, 0, 0);
Color fishingSpotColor = new Color(50, 205, 50, 75);
private final Font font0 = new Font("Palatino Linotype", 1, 16);
private final Font font1 = new Font("Palatino Linotype", 1, 13);
private final Font font2 = new Font("Palatino Linotype", 1, 12);
private final BasicStroke stroke1 = new BasicStroke(1);
//private final Image img1 = getImage("http://images.wikia.com/runescape/images/b/bd/Hill_giant.png");
private final Image img1 = getImage("http://legalbinary.files.wordpress.com/2011/06/bender4.png");
private final Image img2 = getImage("http://i753.photobucket.com/albums/xx174/emistz/x.png");
private int monsterCount = 0;

private int trainingLevel = 0;
private int currTrainingLevel = 0;
private int initTrainingLevel = 0;
private int initTrainingXP = 0;
private long currentBreakTime, totalBreakTime;
private boolean Break = true;
private JComboBox monsterType;
private int foodEaten = 0;
private int boothID = 782;

private int level = 0;

private RSArea ladderArea = new RSArea(new RSTile( 3114, 9850),
new RSTile(3119, 9854) );


private RSArea entranceDown = new RSArea(new RSTile(3113, 3445),
new RSTile(3119, 3449));
private RSArea bankArea = new RSArea(new RSTile(3181, 3433),
new RSTile(3189, 3446));
private RSArea insideDoor = new RSArea(new RSTile(3114, 3450),
new RSTile(3117, 3453));

private RSTile doorTile = new RSTile(3118, 3448);

private RSTile[] pathToBank = {
new RSTile(3127, 3452), new RSTile(3133, 3458),
new RSTile(3142, 3456), new RSTile(3152, 3455),
new RSTile(3161, 3454), new RSTile(3173, 3452),
new RSTile(3182, 3450), new RSTile(3186, 3446),
new RSTile(3185, 3444)
};

private RSPath bankPath;

private RSTile pathToSkelArr[] = {
new RSTile(3117, 9853), new RSTile(3117, 9861),
new RSTile(3116, 9866), new RSTile(3123, 9872),
new RSTile(3129, 9872), new RSTile(3138, 9871)
};

private RSPath pathToSkels;

private RSTile pathToZombieArr[] = {
new RSTile(3117, 9853), new RSTile(3117, 9861),
new RSTile(3116, 9866), new RSTile(3123, 9872),
new RSTile(3129, 9872), new RSTile(3138, 9871),
new RSTile(3145, 9882)
};

private ArrayList<RSTile> pathToZombies = new ArrayList<RSTile>(Arrays.asList(pathToZombieArr));

private boolean hold = false;

private int randomX, randomY = 1;


private ArrayList<RSTile> toDoor;


//private RSTile doorTile = new RSTile(3115, 3449);

private RSObject dDoor() {
return objects.getNearest(new Filter<RSObject>() {
public boolean accept(RSObject g) {
return g.getID() == door;
}
});
}


private RSGroundItem lootable() {
return groundItems.getNearest(new Filter<RSGroundItem>() {
public boolean accept(RSGroundItem g) {
return lootableItems.containsValue(new ItemWrapper(g.getItem().getID())) && calc.distanceTo(g.getLocation()) < 6;
}
});
}


private RSObject findDoors() {
return objects.getNearest(new Filter<RSObject>() {
public boolean accept(RSObject g) {
for(int i = 0; i < doors.length; i++)
{
if(doors[i] == g.getID())
return true;
}
return false;
}
});
}


private RSObject findLadderDown() {
return objects.getNearest(new Filter<RSObject>() {
public boolean accept(RSObject g) {
return g.getID() == ladderDown;
}
});
}

private RSObject findLadderUp() {
return objects.getNearest(new Filter<RSObject>() {
public boolean accept(RSObject g) {
return g.getID() == ladderUp;
}
});
}

private boolean needsBank()
{

if(!inventory.contains(brassKey))
return true;

if(!useFood)
{
if(inventory.isFull())
return true;

return false;
}

if(inventory.containsOneOf(food))
{
return false;
}
return true;


}


private boolean checkVersion(String urlC, String post)
{

URLConnection url = null;
BufferedReader in = null;

try
{
url = new URL(urlC).openConnection();
in = new BufferedReader(new InputStreamReader(url.getInputStream()));
if (Double.parseDouble(in.readLine()) > version)
{
log("Please visit the thread: " + post);
if (in != null)
{
in.close();
}



return false;
}

}
catch (IOException e)
{
log("Problem getting version. Please visit the forums.");

}
return true;
}


private State getState()
{


RSObject ladderUpObject = findLadderUp();
if(ladderUpObject != null)
{
secondFloor = true;
}
else
{
secondFloor = false;
}

if(System.currentTimeMillis() >= breakTime + startBreak)
{

nextBreak = System.currentTimeMillis() + random(3000000, 40000000);
startBreak = nextBreak;
breakTime = random(3000000, 10000000);
endtime = startBreak + breakTime;

totalBreakTime += currentBreakTime;
currentBreakTime = 0;
env.enableRandom("Login");
env.enableRandom("Improved Login");
}


if(startBreak <= System.currentTimeMillis() && Break && !status.equals("Traveling..."))
{
currentBreakTime = System.currentTimeMillis() - startBreak;
//log("Breaking for " + breakTime / 100000 + "minutes");
return State.BREAK;
}


while(!game.isLoggedIn())
{
try
{
game.login();
}
catch(Exception e)
{

}
sleep(50);
}


if (antiBanTime <= System.currentTimeMillis() && !status.equals("Traveling...") && !needsHealing())
{
antiBanTime = System.currentTimeMillis() + antiBanRandom;
//log("ANTIBAN STATE");
return State.ANTIBAN;
}


if(!ladderArea.contains(getMyPlayer().getLocation()) && secondFloor)
{
//log("State.FIGHTING");
return State.FIGHTING;
}
else if(bankArea.contains(getMyPlayer().getLocation()))
{
if(needsBank())
{
//log("State.BANKING");
return State.BANKING;
}
else
{
//log("State.TODOOR");
return State.TODOOR;
}
}
else if(insideDoor.contains(getMyPlayer().getLocation()))
{
//log("State.LADDER");
return State.LADDER;
}
else if(ladderUpObject != null)
{
//log("State.LADDER");
return State.LADDER;
}

else if(!needsBank() && !entranceDown.contains(getMyPlayer().getLocation()))
{
//log("State.TODOOR");
return State.TODOOR;
}

else if(entranceDown.contains(getMyPlayer().getLocation()) && !needsBank())
{
//log("State.DOOR");
return State.DOOR;
}
// else if(entranceDown.contains(getMyPlayer().getLocation()) && needsBank())
// {
// log("State.TOBANK");
// return State.TOBANK;
// }
else if(needsBank() && !bankArea.contains(getMyPlayer().getLocation()))
{
//log("State.TOBANK");
return State.TOBANK;
}


//log("State DEFAULT");
return State.DEFAULT;
}

private boolean stepTo(RSTile tile) {


RSPath walkPath = walking.getPath(tile.randomize(1, 1));
RSObject doors = findDoors();

try {

if(doors != null)
{
//log("Door");
// doors.doAction("Open");
}

if (walkPath != null) {
//log(walkPath.isValid());
if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
{
camera.setCompass('N');
return walkPath.traverse();
}
}
}
} catch (Exception e) {

}

return false;

}



public void drawMouse(final Graphics g) {
final Point loc = mouse.getLocation();
final long mpt = System.currentTimeMillis() - mouse.getPressTime();
if (mouse.getPressTime() == -1 || mpt >= 1000) {
g.setColor(Color.BLUE);
g.drawLine(loc.x-10, loc.y-10, loc.x+10, loc.y+10);
g.drawLine(loc.x-10, loc.y-12, loc.x+10, loc.y+8);

g.drawLine(loc.x-10, loc.y+10, loc.x+10, loc.y-10);
g.drawLine(loc.x-10, loc.y+12, loc.x+10, loc.y-8);

g.setColor(Color.RED);
g.drawLine(loc.x-10, loc.y-10, loc.x+10, loc.y+10);
g.drawLine(loc.x-10, loc.y-12, loc.x+10, loc.y+8);

g.drawLine(loc.x-10, loc.y+10, loc.x+10, loc.y-10);
g.drawLine(loc.x-10, loc.y+12, loc.x+10, loc.y-8);
}

if (mpt < 1000) {
g.setColor(Color.RED);
g.drawLine(loc.x-10, loc.y-10, loc.x+10, loc.y+10);
g.drawLine(loc.x-10, loc.y-12, loc.x+10, loc.y+8);
g.drawLine(loc.x-10, loc.y+10, loc.x+10, loc.y-10);
g.drawLine(loc.x-10, loc.y+12, loc.x+10, loc.y-8);

g.setColor(Color.BLUE);
g.drawLine(loc.x-10, loc.y-10, loc.x+10, loc.y+10);
g.drawLine(loc.x-10, loc.y-12, loc.x+10, loc.y+8);

g.drawLine(loc.x-10, loc.y+10, loc.x+10, loc.y-10);
g.drawLine(loc.x-10, loc.y+12, loc.x+10, loc.y-8);
}

}


public void mouseClicked(MouseEvent e)
{
}

@Override
public void mouseEntered(MouseEvent e)
{
// TODO Auto-generated method stub

}

@Override
public void mouseExited(MouseEvent e)
{
// TODO Auto-generated method stub

}

@Override
public void mousePressed(MouseEvent e)
{
// TODO Auto-generated method stub

if ( (e.getPoint().getX() >= 500 && e.getPoint().getX() <= 540) && (e.getPoint().getY() <= 240 && e.getPoint().getY() >= 200))
{
showpaint = !showpaint;
}
}

@Override
public void mouseReleased(MouseEvent e)
{
// TODO Auto-generated method stub

}


private int numDigits(int num)
{
int cnt=0;

while (num > 0 )
{
int r = num % 10;
cnt++;
num = num / 10;
}

return cnt;
}


private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch(IOException e) {
return null;
}
}

private final RenderingHints antialiasing = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

private int getKilled(String mob)
{
if(mob.equals("Hobgoblin"))
{
return (int)(hobLife * 0.4);
}
if(mob.equals("Zombie"))
{
return (int)(zombieLife * 0.4);
}
if(mob.equals("Skeleton"))
{
return (int)(skeletonLife * 0.4);
}
if(mob.equals("Giant Rat"))
{
return 10;
}

if(mob.equals("Hill Giant"))
{
return (int)(giantLife * 0.4);
}
if(mob.equals("Giant Spider"))
{
return 10;
}
return 1;
}

@Override
public void onRepaint(Graphics g)
{

int offsetX = 20;
int offsetY = -10;


int secondOffsetX = 115;
int secondOffsetY = -90;

int growth=0;
long millis = 0;
long hours=0;
int trainingExpHr = 0;
int currTrainingXP = 0;
long minutes = 0;
long seconds = 0;
int xPToCombatLevel = 0;


float barCombat;

//log(skills.getCurrentExp(skills.getIndex(trainingType.getSelectedItem().toString())));

int cnt=0;
int spaces = 0;
//log("totalBreak:" + totalBreakTime);
//log("currentBreak: " + currentBreakTime);

if(startTime != 0)
{

currTrainingXP = skills.getCurrentExp(skills.getIndex(trainingType.getSelectedItem().toString()));
currTrainingLevel = skills.getRealLevel(skills.getIndex(trainingType.getSelectedItem().toString()));
xPToCombatLevel = skills.getExpToNextLevel(skills.getIndex(trainingType.getSelectedItem().toString()));
millis = System.currentTimeMillis() - startTime;
hours = millis / (1000 * 60 * 60);
millis -= hours * (1000 * 60 * 60);
minutes = millis / (1000 * 60);
millis -= minutes * (1000 * 60);
seconds = millis / 1000;
millis -= minutes * (1000 * 60);
if(startBreak <= System.currentTimeMillis() && Break)
{
currentBreakTime = System.currentTimeMillis() - startBreak;
}
trainingExpHr = (int) ((currTrainingXP-initTrainingXP) * 3600000D / (System.currentTimeMillis() - startTime - totalBreakTime - currentBreakTime));
}


spaces = numDigits(xPToCombatLevel);

if(spaces > 2)
{
spaces-=2;
growth = spaces*6;
secondOffsetX-=spaces*2;

if(trainingType.getSelectedItem().toString().equals("Strength"))
{
growth+=12;
secondOffsetX-=4;
}
}

barCombat = (float)skills.getPercentToNextLevel(skills.getIndex(trainingType.getSelectedItem().toString()))/100;


barCombat = (190+growth)*barCombat;

if(showpaint)
{


((Graphics2D) g).setRenderingHints(antialiasing);

g.setColor(color1);
g.fillRoundRect(208+secondOffsetX, 100 + secondOffsetY, 175+growth, 18, 16, 16);
g.setColor(color2);
((Graphics2D) g).setStroke(stroke1);
g.drawRoundRect(208+secondOffsetX, 100 + secondOffsetY, 175+growth, 18, 16, 16);

g.setColor(Color.RED);
g.fillRoundRect(208+secondOffsetX, 100 + secondOffsetY, (int)barCombat, 16, 16, 16);
g.drawRoundRect(208+secondOffsetX, 100 + secondOffsetY, (int)barCombat, 16, 16, 16);


monsterCount = (currTrainingXP-initTrainingXP)/getKilled(monsterType.getSelectedItem().toString());

g.setFont(font2);
g.setColor(color4);
g.drawString("XP to " + trainingType.getSelectedItem().toString() + " Level: " + skills.getExpToNextLevel(skills.getIndex(trainingType.getSelectedItem().toString())), 212+secondOffsetX, 114+secondOffsetY);




g.setColor(color1);
g.fillRoundRect(-15+offsetX, 208 + offsetY, 510, 141, 16, 16);
g.setColor(color2);
((Graphics2D) g).setStroke(stroke1);
g.drawRoundRect(-15+offsetX, 208 + offsetY, 510, 141, 16, 16);
g.setColor(color6);
((Graphics2D) g).setStroke(stroke1);

g.drawImage(img1, 130 + offsetX, 212+offsetY, null);
g.setFont(font0);
g.setColor(color3);
g.drawString("e-Dgeville Dungeon Fighter ", 217+offsetX, 235+offsetY);
g.setFont(font2);
g.setColor(color4);
g.drawString("Author: emist", -5 + offsetX, 221 + offsetY);
g.drawString("Status: " + status, -5 + offsetX, 236+offsetY);
g.drawString("Current Level: " + currTrainingLevel, -5+offsetX, 251+offsetY);
g.drawString("Levels Gained: " + trainingLevel, -5+offsetX, 266+offsetY );
g.drawString(monsterType.getSelectedItem().toString() + "s Killed: " + monsterCount, -5+offsetX, 281+offsetY);
g.drawString("Time running: " + hours + ":" + minutes + ":"+ seconds, -5+offsetX, 296+offsetY);
g.drawString("Eaten: " + foodEaten + " " + foodType.getSelectedItem().toString(), -5+offsetX, 311+offsetY);
g.drawString("Experience Gained: " + (currTrainingXP-initTrainingXP), -5+offsetX, 326+offsetY);
g.drawString("Experience/Hour: " + trainingExpHr, -5+offsetX, 341+offsetY);
g.setColor(color5);

}
g.drawImage(img2, 500, 200, null);
drawMouse(g);
}




private void setAttackStyle()
{
String attackStyle = trainingType.getSelectedItem().toString();

//game.openTab(game.TAB_ATTACK);


if(Integer.parseInt(attackModes.getSelectedItem().toString()) == 3)
{
if(attackStyle.equals("Attack"))
{
if(combat.getFightMode() != 0)
combat.setFightMode(0);
}
else if(attackStyle.equals("Strength"))
{
if(combat.getFightMode() != 1)
combat.setFightMode(1);
}
else if(attackStyle.equals("Defence"))
{ if(combat.getFightMode() != 2)
{
log(combat.getFightMode());
combat.setFightMode(3);
}
}
}
else
{
if(attackStyle.equals("Strength"))
{
if(combat.getFightMode() != 1)
{
combat.setFightMode(1);
}
}
else if(attackStyle.equals("Attack"))
{
if(combat.getFightMode() != 0)
{
combat.setFightMode(0);
}
}
else if(attackStyle.equals("Defence"))
{
if(combat.getFightMode() != 3)
{
combat.setFightMode(3);
}
}
}

}


public void toBank()
{


if(bankArea.contains(getMyPlayer().getLocation()))
return;

if(!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4)
{
camera.setCompass('N');
try
{
bankPath.traverse();
sleep(100);
}
catch (Exception e)
{

}

}

}


public void toSkels()
{

try {
if (pathToSkels != null) {
//log(pathToSkels.isValid());
if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
{
pathToSkels.traverse();
}
}
}
} catch (Exception e) {

}

}

private RSNPC newNPC() {
RSNPC inter = intNPC();
return inter != null ? inter : npcs.getNearest(new Filter<RSNPC>() {
public boolean accept(RSNPC npc) {
return npc.getName().equals(monsterType.getSelectedItem().toString()) && !npc.isDead() && !npc.isInCombat();
}
});
}

private RSNPC intNPC() {
return npcs.getNearest(new Filter<RSNPC>() {
public boolean accept(RSNPC npc) {
return npc.getInteracting() != null && npc.getInteracting().equals(players.getMyPlayer()) && !npc.isDead() && npc.getName().equals(monsterType.getSelectedItem().toString());
}
});

}

private void buryBones()
{
while(inventory.contains(itemsTable.get("Bones").getID()))
{
inventory.getItem(itemsTable.get("Bones").getID()).interact("Bury");
sleep(1500, 2000);
}
while(inventory.contains(itemsTable.get("Big bones").getID()))
{
inventory.getItem(itemsTable.get("Big bones").getID()).interact("Bury");
sleep(1500, 2000);
}
}

public boolean onStart()
{

if(!checkVersion("http://emistz.webs.com/eFighter.txt", "http://www.powerbot.org/community/forum/10-combat/"))
return false;



itemsTable = new Items();
bankPath = walking.newTilePath(pathToBank);



lootableItems = new HashMap<String, ItemWrapper>();








//lootableItems.put("Limpwurt root", itemsTable.get("Limpwurt root"));


bankArr = new ArrayList<RSTile>(Arrays.asList(pathToBank));
toDoor = new ArrayList<RSTile>(bankArr);
Collections.reverse(toDoor);
env.setUserInput(Environment.INPUT_KEYBOARD);
startTime = System.currentTimeMillis();
status = "Initializing...";
pathToSkels = walking.newTilePath(pathToSkelArr);


nextBreak = System.currentTimeMillis() + random(3000000, 40000000);
breakTime = random(300000, 10000000);
startBreak = nextBreak;



//nextBreak = System.currentTimeMillis() + random(3000, 4000);
//breakTime = random(30000, 30000);
//startBreak = nextBreak;

endtime = startBreak + breakTime;


GUI = new FighterGUI();

try{
SwingUtilities.invokeAndWait(GUI);
}
catch (Exception e)
{}




while(GUI.isVisible())
{
sleep(700);
}
if(GUI.wasClosed())
{
return false;
}


while(!game.isLoggedIn())
{
try
{
game.login();
}
catch(Exception e)
{

}
sleep(50);
}

initTrainingLevel = skills.getRealLevel(skills.getIndex(trainingType.getSelectedItem().toString()));
initTrainingXP = skills.getCurrentExp(skills.getIndex(trainingType.getSelectedItem().toString()));
//log(skills.getCurrentExp(skills.getIndex(trainingType.getSelectedItem().toString())));

if(lootValuableBox.isSelected())
{

lootableItems.put("Law rune", itemsTable.get("Law rune"));
lootableItems.put("Chaos rune", itemsTable.get("Chaos rune"));
lootableItems.put("Cosmic rune", itemsTable.get("Cosmic rune"));
lootableItems.put("Nature rune", itemsTable.get("Nature rune"));
lootableItems.put("Uncut diamond", itemsTable.get("Uncut diamond"));
lootableItems.put("Uncut sapphire", itemsTable.get("Uncut sapphire"));
lootableItems.put("Uncut emerald", itemsTable.get("Uncut emerald"));
lootableItems.put("Uncut ruby", itemsTable.get("Uncut ruby"));
lootableItems.put("Shield left half", itemsTable.get("Shield left half"));
lootableItems.put("Casket", itemsTable.get("Casket"));
lootableItems.put("Dragon spear", itemsTable.get("Dragon spear"));
lootableItems.put("Dwarf weed seed", itemsTable.get("Dwarf weed seed"));
lootableItems.put("Watermelon seed", itemsTable.get("Watermelon seed"));
lootableItems.put("Snapdraon seed", itemsTable.get("Snapdragon seed"));
lootableItems.put("Grimy irit", itemsTable.get("Grimy irit"));
lootableItems.put("Adamant arrow", itemsTable.get("Adamant arrow"));
lootableItems.put("Mithril arrow", itemsTable.get("Mithril arrow"));
lootableItems.put("Gold charm", itemsTable.get("Gold charm"));
lootableItems.put("Blue charm", itemsTable.get("Blue charm"));
lootableItems.put("Grimy ranarr", itemsTable.get("Grimy ranarr"));
lootableItems.put("Toadflax seed", itemsTable.get("Toadflax seed"));
lootableItems.put("Death rune", itemsTable.get("Death rune"));
lootableItems.put("Green charm", itemsTable.get("Green charm"));
lootableItems.put("Clue scroll (medium)", itemsTable.get("Clue scroll (medium)"));
lootableItems.put("Clue scroll (medium)1", itemsTable.get("Clue scroll (medium)1"));
lootableItems.put("Avantoe seed", itemsTable.get("Avantoe seed"));
lootableItems.put("Crimson charm", itemsTable.get("Crimson charm"));
lootableItems.put("Grimy cadantine", itemsTable.get("Grimy cadantine"));
lootableItems.put("Torstol seed", itemsTable.get("Torstol seed"));
lootableItems.put("Ranarr seed", itemsTable.get("Ranarr seed"));
lootableItems.put("Blood rune", itemsTable.get("Blood rune"));
lootableItems.put("Grimy dwarf weed", itemsTable.get("Grimy dwarf weed"));
lootableItems.put("Grimy lantadyme", itemsTable.get("Grimy lantadyme"));
lootableItems.put("Dragon med helm", itemsTable.get("Dragon med helm"));
lootableItems.put("Rune kiteshield", itemsTable.get("Rune kiteshield"));
lootableItems.put("Black kiteshield", itemsTable.get("Black kiteshield"));


//rare table
lootableItems.put("Uncut dragonstone", itemsTable.get("Uncut dragonstone"));
lootableItems.put("Vecna skull", itemsTable.get("Vecna skull"));
lootableItems.put("Dragon dagger (noted)", itemsTable.get("Dragon dagger (noted)"));
lootableItems.put("Big bones (noted)", itemsTable.get("Big bones (noted)"));

lootableItems.put("Battlestaff (noted)", itemsTable.get("Battlestaff (noted)"));
lootableItems.put("Air orb (noted)", itemsTable.get("Air orb (noted)"));
lootableItems.put("Fire orb (noted)", itemsTable.get("Fire orb (noted)"));
lootableItems.put("Clean toadflax (noted)", itemsTable.get("Clean toadflax (noted)"));
lootableItems.put("Clean ranarr (noted)", itemsTable.get("Clean ranarr (noted)"));
lootableItems.put("Clean snapdragon (noted)", itemsTable.get("Clean snapdragon (noted)"));
lootableItems.put("Clean torstol (noted)", itemsTable.get("Clean torstol (noted)"));
lootableItems.put("Saradomin brew (4) (noted)", itemsTable.get("Saradomin brew (4) (noted)"));
lootableItems.put("Coal (noted)", itemsTable.get("Coal (noted)"));
lootableItems.put("Adamantite ore (noted)", itemsTable.get("Adamantite ore (noted)"));
lootableItems.put("Runite ore (noted)", itemsTable.get("Runite ore (noted)"));
lootableItems.put("Adamant bar (noted)", itemsTable.get("Adamant bar (noted)"));
lootableItems.put("Rune bar (noted)", itemsTable.get("Rune bar (noted)"));
lootableItems.put("Pure essence (noted)", itemsTable.get("Pure essence (noted)"));
lootableItems.put("Raw swordfish (noted)", itemsTable.get("Raw swordfish (noted)"));
lootableItems.put("Raw shark (noted)", itemsTable.get("Raw shark (noted)"));
lootableItems.put("Yew seed", itemsTable.get("Yew seed"));
lootableItems.put("Magic seed", itemsTable.get("Magic seed"));
lootableItems.put("Palm tree seed", itemsTable.get("Palm tree seed"));
lootableItems.put("Yew logs (noted)", itemsTable.get("Yew logs (noted)"));
lootableItems.put("Loop half of a key", itemsTable.get("Loop half of a key"));
lootableItems.put("Tooth half of a key", itemsTable.get("Tooth half of a key"));
lootableItems.put("Uncut onyx", itemsTable.get("Uncut onyx"));

}

if(lootCoinsBox.isSelected())
{
lootableItems.put("Coins", itemsTable.get("Coins"));
}

if(buryBonesBox.isSelected())
{
lootableItems.put("Bones", itemsTable.get("Bones"));
lootableItems.put("Big bones", itemsTable.get("Big bones"));
}


int i = 0;


keepers = new int[lootableItems.size()+2];

Collection<?> keys = lootableItems.keySet();
for(Object key: keys)
{

keepers[i] = lootableItems.get(key).getID();
i++;
}

keepers[lootableItems.size()] = food;
keepers[lootableItems.size()+1] = brassKey;


return true;
}

public void useSpec(int spec)
{

int specialatt = spec;

if (combat.getSpecialBarEnergy()+random(5, 15) >= specialatt && !combat.isSpecialEnabled())
{
if (game.getCurrentTab() != 0)
{
game.openTab(0);
}

if(combat.getSpecialBarEnergy() >= specialatt)
mouse.click(random(570,710),random(410,435),true);



}

}


private void eat()
{
RSItem foods = inventory.getItem(food);
if(foods != null)
{
foods.doClick(true);
}
}

public void messageReceived(MessageEvent e) {
if (e.getMessage().contains("You've just advanced a " + trainingType.getSelectedItem().toString()))
{
trainingLevel++;
}
else if (e.getMessage().contains("You've just advanced an " + trainingType.getSelectedItem().toString()))
{
trainingLevel++;
}
else if(e.getMessage().contains("You eat the "))
{
foodEaten++;
}

}

private void dropTrash()
{
if(inventory.getCountExcept(keepers) > 0)
{
inventory.dropAllExcept(keepers);
sleep(50);
}
}


public void onFinish()
{
}

private void setRun() {
if (!walking.isRunEnabled()) {
if (walking.getEnergy() >= 50) {
walking.setRun(true);
sleep(1000, 1600);
}
}
}

private void setCamera() {
if (camera.getPitch() < 10) {
camera.setPitch(true);
sleep(1000, 1600);
}
}

private boolean needsHealing()
{
return getMyPlayer().getHPPercent() < 50;
}



private void bank()
{
camera.setPitch(true);
status = "Banking";
// bankArr = new ArrayList<RSTile>(Arrays.asList(pathToBank));



/*
log("interface index = " + bank.getInterface().getIndex());
log("text: " + bank.getInterface().getText());
if(bank.getInterface().getIndex() == bank.INTERFACE_COLLECTION_BOX)
{
log("collection box");
bank.close();
sleep(random(1000,2000));
return;
}
*/

if(interfaces.getAllContaining("Collection").length > 0)
{
//log("Collections open");
//log("Mouse location" + mouse.getLocation());

//Nasty patch because the child component collection_box_close is not valid
mouse.click(426, 76, true);
//log("interface id " + interfaces.getComponent(bank.INTERFACE_COLLECTION_BOX).getIndex());
//log(interfaces.getComponent(bank.INTERFACE_COLLECTION_BOX, bank.INTERFACE_COLLECTION_BOX_CLOSE ).getCenter());
sleep(1000,2000);
}



if(!bank.isOpen())
{
walking.walkTo(new RSTile(3186, 3442));
sleep(1000, 2000);
bank.open();
sleep(random(1000, 2000));
return;
}

if(bank.depositAll())
sleep(random(1000, 2000));

bank.withdraw(brassKey,1);

if(bank.getCount(food) > 0)
{
if(inventory.getCount(food) < foodAmtSlider.getValue())
{
bank.withdraw(food, foodAmtSlider.getValue()-inventory.getCount(food));
sleep(random(2000,3000));
}
bank.close();
sleep(random(1000, 2000));
}
else
{
log("Out of food, logging out");
env.disableRandom("Login");
env.disableRandom("Improved Login");
game.logout(false);
}
}



public int loop()
{

//RSObject entranceDoor1 = dDoor();
//if(entranceDoor1 != null)
// log(camera.getObjectAngle(entranceDoor1));

mouse.setSpeed(random(4,9));
//log(mouse.getPressLocation());
dropTrash();
buryBones();


while(!game.isLoggedIn() && getState() != State.BREAK)
{
try
{
game.login();
}
catch(Exception e)
{
return 100;
}
sleep(50);
}

if(!combat.isAutoRetaliateEnabled())
{
combat.setAutoRetaliate(true);
sleep(1000);
}



setAttackStyle();



//log(mouse.getPressLocation());
setRun();

switch(getState())
{
case BREAK:
{
status = "Breaking";
env.disableRandom("Login");
env.disableRandom("Improved Login");
if(game.isLoggedIn() && !getMyPlayer().isInCombat())
{
game.logout(false);
sleep(50);
}
return random(3000, 5000);
}

case TODOOR:
{
setCamera();
status = "Traveling...";
stepTo(doorTile);
sleep(100);
return random(800,1000);
}
case DOOR:
{
RSObject entranceDoor = dDoor();
camera.setPitch(true);

if(entranceDoor != null)
{
camera.turnTo(entranceDoor);
entranceDoor.interact("Open Door");
return random(4000, 5000);
}
}
case LADDER:
{
RSObject upLadder = findLadderUp();
RSObject downLadder = findLadderDown();

if(upLadder != null)
{
secondFloor = true;
}
else
{
secondFloor = false;
}

if(!needsBank())
{


if(downLadder != null)
{
//log(calc.distanceTo(downLadder));
if(calc.distanceTo(downLadder) < 3)
{
downLadder.interact("Climb-Down Ladder");

}

return random(4000, 5000);
}
else
{
if(monsterType.getSelectedItem().toString().equals("Hobgoblin"))
stepTo(hobsTile);
else if(monsterType.getSelectedItem().toString().equals("Hill Giant"))
stepTo(giantTile);
else if(monsterType.getSelectedItem().toString().equals("Zombie"))
stepTo(zombieTile);
else if(monsterType.getSelectedItem().toString().equals("Giant Rat"))
stepTo(ratTile);
else if(monsterType.getSelectedItem().toString().equals("Skeleton"))
stepTo(skeletonTile);//toSkels();
sleep(100);
return random(1000,2000);
}
}
else if(needsBank())
{

if(upLadder != null)
{

if(!getMyPlayer().isMoving())
{
upLadder.doClick();

}

return random(4000, 5000);
}
RSObject entranceDoor = dDoor();
if(entranceDoor != null) //&& insideDoor.contains(getMyPlayer().getLocation()))
{
entranceDoor.doClick();
return random(4000, 5000);
}

}

return random(1000, 2000);
}
case TOBANK:
{

//log(stepTo(bankTile));
toBank();
sleep(50);
return random(1000, 1500);
}
case FIGHTING:
{
if(needsBank())
{
//status = "Traveling...";
//env.saveScreenshot(true);
stepTo(ladderUpTile);
sleep(50);
return random(1000,2000);

}

if(needsHealing())
{
if(!useFood)
{
//try to get Safe and logout

log("You chose not to use food and got fucked up, you might be dead when you log back in");
stepTo(ladderUpTile);
sleep(100);
while(game.isLoggedIn())
{
env.disableRandom("Login");
env.disableRandom("Improved Login");
game.logout(false);
sleep(500);
}
}
else
{
eat();
return random(3000, 4000);

}
}




try
{
while (lootable() != null)
{
RSItem gItem = lootable().getItem();
if(inventory.isFull())
{

//log("Item: " + gItem.getName() + "Stack Size: " + ((ItemWrapper)itemsTable.get(gItem.getName())).getStackable());
if(!inventory.contains(gItem.getID()))
{
if(!makeSpaceBox.isSelected())
break;
else
{
eat();
return random(3000, 4000);
}
}
else if(inventory.contains(gItem.getID()) && !itemsTable.get(gItem.getName()).isStackable())
{
if(!makeSpaceBox.isSelected())
break;
else
{
eat();
return random(3000, 4000);
}
}
}



log("Item: " + gItem.getName() + " Is Stackable: " + itemsTable.get(gItem.getName()).isStackable());
//log(itemsTable.containsKey(gItem.getName()));
//ItemWrapper i = itemsTable.get(gItem.getName());
//log(i.getName());

RSGroundItem loot = lootable();
status = "Looting " + loot.getItem().getName() + ".";
if (loot.isOnScreen())
{
loot.interact("Take " + loot.getItem().getName());
sleep(900, 1100);
return 1;
}
else
{
walking.walkTileMM(loot.getLocation());
return random(900, 1250);
}
}


RSNPC hMob = newNPC();
if (hMob != null && !hold)
{

status = "Killing " + monsterType.getSelectedItem().toString() + "...";

if(specialBox.isSelected())
{
if(random(0,10) == 1)
useSpec(Integer.parseInt(specComboBox.getSelectedItem().toString()));
}


if (hMob.isOnScreen() && !hMob.isInCombat())
{

hMob.interact("Attack " + hMob.getName());
return random(1000, 1600);
}

else if (!hMob.isOnScreen())
{
RSTile mobTile = walking.getClosestTileOnMap(hMob.getLocation()).randomize(-1, 1);
walking.walkTileMM(mobTile);
return random(300, 400);

//return random(1100, 1500);
}




}
else if(hMob == null)
{
if(monsterType.getSelectedItem().toString().equals("Hobgoblin"))
stepTo(hobsTile);
else if(monsterType.getSelectedItem().toString().equals("Hill Giant"))
stepTo(giantTile);
else if(monsterType.getSelectedItem().toString().equals("Zombie"))
stepTo(zombieTile);
else if(monsterType.getSelectedItem().toString().equals("Giant Rat"))
stepTo(ratTile);
else if(monsterType.getSelectedItem().toString().equals("Skeleton"))
stepTo(skeletonTile);
//toSkels();

}
}
catch(Exception e)
{

}


return random(300, 500);
}
case BANKING:
{
//bank.open();
if(!getMyPlayer().isMoving())
bank();
return random(1000, 2000);
}
case ANTIBAN:
{
switch(random(0,5))
{
case 0:
{
ab.checkXP(trainingType.getSelectedItem().toString());
return random(500,1000);
}
case 1:
{
//log("Anitban:MouseOffScreen");
ab.moveMouseOffScreen(200);
return random(500,1000);

}
case 2:
{
//log("Antiban:CameraLeft");
ab.moveCameraToLeft(1500, 3000);
return random(500,1000);
}
case 3:
{
//log("Antiban:CameraRight");
ab.moveCameraToRight(1500, 3000);
return random(500,1000);
}
case 4:
{
//log("Antiban:CameraRandom");
ab.moveCameraRandomly();
return random(500,1000);
}
}
return random(500,1000);
}


}

//log(stepTo(bankTile));
return 100;

}


public class FighterGUI implements Runnable{

private JFrame frame;
private JTextField pinField;
private boolean closed = false;

/**
* Launch the application.
*/

/**
* Create the application.
*/
public FighterGUI() {
//initialize();
}

/**
* Initialize the contents of the frame.
*/

public void setVisible(boolean visible)
{
frame.setVisible(visible);
}

public boolean isVisible()
{
return frame.isVisible();
}

public void messageBox(String message)
{
JOptionPane.showMessageDialog(null, message);
}

public boolean wasClosed()
{
return closed;
}


public void run()
{
initialize();
}

private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, 591, 400);
//frame.setDefautCloseOperation(JFrame.EXIT_ON_CLOSE);

JLabel lblEdgevillDungeonFighter = new JLabel("E-dgevill Dungeon Fighter");
lblEdgevillDungeonFighter.setFont(new Font("DejaVu Sans Condensed", Font.BOLD, 16));

monsterType = new JComboBox();
monsterType.setModel(new DefaultComboBoxModel(new String[] {"Hobgoblin", "Skeleton", "Hill Giant", "Zombie"})); //, "Giant Rat", "Giant Spider"}));
monsterType.setMaximumRowCount(6);

JLabel lblMonster = new JLabel("Monster:");

useFoodBox = new JCheckBox("Use food");
useFoodBox.setEnabled(true);
useFoodBox.setSelected(true);

pinBox = new JCheckBox("Pin");

pinField = new JTextField();
pinField.setEnabled(false);
pinField.setColumns(10);

JLabel lblFoodAmt = new JLabel("Food Qty.");


startButton = new JButton("Start Button");

breakBox = new JCheckBox("Break");
breakBox.setSelected(true);

lootValuableBox = new JCheckBox("Loot valuable");
lootValuableBox.setEnabled(true);
lootValuableBox.setSelected(true);

startButton.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent arg0)
{

String selectedFood = foodType.getSelectedItem().toString();

/*
if(selectedFood.equals("Salmon"))
food = salmon;
else if(selectedFood.equals("Swordfish"))
food = swordFish;
else if(selectedFood.equals("Lobster"))
food = lobster;
else if(selectedFood.equals("Tuna"))
food = tuna;
*/

food = itemsTable.get(selectedFood).getID();

useFood = useFoodBox.isSelected();
Break = breakBox.isSelected();
setVisible(false);

}
});

JLabel lblTraining = new JLabel("Training:");

trainingType = new JComboBox();
trainingType.setModel(new DefaultComboBoxModel(new String[] {"Attack", "Strength", "Defence"}));
trainingType.setMaximumRowCount(4);


JLabel lblNewLabel = new JLabel("Food");

foodType = new JComboBox();
foodType.setModel(new DefaultComboBoxModel(new String[] {"Salmon", "Tuna", "Lobster", "Swordfish", "Shark",
"Monkfish", "Cavefish", "Rocktail"}));
foodType.setSelectedIndex(3);



makeSpaceBox = new JCheckBox("Make space");
makeSpaceBox.setSelected(true);


foodAmtSlider = new JSlider();
foodAmtSlider.setPaintTicks(true);
foodAmtSlider.setPaintLabels(true);
foodAmtSlider.setMinorTickSpacing(5);
foodAmtSlider.setMajorTickSpacing(10);
foodAmtSlider.setMaximum(30);



lootCoinsBox = new JCheckBox("Loot coins");

buryBonesBox = new JCheckBox("Bury bones");

attackModes = new JComboBox();
attackModes.setModel(new DefaultComboBoxModel(new String[] {"3", "4"}));
attackModes.setMaximumRowCount(2);

JLabel lblNewLabel_1 = new JLabel("Modes");

JLabel lblNewLabel_2 = new JLabel("Special %");

specialBox = new JCheckBox("Special");

specComboBox = new JComboBox();
specComboBox.setModel(new DefaultComboBoxModel(new String[] {"0", "10", "20", "30", "40", "50", "60", "70", "80", "90", "100"}));
specComboBox.setMaximumRowCount(10);



GroupLayout groupLayout = new GroupLayout(frame.getContentPane());
groupLayout.setHorizontalGroup(
groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(Alignment.LEADING, groupLayout.createSequentialGroup()
.addGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(lblEdgevillDungeonFighter))
.addGroup(groupLayout.createSequentialGroup()
.addContainerGap()
.addComponent(startButton))
.addGroup(groupLayout.createSequentialGro


That is a snippet of my first java script from Powerbot. It was very popular and im hoping I can continue scripting SCAR/SIMBA here!

PatDuffy

2012-02-06 21:33:55

must be a pascal script

i'm gonna get ninja'd while waiting for the dam 60 second wait time

E: wow I didn't

alock

2012-02-06 21:35:12

Oh, great. Can i simply upload one here? it might take a little digging :P

PatDuffy

2012-02-06 21:36:56

has be to a pascal script for simba using the SRL include

alock

2012-02-06 21:39:31

Can you check back on this in 30 mins? ill have something up, its not for RS though

PatDuffy

2012-02-06 21:40:30

has to be for RS using the SRL include

alock

2012-02-06 21:42:03

Can you check back in an hour and ill have a working RS script up? hahaha :P

working yet rudimentary i may include

PatDuffy

2012-02-06 21:44:14

I wouldn't bother….

The second 1/2 of the requirement for Members is to be an active member of the community which you are not :p

alock

2012-02-06 21:46:03

well then hahahhaha, lets make this a continuance and I shall ask for a final time!
Sir, will you come back in a week or two after getting my post count up and having evidence of help? hahaha :D

PatDuffy

2012-02-06 21:49:54

nope. wait more like 1-2 months before applying :p

That will give us ample time to get you know you as a person and be able to judge your character.

Kyle Undefined

2012-02-06 21:51:50

No, I wouldn't vote yes until you've been here at least 2 months.

Also, can you prove that you're "emist" from PB?

[XoL]

2012-02-06 21:54:27

Simply make a new topic in a months time :)

PatDuffy

2012-02-06 21:54:48

From: Kyle Undefined
No, I wouldn't vote yes until you've been here at least 2 months.

Also, can you prove that you're "emist" from PB?


I wanted to say something about that but I knew someone else would. I decided to play nice guy tonight