From 5f6fd462d65e247b7c4d836ef03c42fc8da3e7df Mon Sep 17 00:00:00 2001 From: Dark98 Date: Mon, 30 Jan 2023 02:00:21 +0000 Subject: [PATCH] Initial PickPocketing Example Script --- .gitignore | 3 +++ README.md | 2 ++ pom.xml | 52 ++++++++++++++++++++++++++++++++++++ src/main/java/Constants.java | 5 ++++ src/main/java/Main.java | 22 +++++++++++++++ src/main/java/Thieve.java | 40 +++++++++++++++++++++++++++ 6 files changed, 124 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/Constants.java create mode 100644 src/main/java/Main.java create mode 100644 src/main/java/Thieve.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c86ef7d --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Git ignored files +.idea/ +target/ \ No newline at end of file diff --git a/README.md b/README.md index 51935c4..6b96dee 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # Example-Script A Simple Example/Template Script + +Finds The Nearest Man/Woman(NPC IDs Set In [Constants.java](https://github.com/2006Scape-Scripts/Example-Script/blob/main/src/main/java/Constants.java)) & PickPockets Them. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d98b22e --- /dev/null +++ b/pom.xml @@ -0,0 +1,52 @@ + + + 4.0.0 + + src + example-script + 0.1 + + + 1.7 + + + + + parabot-maven + Parabot its Maven Repository + https://maven.parabot.org/ + + + + + + org.parabot + client + 2.8.1 + + + org.parabot + 317-api-minified + 1.21.5 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + org.apache.maven.plugins + maven-jar-plugin + 3.3.0 + + + + \ No newline at end of file diff --git a/src/main/java/Constants.java b/src/main/java/Constants.java new file mode 100644 index 0000000..db3c976 --- /dev/null +++ b/src/main/java/Constants.java @@ -0,0 +1,5 @@ +public class Constants { + public static final int[] NPC_IDS = {1, 2, 3, 4, 5, 6}; + public static final int PICKPOCKET_ANIM_ID = 881; +} + diff --git a/src/main/java/Main.java b/src/main/java/Main.java new file mode 100644 index 0000000..c8ac71d --- /dev/null +++ b/src/main/java/Main.java @@ -0,0 +1,22 @@ +import org.parabot.environment.scripts.Category; +import org.parabot.environment.scripts.Script; +import org.parabot.environment.scripts.ScriptManifest; +import org.parabot.environment.scripts.framework.Strategy; + +import java.util.ArrayList; + +@ScriptManifest(author = "Script Author", category = Category.THIEVING, description = "An Example Script That Thieves From Men & Women.", name = "Example-Script", servers = {"2006Scape"}, version = 0.1) +public class Main extends Script { + public ArrayList strategies = new ArrayList<>(); + + @Override + public boolean onExecute() { + strategies.add(new Thieve()); + provide(strategies); + return true; + } + + @Override + public void onFinish() { + } +} \ No newline at end of file diff --git a/src/main/java/Thieve.java b/src/main/java/Thieve.java new file mode 100644 index 0000000..c2666fd --- /dev/null +++ b/src/main/java/Thieve.java @@ -0,0 +1,40 @@ +import org.parabot.environment.api.utils.Time; +import org.parabot.environment.scripts.framework.Strategy; +import org.rev317.min.api.methods.Npcs; +import org.rev317.min.api.methods.Players; +import org.rev317.min.api.wrappers.Npc; + +public class Thieve implements Strategy { + + boolean PICKPOCKET; + + @Override + public boolean activate() { + if (Players.getMyPlayer().getAnimation() != Constants.PICKPOCKET_ANIM_ID) { + if (Players.getMyPlayer().getAnimation() == 404 || Players.getMyPlayer().getAnimation() == Constants.PICKPOCKET_ANIM_ID) { + Time.sleep(2000); + } else { + if (Players.getMyPlayer().getAnimation() == -1) { + PICKPOCKET = attemptPickPocket(); + } + } + } + return attemptPickPocket(); + } + + + private boolean attemptPickPocket() { + for (Npc npc : Npcs.getNearest(Constants.NPC_IDS)) { + if (npc != null && Players.getMyPlayer().getAnimation() == -1) { + npc.interact(Npcs.Option.PICKPOCKET); + Time.sleep(2000); + } + } + return true; + } + + @Override + public void execute() { + + } +}