Guest User

Untitled

a guest
Jul 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.42 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import java.lang.String;
  4.  
  5. import org.rsbot.bot.Bot;
  6. import org.rsbot.script.*;
  7. import org.rsbot.script.wrappers.*;
  8. import org.rsbot.script.wrappers.RSInterface;
  9. import org.rsbot.script.wrappers.RSNPC;
  10. import org.rsbot.script.wrappers.RSObject;
  11. import org.rsbot.accessors.*;
  12. import org.rsbot.event.listeners.PaintListener;
  13. import org.rsbot.event.listeners.ServerMessageListener;
  14. import org.rsbot.event.events.ServerMessageEvent;
  15. import org.rsbot.util.ScreenshotUtil;
  16.  
  17. @ScriptManifest(authors = { "Twistzor" }, category = "Money", name = "Twistzor's YDB buyer", version = 1.0, description = "<html><body bgcolor = Black><font color = Red><center><h2>Twister's Yanille Dragon Bitter Buyer</h2><BR><br></font>"
  18. +"</body></html>")
  19. public class TwistzorYDBbuyer extends Script implements PaintListener {
  20.  
  21. final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  22.  
  23. private int banker = 494;
  24. private int bartender = 739;
  25. private int coins = 995;
  26. private int DB = 1911;
  27. private int DoorClosed = 1533;
  28. private int DoorOpen = 1534;
  29.  
  30. private String Currentstate = "Starting up";
  31.  
  32. RSTile[] fromBanktoDoor = {new RSTile(2613,3094), new RSTile(2603,3097),
  33. new RSTile(2591,3097),new RSTile(2578,3095),
  34. new RSTile(2568,3090), new RSTile(2557,3088), new RSTile(2551,3083)};
  35. RSTile[] fromDoortoBank = reversePath(fromBanktoDoor);
  36. RSTile fromDoortoBar = new RSTile(2554,3080);
  37. RSTile doorInside = new RSTile(2551,3082);
  38. RSTile doorOutside = new RSTile(2551,3083); //= tile van deur
  39. public boolean onStart(Map<String, String> args) {
  40. return true;
  41. }
  42.  
  43. public void onFinish(){
  44. return;
  45. }
  46.  
  47. private void antiban() {
  48. final int random = random(1, 600);
  49. if (random == 546) {
  50. Point randomMouse;
  51. final int rndMovement = random(1, 5);
  52. for (int a = 0; a < rndMovement; a++) {
  53. randomMouse = new Point(random(15, 730), random(15, 465));
  54. moveMouse(randomMouse);
  55. wait(random(50, 800));
  56. }
  57. return;
  58. }
  59. if (random == 1) {
  60. setCameraRotation(random(1, 60));
  61. }
  62. if (random == 242 || random == 346) {
  63. int currentAngle = getCameraAngle();
  64. Bot.getClient().getCamPosZ();
  65. switch (random(0, 1)) {
  66. case 0:
  67. setCameraRotation(currentAngle + random(0, 230));
  68. return;
  69. case 1:
  70. setCameraRotation(currentAngle - random(0, 230));
  71. return;
  72. }
  73. }
  74. if (random == 456) {
  75. setCameraRotation(random(1, 400));
  76. }
  77. if (random == 74 || random == 536 || random == 383 || random == 432) {
  78. setCameraAltitude(true);
  79. }
  80. }
  81. private boolean atBank(){
  82. RSNPC bankzor = getNearestNPCByID(banker);
  83. if(bankzor == null) return false;
  84. if(bankzor.isOnScreen()){
  85. return true;
  86. }else{
  87. return false;
  88. }
  89. }
  90. private void BankMethod(){
  91. if(bank.isOpen()){
  92. Currentstate = "Banking";
  93. bank.depositAll();
  94. wait(random(500,750));
  95. bank.withdraw(coins, 56);
  96. wait(random(500,750));
  97. }else{
  98. RSNPC bankzor = getNearestNPCByID(banker);
  99. clickRSNPC(bankzor, "Bank");
  100. wait(random(500,750));
  101. }
  102. }
  103. private void OpenDoorIfNeeded(){
  104. RSObject DoorC = getNearestObjectByID(DoorClosed);
  105. if(DoorC != null){
  106. //atDoor(DoorClosed, 's'); outdated
  107. Point p = Calculations.tileToScreen(doorOutside, 0.5, 0, 50);
  108. clickMouse(p, true);
  109. }
  110. }
  111. private void walkfromDoortoBank() {
  112. RSTile[] randomizedfromDoortoBank = randomizePath(fromDoortoBank, 2, 2);
  113. Currentstate = "Walking to bank";
  114. walkPathMM(randomizedfromDoortoBank, 16);
  115. wait(random(100,1200));
  116. }
  117. private boolean atBartender(){
  118. RSNPC bart = getNearestNPCByID(bartender);
  119. if(bart == null) return false;
  120. if(bart.isOnScreen()){
  121. return true;
  122. }else{
  123. return false;
  124. }
  125. }
  126. private void BuyBeer(){
  127. RSNPC bart = getNearestNPCByID(bartender);
  128. Currentstate = "Buying";
  129. clickRSNPC(bart, "Talk-to");
  130. RSInterface chatint = RSInterface.getInterface(INTERFACE_CHAT_BOX);
  131. waitForIface(chatint , 5000);
  132. clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
  133. wait(random(350,450 ));
  134. clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
  135. wait(random(350,450 ));
  136. clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
  137. wait(random(350,450 ));
  138. clickMouse(random(173,344), random(417,406), true);
  139. wait(random(400,550));
  140. clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
  141. wait(random(350,450 ));
  142. clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
  143. wait(random(350,450 ));
  144. }
  145. private void walkfromDoortoBar() {
  146. RSTile randomizedfromDoortoBar = randomizeTile(fromDoortoBar, 2, 2);
  147. walkTileMM(randomizedfromDoortoBar);
  148. wait(random(100,1200));
  149. }
  150. private void walkfromBanktoDoor() {
  151. RSTile[] randomizedfromDoortoBar = randomizePath(fromBanktoDoor, 2, 2);
  152. Currentstate = "walking to bar";
  153. walkPathMM(randomizedfromDoortoBar, 16);
  154. wait(random(100,1200));
  155. }
  156.  
  157. public int loop() {
  158. RSNPC bart = getNearestNPCByID(bartender);
  159. antiban();
  160. if(getEnergy() > random(40,70)) setRun(true);
  161. if(isInventoryFull() || getInventoryCount(coins) == 0){
  162. if(atBank()){
  163. BankMethod();
  164. }else{
  165. walkTileMM(doorInside, 2, 2);
  166. log("walking to doorinside");
  167. wait(random(1500,2500));
  168. OpenDoorIfNeeded();
  169. log("check");
  170. wait(random(1500,2500));
  171. walkfromDoortoBank();
  172. log("walktobank");
  173. }
  174. }else{
  175. if(getMyPlayer().getLocation() == doorOutside){
  176. log("" + getMyPlayer().getLocation().getX());
  177. OpenDoorIfNeeded();
  178. wait(random(500,750));
  179. walkfromDoortoBar();
  180. }else if(bart != null && atBartender()){
  181. log("" +getMyPlayer().getLocation());
  182. while(!isInventoryFull()){
  183. BuyBeer();
  184. }
  185. }else if (!bart.isOnScreen()) {
  186. RSTile nub = bart.getLocation();
  187. walkTileMM(nub);
  188. }else{
  189. walkfromBanktoDoor();
  190. atTile(doorOutside, "Walk here");
  191. }
  192.  
  193. }
  194.  
  195. return random(800,1000);
  196. }
  197.  
  198. public void onRepaint(Graphics render) {
  199. if (isLoggedIn()) {
  200. render.setColor(Color.GREEN);
  201. render.drawString("State: " + Currentstate, 8, 335);
  202. Point p = Calculations.tileToScreen(doorOutside, 0.5, 0, 50);
  203. render.drawOval(p.x - 5, p.y - 5, 5, 5);
  204. }
  205. }
  206.  
  207.  
  208. }
Add Comment
Please, Sign In to add comment