Guest User

Untitled

a guest
Jul 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.05 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. public boolean acquireNewTarget() {
  36. NPC attackable = npcs.getNearestByID(attackableNPCs);
  37.  
  38. if (attackable != null){
  39. return true;
  40. }else{
  41. return false;
  42. }
  43. }
  44.  
  45. public void engageTarget() {
  46. attackable.click("Attack");
  47. }
  48. //end of custom methods
  49.  
  50. public int loop() {
  51.  
  52. if(first){
  53. first = false;
  54. if(!useEntrance()) {
  55. return -1;
  56. }
  57. first = false;
  58. }
  59.  
  60. if(checkCombatStatus()) {
  61. //no action
  62. }else{
  63. if(acquireNewTarget()) {
  64. engageTarget();
  65. }else{
  66. return 1000;
  67. }
  68. }
  69.  
  70.  
  71. return 1000;
  72.  
  73. }
  74.  
  75. public void onStart() {
  76. log("started QFightCaver");
  77. }
  78.  
  79. public void serverMessageReceived(String s) {
  80.  
  81. }
  82.  
  83. public void onStop() {
  84.  
  85. }
  86.  
  87. public void paint(Graphics g) {
  88.  
  89. }
Add Comment
Please, Sign In to add comment