Thondar

TT Tanner 0.1

Jun 10th, 2011
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. import java.awt.*;
  2. import javax.imageio.ImageIO;
  3. import java.io.IOException;
  4. import java.net.URL;
  5.  
  6. import org.rsbot.event.listeners.PaintListener;
  7. import org.rsbot.script.*;
  8. import org.rsbot.script.wrappers.*;
  9.  
  10. @ScriptManifest(authors = {"TT Production"}, keywords = {"Cowhide Tanner"}, name = "TT Tanner", description = "A Cowhide Tanner", version = 0.1)
  11.  
  12. public class TTTanner extends Script implements PaintListener{
  13.  
  14. RSTile tannerTile = new RSTile (3276,3191);
  15. RSTile bankTile = new RSTile (3270,3166);
  16.  
  17. int cowhide = 1739;
  18. int gold = 995;
  19. int Inventory = 0;
  20. int bankerID = 496;
  21. int tannerID = 2824;
  22. int leatherID = 1743;
  23. int leatherGot;
  24. int cowhideprice;
  25. int leatherprice;
  26. int goldcheck;
  27. int profitprice = leatherprice - cowhideprice - 3;
  28.  
  29. long starttime;
  30.  
  31. private boolean restCheck;
  32. private boolean antibanCheck;
  33.  
  34. @Override
  35. public boolean onStart() {
  36. mouse.setSpeed(random(4, 6));
  37. starttime = System.currentTimeMillis();
  38. walking.setRun(true);
  39. cowhideprice = grandExchange.lookup(cowhide).getGuidePrice();
  40. leatherprice = grandExchange.lookup(leatherID).getGuidePrice();
  41. return true;
  42. }
  43.  
  44.  
  45. public void bank() {
  46. RSNPC banker = npcs.getNearest(bankerID);
  47. rest();
  48. if (bank.isOpen() && inventory.contains(leatherID))
  49. bank.depositAll();
  50. Inventory = inventory.getCount(leatherID);
  51. leatherGot += Inventory;
  52. sleep(500, 750);
  53. if (bank.isOpen() && !inventory.contains(leatherID)) {
  54. bank.withdraw(gold, 100);
  55. bank.withdraw(cowhide, 100);
  56. sleep(500, 750);
  57. bank.close();
  58. } else {
  59. if(banker != null) {
  60. if(banker.isOnScreen())
  61. banker.doAction("Bank Banker");{
  62. } sleep(1800, 2100);
  63. } else {
  64. walking.getPath(bankTile).traverse();
  65. }
  66. }
  67. }
  68. public void tan(){
  69. rest();
  70. RSNPC tanner = npcs.getNearest(tannerID);
  71. if (tanner != null) {
  72. if(tanner.isOnScreen())
  73. tanner.doAction("Trade Ellis");{
  74. sleep(800, 1100);
  75. mouse.click(205,108,false);
  76. sleep(350, 500);
  77. mouse.click(205,198,true);
  78. } sleep(500, 800);
  79. }
  80. }
  81.  
  82. public boolean atBank(){
  83. RSArea BankArea = new RSArea(new RSTile(3265, 3160),
  84. new RSTile(3272, 3273));
  85. return BankArea.contains(getMyPlayer().getLocation());
  86. }
  87. public boolean atTanner(){
  88. RSArea TannerArea = new RSArea(new RSTile(3270, 3189),
  89. new RSTile(3277, 3194));
  90. return TannerArea.contains(getMyPlayer().getLocation());
  91. }
  92.  
  93. private void rest() {
  94. if(walking.getEnergy() < 30)
  95. walking.rest(random(70,95));
  96. }
  97. private void antiBan() {
  98. int t = random(0, 10);
  99. int r = random(0, 15);
  100. if (t == 7);
  101. if (r == 2) {
  102. mouse.moveSlightly();
  103. sleep(500, 800);
  104. }
  105.  
  106. if (r == 3) {
  107. mouse.moveRandomly(10, 50);
  108. }
  109.  
  110. if (r == 5) {
  111. camera.moveRandomly(random(350, 650));
  112. }
  113.  
  114. if (r == 6) {
  115. camera.moveRandomly(random(450, 750));
  116. }
  117.  
  118. if (r == 8) {
  119. camera.moveRandomly(random(150, 450));
  120. }
  121.  
  122. if (r == 10) {
  123. camera.moveRandomly(random(750, 1250));
  124. }
  125.  
  126. if (r == 12) {
  127. mouse.moveOffScreen();
  128. }
  129.  
  130. if (r == 14) {
  131. camera.moveRandomly(random(500, 900));
  132. }
  133. }
  134.  
  135. public int loop() {
  136. if(atBank() && !inventory.contains(cowhide)){
  137. bank();
  138. }
  139. if(atBank() && inventory.contains(leatherID)){
  140. bank();
  141. }
  142. if(atTanner() && inventory.contains(cowhide)){
  143. tan();
  144. }
  145. if(!atTanner() && inventory.contains(cowhide)){
  146. walking.walkTo(tannerTile);
  147. }
  148. if(!atBank() && !inventory.contains(cowhide)){
  149. walking.walkTo(bankTile);
  150. }
  151. antiBan();
  152. {
  153. }
  154. return random(500, 1500);
  155.  
  156. }
  157.  
  158. @Override
  159. public void onFinish() {
  160. }
  161. //START: Code generated using Enfilade's Easel
  162. private Image getImage(String url) {
  163. try {
  164. return ImageIO.read(new URL(url));
  165. } catch(IOException e) {
  166. return null;
  167. }
  168. }
  169.  
  170. private final Color color1 = new Color(73, 68, 68);
  171. private final Color color2 = new Color(153, 153, 153);
  172. private final Color color3 = new Color(204, 204, 204);
  173.  
  174. private final BasicStroke stroke1 = new BasicStroke(1);
  175.  
  176. private final Font font1 = new Font("Arial", 1, 10);
  177. private final Font font2 = new Font("Arial", 1, 14);
  178.  
  179. private final Image img1 = getImage("http://i.imgur.com/EJBHs.png");
  180. private final Image img2 = getImage("http://i.imgur.com/aUisg.png");
  181. private final Image img3 = getImage("http://i.imgur.com/eRsVJ.png");
  182. private final Image img4 = getImage("http://i.imgur.com/cwGcs.gif");
  183. private final Image img5 = getImage("http://i.imgur.com/wJiPx.png");
  184.  
  185. public void onRepaint(Graphics g1) {
  186.  
  187. long millis = System.currentTimeMillis() - starttime;
  188. long hours = millis / (1000 * 60 * 60);
  189. millis -= hours * (1000 * 60 * 60);
  190. long minutes = millis / (1000 * 60);
  191. millis -= minutes * (1000 * 60);
  192. long seconds = millis / 1000;
  193.  
  194. float leahtersec = 0;
  195. if ((minutes > 0 || hours > 0 || seconds > 0) && leatherGot > 0) {
  196. leahtersec = ((float) leatherGot)/(float)(seconds + (minutes*60) + (hours*60*60));
  197. }
  198.  
  199. float leahtermin = leahtersec * 60;
  200. float aleatherhour = leahtermin * 60;
  201. float agoldhour = aleatherhour * profitprice;
  202. int goldearned = leatherGot * profitprice;
  203. int leahterhour = Math.round(aleatherhour);
  204. int goldhour = Math.round(agoldhour);
  205.  
  206.  
  207. Graphics2D g = (Graphics2D)g1;
  208. g.setColor(color1);
  209. g.fillRect(5, 343, 508, 131);
  210. g.setColor(color2);
  211. g.setStroke(stroke1);
  212. g.drawRect(5, 343, 508, 131);
  213. g.setFont(font1);
  214. g.setColor(color3);
  215. g.drawString("Total: " + leatherGot, 72, 460);
  216. g.drawString("Pr/H: " + leahterhour, 220, 460);
  217. g.drawString("Pr/H: " + goldhour, 220, 416);
  218. g.drawString("Total: " + goldearned, 72, 416);
  219. g.setColor(color2);
  220. g.drawLine(358, 474, 358, 344);
  221. g.drawLine(211, 474, 211, 388);
  222. g.drawLine(60, 474, 60, 344);
  223. g.drawImage(img1, 90, 290, null);
  224. g.setFont(font2);
  225. g.setColor(color3);
  226. g.drawString( + hours + ":" + minutes + ":" + seconds, 146, 370);
  227. g.setColor(color2);
  228. g.drawLine(5, 433, 358, 433);
  229. g.drawLine(5, 388, 358, 388);
  230. g.drawImage(img2, 383, 356, null);
  231. g.drawImage(img3, 20, 440, null);
  232. g.drawImage(img4, 17, 394, null);
  233. g.drawImage(img5, 19, 349, null);
  234. }
  235. //END: Code generated using Enfilade's Easel
  236.  
  237. }
Advertisement
Add Comment
Please, Sign In to add comment