[OAK] FallinOaks [FLAWLESS]


Welcome to FallinOaks - Version 8
Videos: if youtube thing wont show heres links:
• How to use fallinoaks
|+|
• Whats its like when using it
Windows Vista/7
Documents/RSBot/Scripts/Sources
Windows XP
My Documents/RSBot/Scripts/Sources
Features:
• GUI - NEW!
• More Locations (3) - NEW!
• Nest Support
• Paint
• Banking
• Supports All Hatchets (ON & OFF)
Known Bugs:
• Miss Clicks
Locations: Just Select in GUI
• Draynor
• Varrock - NEW! [FLAWLESS - PERFECT! (SO FAR)]
• Falador - NEW!
[ UPDATE LOG FROM [v6 - v8] ]
Code:
New Paint [Newer then proggy below] Working GUI More Locations Better Banking Better Walking Fixed Nest Support Fixed Mass clicking Draynor clicking (semi fixed) complete fix soon New Antiban Fixed Draynor & Falador Better status updates/checks
[ Progress Reports ]


Save As:
FallinOaks.java
Code:
/*
* @Author lolpl0xme
* BTOdell9751 - All GUI
* mak001, bluefirecorp, ConnectQ - Mass Clicking
* Electricity - Basic Antiban
* Enfilade, TragiKs - Basic Paint & Tutorial
* Swell, InvaderZim - Banking & And Basics
*/
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.WindowListener;
import java.io.IOException;
import java.net.URL;
import java.io.*;
import java.net.*;
import javax.swing.JOptionPane;
import javax.swing.JFileChooser;
import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.rsbot.event.events.ServerMessageEvent;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.event.listeners.ServerMessageListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSGroundItem;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(authors = { "lolpl0xme" }, keywords = { "Woodcutting" }, name = "Fallin Oaks", version = 0.8, description = "Cuts oak trees all over runescape")
public class FallinOaks extends Script implements PaintListener, ServerMessageListener {
/*
* GUI stuff
*/
private String location = null;
private FallinOaksGUI gui = null;
/*
* All RSAreas
*/
//Tree Path's
private RSTile[] TreestoBank;
final RSTile[] DTreestoBank = { new RSTile(3107, 3250), new RSTile(3093, 3244), new RSTile(3102, 3244), new RSTile(3092, 3242) };// DRAYNOR [FINISHED]
//new RSTile(3102, 3244), new RSTile(3093, 3244), new RSTile(3108, 3250), new RSTile(3093, 3245)}
final RSTile[] VTreestoBank = {new RSTile(3276, 3430), new RSTile(3261, 3429), new RSTile(3252, 3421)};// VARROCK [FINISHED]
final RSTile[] FTreestoBank = {new RSTile(2950, 3401), new RSTile(2963, 3398), new RSTile(2959, 3381), new RSTile(2945, 3371)};// FALADOR [FINISHED]
//Bank Path's
private RSTile[] BanktoTrees;
final RSTile[] DBanktoTrees = { new RSTile(3093, 3244), new RSTile(3101, 3247), new RSTile(3107, 3250) };// DRAYNOR [FINISHED]
final RSTile[] VBanktoTrees = {new RSTile(3253, 3420), new RSTile(3265, 3428), new RSTile(3280, 3429)};// VARROCK [FINISHED]
final RSTile[] FBanktoTrees = {new RSTile(2946, 3369), new RSTile(2952, 3382), new RSTile(2964, 3392), new RSTile(2953, 3404)};// FALADOR [FINISHED]
//Bank Area's
final RSArea DBankArea = new RSArea(new RSTile(3095, 3246), new RSTile(3092, 3241));// DRAYNOR [FINISHED]
final RSArea VBankArea = new RSArea(new RSTile(3257, 3423), new RSTile(3250, 3419));// VARROCK [FINISHED]
final RSArea FBankArea = new RSArea(new RSTile(2947, 3371), new RSTile(2943, 3368));// FALADOR [FINISHED]
//Tree Area's
final RSArea DOakArea = new RSArea(new RSTile(3109, 3253), new RSTile(3098, 3237));// DRAYNOR [FINISHED]
final RSArea VOakArea = new RSArea(new RSTile(3285, 3438), new RSTile(3275, 3426));// VARROCK [FINISHED]
final RSArea FOakArea = new RSArea(new RSTile(2953, 3413), new RSTile(2945, 3398));// FALADOR [FINISHED]
private RSArea finalBankArea = null;
private RSArea finalOakArea = null;
private RSTile[] finaltoTreePath = null;
private RSTile[] finaltoBankPath = null;
private final int[] hatchetIDs = { 349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
public final int[] nestIDs = {5070, 5071, 5072, 5073, 5074, 5075, 5076, 7413, 11966};
private int bankboothID[] = {2213, 11402, 11758};
private final int[] oTree = { 1281 };
private int oLog = (1521);
private int xpHour;
private int startXp;
private int levelsGained = 0;
private int logsCut = 0;
private int xpGained;
private int currentXp;
private int nestsCollected = 0;
double version = 0.8;
private String status = "Starting FallinOaks...";
public long startTime = System.currentTimeMillis();
long runTime = 0;
long seconds = 0;
long minutes = 0;
long hours = 0;
private void nest() {
RSGroundItem nest = groundItems.getNearest(nestIDs);
int initialCount = inventory.getCount();
if (nest != null && initialCount < 28) {
if (!nest.isOnScreen())
camera.turnToTile(nest.getLocation());
if (nest.doAction("Take")) {
status = "Taking nest";
for (int i = 0; i < 15; ++i) {
sleep(100);
if (getMyPlayer().isMoving()) {
i = 0;
}
}
}
}
}
public void serverMessageRecieved(ServerMessageEvent e) {
if (e.getMessage().contains("Woodcutting level")) {
levelsGained++;
}
if (e.getMessage().contains("get some")) {
logsCut++;
}
if (e.getMessage().contains("nest falls")) {
nestsCollected++;
}
}
private void useBank(){
RSObject bankBooth = objects.getNearest(bankboothID);
if(bankBooth != null && inventory.contains(oLog)){
bankBooth.doAction("Use-quickly");
status = "Opening bank";
sleep(800, 1000);
}
}
private void depositOakLogs(){
if(bank.isOpen()){
bank.depositAllExcept(hatchetIDs);
status = "Depositing items";
sleep(300, 600);
}
}
private void closeBank(){
if(bank.isOpen()){
mouse.move(490, 36, 3, 3);
sleep(300, 600);
mouse.click(true);
status = "Bank closed";
}
}
private void Bank(){
useBank();
depositOakLogs();
closeBank();
}
public void antiban() {
switch (random(1, 200)) {
case 5:
game.openTab(Game.TAB_STATS);
skills.doHover(Skills.INTERFACE_WOODCUTTING);
status = "ANTIBAN";
sleep(random(1000, 2100));
game.openTab(Game.TAB_INVENTORY);
status = "Waiting...";
break;
case 6:
game.openTab(Game.TAB_FRIENDS);
status = "ANTIBAN";
sleep(random(1000, 1700));
game.openTab(Game.TAB_INVENTORY);
status = "Waiting...";
break;
case 7:
game.openTab(Game.TAB_CLAN);
status = "ANTIBAN";
sleep(random(1000, 1800));
game.openTab(Game.TAB_INVENTORY);
status = "Waiting...";
case 8:
if (random(1, 20) != 1)
return;
status = "ANTIBAN";
int angle = camera.getAngle() + random(-90, 90);
if (angle < 0) {
angle = random(0, 10);
}
if (angle > 359) {
angle = random(0, 10);
}
camera.setAngle(angle);
break;
case 9:
if (random(1, 5) == 1)
status = "ANTIBAN";
mouse.moveSlightly();
case 10:
if (random (0, 12) == 7) {
status = "ANTIBAN";
mouse.moveOffScreen();
sleep(random(5600, random(7200, 9000)));
}
break;
}
}
public boolean onStart() {
gui = new FallinOaksGUI();
gui.setVisible(true);
gui.addWindowListener(new WindowListener() {
public void windowClosing(java.awt.event.WindowEvent e) {
log("GUI was closed, stopping FallinOaks.");
stopScript();
}
public void windowOpened(java.awt.event.WindowEvent e) {}
public void windowClosed(java.awt.event.WindowEvent e) {}
public void windowIconified(java.awt.event.WindowEvent e) {}
public void windowDeiconified(java.awt.event.WindowEvent e) {}
public void windowActivated(java.awt.event.WindowEvent e) {}
public void windowDeactivated(java.awt.event.WindowEvent e) {}
});
while (gui.isVisible()) {
sleep(200,300);
}
if (location.equals("Draynor")) {
finaltoTreePath = DBanktoTrees;
finaltoBankPath = DTreestoBank;
finalOakArea = DOakArea;
finalBankArea = DBankArea;
} else if (location.equals("Varrock")) {
finaltoTreePath = VBanktoTrees;
finaltoBankPath = VTreestoBank;
finalOakArea = VOakArea;
finalBankArea = VBankArea;
} else if (location.equals("Falador")) {
finaltoTreePath = FBanktoTrees;
finaltoBankPath = FTreestoBank;
finalOakArea = FOakArea;
finalBankArea = FBankArea;
}
log("Start at trees or bank!");
startXp = skills.getCurrentExp(8);
mouse.setSpeed(10);
return true;
}
private final RenderingHints antialiasing = new RenderingHints(
RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
private Image getImage(String url) {
try {
return ImageIO.read(new URL(url));
} catch(IOException e) {
return null;
}
}
private final Color color1 = new Color(0, 0, 0);
private final Color color2 = new Color(255, 255, 51);
private final Color color3 = new Color(255, 255, 255);
private final BasicStroke stroke1 = new BasicStroke(2);
private final Font font1 = new Font("Comic Sans MS", 0, 14);
private final Image img1 = getImage("http://img52.imageshack.us/img52/4858/fallinoaks.png");
private final Image img2 = getImage("http://img12.imageshack.us/img12/4882/barol.png");
public void onRepaint(Graphics g1) {
nestsCollected = 0;
if (game.isLoggedIn()) {
runTime = System.currentTimeMillis() - startTime;
seconds = runTime / 1000;
if (seconds >= 60) {
minutes = seconds / 60;
seconds -= (minutes * 60);
}
if (minutes >= 60) {
hours = minutes / 60;
minutes -= (hours * 60);
}
xpHour = (int) ((3600000.0 / (double) runTime) * xpGained);
}
Graphics2D g = (Graphics2D)g1;
g.setRenderingHints(antialiasing);
currentXp = skills.getCurrentExp(8);
xpGained = currentXp - startXp;
g.setColor(color1);
g.setColor(color2);
g.setStroke(stroke1);
g.drawImage(img1, 550, 204, null);
g.drawImage(img2, 7, 459, null);
g.setFont(font1);
g.setColor(color3);
g.drawString("Logs Cut: "+ logsCut +".", 554, 280);
g.drawString("EXP Gained: " + xpGained, 554, 325);
g.drawString("Version: " + version, 554, 355);
g.drawString("Status: " + status + ".", 554, 265);
g.drawString("Levels gained: " + levelsGained, 554, 310);
g.drawString("EXP Per Hour: " + xpHour + ".", 554, 340);
g.drawString("Time: " + hours + " Hrs " + minutes + " Mins " + seconds + " Secs ", 554, 250);
g.drawString("Nests: " + nestsCollected +".", 554, 295);
g.drawLine(mouse.getLocation().x - 5, mouse.getLocation().y,
mouse.getLocation().x + 5, mouse.getLocation().y);
g.drawLine(mouse.getLocation().x, mouse.getLocation().y - 5,
mouse.getLocation().x, mouse.getLocation().y + 5);
}
public int loop(){
antiban();
nest();
if(inventory.isFull()){
if(finalBankArea.contains(getMyPlayer().getLocatio n())){
if(!bank.isOpen()){
bank.open();
return random(500, 700);
}
bank.depositAllExcept(hatchetIDs);
if(bank.isOpen()){
bank.close();
return random(500, 700);
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
status = "Walking...";
walking.walkPathMM(finaltoBankPath);
return random(300, 600);
}
}
}else{
if(finalOakArea.contains(getMyPlayer().getLocation ())){
status = "Waiting at oak trees";
if(getMyPlayer().getAnimation() != 2846){
RSObject tree = objects.getNearest(oTree);
while (getMyPlayer().getAnimation() != -1)
if (!tree.isOnScreen())
camera.turnToTile(tree.getLocation());
if(tree != null){
tree.doAction("Chop");
status = "Cutting oaks";
sleep(1200, 1500);
}
}
}else{
if(walking.getDestination() == null || calc.distanceTo(walking.getDestination()) < random(4, 6)){
status = "Walking...";
walking.walkPathMM(finaltoTreePath);
return random(300, 600);
}
}
}
return random(100, 200);
}
public void onFinish() {
log("Smile: Screenshot taken!");
env.saveScreenshot(true);
}
private class FallinOaksGUI extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JLabel jLabel = null;
private JLabel TitleLabel = null;
private JComboBox LocationBox = null;
private JButton StartScript = null;
/**
* This is the default constructor
*/
public FallinOaksGUI() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(203, 150);
this.setLocation(getCenteredCorner(this));
this.setContentPane(getJContentPane());
this.setTitle("Fallin Oaks");
}
private Point getCenteredCorner(Component c)
{
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
return new Point(
(int)((dim.getWidth() - c.getWidth()) / 2),
(int)((dim.getHeight() - c.getHeight()) / 2)
);
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
TitleLabel = new JLabel("", JLabel.CENTER);
TitleLabel.setBounds(new Rectangle(0, 15, 187, 16));
TitleLabel.setFont(new Font("Tahoma", Font.PLAIN, 18));
TitleLabel.setText("Fallin Oaks GUI");
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(15, 45, 64, 23));
jLabel.setText("Locations:");
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(jLabel, null);
jContentPane.add(TitleLabel, null);
jContentPane.add(getLocationBox(), null);
jContentPane.add(getStartScript(), null);
}
return jContentPane;
}
/**
* This method initializes LocationBox
*
* @return javax.swing.JComboBox
*/
private JComboBox getLocationBox() {
if (LocationBox == null) {
LocationBox = new JComboBox(new String[] {"Select", "Draynor", "Varrock", "Falador"});
LocationBo*****tBounds(new Rectangle(85, 45, 91, 22));
LocationBox.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent e) {
location = (String) LocationBox.getSelectedItem();
}
});
}
return LocationBox;
}
/**
* This method initializes StartScript
*
* @return javax.swing.JButton
*/
private JButton getStartScript() {
if (StartScript == null) {
StartScript = new JButton();
StartScript.setBounds(new Rectangle(23, 77, 144, 24));
StartScript.setText("Start FallinOaks");
StartScript.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
if (((String) LocationBox.getSelectedItem()).equals("Select")) {
JOptionPane.showMessageDialog(FallinOaksGUI.this, "Please select a location.", "Location Error", JOptionPane.ERROR_MESSAGE);
return;
}
dispose();
}
});
}
return StartScript;
}
}
}


