Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Graphics;
- import com.quirlion.script.Script;
- import com.quirlion.script.types.NPC;
- import com.quirlion.script.types.Thing;
- public class QFightCaver extends Script {
- //custom methods
- NPC attackable;
- public int[] attackableNPCs = {2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2549, 2750};
- public boolean first = true;
- public boolean useEntrance() {
- Thing entrance = things.getNearest(9356);
- if (entrance != null) {
- entrance.click("Enter Cave entrance");
- return true;
- }else{
- log("Cave entrance not found, quitting.");
- return false;
- }
- }
- public boolean checkCombatStatus(){
- if (!players.getCurrent().isInCombat()) {
- return false;
- }else{
- return true;
- }
- }
- public boolean acquireNewTarget() {
- NPC attackable = npcs.getNearestByID(attackableNPCs);
- if (attackable != null){
- return true;
- }else{
- return false;
- }
- }
- public void engageTarget() {
- attackable.click("Attack");
- }
- //end of custom methods
- public int loop() {
- if(first){
- first = false;
- if(!useEntrance()) {
- return -1;
- }
- first = false;
- }
- if(checkCombatStatus()) {
- //no action
- }else{
- if(acquireNewTarget()) {
- engageTarget();
- }else{
- return 1000;
- }
- }
- return 1000;
- }
- public void onStart() {
- log("started QFightCaver");
- }
- public void serverMessageReceived(String s) {
- }
- public void onStop() {
- }
- public void paint(Graphics g) {
- }
Add Comment
Please, Sign In to add comment