mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-03 08:39:12 +00:00
Initial Maven
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
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 org.rev317.min.api.events.MessageEvent;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ScriptManifest(author = "RedSparr0w", category = Category.OTHER, description = "src/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());
|
||||
}
|
||||
if(Variables.skill_to_train.equalsIgnoreCase("Bank Runner")) {
|
||||
strategies.add(new Bank());
|
||||
strategies.add(new Walk());
|
||||
}
|
||||
strategies.add(new HandleLogin());
|
||||
provide(strategies);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
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("AIOWoodcutter", 360, 247);
|
||||
g.setFont(new Font("Arial", 1, 11));
|
||||
g.drawString("Status: " + Variables.getStatus(), 360, 270);
|
||||
g.drawString("Logs(P/H): " + 10 + "(" + 120 + ")", 360, 290);
|
||||
g.drawString("EXP(P/H): " + 1000 + "(" + 12685 + ")", 360, 310);
|
||||
g.drawString("Runtime: " + "02:22:20", 360, 330);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void messageReceived(MessageEvent message) {
|
||||
switch (message.getType()) {
|
||||
case 0:
|
||||
if (message.getMessage().contains("Congratulations, you advanced a woodcutting level.")) {
|
||||
// add in level up to paint
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(Variables.skill_to_train.equalsIgnoreCase("Bank Runner")) {
|
||||
if (message.getMessage().startsWith(Variables.slaveMaster.toLowerCase() + " wishes to trade with you")) {
|
||||
// add in level up to paint
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
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 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(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; }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package ParaScript.data.variables;
|
||||
|
||||
import java.util.ArrayList;
|
||||
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[]{});
|
||||
|
||||
private String name;
|
||||
private int[] ids;
|
||||
|
||||
Ores(String name, int[] ids) {
|
||||
this.name = name;
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
public static String[] toStringArray() {
|
||||
List<Ores> enumList = Arrays.asList(Ores.values());
|
||||
List<String> locationsArray = new ArrayList<>();
|
||||
for (Ores obj : enumList) {
|
||||
locationsArray.add(obj.name);
|
||||
}
|
||||
|
||||
String[] simpleArray = new String[ locationsArray.size() ];
|
||||
locationsArray.toArray( simpleArray );
|
||||
return(simpleArray);
|
||||
}
|
||||
|
||||
public int[] getIDs() {
|
||||
return this.ids;
|
||||
}
|
||||
}
|
||||
@@ -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, 1279}),
|
||||
OAK("Oak", new int[]{1281}),
|
||||
WILLOW ("Willow", new int[]{5551, 1308, 5553, 5552}),
|
||||
MAPLE("Maple", new int[]{1307});
|
||||
|
||||
private String name;
|
||||
private int[] ids;
|
||||
|
||||
Trees(String name, int[] ids) {
|
||||
this.name = name;
|
||||
this.ids = ids;
|
||||
}
|
||||
|
||||
public static String[] toStringArray() {
|
||||
List<Trees> enumList = Arrays.asList(Trees.values());
|
||||
List<String> locationsArray = new ArrayList<>();
|
||||
for (Trees obj : enumList) {
|
||||
locationsArray.add(obj.name);
|
||||
}
|
||||
|
||||
String[] simpleArray = new String[ locationsArray.size() ];
|
||||
locationsArray.toArray( simpleArray );
|
||||
return(simpleArray);
|
||||
}
|
||||
|
||||
public int[] getIDs() {
|
||||
return this.ids;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
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.*;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
import org.rev317.min.api.wrappers.TilePath;
|
||||
|
||||
public class Bank implements Strategy {
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return Variables.running
|
||||
&& Game.isLoggedIn()
|
||||
&& (Variables.getStatus() == "none" || Variables.getStatus() == "banking items")
|
||||
&& Inventory.isFull();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Variables.pathToWalk = new TilePath(Variables.VARROCK_EAST_MINE_PATH_TO_BANK);
|
||||
Variables.setStatus("banking items");
|
||||
while (Variables.pathToWalk != null && !Variables.pathToWalk.hasReached()) {
|
||||
Variables.pathToWalk.traverse();
|
||||
Time.sleep(2000, 3000);
|
||||
}
|
||||
depositItems();
|
||||
}
|
||||
public void depositItems() {
|
||||
Npc banker[] = Npcs.getNearest(494);
|
||||
|
||||
if (banker != null) {
|
||||
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);
|
||||
Variables.setStatus("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package ParaScript.strategies;
|
||||
|
||||
import ParaScript.data.Variables;
|
||||
import org.parabot.environment.api.utils.Time;
|
||||
import org.parabot.environment.input.Keyboard;
|
||||
import org.parabot.environment.input.Mouse;
|
||||
import org.parabot.environment.scripts.framework.SleepCondition;
|
||||
import org.parabot.environment.scripts.framework.Strategy;
|
||||
import org.rev317.min.api.methods.Game;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
public class HandleLogin implements Strategy {
|
||||
|
||||
private Point point = new Point(432, 282);
|
||||
private Point point2 = new Point(328, 324);
|
||||
private Boolean typed = false;
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return !Game.isLoggedIn() || Game.getOpenBackDialogId() == 15812;
|
||||
}
|
||||
|
||||
public void execute() {
|
||||
Variables.setStatus("logging in");
|
||||
|
||||
if (Game.isLoggedIn() && Game.getOpenInterfaceId() == 15812) {
|
||||
Mouse.getInstance().click(point2);
|
||||
Variables.setStatus("none");
|
||||
}
|
||||
if (!Game.isLoggedIn()) {
|
||||
if(Variables.getAccountPassword() != null && Variables.getAccountUsername() != null) {
|
||||
if(!typed) {
|
||||
Mouse.getInstance().click(point);
|
||||
Time.sleep(1000);
|
||||
clearInput();
|
||||
Keyboard.getInstance().sendKeys(Variables.getAccountUsername());
|
||||
Time.sleep(2000);
|
||||
|
||||
clearInput();
|
||||
// Checking again so people don't type their passwords ingame.
|
||||
if(!Game.isLoggedIn()) {
|
||||
Keyboard.getInstance().sendKeys(Variables.getAccountPassword());
|
||||
}
|
||||
|
||||
typed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(typed) {
|
||||
Time.sleep(new SleepCondition() {
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return Game.isLoggedIn();
|
||||
}
|
||||
}, 5000);
|
||||
Mouse.getInstance().click(point);
|
||||
Time.sleep(1000);
|
||||
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
|
||||
Time.sleep(1000);
|
||||
Keyboard.getInstance().clickKey(KeyEvent.VK_ENTER);
|
||||
Variables.setStatus("none");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void clearInput() {
|
||||
for(int i = 0; i < 30; i ++) {
|
||||
Keyboard.getInstance().clickKey(KeyEvent.VK_DELETE);
|
||||
Time.sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
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
|
||||
&& hasRequiredItems()
|
||||
&& (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() {
|
||||
try {
|
||||
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);
|
||||
} catch (Exception err) {
|
||||
System.out.println("Fletching error: ¯\\_(ツ)_/¯");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasRequiredItems(){
|
||||
// Make sure we have a knife and logs
|
||||
return Inventory.getItem(947) != null && Inventory.getItem(1512) != null;
|
||||
}
|
||||
}
|
||||
@@ -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 Mine 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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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,31 @@
|
||||
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.Game;
|
||||
import org.rev317.min.api.methods.Inventory;
|
||||
import org.rev317.min.api.wrappers.TilePath;
|
||||
|
||||
public class Walk implements Strategy {
|
||||
|
||||
@Override
|
||||
public boolean activate() {
|
||||
return Variables.running
|
||||
&& Game.isLoggedIn()
|
||||
&& (Variables.getStatus() == "none" || Variables.getStatus() == "walking to mine")
|
||||
&& !Inventory.isFull()
|
||||
&& Variables.VARROCK_EAST_BANK_ZONE.inTheZone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
Variables.setStatus("walking to mine");
|
||||
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()) {
|
||||
Variables.pathToWalk.traverse();
|
||||
Time.sleep(2000, 3000);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package ParaScript.ui;
|
||||
|
||||
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.wrappers.Player;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
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 location = new JComboBox();
|
||||
private JCheckBox birdsNest = new JCheckBox();
|
||||
// Our colors
|
||||
private Color Color_MidnightBlue = new Color(44, 62, 80);
|
||||
private Color Color_WetAsphalt = new Color(52, 73, 94);
|
||||
private Color Color_WhiteSmoke = new Color(245, 245, 245);
|
||||
private Color Color_Emerald = new Color(46, 204, 113);
|
||||
private Color Color_Alizarin = new Color(231, 76, 60);
|
||||
|
||||
public UI() {
|
||||
setTitle("src/ParaScript");
|
||||
setResizable(false);
|
||||
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
setBounds(100, 100, 400, 300);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
contentPane.setLayout(null);
|
||||
contentPane.setForeground(Color_WhiteSmoke);
|
||||
contentPane.setBackground(Color_MidnightBlue);
|
||||
setContentPane(contentPane);
|
||||
|
||||
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
||||
tabbedPane.setBounds(0, 0, 395, 215);
|
||||
contentPane.add(tabbedPane);
|
||||
|
||||
/*
|
||||
* Login Panel
|
||||
*/
|
||||
JPanel loginPanel = new JPanel();
|
||||
loginPanel.setForeground(Color_WhiteSmoke);
|
||||
loginPanel.setBackground(Color_WetAsphalt);
|
||||
tabbedPane.addTab("Login", null, loginPanel, null);
|
||||
loginPanel.setLayout(null);
|
||||
|
||||
// Username
|
||||
JLabel lblUsername = new JLabel("Username:");
|
||||
lblUsername.setForeground(Color_WhiteSmoke);
|
||||
lblUsername.setBounds(20, 20, 73, 20);
|
||||
loginPanel.add(lblUsername);
|
||||
username.setText(Game.isLoggedIn() ? Players.getMyPlayer().getName() : "");
|
||||
username.setBounds(20, 40, 150, 20);
|
||||
loginPanel.add(username);
|
||||
|
||||
// Password
|
||||
JLabel lblPassword = new JLabel("Password:");
|
||||
lblPassword.setForeground(Color_WhiteSmoke);
|
||||
lblPassword.setBounds(200, 20, 73, 20);
|
||||
loginPanel.add(lblPassword);
|
||||
password.setBounds(200, 40, 150, 20);
|
||||
loginPanel.add(password);
|
||||
|
||||
// Auto Login
|
||||
JLabel lblAutoLogin = new JLabel("Auto Login Enabled");
|
||||
lblAutoLogin.setForeground(Color_WhiteSmoke);
|
||||
lblAutoLogin.setBounds(40, 80, 130, 20);
|
||||
loginPanel.add(lblAutoLogin);
|
||||
autoLogin.setBackground(Color_WetAsphalt);
|
||||
autoLogin.setForeground(Color_WhiteSmoke);
|
||||
autoLogin.setBounds(15, 80, 20, 20);
|
||||
autoLogin.setSelected(true);
|
||||
loginPanel.add(autoLogin);
|
||||
|
||||
/*
|
||||
* Settings Panel
|
||||
*/
|
||||
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",
|
||||
"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();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
* Woodcutting Panel
|
||||
*/
|
||||
|
||||
JPanel woodcuttingPanel = new JPanel();
|
||||
woodcuttingPanel.setForeground(Color_WhiteSmoke);
|
||||
woodcuttingPanel.setBackground(Color_WetAsphalt);
|
||||
tabbedPane.addTab("Woodcutting", null, woodcuttingPanel, null);
|
||||
woodcuttingPanel.setLayout(null);
|
||||
|
||||
// Select which tree to cut
|
||||
JLabel lblTree = new JLabel("Tree");
|
||||
lblTree.setForeground(Color_WhiteSmoke);
|
||||
lblTree.setBounds(20, 20, 73, 20);
|
||||
woodcuttingPanel.add(lblTree);
|
||||
treeSelect.setModel(new DefaultComboBoxModel(Trees.toStringArray()));
|
||||
treeSelect.setBounds(20, 40, 150, 20);
|
||||
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");
|
||||
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);
|
||||
lblBirdsNest.setBounds(200, 120, 150, 20);
|
||||
woodcuttingPanel.add(lblBirdsNest);
|
||||
|
||||
birdsNest.setBounds(195, 140, 20, 20);
|
||||
birdsNest.setSelected(true);
|
||||
woodcuttingPanel.add(birdsNest);
|
||||
|
||||
JLabel lblBirdsNestCheckBox = new JLabel("Pickup");
|
||||
lblBirdsNestCheckBox.setBounds(215, 140, 150, 20);
|
||||
woodcuttingPanel.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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
*/
|
||||
|
||||
/*
|
||||
* Slave Panel
|
||||
*/
|
||||
JPanel slavePanel = new JPanel();
|
||||
slavePanel.setForeground(Color_WhiteSmoke);
|
||||
slavePanel.setBackground(Color_WetAsphalt);
|
||||
tabbedPane.addTab("Settings", 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) {
|
||||
if(autoLogin.isSelected() && !username.getText().equals("")) {
|
||||
Variables.setAccountUsername(username.getText());
|
||||
Variables.setAccountPassword(password.getText());
|
||||
}
|
||||
/*
|
||||
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 (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.setBackground(Variables.running ? Color_Alizarin : Color_Emerald);
|
||||
}
|
||||
});
|
||||
start.setBackground(Color_Emerald);
|
||||
start.setForeground(Color_MidnightBlue);
|
||||
// these next two lines do the magic..
|
||||
start.setContentAreaFilled(false);
|
||||
start.setOpaque(true);
|
||||
start.setBounds(20, 220, 360, 40);
|
||||
contentPane.add(start);
|
||||
}
|
||||
}
|
||||
@@ -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>
|
||||
Reference in New Issue
Block a user