mirror of
https://github.com/2006Scape-Scripts/ParaScript.git
synced 2026-07-02 16:49:02 +00:00
Add attack
This commit is contained in:
Generated
+1
-1
@@ -2,7 +2,7 @@
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3ab8e8a0-ccfd-4b0b-9547-98173085dc38" name="Default Changelist" comment="">
|
||||
<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$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
</list>
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
<option name="SHOW_DIALOG" value="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.Inventory;
|
||||
import org.rev317.min.api.methods.Npcs;
|
||||
import org.rev317.min.api.methods.Players;
|
||||
import org.rev317.min.api.methods.SceneObjects;
|
||||
import org.rev317.min.api.wrappers.Npc;
|
||||
import org.rev317.min.api.wrappers.SceneObject;
|
||||
|
||||
public class Killer implements Strategy {
|
||||
private Npc 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(Npcs.Option.ATTACK);
|
||||
Time.sleep(1000);
|
||||
//Wait for the Player to finish pickpocketing
|
||||
Time.sleep(() -> Players.getMyPlayer().getAnimation() == -1, 500);
|
||||
}
|
||||
|
||||
private Npc victim(){
|
||||
for(Npc victim : Npcs.getNearest(41)){
|
||||
if(victim != null){
|
||||
return victim;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user