Advertisement
TheBat

Untitled

Apr 24th, 2013
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. RSNPC chosen = null;
  2.  
  3. int[] gilesniles = {2536, 2537, 2538};
  4.  
  5. enum Niles{
  6. HELM("helmet", 8833),
  7. BOWL("bowl", 2807),
  8. SWORD("sword", 8836),
  9. FISH("fish", 8829),
  10. BATTLEAXE("battleaxe", 8828),
  11. SHEARS("shears", 8835),
  12. SPADE("spade", 8837),
  13. RING("ring", 8834),
  14. SHIELD("shield", 8832);
  15.  
  16.  
  17. public static Niles getAnswerByModelId(int id){
  18. for(Niles n : values()){
  19. if(n.getModelId() == id){
  20. return n;
  21. }
  22. }
  23. return null;
  24. }
  25.  
  26.  
  27. String name;
  28. int modelId;
  29.  
  30. public String getName(){
  31. return name;
  32. }
  33.  
  34. public int getModelId(){
  35. return modelId;
  36. }
  37.  
  38. Niles(String name, int modelId){
  39. this.name=name;
  40. this.modelId=modelId;
  41. }
  42.  
  43. }
  44.  
  45. void solveNiles(){
  46. println("solving");
  47. RSInterfaceMaster needsSolving = Interfaces.get(184);
  48. if(needsSolving != null && !needsSolving.isHidden()){
  49.  
  50. int modelId = needsSolving.getChild(7).getModelID();
  51. println("not null " +modelId);
  52. Niles answer = Niles.getAnswerByModelId(modelId);
  53.  
  54.  
  55. int correctAnswerChildId = -1;
  56. if(answer != null){
  57. println("answer not null");
  58. for(RSInterfaceChild child : needsSolving.getChildren()){
  59. if(child.getText().contains(answer.getName())){
  60. correctAnswerChildId = child.getIndex() + 7;
  61.  
  62.  
  63. }
  64. }
  65. }
  66.  
  67. if(correctAnswerChildId != -1) {
  68. println("clicking select");
  69. needsSolving.getChild(correctAnswerChildId).click("select");
  70. }
  71. return;
  72. }
  73. if(chosen == null){
  74. RSNPC[] niles = NPCs.findNearest(gilesniles);
  75.  
  76. if(niles != null && niles.length != 0){
  77. for(RSNPC a : niles){
  78. if(a.getChatMessage() != null && a.getChatMessage().contains(Player.getRSPlayer().getName())){
  79. chosen = a;
  80. }
  81. }
  82. }
  83. }else{
  84. println("found chosen");
  85. chosen.click("Talk-to");
  86. }
  87.  
  88.  
  89.  
  90. }
  91.  
  92. @Override
  93. public void run() {
  94. while(true){
  95. solveNiles();
  96. sleep(1000);
  97. }
  98. //To change body of implemented methods use File | Settings | File Templates.
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement