Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- @ScriptManifest(authors = {"Tarth, Thondar"}, keywords = {"Cow, Hide, Lumbridge"}, name = "CowHider", description = "A Cowhide looter, loots cowhides near Lumbridge", version = 1.1)
- public class CowHider extends Script implements PaintListener{
- int lumbridgecheck = 6539;
- int bankerID = 9710;
- int gateID = 45212;
- int cowhide = 1739;
- int bones = 526;
- int cowhideprice;
- int bonesprice;
- int bankerLU = 36786;
- int staircase1 = 36773;
- int staircase2 = 36774;
- int staircase3 = 36775;
- int luBankTop = 33505;
- long starttime;
- public int Inventory = 0;
- public int bonesInv = 0;
- public int hidesgot;
- public int bonesgot;
- private boolean bankTele;
- RSTile lootpath = new RSTile(3256,3284);
- RSTile cowpath = new RSTile(3251,3266);
- RSTile BankTile = new RSTile (3449,3720);
- RSTile LUBankTile = new RSTile (3206,3209);
- RSTile TopBankTile = new RSTile (3208,3220,2);
- private boolean restCheck;
- private boolean antibanCheck;
- private boolean guiWait = true;
- cowhider g = new cowhider();
- @Override
- public boolean onStart() {
- mouse.setSpeed(random(4, 6));
- starttime = System.currentTimeMillis();
- g.setVisible(true);
- while(guiWait) sleep(500);
- walking.setRun(true);
- cowhideprice = grandExchange.lookup(cowhide).getGuidePrice();
- bonesprice = grandExchange.lookup(bones).getGuidePrice();
- atLumbridge();
- if (atLumbridge() == false && atField() == false){
- lumbridgeTeleport();
- }
- return true;
- }
- public void lumbridgeTeleport(){
- final int lumbridge = Magic.SPELL_HOME_TELEPORT;
- if (players.getMyPlayer().getAnimation() == -1)
- magic.castSpell(lumbridge);
- sleep(1250, 1750);
- }
- public boolean atLumbridge(){
- RSArea LUArea = new RSArea(new RSTile(3201, 3201), new RSTile(3262,
- 3253));
- return LUArea.contains(getMyPlayer().getLocation());
- }
- public boolean atLumbridgeTop(){
- RSObject BankTop = objects.getNearest(luBankTop);
- if(BankTop != null)
- if(BankTop.isOnScreen());
- return true;
- }
- public boolean atField(){
- RSArea TopArea = new RSArea(new RSTile(3237, 3248), new RSTile(3269,
- 3299));
- return TopArea.contains(getMyPlayer().getLocation());
- }
- public boolean atDaem(){
- RSArea DaemArea = new RSArea(new RSTile(3391, 3651),
- new RSTile(3490, 3773));
- return DaemArea.contains(getMyPlayer().getLocation());
- }
- public void bankLumbridge() {
- RSObject stairs = objects.getNearest(staircase1, staircase2);
- if (restCheck == true) {
- rest();
- }
- if(stairs.isOnScreen())
- stairs.doAction("Climb-up Staircase");
- sleep(300, 500);
- }
- public void bankLumbridgeTop() {
- RSObject banker = objects.getNearest(bankerLU);
- RSObject stairs = objects.getNearest(staircase2);
- if (restCheck == true) {
- rest();
- }
- if(stairs != null)
- if(stairs.isOnScreen())
- stairs.doAction("Climb-up Staircase");
- sleep(300, 500);
- if (bank.isOpen()) {
- bank.depositAll();
- Inventory = inventory.getCount(cowhide);
- hidesgot += Inventory;
- bonesInv = inventory.getCount(bones);
- bonesgot += bonesInv;
- sleep(800, 1100);
- bank.close();
- } else {
- if(banker != null) {
- if(banker.isOnScreen())
- banker.doAction("Use-quickly Bank booth");{
- } sleep(1800, 2100);
- }else{
- walking.getPath(TopBankTile);
- }
- }
- }
- public void moveToCowField(){
- walking.getPath(cowpath).traverse();
- return;
- }
- private void rest() {
- if(restCheck == true);
- if(walking.getEnergy() < 30)
- walking.rest(random(70,95));
- }
- public void loot(){
- RSGroundItem hide = groundItems.getNearest(cowhide);
- if (restCheck == true) {
- rest();
- }
- if(!inventory.isFull())
- if(hide != null) {
- if(hide.isOnScreen()){
- hidePickup();
- camera.moveRandomly(300);
- if (hide.doAction("Take Cowhide")){
- sleep(800,1000);
- while(getMyPlayer().isMoving())
- sleep(100,150);
- }
- } else {
- walking.walkTileMM(new RSTile(hide.getLocation().getX(), hide.getLocation().getY()));
- camera.moveRandomly(200);
- }
- }
- else {
- walking.getPath(lootpath).traverse();
- }
- }
- 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 void Bank() {
- RSNPC banker = npcs.getNearest(bankerID);
- if (restCheck == true) {
- rest();
- }
- if (bank.isOpen()) {
- bank.depositAll();
- Inventory = inventory.getCount(cowhide);
- hidesgot += Inventory;
- bonesInv = inventory.getCount(bones);
- bonesgot += bonesInv;
- sleep(800, 1100);
- bank.close();
- } else {
- if(banker != null) {
- if(banker.isOnScreen())
- banker.doAction("Bank Fremennik banker");{
- } sleep(1800, 2100);
- } else {
- walking.getPath(BankTile).traverse();
- }
- }
- }
- private void teleport() {
- if (game.getCurrentTab() != Game.TAB_EQUIPMENT) {
- game.openTab(Game.TAB_EQUIPMENT);
- sleep(random(300, 600));
- }
- interfaces.get(Equipment.INTERFACE_EQUIPMENT)
- .getComponent(Equipment.RING).doAction("Teleport");
- sleep(750, 1250);
- }
- private RSGroundItem hidePickup() {
- return groundItems.getNearest(new Filter<RSGroundItem>() {
- public boolean accept(RSGroundItem g) {
- return g.getItem().getID() == cowhide;
- }
- });
- }
- public int loop() {
- if(atLumbridge() && !inventory.isFull()) {
- moveToCowField();
- return 0;}
- if(atField() && !inventory.isFull()) {
- loot();
- return 0;}
- if(atDaem() && !inventory.isFull()) {
- lumbridgeTeleport();
- return 0;}
- if(atDaem() && inventory.isFull()) {
- walking.walkTo(BankTile);
- Bank();
- return 0;}
- if(atLumbridgeTop() && !inventory.isFull()) {
- lumbridgeTeleport();
- return 0;}
- if(atLumbridge() && inventory.isFull()) {
- walking.walkTileMM(LUBankTile);
- bankLumbridge();
- return 0;}
- if(atField() && inventory.isFull() && bankTele == true) {
- if (players.getMyPlayer().getAnimation() == -1)
- lumbridgeTeleport();
- sleep(900, 1300);
- return 0;}
- if(atField() && inventory.isFull() && bankTele == false) {
- if (players.getMyPlayer().getAnimation() == -1)
- teleport();
- sleep(900, 1300);
- return 0;}
- if(atLumbridgeTop() && inventory.isFull()) {
- bankLumbridgeTop();
- return 0;}
- if(antibanCheck == true) {
- antiBan();
- }
- return random(500, 1500);
- }
- @Override
- public void onFinish() {
- env.saveScreenshot(true);
- }
- // --------------- PAINT --------------- //
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(150, 110, 75);
- private final Font font1 = new Font("Calibri", 0, 18);
- 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 img14 = getImage("http://i.imgur.com/eUH7L.png");
- private final Image img15 = getImage("http://i.imgur.com/JWplE.png");
- private final Image img16 = getImage("http://i.imgur.com/aUisg.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 hidesec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && hidesgot > 0) {
- hidesec = ((float) hidesgot)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- float bonessec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && bonesgot > 0) {
- bonessec = ((float) bonesgot)/(float)(seconds + (minutes*60) + (hours*60*60));
- }
- float bonesmin = bonessec * 60;
- float bboneshour = bonesmin * 60;
- float bgoldhour = bboneshour * bonesprice;
- float hidemin = hidesec * 60;
- float hhidehour = hidemin * 60;
- float hgoldhour = hhidehour * cowhideprice;
- float agoldhour = bgoldhour + hgoldhour;
- int agoldearned = hidesgot * cowhideprice;
- int bgoldearned = bonesgot * bonesprice;
- int goldearned = agoldearned + bgoldearned;
- int hidehour = Math.round(hhidehour);
- int goldhour = Math.round(agoldhour);
- 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, 190, 371);
- g.drawString("" + goldearned, 70, 417);
- g.drawString("" + goldhour, 240, 417);
- g.drawString("" + hidesgot, 70, 462);
- g.drawString("" + hidehour, 240, 462);
- g.drawImage(img5, -4, 342, null);
- g.drawImage(img5, -4, 388, null);
- g.drawImage(img6, -25, 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, 200, 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, 200, 370, null);
- g.drawImage(img7, 200, 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(img14, 144, 395, null);
- g.drawImage(img14, 144, 440, null);
- g.drawImage(img15, 316, 395, null);
- g.drawImage(img15, 316, 440, null);
- g.drawImage(img16, 398, 356, null);
- }
- class cowhider extends JFrame {
- public cowhider() {
- initComponents();
- }
- private void startButtonActionPerformed(ActionEvent e) {
- String chosen = comboBox1.getSelectedItem().toString();
- if(chosen.equals("Lumbridge")) {
- bankTele = true;
- }else{
- bankTele = false;
- }
- if(checkBox1.isSelected()) {
- restCheck = true;
- }
- if(checkBox2.isSelected()) {
- antibanCheck = true;
- }
- guiWait = false;
- g.dispose();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
- label1 = new JLabel();
- comboBox1 = new JComboBox();
- label2 = new JLabel();
- startButton = new JButton();
- label3 = new JLabel();
- checkBox1 = new JCheckBox();
- checkBox2 = new JCheckBox();
- //======== this ========
- Container contentPane = getContentPane();
- //---- label1 ----
- label1.setText("Cowhider");
- label1.setFont(new Font("Calibri", Font.PLAIN, 30));
- label1.setHorizontalAlignment(SwingConstants.CENTER);
- //---- comboBox1 ----
- comboBox1.setModel(new DefaultComboBoxModel(new String[] {
- "Lumbridge",
- "Daemonheim"
- }));
- //---- label2 ----
- label2.setText("Where to bank:");
- //---- startButton ----
- startButton.setText("Start");
- startButton.addActionListener(new ActionListener() {
- @Override
- public void actionPerformed(ActionEvent e) {
- startButtonActionPerformed(e);
- }
- });
- //---- label3 ----
- label3.setText("NB! Daemonheim banking requiers a \"Ring of kinship\"");
- label3.setFont(new Font("Tahoma", Font.ITALIC, 11));
- //---- checkBox1 ----
- checkBox1.setText("Rest");
- //---- checkBox2 ----
- checkBox2.setText("Antiban");
- GroupLayout contentPaneLayout = new GroupLayout(contentPane);
- contentPane.setLayout(contentPaneLayout);
- contentPaneLayout.setHorizontalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(contentPaneLayout.createParallelGroup()
- .addComponent(startButton, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
- .addComponent(label1, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE)
- .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
- .addComponent(label2)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE)
- .addComponent(comboBox1, GroupLayout.PREFERRED_SIZE, 180, GroupLayout.PREFERRED_SIZE))
- .addComponent(label3, GroupLayout.Alignment.TRAILING, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE)
- .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup()
- .addComponent(checkBox1, GroupLayout.PREFERRED_SIZE, 86, GroupLayout.PREFERRED_SIZE)
- .addGap(28, 28, 28)
- .addComponent(checkBox2, GroupLayout.PREFERRED_SIZE, 99, GroupLayout.PREFERRED_SIZE)))
- .addContainerGap())
- );
- contentPaneLayout.setVerticalGroup(
- contentPaneLayout.createParallelGroup()
- .addGroup(contentPaneLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(label1)
- .addGap(18, 18, 18)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
- .addComponent(label2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(comboBox1, GroupLayout.DEFAULT_SIZE, 28, Short.MAX_VALUE))
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(label3)
- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 33, Short.MAX_VALUE)
- .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
- .addComponent(checkBox1)
- .addComponent(checkBox2))
- .addGap(18, 18, 18)
- .addComponent(startButton, GroupLayout.PREFERRED_SIZE, 39, GroupLayout.PREFERRED_SIZE)
- .addContainerGap())
- );
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- // Generated using JFormDesigner Evaluation license - Jonas Bill Jensen
- private JLabel label1;
- private JComboBox comboBox1;
- private JLabel label2;
- private JButton startButton;
- private JLabel label3;
- private JCheckBox checkBox1;
- private JCheckBox checkBox2;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment