Thondar

TT Tanner 0.1

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