Initial commit

This commit is contained in:
RedSparr0w
2019-10-12 10:07:14 +13:00
commit d62294ef4e
18 changed files with 754 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/ParaScript.iml" filepath="$PROJECT_DIR$/ParaScript.iml" />
</modules>
</component>
</project>
+124
View File
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/ParaScript" vcs="Git" />
</component>
</project>
+75
View File
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Enum" />
<option value="Class" />
</list>
</option>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/ParaScript" />
</component>
<component name="ProjectId" id="1RwJc2HEUFTeubPY6u2X9b5qHk3" />
<component name="PropertiesComponent">
<property name="GenerateAntBuildDialog.backupFiles" value="true" />
<property name="GenerateAntBuildDialog.enableUiFormCompile" value="true" />
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
<property name="GenerateAntBuildDialog.generateSingleFile" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="parascript" />
<property name="last_opened_file_path" value="$USER_HOME$/OneDrive/Documents/GitHub/2006rebotted" />
<property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="com.intellij.jarRepository.settings.RemoteRepositoriesConfigurable" />
</component>
<component name="RecentsManager">
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="ParaScript.ui" />
<recent name="ParaScript.data" />
<recent name="ParaScript.strategies" />
<recent name="ParaScript" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="JarApplication">
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="true" />
<option name="ALTERNATIVE_JRE_PATH" value="1.8" />
<method v="2" />
</configuration>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="" />
<created>1570572301532</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1570572301532</updated>
</task>
<servers />
</component>
</project>
+31
View File
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<output url="file://$USER_HOME$/OneDrive/Documents/Parabot/scripts/compiled" />
<output-test url="file://$MODULE_DIR$/out/test/ParaScript" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/OneDrive/Documents/Java Dependencies/Parabot/Parabot-317-API-Minified.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$USER_HOME$/OneDrive/Documents/Java Dependencies/Parabot/Parabot_Client-2.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
</component>
</module>
+42
View File
@@ -0,0 +1,42 @@
package ParaScript;
import ParaScript.data.Variables;
import ParaScript.strategies.MakeArrowShafts;
import ParaScript.strategies.ScriptState;
import ParaScript.strategies.Thieving;
import ParaScript.strategies.WoodcutTree;
import ParaScript.ui.UI;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.Script;
import org.parabot.environment.scripts.framework.Strategy;
import org.parabot.environment.scripts.Category;
import org.parabot.environment.scripts.ScriptManifest;
import java.util.ArrayList;
@ScriptManifest(author = "RedSparr0w", category = Category.OTHER, description = "ParaScript", name = "Script", servers = { "2006rebotted" }, version = 1)
public class Main extends Script{
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
@Override
public boolean onExecute() {
UI ui = new UI();
ui.setVisible(true);
while (!Variables.running) {
Time.sleep(300);
}
strategies.add(new ScriptState());
strategies.add(new MakeArrowShafts());
strategies.add(new WoodcutTree());
provide(strategies);
return true;
}
@Override
public void onFinish() {
}
}
+23
View File
@@ -0,0 +1,23 @@
package ParaScript.data;
import ParaScript.data.variables.Trees;
import ParaScript.data.variables.Zone;
import org.rev317.min.api.wrappers.Tile;
import java.util.List;
public class Variables {
public static boolean running = false;
private static String currentStatus = "none";
public static String getStatus() {
return currentStatus;
}
public static void setStatus(String i) {
currentStatus = i;
}
public final static Zone LUMBRIDGE_NORMAL_TREE_ZONE = new Zone(new Tile(3186, 3249), new Tile(3207, 3234));
}
+36
View File
@@ -0,0 +1,36 @@
package ParaScript.data.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum Trees {
NORMAL("normal", new int[]{1276, 1278}),
OAK("oak", new int[]{1281}),
WILLOW ("willow", new int[]{5551, 1308, 5553, 5552}),
MAPLE("maple", new int[]{1307});
private String name;
private int[] trees;
Trees(String name, int[] trees) {
this.name = name;
this.trees = trees;
}
public static String[] toStringArray() {
List<Trees> enumList = Arrays.asList(Trees.values());
List<String> locationsArray = new ArrayList<>();
for (Trees tree : enumList) {
locationsArray.add(tree.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public int[] getIDs() {
return this.trees;
}
}
+39
View File
@@ -0,0 +1,39 @@
package ParaScript.data.variables;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.wrappers.SceneObject;
import org.rev317.min.api.wrappers.Tile;
public class Zone
{
Tile topLeftTile;
Tile botRightTile;
public Zone(Tile topLeftTile, Tile botRightTile)
{
this.topLeftTile = topLeftTile;
this.botRightTile = botRightTile;
}
public boolean inTheZone()
{
if ((Players.getMyPlayer().getLocation().getX() > this.topLeftTile.getX()) &&
(Players.getMyPlayer().getLocation().getY() < this.topLeftTile.getY()) &&
(Players.getMyPlayer().getLocation().getX() < this.botRightTile.getX()) &&
(Players.getMyPlayer().getLocation().getY() > this.botRightTile.getY())) {
return true;
}
return false;
}
public boolean inTheZoneObject(SceneObject tree)
{
if ((tree.getLocation().getX() > this.topLeftTile.getX()) &&
(tree.getLocation().getY() < this.topLeftTile.getY()) &&
(tree.getLocation().getX() < this.botRightTile.getX()) &&
(tree.getLocation().getY() > this.botRightTile.getY())) {
return true;
}
return false;
}
}
+19
View File
@@ -0,0 +1,19 @@
package ParaScript.strategies;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
public class Bank implements Strategy {
@Override
public boolean activate() {
return true;
}
@Override
public void execute() {
for (SceneObject i : SceneObjects.getNearest(100)) {
i.interact(SceneObjects.Option.MINE);
}
}
}
@@ -0,0 +1,47 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import ParaScript.data.variables.Trees;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
import org.rev317.min.api.methods.Menu;
import org.rev317.min.api.methods.Inventory;
import org.rev317.min.api.methods.Items;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
import java.awt.*;
public class MakeArrowShafts implements Strategy {
@Override
public boolean activate() {
if (Variables.running
&& hasLogs()
&& (Variables.getStatus() == "none" || Variables.getStatus() == "making arrow shafts")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1) {
Variables.setStatus("making arrow shafts");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
System.out.println("making arrow shafts");
Inventory.getItem(947).interact(Items.Option.USE);
Inventory.getItem(1512).interact(Items.Option.USE_WITH);
Menu.clickButton(8886);
Time.sleep(3000);
//Wait for the Player to chop the Tree
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
}
private boolean hasLogs(){
return Inventory.contains(1512);
}
}
+32
View File
@@ -0,0 +1,32 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.scripts.framework.Strategy;
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 Mine implements Strategy {
@Override
public boolean activate() {
for (SceneObject i : SceneObjects.getNearest(100)) {
if (Variables.running
&& i !=null
&& i.distanceTo() <= 10
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
return true;
}
}
return false;
}
@Override
public void execute() {
for (SceneObject i : SceneObjects.getNearest(100)) {
i.interact(SceneObjects.Option.MINE);
}
}
}
@@ -0,0 +1,26 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
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 ScriptState implements Strategy {
@Override
public boolean activate() {
if (!Variables.running) {
return true;
}
return false;
}
@Override
public void execute() {
//Wait for the Player to finish pickpocketing
Time.sleep(() -> !Variables.running, 1000);
}
}
+43
View File
@@ -0,0 +1,43 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
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 Thieving implements Strategy {
private SceneObject victim;
@Override
public boolean activate() {
victim = victim(); // set the local Variable
if (Variables.running
&& victim != null
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
return true;
}
return false;
}
@Override
public void execute() {
victim.interact(SceneObjects.Option.STEAL_FROM);
Time.sleep(1000);
//Wait for the Player to finish pickpocketing
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500);
}
private SceneObject victim(){
for(SceneObject victim : SceneObjects.getNearest(1, 2, 3, 4)){
if(victim != null){
return victim;
}
}
return null;
}
}
@@ -0,0 +1,49 @@
package ParaScript.strategies;
import ParaScript.data.Variables;
import ParaScript.data.variables.Trees;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.Strategy;
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 WoodcutTree implements Strategy {
private SceneObject tree;
@Override
public boolean activate() {
tree = tree(); // set the local Variable
if (Variables.running
&& tree != null
&& (Variables.getStatus() == "none" || Variables.getStatus() == "woodcutting")
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
Variables.setStatus("woodcutting");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
tree.interact(SceneObjects.Option.CHOP_DOWN);
Time.sleep(1000);
//Wait for the Player to chop the Tree
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
}
private SceneObject tree(){
for(SceneObject tree : SceneObjects.getNearest(Trees.NORMAL.getIDs())){
if(tree != null){
if(Variables.LUMBRIDGE_NORMAL_TREE_ZONE.inTheZoneObject(tree)) {
return tree;
}
}
}
return null;
}
}
+146
View File
@@ -0,0 +1,146 @@
package ParaScript.ui;
import ParaScript.data.variables.Trees;
import ParaScript.data.Variables;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class UI extends JFrame {
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
private JPanel contentPane;
private JComboBox location = new JComboBox();
private JComboBox treeSelect = new JComboBox();
private JRadioButton bank = new JRadioButton("Bank");
private JRadioButton drop = new JRadioButton("Drop");
private JTextField username = new JTextField();
private JPasswordField password = new JPasswordField();
private JCheckBox birdsNest = new JCheckBox();
public UI() {
setTitle("AIO Woodcutter");
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 400, 280);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBounds(0, 0, 395, 220);
contentPane.add(tabbedPane);
JPanel fletchPanel = new JPanel();
tabbedPane.addTab("Woodcutting", null, fletchPanel, null);
fletchPanel.setLayout(null);
JLabel lblUsername = new JLabel("Username:");
lblUsername.setBounds(20, 20, 73, 20);
fletchPanel.add(lblUsername);
username.setBounds(20, 40, 150, 20);
fletchPanel.add(username);
JLabel lblPassword = new JLabel("Password:");
lblPassword.setBounds(20, 60, 73, 20);
fletchPanel.add(lblPassword);
password.setBounds(20, 80, 150, 20);
fletchPanel.add(password);
JLabel lblLocation = new JLabel("Location");
lblLocation.setBounds(200, 20, 73, 20);
fletchPanel.add(lblLocation);
/*
location.setModel(
new DefaultComboBoxModel(Methods.locationToStringArray()));
location.setBounds(200, 40, 150, 20);
fletchPanel.add(location);
*/
JLabel lblTree = new JLabel("Tree");
lblTree.setBounds(200, 60, 73, 20);
fletchPanel.add(lblTree);
treeSelect.setModel(new DefaultComboBoxModel(Trees.toStringArray()));
treeSelect.setBounds(200, 80, 150, 20);
fletchPanel.add(treeSelect);
JLabel lblMethod = new JLabel("Method");
lblMethod.setBounds(20, 120, 73, 20);
fletchPanel.add(lblMethod);
/*
woodcutOptionButtonGroup.add(bank);
bank.setSelected(true);
bank.setBounds(20, 140, 80, 20);
fletchPanel.add(bank);
woodcutOptionButtonGroup.add(drop);
drop.setBounds(20, 160, 80, 20);
fletchPanel.add(drop);
JLabel lblBirdsNest = new JLabel("Bird nests");
lblBirdsNest.setBounds(200, 120, 150, 20);
fletchPanel.add(lblBirdsNest);
birdsNest.setBounds(195, 140, 20, 20);
birdsNest.setSelected(true);
fletchPanel.add(birdsNest);
JLabel lblBirdsNestCheckBox = new JLabel("Pickup");
lblBirdsNestCheckBox.setBounds(215, 140, 150, 20);
fletchPanel.add(lblBirdsNestCheckBox);
location.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Location loc : Location.values()) {
if (loc.getName().equalsIgnoreCase(location.getSelectedItem().toString())) {
treeSelect.setModel(
new DefaultComboBoxModel(Methods.treeToStringArray(loc)));
}
}
}
});
*/
JButton start = new JButton("Start");
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
/*
for (Location loc : Location.values()) {
if (loc.getName().equalsIgnoreCase(location.getSelectedItem().toString())) {
Variables.setLocation(loc);
}
}
for (Tree selectedTree : Tree.values()) {
if (selectedTree.getName().equalsIgnoreCase(treeSelect.getSelectedItem().toString())) {
Variables.setTree(selectedTree);
System.out.println(selectedTree.getName());
}
}
if(!password.getText().equals("") && !username.getText().equals("")) {
Variables.setAccountUsername(username.getText());
Variables.setAccountPassword(password.getText());
}
if (drop.isSelected()) {
Variables.setDrop(true);
}
if (bank.isSelected()) {
Variables.setBanking(true);
}
if (birdsNest.isSelected()) {
Variables.setPickupBirdNests(true);
}
dispose();
*/
Variables.running = !Variables.running;
start.setText(Variables.running ? "pause" : "start");
}
});
start.setBounds(0, 220, 400, 20);
contentPane.add(start);
}
}