Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Polygon;
- import org.tribot.api.DynamicClicking;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.input.Mouse;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.ChooseOption;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Options;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSInterfaceChild;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- @ScriptManifest(authors = { "Coca Cola" }, category = "Money Making", name = "CC Claymaker", description = "Mines clay " +
- "at the Varrock west mine, softens it at the varrock square fountain, makes soft clay, and then banks it in Varrock west bank, and repeats.")
- public class CCSoftClay extends Script implements Painting {
- Timer time = new Timer(3000);
- final long startTime = System.currentTimeMillis();
- private final int[] CLAY_ROCK = { 1760, 1758 };
- private final int BANK_BOOTH = 2213;
- private final int FOUNTAIN = 11785;
- private final int BUCKET = 1925;
- private final int BUCKET_OF_WATER = 1929;
- private final int CLAY_ITEM = 434;
- private final int[] SOFT_CLAY = { 1761 };
- private final int[] DO_NOT_BANK = { 1925, 1929, 434, 1265, 1267, 1269, 2372, 1273, 1275 };
- private final int[] junk ={ 1521, 1971, 1917, 6961, 2327, 9003, 6180, 6181, 6182, 6654,
- 6655, 6656, 6657, 6658, 6659, 6183, 3057, 3058, 3059, 3060,
- 3061, 117, 1607, 1608, 1623, 1624, 1625, 1606, 1621, 1622,
- 1603, 1604, 1619, 1620, 1601, 1602, 1617, 1618, 1973, 995 };
- private final Polygon bankArea = new Polygon(new int[] { 3179, 3186, 3186, 3179},
- new int[] { 3432, 3432, 3448, 3448 },4);
- private final Polygon mineArea = new Polygon(new int[] { 3175, 3185, 3185, 3175},
- new int[] { 3366, 3366, 3377, 3377 },4);
- private final Polygon vSqArea = new Polygon(new int[] { 3207, 3220, 3220, 3107},
- new int[] { 3420, 3420, 3435, 3435 },4);
- RSTile[] banktomine = new RSTile[] { new RSTile(3178, 3429),
- new RSTile(3170, 3423), new RSTile(3170, 3415),
- new RSTile(3170, 3407), new RSTile(3170, 3398),
- new RSTile(3179, 3391), new RSTile(3179, 3384),
- new RSTile(3186, 3378), new RSTile(3184, 3373),
- new RSTile(3180, 3371)};
- RSTile[] minetofountain = new RSTile[] { new RSTile(3186, 3373),
- new RSTile(3193, 3374), new RSTile(3201, 3376),
- new RSTile(3208, 3379), new RSTile(3211, 3384),
- new RSTile(3211, 3393), new RSTile(3211, 3400),
- new RSTile(3211, 3407), new RSTile(3211, 3418),
- new RSTile(3211, 3425)};
- RSTile[] fountaintobank = new RSTile[] { new RSTile(3206, 3428),
- new RSTile(3199, 3428), new RSTile(3191, 3430),
- new RSTile(3184, 3431), new RSTile(3185, 3436)};
- @SuppressWarnings("deprecation")
- int startLvl = Skills.getActualLevel("Mining");
- @SuppressWarnings("deprecation")
- int startXP = Skills.getXP("Mining");
- int bankedClay = 0;
- public void run() {
- if (onStart()) {
- while (true) {
- sleep(loop());
- }
- }
- }
- private boolean onStart() {
- println("Coca Cola's Soft Clay Miner/Softener has started.");
- Mouse.setSpeed(150);
- return true;
- }
- public RSObject findNearest(int distance, int... ids) {
- RSObject[] objects = Objects.findNearest(distance, ids);
- for (RSObject object : objects) {
- if (object != null) {
- return object;
- }
- }
- return null;
- }
- private int loop() {
- RSObject bankbooth = findNearest(15, BANK_BOOTH);
- if (!Inventory.isFull() && bankArea.contains(Player.getPosition().getX(), Player.getPosition().getY())) {
- startRunning();
- checkForJunk();
- Walking.walkPath(banktomine);
- }
- if (Inventory.isFull() && mineArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && Inventory.getCount(CLAY_ITEM) > 1) {
- startRunning();
- checkForJunk();
- Walking.walkPath(minetofountain);
- }
- if (Inventory.isFull() && vSqArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && Inventory.getCount(CLAY_ITEM) > 1
- && Inventory.getCount(BUCKET_OF_WATER) < 1) {
- fillBuckets();
- }
- if (Inventory.isFull() && vSqArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && Inventory.getCount(CLAY_ITEM) > 1
- && Inventory.getCount(SOFT_CLAY) < 1 && Inventory.getCount(BUCKET_OF_WATER) > 1 ) {
- softenClay();
- }
- if (Inventory.isFull() && vSqArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && Inventory.getCount(BUCKET_OF_WATER) < 1
- && Inventory.getCount(CLAY_ITEM) < 1) {
- startRunning();
- Walking.walkPath(fountaintobank);
- }
- if (Inventory.isFull() && vSqArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && Inventory.getCount(CLAY_ITEM) <= 1
- && Inventory.getCount(SOFT_CLAY) > 1) {
- startRunning();
- Walking.walkPath(fountaintobank);
- }
- if (!Inventory.isFull() && mineArea.contains(Player.getPosition().getX(), Player.getPosition().getY())) {
- mine();
- }
- if (Inventory.isFull() && bankArea.contains(Player.getPosition().getX(), Player.getPosition().getY())) {
- if (bankbooth != null) {
- if (bankbooth.isOnScreen()) {
- while(bankbooth.getPosition().distanceTo(Player.getPosition()) < 5 && bankArea.contains(Player.getPosition().getX(), Player.getPosition().getY()) && !Banking.isBankScreenOpen()) {
- bankbooth.click("Bank");
- sleep(2000);
- } if (Banking.isBankScreenOpen()) {
- Banking.depositAllExcept(DO_NOT_BANK);
- bankedClay += Inventory.getCount(SOFT_CLAY);
- Banking.close();
- startRunning();
- }
- }
- }
- }
- return 100;
- }
- public void softenClay() {
- RSItem[] waterbucket = Inventory.find(new int[] { BUCKET_OF_WATER });
- RSItem[] clayitem = Inventory.find(new int[] { CLAY_ITEM });
- RSInterfaceChild clayinterface = Interfaces.get(548, 88);
- if (waterbucket[0].click(new String[] { "Use" })) {
- sleep(450, 655);
- if (clayitem[0].click(new String[] { "Use" })) {
- sleep(1455, 1644);
- if (clayinterface != null) {
- Mouse.clickBox(220, 400, 300, 450, 3);
- ChooseOption.select(new String[] { "All" });
- sleep(17500, 18000);
- }
- }
- }
- }
- public void fillBuckets() {
- RSItem[] bucket = Inventory.find(new int[] { BUCKET });
- RSObject fountain = findNearest(15, FOUNTAIN);
- if (fountain != null) {
- if (fountain.isOnScreen()) {
- if (bucket[0].click(new String[] { "Use" })) {
- sleep(800, 1000);
- while(fountain.getPosition().distanceTo(Player.getPosition()) < 7 && Inventory.getCount(BUCKET_OF_WATER) < 1) {
- DynamicClicking.clickRSObject(fountain, "Use Bucket -> Fountain");
- sleep(1000, 2000);
- }
- }
- sleep(2000);
- time.reset();
- while (Player.getRSPlayer().getAnimation() == -1 || Player.getRSPlayer().getAnimation() == 832 && time.isRunning()) {
- sleep(1000);
- }
- }
- }
- }
- public void mine() {
- RSObject clayrock = findNearest(10, CLAY_ROCK);
- if (clayrock != null) {
- if (clayrock.isOnScreen()) {
- clayrock.click("Mine");
- sleep(2000);
- time.reset();
- while (Player.getRSPlayer().getAnimation() == 628 && time.isRunning()) {
- sleep(10);
- }
- } else {
- Walking.walkTo(clayrock);
- Camera.turnToTile(clayrock.getPosition());
- }
- }
- }
- public void checkForJunk() {
- if(Inventory.getCount(junk) >= 1) {
- Inventory.drop(junk);
- }
- }
- public void startRunning() {
- if(!Game.isRunOn()) {
- Options.setRunOn(true);
- }
- }
- @SuppressWarnings({ "deprecation" })
- public void onPaint (Graphics g) {
- long timeRan = System.currentTimeMillis() - startTime;
- int currentLvl = Skills.getActualLevel("Mining");
- int gainedExp = Skills.getXP("Mining") - startXP;
- int gainedLvl = currentLvl - startLvl;
- int xpToLevel = Skills.getXPToNextLevel("Mining");
- long xpPerHour= (long)(gainedExp * 3600000d / timeRan);
- long clayPerHour = (long)(bankedClay * 3600000d / timeRan);
- Font font = new Font("Trajan Pro", Font.BOLD, 14);
- g.setColor(new Color(164, 152, 151));
- g.setFont(font);
- g.drawString("Time running: " + Timing.msToString(timeRan), 10, 250);
- g.drawString("Mining EXP Gained: " + gainedExp + " (" + xpPerHour + " EXP per hour.)", 10, 270);
- g.drawString("Mining Level: " + currentLvl + " (Gained " + gainedLvl + " levels.)", 10, 290);
- g.drawString("Experience to next level: " + xpToLevel, 10, 310);
- g.drawString("Soft clay made: " + bankedClay + " (" + clayPerHour + " Soft clay per hour.)", 10, 330);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement