Created
December 10, 2015 18:05
-
-
Save lordgmage/14e49ed264e90203966f to your computer and use it in GitHub Desktop.
LordWoodcutting pro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.data; | |
public class Constants { | |
public final static int NORMAL = 1276; | |
public final static int OAKS = 1281; | |
public final static int TEAK = 9036; | |
public final static int WILLIOWS = 1308; | |
public final static int MAHOGANY = 9034; | |
public final static int YEWS = 1309; | |
public final static int MAGIC = 1306; | |
public final static int DEPOSIT = 9398; | |
public final static int CLOSE = 233; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.data; | |
public class Variables { | |
public static int tree; | |
public static boolean dropping; | |
public static boolean deposit; | |
private static String currentStatus; | |
public static int getTree() { | |
return tree; | |
} | |
public static boolean getDropping() { | |
return dropping; | |
} | |
public static boolean getDeposit() { | |
return deposit; | |
} | |
public static String getCurrentStatus() { | |
return currentStatus; | |
} | |
public static void setDropping(boolean dropping) { | |
Variables.dropping = dropping; | |
} | |
public static void setDeposit(boolean deposit) { | |
Variables.deposit = deposit; | |
} | |
public static void setCurrentStatus(String currentStatus) { | |
Variables.currentStatus = currentStatus; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.main; | |
import org.parabot.environment.scripts.Category; | |
import org.parabot.environment.scripts.Script; | |
import org.parabot.environment.scripts.ScriptManifest; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.parabot.lord.lordwoodcutting.strategies.Cut; | |
import org.parabot.lord.lordwoodcutting.strategies.Deposit; | |
import org.parabot.lord.lordwoodcutting.strategies.Dropping; | |
import java.util.ArrayList; | |
@ScriptManifest(author = "Lord", | |
category = Category.WOODCUTTING, | |
description = "Cuts logs and drops them", | |
name = "Lord Woodcutting Pro", | |
servers = { "PKHonor" }, | |
version = 1) | |
public class Core extends Script { | |
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>(); | |
@Override | |
public boolean onExecute() { | |
UI GUI = new UI(); | |
GUI.setVisible(true); | |
while (GUI.isVisible()) { | |
sleep(20); | |
} | |
System.out.println("Made with help from Legacy"); | |
strategies.add(new Cut()); | |
strategies.add(new Dropping()); | |
strategies.add(new Deposit()); | |
provide(strategies); | |
return true; | |
} | |
@Override | |
public void onFinish() { | |
super.onFinish(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.main; | |
import com.sun.tools.javadoc.Start; | |
import org.parabot.lord.lordwoodcutting.data.Constants; | |
import org.parabot.lord.lordwoodcutting.data.Variables; | |
import java.awt.BorderLayout; | |
import java.awt.EventQueue; | |
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
import javax.swing.border.EmptyBorder; | |
import javax.swing.JTextField; | |
import javax.swing.JLabel; | |
import java.awt.Font; | |
import javax.swing.SwingConstants; | |
import javax.swing.JComboBox; | |
import javax.swing.DefaultComboBoxModel; | |
import javax.swing.JButton; | |
import javax.swing.JCheckBox; | |
import java.awt.event.ActionListener; | |
import java.awt.event.ActionEvent; | |
public class UI extends JFrame { | |
private JPanel contentPane; | |
/** | |
* Launch the application. | |
*/ | |
public static void main(String[] args) { | |
EventQueue.invokeLater(new Runnable() { | |
public void run() { | |
try { | |
UI frame = new UI(); | |
frame.setVisible(true); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
}); | |
} | |
/** | |
* Create the frame. | |
*/ | |
public UI() { | |
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
setBounds(100, 100, 303, 365); | |
contentPane = new JPanel(); | |
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); | |
setContentPane(contentPane); | |
contentPane.setLayout(null); | |
JLabel lblLordPlanking = new JLabel("Lord Woodcutting Pro"); | |
lblLordPlanking.setHorizontalAlignment(SwingConstants.CENTER); | |
lblLordPlanking.setFont(new Font("Arial Black", Font.BOLD, 20)); | |
lblLordPlanking.setBounds(0, 0, 287, 93); | |
contentPane.add(lblLordPlanking); | |
final JCheckBox Deposit = new JCheckBox("Deposit"); | |
Deposit.setBounds(109, 157, 140, 23); | |
contentPane.add(Deposit); | |
final JCheckBox chckbxDropAll = new JCheckBox("Drop All"); | |
chckbxDropAll.setBounds(109, 195, 140, 23); | |
contentPane.add(chckbxDropAll); | |
final JComboBox LogSelect = new JComboBox(); | |
LogSelect.setModel(new DefaultComboBoxModel(new String[] {"Normal", "Oak", "Willow", "Teak", "Mahogany", "Yew", "Magic"})); | |
LogSelect.setBounds(84, 104, 114, 20); | |
contentPane.add(LogSelect); | |
final JButton Start = new JButton("Start"); | |
Start.addActionListener(new ActionListener() { | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
String selection = (String) LogSelect.getModel().getSelectedItem(); | |
switch (selection) { | |
case "Normal": | |
Variables.tree = Constants.NORMAL; | |
break; | |
case "Oaks": | |
Variables.tree = Constants.OAKS; | |
break; | |
case "Mahogany": | |
Variables.tree = Constants.MAHOGANY; | |
break; | |
case "Willow": | |
Variables.tree = Constants.WILLIOWS; | |
break; | |
case "Teak": | |
Variables.tree = Constants.TEAK; | |
break; | |
case "Yew": | |
Variables.tree = Constants.YEWS; | |
break; | |
case "Magic": | |
Variables.tree = Constants.MAGIC; | |
break; | |
default: | |
System.out.println("Something wrong as happened please contact the script writers."); | |
break; | |
} | |
if (Deposit.isSelected()){ | |
Variables.setDeposit(true); | |
} | |
if (chckbxDropAll.isSelected()){ | |
Variables.setDropping(true); | |
} | |
setVisible(false); | |
} | |
}); | |
Start.setBounds(10, 308, 209, 23); | |
contentPane.add(Start); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.SleepCondition; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.parabot.lord.lordwoodcutting.data.Variables; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Players; | |
import org.rev317.min.api.methods.SceneObjects; | |
import org.rev317.min.api.wrappers.SceneObject; | |
public class Cut implements Strategy { | |
public boolean activate() { | |
return !Inventory.isFull() && Players.getMyPlayer().getAnimation() == -1; | |
} | |
public void execute() { | |
Variables.setCurrentStatus("Cutting the tree master"); | |
SceneObject[] TREE_ID = SceneObjects.getNearest(Variables.tree); | |
if (TREE_ID.length > 0 && TREE_ID != null) { | |
if (Players.getMyPlayer().getAnimation() == -1) { | |
TREE_ID[0].interact(SceneObjects.Option.CHOP_DOWN); | |
} | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Inventory.isFull(); | |
} | |
}, 1000); | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.strategies; | |
import org.parabot.core.asm.redirect.PreferencesRedirect; | |
import org.parabot.environment.api.utils.PBPreferences; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.scripts.framework.SleepCondition; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.parabot.lord.lordwoodcutting.data.Constants; | |
import org.parabot.lord.lordwoodcutting.data.Variables; | |
import org.rev317.min.api.methods.*; | |
import org.rev317.min.api.wrappers.SceneObject; | |
public class Deposit implements Strategy { | |
@Override | |
public boolean activate() { | |
return Variables.deposit == true && Inventory.isFull(); | |
} | |
@Override | |
public void execute() { | |
// if (Skill.WOODCUTTING.getLevel() < 80){ | |
// System.out.println("You do not have the required level to deposit"); | |
// Variables.setDropping(true); | |
// Variables.setDeposit(false); | |
// } | |
Variables.setCurrentStatus("I'm banking this for you"); | |
SceneObject[] DepositBox = SceneObjects.getNearest(Constants.DEPOSIT); | |
if (DepositBox.length > 0 && DepositBox != null) { | |
DepositBox[0].interact(SceneObjects.Option.DEPOSIT); | |
} | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Bank.isOpen(); | |
} | |
},2500); | |
Menu.sendAction(646,7954,16,23412); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Inventory.isEmpty(); | |
} | |
},2500); | |
Menu.clickButton(200); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return !Bank.isOpen(); | |
} | |
},2500); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.parabot.lord.lordwoodcutting.strategies; | |
import org.parabot.environment.api.utils.Time; | |
import org.parabot.environment.input.Keyboard; | |
import org.parabot.environment.scripts.framework.SleepCondition; | |
import org.parabot.environment.scripts.framework.Strategy; | |
import org.parabot.lord.lordwoodcutting.data.Variables; | |
import org.rev317.min.api.methods.Game; | |
import org.rev317.min.api.methods.Inventory; | |
import org.rev317.min.api.methods.Menu; | |
import org.rev317.min.api.methods.Players; | |
public class Dropping implements Strategy{ | |
@Override | |
public boolean activate() { | |
return Inventory.isFull() && Players.getMyPlayer().getAnimation() == -1 && Variables.dropping == true; | |
} | |
@Override | |
public void execute() { | |
Variables.setCurrentStatus("Dropping all the goodies"); | |
Keyboard.getInstance().sendKeys("::empty"); | |
Time.sleep(500); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Inventory.isEmpty(); | |
} | |
},1000); | |
if (Game.getOpenBackDialogId() == 4272){ | |
Menu.sendAction(679,1094653498,144,4275); | |
Time.sleep(new SleepCondition() { | |
@Override | |
public boolean isValid() { | |
return Inventory.isEmpty(); | |
} | |
},2000); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment