Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = {"TT Production"}, keywords = {"Cowhide Tanner"}, name = "TT Tanner", description = "A Cowhide Tanner", version = 0.1)
- public class TTTanner extends Script implements PaintListener{
- RSTile tannerTile = new RSTile (3276,3191);
- RSTile bankTile = new RSTile (3270,3166);
- int cowhide = 1739;
- int gold = 995;
- int Inventory = 0;
- int bankerID = 496;
- int tannerID = 2824;
- int leatherID = 1741;
- int leatherGot;
- int cowhideprice;
- int leatherprice;
- int goldcheck;
- int pricefix = cowhideprice - 1;
- int profitprice = leatherprice - pricefix;
- long starttime;
- @Override
- public boolean onStart() {
- mouse.setSpeed(random(4, 6));
- starttime = System.currentTimeMillis();
- walking.setRun(true);
- cowhideprice = grandExchange.lookup(cowhide).getGuidePrice();
- leatherprice = grandExchange.lookup(leatherID).getGuidePrice();
- return true;
- }
- public void bank() {
- RSNPC banker = npcs.getNearest(bankerID);
- rest();
- if (bank.isOpen() && !inventory.contains(cowhide)) {
- bank.depositAll();
- Inventory = inventory.getCount(leatherID);
- leatherGot += Inventory;
- bank.withdraw(gold, 100);
- sleep(300, 500);
- bank.withdraw(cowhide, 100);
- sleep(500, 750);
- bank.close();
- } else {
- if(banker != null) {
- if(banker.isOnScreen())
- banker.doAction("Bank Banker");{
- } sleep(1800, 2100);
- } else {
- walking.getPath(bankTile).traverse();
- }
- }
- }
- public void tan(){
- rest();
- RSNPC tanner = npcs.getNearest(tannerID);
- if (tanner != null) {
- if(tanner.isOnScreen())
- tanner.doAction("Trade Ellis");{
- sleep(800, 1100);
- mouse.click(91,108,false);
- sleep(350, 500);
- mouse.click(91,198,true);
- } sleep(500, 800);
- }
- }
- public boolean atBank(){
- RSArea BankArea = new RSArea(new RSTile(3265, 3160),
- new RSTile(3272, 3273));
- return BankArea.contains(getMyPlayer().getLocation());
- }
- public boolean atTanner(){
- RSArea TannerArea = new RSArea(new RSTile(3270, 3189),
- new RSTile(3277, 3194));
- return TannerArea.contains(getMyPlayer().getLocation());
- }
- private void rest() {
- if(walking.getEnergy() < 30)
- walking.rest(random(70,95));
- }
- private void antiBan() {
- int t = random(0, 10);
- int r = random(0, 15);
- if (t == 7);
- if (r == 2) {
- mouse.moveSlightly();
- sleep(500, 800);
- }
- if (r == 3) {
- mouse.moveRandomly(10, 50);
- }
- if (r == 5) {
- camera.moveRandomly(random(350, 650));
- }
- if (r == 6) {
- camera.moveRandomly(random(450, 750));
- }
- if (r == 8) {
- camera.moveRandomly(random(150, 450));
- }
- if (r == 10) {
- camera.moveRandomly(random(750, 1250));
- }
- if (r == 12) {
- mouse.moveOffScreen();
- }
- if (r == 14) {
- camera.moveRandomly(random(500, 900));
- }
- }
- public int loop() {
- if(atBank() && !inventory.contains(cowhide)){
- bank();
- }
- if(atBank() && inventory.contains(leatherID)){
- bank();
- }
- if(atTanner() && inventory.contains(cowhide)){
- tan();
- }
- if(!atTanner() && inventory.contains(cowhide)){
- walking.walkTo(tannerTile);
- }
- if(!atBank() && !inventory.contains(cowhide)){
- walking.walkTo(bankTile);
- }
- antiBan();
- {
- }
- return random(500, 1500);
- }
- @Override
- public void onFinish() {
- }
- //START: Code generated using Enfilade's Easel
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(73, 68, 68);
- private final Color color2 = new Color(153, 153, 153);
- private final Color color3 = new Color(204, 204, 204);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 1, 10);
- private final Font font2 = new Font("Arial", 1, 14);
- private final Image img1 = getImage("http://i.imgur.com/EJBHs.png");
- private final Image img2 = getImage("http://i.imgur.com/aUisg.png");
- private final Image img3 = getImage("http://i.imgur.com/eRsVJ.png");
- private final Image img4 = getImage("http://i.imgur.com/cwGcs.gif");
- private final Image img5 = getImage("http://i.imgur.com/wJiPx.png");
- public void onRepaint(Graphics g1) {
- long millis = System.currentTimeMillis() - starttime;
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- float leahtersec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && leatherGot > 0) {
- leahtersec = ((float) leatherGot)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- float leahtermin = leahtersec * 60;
- float aleatherhour = leahtermin * 60;
- float agoldhour = aleatherhour * profitprice;
- int goldearned = leatherGot * profitprice;
- int leahterhour = Math.round(aleatherhour);
- int goldhour = Math.round(agoldhour);
- Graphics2D g = (Graphics2D)g1;
- g.setColor(color1);
- g.fillRect(5, 343, 508, 131);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRect(5, 343, 508, 131);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Total: " + leatherGot, 72, 460);
- g.drawString("Pr/H: " + leahterhour, 220, 460);
- g.drawString("Pr/H: " + goldhour, 220, 416);
- g.drawString("Total: " + goldearned, 72, 416);
- g.setColor(color2);
- g.drawLine(358, 474, 358, 344);
- g.drawLine(211, 474, 211, 388);
- g.drawLine(60, 474, 60, 344);
- g.drawImage(img1, 90, 290, null);
- g.setFont(font2);
- g.setColor(color3);
- g.drawString( + hours + ":" + minutes + ":" + seconds, 193, 370);
- g.setColor(color2);
- g.drawLine(5, 433, 358, 433);
- g.drawLine(5, 388, 358, 388);
- g.drawImage(img2, 383, 356, null);
- g.drawImage(img3, 20, 440, null);
- g.drawImage(img4, 17, 394, null);
- g.drawImage(img5, 19, 349, null);
- }
- //END: Code generated using Enfilade's Easel
- }
Advertisement
Add Comment
Please, Sign In to add comment