All pastes #2069898 Raw Edit

Something

public text v1 · immutable
#2069898 ·published 2011-05-27 05:08 UTC
rendered paste body
import org.omg.CORBA.Current;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.*;
import org.rsbot.script.methods.Magic;
import org.rsbot.script.wrappers.*;

import java.awt.*;
import javax.imageio.ImageIO;
import java.io.IOException;
import java.net.URL;

@ScriptManifest(authors = {"Tarth, Thondar"}, keywords = {"Cow, Hide, Lumbridge"}, name = "CowHider, by Tarth and Thondar", description = "A Cow hide looter, loots cow hides near Lumbridge", version = 1)

public class CowHider extends Script implements PaintListener{
	int lumbridgecheck = 6539;
	int banker = 9710;
	int gate = 45212;
	int cowhide = 1739;
	int cowhideprice;
	long starttime;
	public boolean needBank;
	public int Inventory = 0;
	public int hidesgot;
	RSTile cowpath = new RSTile(3254,3266);
	
	
    @Override
    public boolean onStart() {
    	starttime = System.currentTimeMillis();
    	mouse.setSpeed(5);
    	cowhideprice = grandExchange.lookup(cowhide).getGuidePrice();
    	atLumbridge();
    		if (atLumbridge() == false){
    		lumbridgeTeleport();
    			
    		}
    	
        return true;
    }
    
    public void lumbridgeTeleport(){
    	final int lumbridge = Magic.SPELL_HOME_TELEPORT; 
		magic.castSpell(lumbridge);
		  	
    }
    
    public boolean atLumbridge(){
    	RSArea LUArea = new RSArea(new RSTile(3232, 3211), new RSTile(3255,
				3228));
		return LUArea.contains(getMyPlayer().getLocation());
    	
    }
    
    private boolean atBank() {
    	RSNPC bank = npcs.getNearest(banker);
    	if(bank != null) {
    		if(bank.isOnScreen()); {
    			return true;
    		}
    	}
    	return false;
    }
    
    	 //  if (calc.tileOnScreen(hides.getLocation()) == true); 
			
		  
    
    
    public void moveToCowField(){
    	RSArea COWArea = new RSArea(new RSTile(3253, 3256), new RSTile(3263, 3297));
    	RSGroundItem hide = groundItems.getNearest(cowhide);
    	
    		if (COWArea.contains(getMyPlayer().getLocation())){
    			if(hide != null) {
    				if(hide.isOnScreen())
    			 		hide.doAction("Take");
    				} else {
    	   	walking.getPath(cowpath).traverse();
    				}
    		}
    }
    
    public void Bank() {
		if (inventory.isFull()) {
			needBank = true;
		} else {
			needBank = false;
		}
		if (needBank) {
			if (bank.isOpen()) {
				bank.depositAll();
				Inventory = inventory.getCount(cowhide);
				hidesgot += Inventory;
				sleep(600, 800);
			} else {
				bank.open();
			}	sleep(1800, 2100);
		}
	}

    public int loop() {
    	moveToCowField();
    	Bank();
        return random(500, 1500);
    }

    @Override
    public void onFinish() {
    }
    
    // --------------- PAINT --------------- //
    
    private Image getImage(String url) {
        try {
            return ImageIO.read(new URL(url));
        } catch(IOException e) {
            return null;
        }
    }

    private final Color color1 = new Color(95, 65, 50);

    private final Font font1 = new Font("Comic Sans MS", 0, 16);

    private final Image img1 = getImage("http://i.imgur.com/Rxa1A.jpg");
    private final Image img2 = getImage("http://i.imgur.com/pzrmW.gif");
    private final Image img3 = getImage("http://i.imgur.com/cwGcs.gif");
    private final Image img4 = getImage("http://i.imgur.com/wJiPx.png");
    private final Image img5 = getImage("http://imageshack.us/m/713/2005/cooltext524990002.png");
    private final Image img6 = getImage("http://imageshack.us/m/29/834/cooltext524988541.png");
    private final Image img7 = getImage("http://imageshack.us/m/811/825/cooltext524990524.png");
    private final Image img8 = getImage("http://imageshack.us/m/36/5995/cooltext524986645.png");
    private final Image img9 = getImage("http://imageshack.us/m/7/4655/cooltext524991734.png");
    private final Image img10 = getImage("http://i.imgur.com/wCJju.png");
    private final Image img11 = getImage("http://i.imgur.com/yGfQa.png");
    private final Image img12 = getImage("http://i.imgur.com/XbDXr.png");
    private final Image img13 = getImage("http://i.imgur.com/FQEeg.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;
        
    	int hidesec = 0;
    	if ((minutes > 0 || hours > 0 || seconds > 0) && hidesgot > 0) {
    		hidesec = ((int) hidesgot)/(int)(seconds + (minutes*60) + (hours*60*60));
    	}
    	int hidemin = hidesec * 60;
    	int hidehour = hidemin * 60;
    	int goldhour = hidehour * cowhideprice;
    	int goldearned = hidesgot * cowhideprice;
    	
        Graphics2D g = (Graphics2D)g1;
        g.drawImage(img1, 7, 345, null);
        g.drawImage(img2, 11, 439, null);
        g.drawImage(img3, 9, 392, null);
        g.drawImage(img4, 10, 349, null);
        g.setFont(font1);
        g.setColor(color1);
        g.drawString(+ hours + ":" + minutes + ":" + seconds, 189, 371);
        g.drawString("" + goldearned, 120, 417);
        g.drawString("" + goldhour, 290, 417);
        g.drawString("" + hidesgot, 120, 462);
        g.drawString("" + hidehour, 290, 462);
        g.drawImage(img5, -4, 342, null);
        g.drawImage(img5, -4, 388, null);
        g.drawImage(img6, -24, 304, null);
        g.drawImage(img6, -25, 343, null);
        g.drawImage(img7, 371, 327, null);
        g.drawImage(img7, 33, 328, null);
        g.drawImage(img8, -19, 249, null);
        g.drawImage(img6, -25, 380, null);
        g.drawImage(img6, 488, 302, null);
        g.drawImage(img6, 488, 338, null);
        g.drawImage(img7, 371, 428, null);
        g.drawImage(img7, 33, 427, null);
        g.drawImage(img7, 193, 427, null);
        g.drawImage(img8, -18, 383, null);
        g.drawImage(img6, 488, 378, null);
        g.drawImage(img7, 371, 370, null);
        g.drawImage(img7, 371, 400, null);
        g.drawImage(img7, 193, 370, null);
        g.drawImage(img7, 193, 397, null);
        g.drawImage(img7, 371, 343, null);
        g.drawImage(img7, 33, 353, null);
        g.drawImage(img7, 33, 381, null);
        g.drawImage(img7, 33, 402, null);
        g.drawImage(img9, 28, 258, null);
        g.drawImage(img10, 418, 443, null);
        g.drawImage(img11, 410, 368, null);
        g.drawImage(img12, 435, 423, null);
        g.drawImage(img13, 430, 402, null);
    }
}