Thondar

TT Tanner 0.1

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