Thondar

TT Tanner 0.1

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