Guest User

Untitled

a guest
Jul 22nd, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. import java.awt.Graphics;
  2. import com.quirlion.script.Script;
  3.  
  4. import com.quirlion.script.types.NPC;
  5. import com.quirlion.script.types.Thing;
  6.  
  7.  
  8. public class QFightCaver extends Script {
  9.  
  10. //custom methods
  11. NPC attackable;
  12. public int[] attackableNPCs = {2734, 2735, 2736, 2737, 2738, 2739, 2740, 2741, 2742, 2743, 2744, 2745, 2746, 2747, 2748, 2549, 2750};
  13. public boolean first = true;
  14. public boolean useEntrance() {
  15.  
  16. Thing entrance = things.getNearest(9356);
  17. if (entrance != null) {
  18. entrance.click("Enter Cave entrance");
  19. return true;
  20. }else{
  21. log("Cave entrance not found, quitting.");
  22. return false;
  23. }
  24.  
  25. }
  26.  
  27. public boolean checkCombatStatus(){
  28. if (!players.getCurrent().isInCombat()) {
  29. return false;
  30. }else{
  31. return true;
  32. }
  33. }
  34.  
  35.  
  36. public void engageTarget() {
  37. NPC attackable = npcs.getNearestByID(attackableNPCs);
  38. if(attackable != null) {
  39. attackable.click("Attack");
  40. log("clicked");
  41. }else{
  42. log("Failed to engage acquired target.");
  43. }
  44. }
  45. //end of custom methods
  46.  
  47. public int loop() {
  48. log("started");
  49. if(!useEntrance()){
  50. return -1;
  51. }
  52.  
  53.  
  54.  
  55. if(checkCombatStatus()) {
  56. //no action
  57. }else{
  58. engageTarget();
  59. }
  60.  
  61.  
  62. return 1000;
  63.  
  64. }
  65.  
  66.  
  67. public void serverMessageReceived(String s) {
  68.  
  69. }
  70.  
  71. public void onStop() {
  72.  
  73. }
  74.  
  75. public void paint(Graphics g) {
  76.  
  77. }
  78.  
  79. }
Add Comment
Please, Sign In to add comment