mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-03 00:38:36 +00:00
Add settings panel, choose which skill to train
This commit is contained in:
Generated
+8
-2
@@ -3,8 +3,14 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="">
|
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/ParaScript.iml" beforeDir="false" afterPath="$PROJECT_DIR$/ParaScript.iml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/ParaScript/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/Main.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/Main.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/data/Variables.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/data/Variables.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/data/variables/Trees.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/data/variables/Trees.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/strategies/Bank.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/strategies/Bank.java" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/ParaScript/strategies/Mine.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/strategies/Mine.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/strategies/Mine.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/strategies/Mine.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/strategies/Walk.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/strategies/Walk.java" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/src/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/ParaScript/ui/UI.java" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
@@ -33,8 +39,8 @@
|
|||||||
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
|
<property name="GenerateAntBuildDialog.forceTargetJdk" value="true" />
|
||||||
<property name="GenerateAntBuildDialog.generateSingleFile" value="true" />
|
<property name="GenerateAntBuildDialog.generateSingleFile" value="true" />
|
||||||
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="parascript" />
|
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="parascript" />
|
||||||
<property name="last_opened_file_path" value="$PROJECT_DIR$/../Script-Factory" />
|
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
||||||
<property name="project.structure.last.edited" value="Modules" />
|
<property name="project.structure.last.edited" value="Project" />
|
||||||
<property name="project.structure.proportion" value="0.15" />
|
<property name="project.structure.proportion" value="0.15" />
|
||||||
<property name="project.structure.side.proportion" value="0.2" />
|
<property name="project.structure.side.proportion" value="0.2" />
|
||||||
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
|
<property name="settings.editor.selected.configurable" value="project.propVCSSupport.Mappings" />
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
</content>
|
</content>
|
||||||
<orderEntry type="inheritedJdk" />
|
<orderEntry type="inheritedJdk" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="module-library">
|
<orderEntry type="module-library" exported="">
|
||||||
<library>
|
<library>
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$USER_HOME$/OneDrive/Documents/Java Dependencies/Parabot/Parabot-317-API-Minified.jar!/" />
|
<root url="jar://$USER_HOME$/OneDrive/Documents/Java Dependencies/Parabot/Parabot-317-API-Minified.jar!/" />
|
||||||
|
|||||||
@@ -26,8 +26,15 @@ public class Main extends Script{
|
|||||||
}
|
}
|
||||||
|
|
||||||
strategies.add(new ScriptState());
|
strategies.add(new ScriptState());
|
||||||
strategies.add(new MakeArrowShafts());
|
if(Variables.skill_to_train.equalsIgnoreCase("Woodcutting")) {
|
||||||
strategies.add(new WoodcutTree());
|
strategies.add(new MakeArrowShafts());
|
||||||
|
strategies.add(new WoodcutTree());
|
||||||
|
}
|
||||||
|
if(Variables.skill_to_train.equalsIgnoreCase("Mining")) {
|
||||||
|
strategies.add(new Mine());
|
||||||
|
strategies.add(new Bank());
|
||||||
|
strategies.add(new Walk());
|
||||||
|
}
|
||||||
strategies.add(new HandleLogin());
|
strategies.add(new HandleLogin());
|
||||||
provide(strategies);
|
provide(strategies);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public class Variables {
|
|||||||
private static String currentStatus = "none";
|
private static String currentStatus = "none";
|
||||||
private static String username = "";
|
private static String username = "";
|
||||||
private static String password = "";
|
private static String password = "";
|
||||||
|
public static String skill_to_train = "Woodcutting";
|
||||||
public static TilePath pathToWalk;
|
public static TilePath pathToWalk;
|
||||||
|
|
||||||
public static String getStatus() {
|
public static String getStatus() {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public enum Trees {
|
public enum Trees {
|
||||||
NORMAL("Normal", new int[]{1276, 1278}),
|
NORMAL("Normal", new int[]{1276, 1278, 1279}),
|
||||||
OAK("Oak", new int[]{1281}),
|
OAK("Oak", new int[]{1281}),
|
||||||
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}),
|
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}),
|
||||||
MAPLE("Maple", new int[]{1307});
|
MAPLE("Maple", new int[]{1307});
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public class Bank implements Strategy {
|
|||||||
Variables.setStatus("banking items");
|
Variables.setStatus("banking items");
|
||||||
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
|
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
|
||||||
Variables.pathToWalk.traverse();
|
Variables.pathToWalk.traverse();
|
||||||
Time.sleep(1000, 2000);
|
Time.sleep(2000, 3000);
|
||||||
}
|
}
|
||||||
depositItems();
|
depositItems();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package ParaScript.strategies;
|
||||||
|
|
||||||
|
import ParaScript.data.Variables;
|
||||||
|
import ParaScript.data.variables.Ores;
|
||||||
|
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 BankRunner implements Strategy {
|
||||||
|
private SceneObject ore;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean activate() {
|
||||||
|
ore = ore(); // set the local Variable
|
||||||
|
if (Variables.running
|
||||||
|
&& ore != null
|
||||||
|
&& (Variables.getStatus() == "none" || Variables.getStatus() == "mining")
|
||||||
|
&& Variables.VARROCK_EAST_MINE_ZONE.inTheZone()
|
||||||
|
&& !Players.getMyPlayer().isInCombat()
|
||||||
|
&& Players.getMyPlayer().getAnimation() == -1
|
||||||
|
&& !Inventory.isFull()) {
|
||||||
|
Variables.setStatus("mining");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Variables.setStatus("none");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
ore.interact(SceneObjects.Option.MINE);
|
||||||
|
Time.sleep(1000);
|
||||||
|
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
|
||||||
|
} catch (Exception err){
|
||||||
|
System.out.println("Mining error: ¯\\_(ツ)_/¯");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private SceneObject ore(){
|
||||||
|
int[] ore_to_mine = Ores.COPPER_TIN.getIDs();
|
||||||
|
if (Inventory.getCount(437) >= 14)
|
||||||
|
ore_to_mine = Ores.TIN.getIDs();
|
||||||
|
if (Inventory.getCount(439) >= 14)
|
||||||
|
ore_to_mine = Ores.COPPER.getIDs();
|
||||||
|
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
|
||||||
|
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
|
||||||
|
return ore;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,8 +2,6 @@ package ParaScript.strategies;
|
|||||||
|
|
||||||
import ParaScript.data.Variables;
|
import ParaScript.data.Variables;
|
||||||
import ParaScript.data.variables.Ores;
|
import ParaScript.data.variables.Ores;
|
||||||
import ParaScript.data.variables.Trees;
|
|
||||||
import com.sun.deploy.util.ArrayUtil;
|
|
||||||
import org.parabot.environment.api.utils.Time;
|
import org.parabot.environment.api.utils.Time;
|
||||||
import org.parabot.environment.scripts.framework.Strategy;
|
import org.parabot.environment.scripts.framework.Strategy;
|
||||||
import org.rev317.min.api.methods.Inventory;
|
import org.rev317.min.api.methods.Inventory;
|
||||||
@@ -44,9 +42,9 @@ public class Mine implements Strategy {
|
|||||||
|
|
||||||
private SceneObject ore(){
|
private SceneObject ore(){
|
||||||
int[] ore_to_mine = Ores.COPPER_TIN.getIDs();
|
int[] ore_to_mine = Ores.COPPER_TIN.getIDs();
|
||||||
if (Inventory.getCount(Ores.COPPER.getIDs()) >= 14)
|
if (Inventory.getCount(437) >= 14)
|
||||||
ore_to_mine = Ores.TIN.getIDs();
|
ore_to_mine = Ores.TIN.getIDs();
|
||||||
if (Inventory.getCount(Ores.TIN.getIDs()) >= 14)
|
if (Inventory.getCount(439) >= 14)
|
||||||
ore_to_mine = Ores.COPPER.getIDs();
|
ore_to_mine = Ores.COPPER.getIDs();
|
||||||
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
|
for(SceneObject ore : SceneObjects.getNearest(ore_to_mine)){
|
||||||
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
|
if(Variables.VARROCK_EAST_MINE_ZONE.inTheZoneObject(ore)) {
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ public class Walk implements Strategy {
|
|||||||
//Variables.setBotStatus("walking to " + Variables.getTree().getName());
|
//Variables.setBotStatus("walking to " + Variables.getTree().getName());
|
||||||
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
|
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
|
||||||
Variables.pathToWalk.traverse();
|
Variables.pathToWalk.traverse();
|
||||||
Time.sleep(1000, 2000);
|
Time.sleep(2000, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+45
-15
@@ -15,15 +15,18 @@ import java.awt.event.ActionListener;
|
|||||||
public class UI extends JFrame {
|
public class UI extends JFrame {
|
||||||
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
|
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
|
||||||
private JPanel contentPane;
|
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 JCheckBox birdsNest = new JCheckBox();
|
|
||||||
// Login tab
|
// Login tab
|
||||||
private JTextField username = new JTextField();
|
private JTextField username = new JTextField();
|
||||||
private JPasswordField password = new JPasswordField();
|
private JPasswordField password = new JPasswordField();
|
||||||
private JCheckBox autoLogin = new JCheckBox();
|
private JCheckBox autoLogin = new JCheckBox();
|
||||||
|
// Settings
|
||||||
|
private JComboBox skillSelect = new JComboBox();
|
||||||
|
private JRadioButton bank = new JRadioButton("Bank");
|
||||||
|
private JRadioButton drop = new JRadioButton("Drop");
|
||||||
|
// Woodcutting
|
||||||
|
private JComboBox treeSelect = new JComboBox();
|
||||||
|
private JComboBox location = new JComboBox();
|
||||||
|
private JCheckBox birdsNest = new JCheckBox();
|
||||||
// Our colors
|
// Our colors
|
||||||
private Color Color_MidnightBlue = new Color(44, 62, 80);
|
private Color Color_MidnightBlue = new Color(44, 62, 80);
|
||||||
private Color Color_WetAsphalt = new Color(52, 73, 94);
|
private Color Color_WetAsphalt = new Color(52, 73, 94);
|
||||||
@@ -84,22 +87,41 @@ public class UI extends JFrame {
|
|||||||
autoLogin.setSelected(true);
|
autoLogin.setSelected(true);
|
||||||
loginPanel.add(autoLogin);
|
loginPanel.add(autoLogin);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Settings
|
||||||
|
*/
|
||||||
|
JPanel settingsPanel = new JPanel();
|
||||||
|
settingsPanel.setForeground(Color_WhiteSmoke);
|
||||||
|
settingsPanel.setBackground(Color_WetAsphalt);
|
||||||
|
tabbedPane.addTab("Settings", null, settingsPanel, null);
|
||||||
|
settingsPanel.setLayout(null);
|
||||||
|
|
||||||
|
// Which skill are we training
|
||||||
|
JLabel lblSkillToTrain = new JLabel("Skill to train");
|
||||||
|
lblSkillToTrain.setForeground(Color_WhiteSmoke);
|
||||||
|
lblSkillToTrain.setBounds(20, 20, 73, 20);
|
||||||
|
settingsPanel.add(lblSkillToTrain);
|
||||||
|
skillSelect.setModel(new DefaultComboBoxModel(new String[]{
|
||||||
|
"Woodcutting",
|
||||||
|
"Mining",
|
||||||
|
}));
|
||||||
|
skillSelect.setBounds(20, 40, 150, 20);
|
||||||
|
settingsPanel.add(skillSelect);
|
||||||
|
skillSelect.addActionListener (new ActionListener () {
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
Variables.skill_to_train = skillSelect.getSelectedItem().toString();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
/*
|
||||||
|
* Woodcutting Stuff
|
||||||
|
*/
|
||||||
|
|
||||||
JPanel woodcuttingPanel = new JPanel();
|
JPanel woodcuttingPanel = new JPanel();
|
||||||
woodcuttingPanel.setForeground(Color_WhiteSmoke);
|
woodcuttingPanel.setForeground(Color_WhiteSmoke);
|
||||||
woodcuttingPanel.setBackground(Color_WetAsphalt);
|
woodcuttingPanel.setBackground(Color_WetAsphalt);
|
||||||
tabbedPane.addTab("Woodcutting", null, woodcuttingPanel, null);
|
tabbedPane.addTab("Woodcutting", null, woodcuttingPanel, null);
|
||||||
woodcuttingPanel.setLayout(null);
|
woodcuttingPanel.setLayout(null);
|
||||||
|
|
||||||
/*
|
|
||||||
JLabel lblLocation = new JLabel("Location");
|
|
||||||
lblLocation.setBounds(200, 20, 73, 20);
|
|
||||||
woodcuttingPanel.add(lblLocation);
|
|
||||||
|
|
||||||
location.setModel(new DefaultComboBoxModel(Methods.locationToStringArray()));
|
|
||||||
location.setBounds(200, 40, 150, 20);
|
|
||||||
woodcuttingPanel.add(location);
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Select which tree to cut
|
// Select which tree to cut
|
||||||
JLabel lblTree = new JLabel("Tree");
|
JLabel lblTree = new JLabel("Tree");
|
||||||
lblTree.setForeground(Color_WhiteSmoke);
|
lblTree.setForeground(Color_WhiteSmoke);
|
||||||
@@ -110,6 +132,14 @@ public class UI extends JFrame {
|
|||||||
woodcuttingPanel.add(treeSelect);
|
woodcuttingPanel.add(treeSelect);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
JLabel lblLocation = new JLabel("Location");
|
||||||
|
lblLocation.setBounds(200, 20, 73, 20);
|
||||||
|
woodcuttingPanel.add(lblLocation);
|
||||||
|
|
||||||
|
location.setModel(new DefaultComboBoxModel(Methods.locationToStringArray()));
|
||||||
|
location.setBounds(200, 40, 150, 20);
|
||||||
|
woodcuttingPanel.add(location);
|
||||||
|
|
||||||
JLabel lblMethod = new JLabel("Method");
|
JLabel lblMethod = new JLabel("Method");
|
||||||
lblMethod.setBounds(20, 120, 73, 20);
|
lblMethod.setBounds(20, 120, 73, 20);
|
||||||
woodcuttingPanel.add(lblMethod);
|
woodcuttingPanel.add(lblMethod);
|
||||||
|
|||||||
Reference in New Issue
Block a user