mirror of
https://github.com/2006Scape-Scripts/Example-Script.git
synced 2026-07-02 16:49:02 +00:00
Initial PickPocketing Example Script
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
# Git ignored files
|
||||
.idea/
|
||||
target/
|
||||
@@ -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.
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
<?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>example-script</artifactId>
|
||||
<version>0.1</version>
|
||||
|
||||
<properties>
|
||||
<jdk.version>1.7</jdk.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>parabot-maven</id>
|
||||
<name>Parabot its Maven Repository</name>
|
||||
<url>https://maven.parabot.org/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>client</artifactId>
|
||||
<version>2.8.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>317-api-minified</artifactId>
|
||||
<version>1.21.5</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.3.2</version>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.3.0</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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<Strategy> strategies = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public boolean onExecute() {
|
||||
strategies.add(new Thieve());
|
||||
provide(strategies);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinish() {
|
||||
}
|
||||
}
|
||||
@@ -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() {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user