Renamed to 2006AIO & Got basic thieving bot working

This commit is contained in:
Dark98
2019-10-20 20:30:28 +01:00
parent 377caf2346
commit 0ff447fc99
9 changed files with 159 additions and 13 deletions
Generated
-1
View File
@@ -2,6 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$/ParaScript" vcs="Git" />
</component> </component>
</project> </project>
+14 -1
View File
@@ -2,8 +2,15 @@
<project version="4"> <project version="4">
<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 afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/variables/Npcs.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/vcs.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<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$/src/main/java/ParaScript/strategies/Bank.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Bank.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/ParaScript.iml" beforeDir="false" afterPath="$PROJECT_DIR$/ParaScript.iml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/Main.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/data/Variables.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/strategies/Thieving.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/ParaScript/ui/UI.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/target/classes/config.xml" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/config.xml" 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" />
@@ -39,6 +46,7 @@
<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="SHARE_PROJECT_CONFIGURATION_FILES" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" /> <property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Modules" /> <property name="project.structure.last.edited" value="Modules" />
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
@@ -110,4 +118,9 @@
</map> </map>
</option> </option>
</component> </component>
<component name="VcsManagerConfiguration">
<ignored-roots>
<path value="$PROJECT_DIR$/ParaScript" />
</ignored-roots>
</component>
</project> </project>
+1 -1
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> <module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8"> <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$USER_HOME$/OneDrive/Documents/Parabot/scripts/compiled" /> <output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" /> <output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
+11 -4
View File
@@ -16,7 +16,7 @@ import org.rev317.min.api.methods.Skill;
import java.awt.*; import java.awt.*;
import java.util.ArrayList; import java.util.ArrayList;
@ScriptManifest(author = "RedSparr0w", category = Category.OTHER, description = "ParaScript", name = "ParaScript", servers = { "2006rebotted" }, version = 1) @ScriptManifest(author = "RedSparr0w & Dark98", category = Category.OTHER, description = "2006 AIO Script", name = "2006AIO", servers = { "2006rebotted" }, version = 1)
public class Main extends Script implements MessageListener, Paintable { public class Main extends Script implements MessageListener, Paintable {
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>(); private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
@@ -41,6 +41,9 @@ public class Main extends Script implements MessageListener, Paintable {
strategies.add(new Bank()); strategies.add(new Bank());
strategies.add(new Walk()); strategies.add(new Walk());
} }
if(Variables.skill_to_train == Skill.THIEVING) {
strategies.add(new Thieving());
}
if(Variables.skill_to_train == null) { if(Variables.skill_to_train == null) {
strategies.add(new Bank()); strategies.add(new Bank());
strategies.add(new Walk()); strategies.add(new Walk());
@@ -72,9 +75,9 @@ public class Main extends Script implements MessageListener, Paintable {
g.fillRect(355, 252, 160, 85); g.fillRect(355, 252, 160, 85);
g.setColor(Color.WHITE); g.setColor(Color.WHITE);
g.setFont(new Font("Arial", 1, 14)); g.setFont(new Font("Arial", Font.BOLD, 14));
g.drawString("ParaScript", 360, 247); g.drawString("2006AIO", 360, 247);
g.setFont(new Font("Arial", 1, 11)); g.setFont(new Font("Arial", Font.BOLD, 11));
g.drawString("Status: " + Variables.getStatus(), 360, 270); g.drawString("Status: " + Variables.getStatus(), 360, 270);
g.drawString("Items(P/H): " + Methods.formatNumber(Variables.itemsGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour(Variables.itemsGained)) + ")", 360, 290); g.drawString("Items(P/H): " + Methods.formatNumber(Variables.itemsGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour(Variables.itemsGained)) + ")", 360, 290);
g.drawString("EXP(P/H): " + Methods.formatNumber((int) Variables.expGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour((int) Variables.expGained)) + ")", 360, 310); g.drawString("EXP(P/H): " + Methods.formatNumber((int) Variables.expGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour((int) Variables.expGained)) + ")", 360, 310);
@@ -89,6 +92,10 @@ public class Main extends Script implements MessageListener, Paintable {
Variables.addItemGained(1); Variables.addItemGained(1);
Variables.updateExpGained(); Variables.updateExpGained();
} }
if (message.getMessage().startsWith("You pick the ")) {
Variables.addItemGained(1);
Variables.updateExpGained();
}
if (message.getMessage().contains("Congratulations, you advanced a woodcutting level.")) { if (message.getMessage().contains("Congratulations, you advanced a woodcutting level.")) {
// add in level up to paint // add in level up to paint
} }
@@ -1,5 +1,6 @@
package ParaScript.data; package ParaScript.data;
import ParaScript.data.variables.Npcs;
import ParaScript.data.variables.Ores; import ParaScript.data.variables.Ores;
import ParaScript.data.variables.Trees; import ParaScript.data.variables.Trees;
import ParaScript.data.variables.Zone; import ParaScript.data.variables.Zone;
@@ -34,6 +35,11 @@ public class Variables {
public static Ores mining_ore_selected = Ores.COPPER_TIN; public static Ores mining_ore_selected = Ores.COPPER_TIN;
public static String mining_method = "Bank"; public static String mining_method = "Bank";
//Thieving
public static Npcs thieving_npc_selected = Npcs.MAN;
public static String thieving_method = "None";
// Used for slave accounts // Used for slave accounts
public static String slaveMaster = ""; public static String slaveMaster = "";
@@ -81,7 +87,35 @@ public class Variables {
new Tile(3287, 3370), new Tile(3287, 3370),
}; };
//mining lumbridge
public final static Zone LUMBRIDGE_BANK_ZONE = new Zone(new Tile(3205, 3225), new Tile(3211, 3214));
public final static Zone LUMBRIDGE_MINE_ZONE = new Zone(new Tile(3276, 3375), new Tile(3298, 3354));
public final static Tile[] LUMBRIDGE_EAST_MINE_PATH_TO_BANK = new Tile[]{
new Tile(3289, 3373),
new Tile(3289, 3373),
new Tile(3290, 3384),
new Tile(3290, 3395),
new Tile(3289, 3406),
new Tile(3281, 3416),
new Tile(3275, 3425),
new Tile(3264, 3426),
new Tile(3253, 3425),
new Tile(3253, 3420),
};
public final static Tile[] LUMBRIDGE_BANK_PATH_TO_MINE = new Tile[] {
new Tile(3253, 3423),
new Tile(3253, 3423),
new Tile(3262, 3427),
new Tile(3273, 3427),
new Tile(3280, 3418),
new Tile(3288, 3408),
new Tile(3290, 3397),
new Tile(3290, 3386),
new Tile(3288, 3375),
new Tile(3287, 3370),
};
public static String getAccountUsername() { return username; } public static String getAccountUsername() { return username; }
public static void setAccountUsername(String i) { username = i; } public static void setAccountUsername(String i) { username = i; }
@@ -0,0 +1,37 @@
package ParaScript.data.variables;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public enum Npcs {
MAN("Man", new int[]{3}, 8);
private String name;
private int[] ids;
private double xp;
Npcs(String name, int[] ids, double xp) {
this.name = name;
this.ids = ids;
this.xp = xp;
}
public static String[] toStringArray() {
List<Npcs> enumList = Arrays.asList(Npcs.values());
List<String> locationsArray = new ArrayList<>();
for (Npcs npc : enumList) {
locationsArray.add(npc.name);
}
String[] simpleArray = new String[ locationsArray.size() ];
locationsArray.toArray( simpleArray );
return(simpleArray);
}
public String getName() { return this.name; }
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
}
@@ -4,12 +4,14 @@ import ParaScript.data.Variables;
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;
import org.rev317.min.api.methods.Npcs;
import org.rev317.min.api.methods.Players; import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects; import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.Npc;
import org.rev317.min.api.wrappers.SceneObject; import org.rev317.min.api.wrappers.SceneObject;
public class Thieving implements Strategy { public class Thieving implements Strategy {
private SceneObject victim; private Npc victim;
@Override @Override
public boolean activate() { public boolean activate() {
@@ -19,21 +21,24 @@ public class Thieving implements Strategy {
&& !Players.getMyPlayer().isInCombat() && !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1 && Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) { && !Inventory.isFull()) {
Variables.setStatus("thieving");
return true; return true;
} }
Variables.setStatus("none");
return false; return false;
} }
@Override @Override
public void execute() { public void execute() {
victim.interact(SceneObjects.Option.STEAL_FROM); victim.interact(Npcs.Option.PICKPOCKET);
Time.sleep(1000); Time.sleep(1000);
//Wait for the Player to finish pickpocketing //Wait for the Player to finish pickpocketing
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500); Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500);
} }
private SceneObject victim(){ private Npc victim(){
for(SceneObject victim : SceneObjects.getNearest(1, 2, 3, 4)){ int[] npc_to_thieve = Variables.thieving_npc_selected.getIDs();
for(Npc victim : Npcs.getNearest(npc_to_thieve)){
if(victim != null){ if(victim != null){
return victim; return victim;
} }
+52 -1
View File
@@ -1,5 +1,6 @@
package ParaScript.ui; package ParaScript.ui;
import ParaScript.data.variables.Npcs;
import ParaScript.data.variables.Ores; import ParaScript.data.variables.Ores;
import ParaScript.data.variables.Trees; import ParaScript.data.variables.Trees;
import ParaScript.data.Variables; import ParaScript.data.Variables;
@@ -36,6 +37,10 @@ public class UI extends JFrame {
private JComboBox oreSelect = new JComboBox(); private JComboBox oreSelect = new JComboBox();
private JComboBox miningMethod = new JComboBox(); private JComboBox miningMethod = new JComboBox();
//Thieving
private JComboBox npcSelect = new JComboBox();
private JComboBox thievingMethod = new JComboBox();
// 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);
@@ -44,7 +49,7 @@ public class UI extends JFrame {
private Color Color_Alizarin = new Color(231, 76, 60); private Color Color_Alizarin = new Color(231, 76, 60);
public UI() { public UI() {
setTitle("src/ParaScript"); setTitle("2006AIO");
setResizable(false); setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 400, 300); setBounds(100, 100, 400, 300);
@@ -113,6 +118,7 @@ public class UI extends JFrame {
skillSelect.setModel(new DefaultComboBoxModel(new String[]{ skillSelect.setModel(new DefaultComboBoxModel(new String[]{
Skill.WOODCUTTING.getName(), Skill.WOODCUTTING.getName(),
Skill.MINING.getName(), Skill.MINING.getName(),
Skill.THIEVING.getName(),
"Bank Runner", "Bank Runner",
})); }));
skillSelect.setBounds(20, 40, 150, 20); skillSelect.setBounds(20, 40, 150, 20);
@@ -255,6 +261,51 @@ public class UI extends JFrame {
}); });
miningPanel.add(miningMethod); miningPanel.add(miningMethod);
/*
* Thieving Panel
*/
JPanel thievingPanel = new JPanel();
thievingPanel.setForeground(Color_WhiteSmoke);
thievingPanel.setBackground(Color_WetAsphalt);
tabbedPane.addTab("Thieving", null, thievingPanel, null);
thievingPanel.setLayout(null);
// Select which ore to mine
JLabel lblNpc = new JLabel("NPC");
lblOre.setForeground(Color_WhiteSmoke);
lblOre.setBounds(20, 20, 73, 20);
thievingPanel.add(lblNpc);
npcSelect.setModel(new DefaultComboBoxModel(Npcs.toStringArray()));
npcSelect.setBounds(20, 40, 150, 20);
npcSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Npcs npc : Npcs.values()) {
if (npc.getName().equalsIgnoreCase(npcSelect.getSelectedItem().toString())) {
Variables.thieving_npc_selected = npc;
}
}
}
});
thievingPanel.add(npcSelect);
// What should we do with our ores
JLabel lblTheivingMethod = new JLabel("Method");
lblMiningMethod.setForeground(Color_WhiteSmoke);
lblMiningMethod.setBounds(20, 60, 150, 20);
miningPanel.add(lblMiningMethod);
miningMethod.setModel(new DefaultComboBoxModel(new String[]{
"Bank",
"Drop",
}));
miningMethod.setBounds(20, 80, 150, 20);
miningMethod.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.thieving_method = thievingMethod.getSelectedItem().toString();
}
});
miningPanel.add(thievingMethod);
/* /*
* Slave Panel * Slave Panel
*/ */
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config> <config>
<jars basedir="C:/Users/Dan-j/IdeaProjects/ParaScript/target/"> <jars basedir="C:\\Users\\DarkA\\Desktop\\ParaScript/target/">
<jar in="1000204.jar" out="/home/ci/jars/1000204.jar"/> <jar in="1000204.jar" out="/home/ci/jars/1000204.jar"/>
</jars> </jars>