* Initial Maven

* Fixup

* Close window on script stop

* Extend Varrock mining area

* Allow selection of tree/ore to collect

* Show items gained, exp gained

* Fixup exp gain

* Add check for user logged in while walking

* Use Skill from the api

* Add drop, bank, fletch methods. Add Bank runner

* fixup Bank Runner

* fixup Bank Runner

* idk

* -

* Fixup Bank Runner
This commit is contained in:
Danial
2019-10-15 21:45:33 +13:00
committed by GitHub
parent 15eb36b99a
commit 377caf2346
31 changed files with 752 additions and 201 deletions
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="ParaScript" />
</profile>
</annotationProcessing>
<bytecodeTargetLevel>
<module name="ParaScript" target="8" />
</bytecodeTargetLevel>
</component>
</project>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: com.googlecode.json-simple:json-simple:1.1.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/googlecode/json-simple/json-simple/1.1.1/json-simple-1.1.1-sources.jar!/" />
</SOURCES>
</library>
</component>
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.ow2.asm:asm-all:5.0.4">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm-all/5.0.4/asm-all-5.0.4.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm-all/5.0.4/asm-all-5.0.4-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/ow2/asm/asm-all/5.0.4/asm-all-5.0.4-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.parabot:317-api-minified:1.21.3">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/317-api-minified/1.21.3/317-api-minified-1.21.3-sources.jar!/" />
</SOURCES>
</library>
</component>
+13
View File
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.parabot:client:2.7">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/client/2.7/client-2.7-sources.jar!/" />
</SOURCES>
</library>
</component>
@@ -0,0 +1,13 @@
<component name="libraryTable">
<library name="Maven: org.parabot:internal-api:1.52.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/org/parabot/internal-api/1.52.1/internal-api-1.52.1-sources.jar!/" />
</SOURCES>
</library>
</component>
+7
View File
@@ -1,5 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<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>
+21 -10
View File
@@ -3,14 +3,7 @@
<component name="ChangeListManager">
<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$/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/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/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" />
<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" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />
@@ -29,6 +22,13 @@
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="MavenImportPreferences">
<option name="importingSettings">
<MavenImportingSettings>
<option name="importAutomatically" value="true" />
</MavenImportingSettings>
</option>
</component>
<component name="ProjectId" id="1RwJc2HEUFTeubPY6u2X9b5qHk3" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
<ConfirmationsSetting value="1" id="Add" />
@@ -40,18 +40,29 @@
<property name="GenerateAntBuildDialog.generateSingleFile" value="true" />
<property name="GenerateAntBuildDialog.outputFileNameProperty" value="parascript" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="project.structure.last.edited" value="Project" />
<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="project.propVCSSupport.Mappings" />
</component>
<component name="RecentsManager">
<key name="ExtractSuperBase.RECENT_KEYS">
<recent name="ParaScript" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript\src\main" />
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript\src" />
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript\main\java" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="ParaScript.strategies" />
<recent name="ParaScript" />
<recent name="ParaScript.data.variables" />
<recent name="ParaScript.ui" />
<recent name="ParaScript.data" />
<recent name="ParaScript" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="C:\Users\Dan-j\Documents\GitHub\ParaScript" />
</key>
</component>
<component name="RunDashboard">
+11 -23
View File
@@ -1,31 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager">
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$USER_HOME$/OneDrive/Documents/Parabot/scripts/compiled" />
<output-test url="file://$MODULE_DIR$/out/test/ParaScript" />
<exclude-output />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library" exported="">
<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>
<orderEntry type="library" name="Maven: org.parabot:client:2.7" level="project" />
<orderEntry type="library" name="Maven: org.ow2.asm:asm-all:5.0.4" level="project" />
<orderEntry type="library" name="Maven: com.googlecode.json-simple:json-simple:1.1.1" level="project" />
<orderEntry type="library" name="Maven: org.parabot:internal-api:1.52.1" level="project" />
<orderEntry type="library" name="Maven: org.parabot:317-api-minified:1.21.3" level="project" />
</component>
</module>
+74
View File
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>src</groupId>
<artifactId>parascript</artifactId>
<version>1</version>
<properties>
<jdk.version>1.8</jdk.version>
</properties>
<repositories>
<repository>
<id>parabot-maven</id>
<name>Parabot its Maven Repository</name>
<url>http://maven.parabot.org/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.parabot</groupId>
<artifactId>client</artifactId>
<version>2.7</version>
</dependency>
<dependency>
<groupId>org.parabot</groupId>
<artifactId>317-api-minified</artifactId>
<version>1.21.3</version>
</dependency>
</dependencies>
<build>
<finalName>1000204</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>config.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<filtering>false</filtering>
<excludes>
<exclude>config.xml</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<excludes>
<exclude>src/main/resources/config.xml</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
-47
View File
@@ -1,47 +0,0 @@
package ParaScript;
import ParaScript.data.Variables;
import ParaScript.strategies.*;
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());
if(Variables.skill_to_train.equalsIgnoreCase("Woodcutting")) {
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());
provide(strategies);
return true;
}
@Override
public void onFinish() {
}
}
-71
View File
@@ -1,71 +0,0 @@
package ParaScript.data;
import ParaScript.data.variables.Trees;
import ParaScript.data.variables.Zone;
import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
import java.util.List;
public class Variables {
public static boolean running = false;
private static String currentStatus = "none";
// Login Panel
private static String username = "";
private static String password = "";
// Settings Panel
public static String skill_to_train = "Woodcutting";
// Used to walk places
public static TilePath pathToWalk;
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(3140, 3260), new Tile(3206, 3206));
// Mining Varrock
public final static Zone VARROCK_EAST_BANK_ZONE = new Zone(new Tile(3250, 3424), new Tile(3257, 3416));
public final static Zone VARROCK_EAST_MINE_ZONE = new Zone(new Tile(3278, 3372), new Tile(3295, 3358));
public final static Tile[] VARROCK_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[] VARROCK_EAST_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, 3371),
};
public static String getAccountUsername() { return username; }
public static void setAccountUsername(String i) { username = i; }
public static String getAccountPassword() { return password; }
public static void setAccountPassword(String i) { password = i; }
}
+108
View File
@@ -0,0 +1,108 @@
package ParaScript;
import ParaScript.data.Variables;
import ParaScript.strategies.*;
import ParaScript.ui.UI;
import org.parabot.environment.api.interfaces.Paintable;
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 org.rev317.min.api.events.MessageEvent;
import org.rev317.min.api.events.listeners.MessageListener;
import org.rev317.min.api.methods.Skill;
import java.awt.*;
import java.util.ArrayList;
@ScriptManifest(author = "RedSparr0w", category = Category.OTHER, description = "ParaScript", name = "ParaScript", servers = { "2006rebotted" }, version = 1)
public class Main extends Script implements MessageListener, Paintable {
private final ArrayList<Strategy> strategies = new ArrayList<Strategy>();
private UI ui = new UI();
@Override
public boolean onExecute() {
ui.setVisible(true);
while (!Variables.running) {
Time.sleep(300);
}
Variables.setBaseExp();
strategies.add(new ScriptState());
if(Variables.skill_to_train == Skill.WOODCUTTING) {
strategies.add(new MakeArrowShafts());
strategies.add(new WoodcutTree());
}
if(Variables.skill_to_train == Skill.MINING) {
strategies.add(new Mine());
strategies.add(new Bank());
strategies.add(new Walk());
}
if(Variables.skill_to_train == null) {
strategies.add(new Bank());
strategies.add(new Walk());
strategies.add(new PickupItems());
}
strategies.add(new HandleLogin());
provide(strategies);
return true;
}
@Override
public void onFinish() {
ui.dispose();
System.out.println("Script Stopped");
}
@Override
public void paint(Graphics graphics) {
Graphics2D g = (Graphics2D) graphics;
Color c2=new Color(0f,.749f,1.0f,.3f );
g.setColor(c2);
g.setBackground(c2);
g.fillRect(355, 232, 160, 20);
Color c=new Color(.686f,.933f,.933f,.3f );
g.setColor(c);
g.setBackground(c);
g.fillRect(355, 252, 160, 85);
g.setColor(Color.WHITE);
g.setFont(new Font("Arial", 1, 14));
g.drawString("ParaScript", 360, 247);
g.setFont(new Font("Arial", 1, 11));
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("EXP(P/H): " + Methods.formatNumber((int) Variables.expGained) + "(" + Methods.formatNumber(Variables.SCRIPT_TIMER.getPerHour((int) Variables.expGained)) + ")", 360, 310);
g.drawString("Runtime: " + Variables.SCRIPT_TIMER.toString(), 360, 330);
}
public void messageReceived(MessageEvent message) {
switch (message.getType()) {
case 0:
if (message.getMessage().startsWith("You manage to ")) {
Variables.addItemGained(1);
Variables.updateExpGained();
}
if (message.getMessage().contains("Congratulations, you advanced a woodcutting level.")) {
// add in level up to paint
}
break;
case 4:
if(Variables.skill_to_train == null) {
if (message.getMessage().startsWith(Variables.slaveMaster.toLowerCase() + " wishes to trade with you")) {
// accept trade
// take items, give items if smithing or similar
// goto bank, deposit/withdraw items
// go back to user
}
}
break;
}
}
}
+17
View File
@@ -0,0 +1,17 @@
package ParaScript;
import java.text.DecimalFormat;
public class Methods {
public static String formatNumber(int number) {
DecimalFormat nf = new DecimalFormat("0.0");
double i = number;
if (i >= 1000000) {
return nf.format((i / 1000000)) + "M";
}
if (i >= 1000) {
return nf.format((i / 1000)) + "K";
}
return "" + number;
}
}
@@ -0,0 +1,139 @@
package ParaScript.data;
import ParaScript.data.variables.Ores;
import ParaScript.data.variables.Trees;
import ParaScript.data.variables.Zone;
import org.parabot.environment.api.utils.Timer;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath;
import java.util.List;
public class Variables {
public static final Timer SCRIPT_TIMER = new Timer();
public static boolean running = false;
private static String currentStatus = "none";
public static int itemsGained = 0;
public static double baseExperience = 0;
public static double expGained = 0;
// Login Panel
private static String username = "";
private static String password = "";
// Settings Panel
public static Skill skill_to_train = Skill.WOODCUTTING;
// Woodcutting
public static Trees woodcutting_tree_selected = Trees.NORMAL;
public static String woodcutting_method = "Fletch";
// Mining
public static Ores mining_ore_selected = Ores.COPPER_TIN;
public static String mining_method = "Bank";
// Used for slave accounts
public static String slaveMaster = "";
// Used to walk places
public static TilePath pathToWalk;
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(3140, 3260), new Tile(3206, 3206));
// Mining Varrock
public final static Zone VARROCK_EAST_BANK_ZONE = new Zone(new Tile(3250, 3424), new Tile(3257, 3416));
public final static Zone VARROCK_EAST_MINE_ZONE = new Zone(new Tile(3276, 3375), new Tile(3298, 3354));
public final static Tile[] VARROCK_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[] VARROCK_EAST_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 void setAccountUsername(String i) { username = i; }
public static String getAccountPassword() { return password; }
public static void setAccountPassword(String i) { password = i; }
public static void addItemGained(int amount){
itemsGained += amount;
}
public static void setBaseExp(){
if (skill_to_train == null) return;
baseExperience = skill_to_train.getExperience();
}
public static void updateExpGained(){
if (skill_to_train == null) return;
expGained = skill_to_train.getExperience() - baseExperience;
}
public static boolean shouldBankItems(){
if (skill_to_train == null) return true;
switch (skill_to_train.getName()){
case "Woodcutting":
return woodcutting_method.equalsIgnoreCase("Bank");
case "Mining":
return mining_method.equalsIgnoreCase("Bank");
default:
return true;
}
}
public static boolean shouldDropItems(){
if (skill_to_train == null) return false;
switch (skill_to_train.getName()){
case "Woodcutting":
return woodcutting_method.equalsIgnoreCase("Drop");
case "Mining":
return mining_method.equalsIgnoreCase("Drop");
default:
return false;
}
}
public static boolean shouldFletchItems(){
if (skill_to_train == null) return false;
switch (skill_to_train.getName()){
case "Woodcutting":
return woodcutting_method.equalsIgnoreCase("Fletch");
default:
return false;
}
}
}
@@ -5,18 +5,20 @@ import java.util.Arrays;
import java.util.List;
public enum Ores {
COPPER("Copper", new int[]{2090}),
TIN("Tin", new int[]{2094}),
COPPER_TIN("Copper & Tin", new int[]{2090, 2094}),
IRON ("Iron", new int[]{2092}),
COAL("Coal", new int[]{});
COPPER_TIN("Copper & Tin", new int[]{2090, 2094}, 17.5),
COPPER("Copper", new int[]{2090}, 17.5),
TIN("Tin", new int[]{2094}, 17.5),
IRON ("Iron", new int[]{2092}, 35),
COAL("Coal", new int[]{}, 50);
private String name;
private int[] ids;
private double xp;
Ores(String name, int[] ids) {
Ores(String name, int[] ids, double xp) {
this.name = name;
this.ids = ids;
this.xp = xp;
}
public static String[] toStringArray() {
@@ -31,7 +33,9 @@ public enum Ores {
return(simpleArray);
}
public int[] getIDs() {
return this.ids;
}
public String getName() { return this.name; }
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
}
@@ -5,17 +5,19 @@ import java.util.Arrays;
import java.util.List;
public enum Trees {
NORMAL("Normal", new int[]{1276, 1278, 1279}),
OAK("Oak", new int[]{1281}),
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}),
MAPLE("Maple", new int[]{1307});
NORMAL("Normal", new int[]{1276, 1278, 1279}, 25),
OAK("Oak", new int[]{1281}, 37.5),
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}, 47.5),
MAPLE("Maple", new int[]{1307}, 100);
private String name;
private int[] ids;
private double xp;
Trees(String name, int[] ids) {
Trees(String name, int[] ids, double xp) {
this.name = name;
this.ids = ids;
this.xp = xp;
}
public static String[] toStringArray() {
@@ -30,7 +32,9 @@ public enum Trees {
return(simpleArray);
}
public int[] getIDs() {
return this.ids;
}
public String getName() { return this.name; }
public int[] getIDs() { return this.ids; }
public double getXP() { return this.xp; }
}
@@ -13,6 +13,7 @@ public class Bank implements Strategy {
public boolean activate() {
return Variables.running
&& Game.isLoggedIn()
&& Variables.shouldBankItems()
&& (Variables.getStatus() == "none" || Variables.getStatus() == "banking items")
&& Inventory.isFull();
}
@@ -22,11 +23,13 @@ public class Bank implements Strategy {
Variables.pathToWalk = new TilePath(Variables.VARROCK_EAST_MINE_PATH_TO_BANK);
Variables.setStatus("banking items");
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
if (!Game.isLoggedIn()) new HandleLogin().execute();
Variables.pathToWalk.traverse();
Time.sleep(2000, 3000);
}
depositItems();
}
public void depositItems() {
Npc banker[] = Npcs.getNearest(494);
@@ -34,10 +37,14 @@ public class Bank implements Strategy {
banker[0].interact(Npcs.Option.BANK);
Time.sleep(3000);
if (Game.getOpenInterfaceId() == 5292) {
//Pick Axes
org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276);
//Axes
//org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740);
if (Variables.skill_to_train == Skill.MINING)
org.rev317.min.api.methods.Bank.depositAllExcept(1266, 1268, 1270, 1272, 1274, 1276);
if (Variables.skill_to_train == Skill.WOODCUTTING)
org.rev317.min.api.methods.Bank.depositAllExcept(1350, 1352, 1354, 1356, 1358, 1360, 6740);
if (Variables.skill_to_train == null) {
org.rev317.min.api.methods.Bank.depositAllExcept(1);
Variables.addItemGained(28);
}
Variables.setStatus("none");
}
}
@@ -5,6 +5,7 @@ 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.Items;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.SceneObjects;
import org.rev317.min.api.wrappers.SceneObject;
@@ -32,6 +33,9 @@ public class Mine implements Strategy {
@Override
public void execute() {
try {
if (Variables.shouldDropItems()) {
if (Inventory.getCount(441) >= 1) Inventory.getItem(441).interact(Items.Option.DROP);
}
ore.interact(SceneObjects.Option.MINE);
Time.sleep(1000);
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 3000);
@@ -41,11 +45,13 @@ public class Mine implements Strategy {
}
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();
int[] ore_to_mine = Variables.mining_ore_selected.getIDs();
if (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;
@@ -0,0 +1,47 @@
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.GroundItems;
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.GroundItem;
import org.rev317.min.api.wrappers.SceneObject;
public class PickupItems implements Strategy {
@Override
public boolean activate() {
if (Variables.running
&& (Variables.getStatus() == "none" || Variables.getStatus() == "picking up items")
&& Variables.VARROCK_EAST_MINE_ZONE.inTheZone()
&& !Players.getMyPlayer().isInCombat()
&& Players.getMyPlayer().getAnimation() == -1
&& !Inventory.isFull()) {
Variables.setStatus("picking up items");
return true;
}
Variables.setStatus("none");
return false;
}
@Override
public void execute() {
try {
GroundItem[] items = GroundItems.getNearest(436, 438, 440);
for (GroundItem item : items) {
item.take();
Time.sleep(1500);
if (Inventory.isFull()){
Variables.setStatus("none");
return;
}
}
} catch (Exception err){
System.out.println("Pickup items error: ¯\\_(ツ)_/¯");
}
}
}
@@ -24,6 +24,7 @@ public class Walk implements Strategy {
Variables.pathToWalk = new TilePath(Variables.VARROCK_EAST_BANK_PATH_TO_MINE);
//Variables.setBotStatus("walking to " + Variables.getTree().getName());
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
if (!Game.isLoggedIn()) new HandleLogin().execute();
Variables.pathToWalk.traverse();
Time.sleep(2000, 3000);
}
@@ -37,7 +37,8 @@ public class WoodcutTree implements Strategy {
}
private SceneObject tree(){
for(SceneObject tree : SceneObjects.getNearest(Trees.NORMAL.getIDs())){
int[] tree_to_cut = Variables.woodcutting_tree_selected.getIDs();
for(SceneObject tree : SceneObjects.getNearest(tree_to_cut)){
if(tree != null){
if(Variables.LUMBRIDGE_NORMAL_TREE_ZONE.inTheZoneObject(tree)) {
return tree;
@@ -1,9 +1,11 @@
package ParaScript.ui;
import ParaScript.data.variables.Ores;
import ParaScript.data.variables.Trees;
import ParaScript.data.Variables;
import org.rev317.min.api.methods.Game;
import org.rev317.min.api.methods.Players;
import org.rev317.min.api.methods.Skill;
import org.rev317.min.api.wrappers.Player;
import javax.swing.*;
@@ -15,18 +17,25 @@ import java.awt.event.ActionListener;
public class UI extends JFrame {
private final ButtonGroup woodcutOptionButtonGroup = new ButtonGroup();
private JPanel contentPane;
// Login tab
private JTextField username = new JTextField();
private JPasswordField password = new JPasswordField();
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 woodcuttingMethod = new JComboBox();
private JComboBox location = new JComboBox();
private JCheckBox birdsNest = new JCheckBox();
// Mining
private JComboBox oreSelect = new JComboBox();
private JComboBox miningMethod = new JComboBox();
// Our colors
private Color Color_MidnightBlue = new Color(44, 62, 80);
private Color Color_WetAsphalt = new Color(52, 73, 94);
@@ -35,7 +44,7 @@ public class UI extends JFrame {
private Color Color_Alizarin = new Color(231, 76, 60);
public UI() {
setTitle("ParaScript");
setTitle("src/ParaScript");
setResizable(false);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 400, 300);
@@ -51,7 +60,7 @@ public class UI extends JFrame {
contentPane.add(tabbedPane);
/*
* Login Stuff
* Login Panel
*/
JPanel loginPanel = new JPanel();
loginPanel.setForeground(Color_WhiteSmoke);
@@ -88,7 +97,7 @@ public class UI extends JFrame {
loginPanel.add(autoLogin);
/*
* Settings
* Settings Panel
*/
JPanel settingsPanel = new JPanel();
settingsPanel.setForeground(Color_WhiteSmoke);
@@ -102,18 +111,26 @@ public class UI extends JFrame {
lblSkillToTrain.setBounds(20, 20, 73, 20);
settingsPanel.add(lblSkillToTrain);
skillSelect.setModel(new DefaultComboBoxModel(new String[]{
"Woodcutting",
"Mining",
Skill.WOODCUTTING.getName(),
Skill.MINING.getName(),
"Bank Runner",
}));
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();
for (Skill skill : Skill.values()) {
if (skill.getName().equalsIgnoreCase(skillSelect.getSelectedItem().toString())) {
Variables.skill_to_train = skill;
return;
}
Variables.skill_to_train = null;
}
}
});
settingsPanel.add(skillSelect);
/*
* Woodcutting Stuff
* Woodcutting Panel
*/
JPanel woodcuttingPanel = new JPanel();
@@ -125,12 +142,39 @@ public class UI extends JFrame {
// Select which tree to cut
JLabel lblTree = new JLabel("Tree");
lblTree.setForeground(Color_WhiteSmoke);
lblTree.setBounds(20, 20, 73, 20);
lblTree.setBounds(20, 20, 150, 20);
woodcuttingPanel.add(lblTree);
treeSelect.setModel(new DefaultComboBoxModel(Trees.toStringArray()));
treeSelect.setBounds(20, 40, 150, 20);
treeSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Trees tree : Trees.values()) {
if (tree.getName().equalsIgnoreCase(treeSelect.getSelectedItem().toString())) {
Variables.woodcutting_tree_selected = tree;
}
}
}
});
woodcuttingPanel.add(treeSelect);
// What should we do with our logs
JLabel lblWoodcuttingMethod = new JLabel("Method");
lblWoodcuttingMethod.setForeground(Color_WhiteSmoke);
lblWoodcuttingMethod.setBounds(20, 60, 150, 20);
woodcuttingPanel.add(lblWoodcuttingMethod);
woodcuttingMethod.setModel(new DefaultComboBoxModel(new String[]{
"Fletch",
"Bank",
"Drop",
}));
woodcuttingMethod.setBounds(20, 80, 150, 20);
woodcuttingMethod.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.woodcutting_method = woodcuttingMethod.getSelectedItem().toString();
}
});
woodcuttingPanel.add(woodcuttingMethod);
/*
JLabel lblLocation = new JLabel("Location");
lblLocation.setBounds(200, 20, 73, 20);
@@ -140,18 +184,6 @@ public class UI extends JFrame {
location.setBounds(200, 40, 150, 20);
woodcuttingPanel.add(location);
JLabel lblMethod = new JLabel("Method");
lblMethod.setBounds(20, 120, 73, 20);
woodcuttingPanel.add(lblMethod);
woodcutOptionButtonGroup.add(bank);
bank.setSelected(true);
bank.setBounds(20, 140, 80, 20);
woodcuttingPanel.add(bank);
woodcutOptionButtonGroup.add(drop);
drop.setBounds(20, 160, 80, 20);
woodcuttingPanel.add(drop);
JLabel lblBirdsNest = new JLabel("Bird nests");
lblBirdsNest.setForeground(WhiteSmoke);
@@ -178,6 +210,74 @@ public class UI extends JFrame {
});
*/
/*
* Mining Panel
*/
JPanel miningPanel = new JPanel();
miningPanel.setForeground(Color_WhiteSmoke);
miningPanel.setBackground(Color_WetAsphalt);
tabbedPane.addTab("Mining", null, miningPanel, null);
miningPanel.setLayout(null);
// Select which ore to mine
JLabel lblOre = new JLabel("Ore");
lblOre.setForeground(Color_WhiteSmoke);
lblOre.setBounds(20, 20, 73, 20);
miningPanel.add(lblOre);
oreSelect.setModel(new DefaultComboBoxModel(Ores.toStringArray()));
oreSelect.setBounds(20, 40, 150, 20);
oreSelect.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
for (Ores ore : Ores.values()) {
if (ore.getName().equalsIgnoreCase(oreSelect.getSelectedItem().toString())) {
Variables.mining_ore_selected = ore;
}
}
}
});
miningPanel.add(oreSelect);
// What should we do with our ores
JLabel lblMiningMethod = 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.mining_method = miningMethod.getSelectedItem().toString();
}
});
miningPanel.add(miningMethod);
/*
* Slave Panel
*/
JPanel slavePanel = new JPanel();
slavePanel.setForeground(Color_WhiteSmoke);
slavePanel.setBackground(Color_WetAsphalt);
tabbedPane.addTab("Bank Runner", null, slavePanel, null);
slavePanel.setLayout(null);
// Which skill are we training
JLabel lblSlaveMaster = new JLabel("Slave Master");
lblSlaveMaster.setForeground(Color_WhiteSmoke);
lblSlaveMaster.setBounds(20, 20, 73, 20);
slavePanel.add(lblSlaveMaster);
JTextField slaveMaster = new JTextField();
slaveMaster.setBounds(20, 40, 150, 20);
slavePanel.add(slaveMaster);
slaveMaster.addActionListener (new ActionListener () {
public void actionPerformed(ActionEvent e) {
Variables.slaveMaster = slaveMaster.getText();
}
});
JButton start = new JButton("START");
start.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
<jars basedir="${project.basedir}/target/">
<jar in="${project.build.finalName}.jar" out="/home/ci/jars/${project.build.finalName}.jar"/>
</jars>
<classpath basedir="/home/ci/allatori/libs">
<jar name="./*.jar"/>
</classpath>
<!-- String encryption -->
<property name="string-encryption" value="enable"/>
<property name="string-encryption-type" value="fast"/>
<property name="string-encryption-version" value="v4"/>
<!-- Control flow obfuscation -->
<property name="control-flow-obfuscation" value="enable"/>
<property name="extensive-flow-obfuscation" value="normal"/>
<!-- Renaming -->
<property name="default-package" value=""/>
<property name="force-default-package" value="disable"/>
<property name="classes-naming" value="unique"/>
<property name="methods-naming" value="iii"/>
<property name="fields-naming" value="iii"/>
<property name="local-variables-naming" value="abc"/>
<!-- Other -->
<property name="line-numbers" value="keep"/>
<property name="generics" value="keep"/>
<property name="member-reorder" value="enable"/>
<property name="finalize" value="disable"/>
<property name="synthetize-methods" value="private"/>
<property name="synthetize-fields" value="private"/>
<property name="remove-toString" value="disable"/>
</config>
Binary file not shown.
+37
View File
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<config>
<jars basedir="C:/Users/Dan-j/IdeaProjects/ParaScript/target/">
<jar in="1000204.jar" out="/home/ci/jars/1000204.jar"/>
</jars>
<classpath basedir="/home/ci/allatori/libs">
<jar name="./*.jar"/>
</classpath>
<!-- String encryption -->
<property name="string-encryption" value="enable"/>
<property name="string-encryption-type" value="fast"/>
<property name="string-encryption-version" value="v4"/>
<!-- Control flow obfuscation -->
<property name="control-flow-obfuscation" value="enable"/>
<property name="extensive-flow-obfuscation" value="normal"/>
<!-- Renaming -->
<property name="default-package" value=""/>
<property name="force-default-package" value="disable"/>
<property name="classes-naming" value="unique"/>
<property name="methods-naming" value="iii"/>
<property name="fields-naming" value="iii"/>
<property name="local-variables-naming" value="abc"/>
<!-- Other -->
<property name="line-numbers" value="keep"/>
<property name="generics" value="keep"/>
<property name="member-reorder" value="enable"/>
<property name="finalize" value="disable"/>
<property name="synthetize-methods" value="private"/>
<property name="synthetize-fields" value="private"/>
<property name="remove-toString" value="disable"/>
</config>