Guest User

Untitled

a guest
Oct 23rd, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.71 KB | None | 0 0
  1. import java.awt.FlowLayout;
  2. import java.util.Random;
  3.  
  4. import javax.swing.JCheckBox;
  5. import javax.swing.JFrame;
  6. import javax.swing.JOptionPane;
  7. import javax.swing.JPanel;
  8. import javax.swing.JTextArea;
  9. import javax.swing.event.ChangeEvent;
  10. import javax.swing.event.ChangeListener;
  11.  
  12. import org.rsbot.script.Script;
  13. import org.rsbot.script.ScriptManifest;
  14. import org.rsbot.script.methods.Game;
  15. import org.rsbot.script.wrappers.RSArea;
  16. import org.rsbot.script.wrappers.RSComponent;
  17. import org.rsbot.script.wrappers.RSInterface;
  18. import org.rsbot.script.wrappers.RSTile;
  19.  
  20. @ScriptManifest(authors = { "Fierze" }, name = "FierzeDicingScammer")
  21. public class FierzeDicingScammer extends Script {
  22. String message;
  23. Random random = new Random();
  24. String effect[] = {"Flash2:", "glow3:", "glow1:", "red:", "wave2:", "wave:", "White:"};
  25. String txt[] = {"55 x2 Legiting dicing join dicer", "Legit 55x2 cc (dicer)", "Legit 55x2 dice games in (dicer)"};
  26. String txt2[] = {"55 x2 Legiting dicing join my cc dicer", "55x2 in my cc - Trusted with 57m+!", "55x2 Legiting dicing join my cc", "55x2 Trusted Dicing in my cc"};
  27. RSTile startTile;
  28. long timer2;
  29. boolean acceptAccepted = false;
  30. long timer = 0;
  31. public boolean isOnTradeWindow(){
  32. if(interfaces.get(334).isValid() || interfaces.get(335).isValid()){
  33. return true;
  34. }else{
  35. return false;
  36. }
  37. }
  38. public boolean onStart(){
  39. startTile = getMyPlayer().getLocation();
  40. acceptAccepted = (JOptionPane.showInputDialog("Accept when other Player accepts or accept when other player adds Item (Recommended >(first = true,or second = false").contains("true"));
  41. return true;
  42. }
  43.  
  44. public void dance(){
  45. if(!isOnTradeWindow()){
  46. RSInterface inter = interfaces.get(464);
  47. if(game.getCurrentTab() == 13){
  48. RSComponent dance = inter.getComponent(random(14,17));
  49. if(dance != null){
  50. if(timer < System.currentTimeMillis()){
  51. if(!isOnTradeWindow()){
  52. dance.doClick();
  53. }
  54. keyboard.sendTextInstant(effect[random.nextInt(effect.length)]+""+txt[random.nextInt(txt.length)], true);
  55. timer = System.currentTimeMillis()+7000;
  56. }
  57. }
  58. }else{
  59. game.openTab(13);
  60. }
  61. }else{
  62. RSInterface tradeOne = interfaces.get(335);
  63. if(tradeOne != null){
  64. RSComponent hasAccepted = tradeOne.getComponent(37);
  65. if(hasAccepted != null){
  66. if(acceptAccepted){
  67. if(hasAccepted.getText().contains("accepted")){
  68. RSComponent acceptOne = tradeOne.getComponent(17);
  69. if(acceptOne != null){
  70. acceptOne.doClick();
  71. }
  72. }
  73. }else{
  74. RSComponent wealth = tradeOne.getComponent(45);
  75. if(wealth != null){
  76. if(!wealth.getText().contains("transfer")){
  77. RSComponent acceptOne = tradeOne.getComponent(17);
  78. if(acceptOne != null){
  79. acceptOne.doClick();
  80. }
  81. }
  82. }
  83. }
  84. }
  85. }
  86. RSInterface tradeTwo = interfaces.get(334);
  87. if(tradeTwo != null){
  88. RSComponent acceptTwo = tradeTwo.getComponent(21);
  89. if(acceptTwo != null){
  90. acceptTwo.doClick();
  91. sleep(1000);
  92. }
  93. }
  94. }
  95. }
  96.  
  97. public void checkMessages(){
  98. if(!isOnTradeWindow()){
  99. RSInterface chatBox = interfaces.get(137);
  100. if(chatBox != null){
  101. for(int x = 180; x < 280; x++){
  102. if(chatBox.getComponent(x) != null && chatBox.getComponent(x).getAbsoluteY() > 330){
  103. String curCompText = chatBox.getComponent(x).getText();
  104. if(curCompText.contains("wishes to trade with you")){
  105. if(!isOnTradeWindow()){
  106. for(String y: chatBox.getComponent(x).getActions()){
  107. if(y.contains("trade"));
  108. chatBox.getComponent(x).doAction("trade");
  109. }
  110. sleep(1000);
  111. }
  112. }else if(curCompText.contains("accepted")){
  113. if(timer2 < System.currentTimeMillis()){
  114. keyboard.sendText("Aww Sorry", true);
  115. }
  116. }else if(curCompText.contains("declined")){
  117. if(timer2 < System.currentTimeMillis()){
  118. keyboard.sendText(txt2[random.nextInt(txt2.length)], true);
  119. timer2 = System.currentTimeMillis()+5000;
  120. }
  121. }
  122. }
  123. }
  124. }
  125. }
  126. }
  127.  
  128. public void checkArea(){
  129. if(!new RSArea(new RSTile(startTile.getX()-5, startTile.getY()-5), new RSTile(startTile.getX()+5, startTile.getY()+5)).contains(getMyPlayer().getLocation())){
  130. walking.walkTo(startTile);
  131. }
  132. }
  133.  
  134. @Override
  135. public int loop() {
  136. checkArea();
  137. checkMessages();
  138. dance();
  139. return 100;
  140. }
  141.  
  142. }
Add Comment
Please, Sign In to add comment