Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.dreambot.api.methods.container.impl.bank.BankType;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.script.listener.InventoryListener;
- import org.dreambot.api.utilities.Timer;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.items.Item;
- import java.awt.*;
- import java.text.DecimalFormat;
- @ScriptManifest(
- author = "WolfsRain",
- description = "Fills buckets in Lumby PVP.",
- category = Category.MONEYMAKING,
- version = 1.0,
- name = "WolfsRain's Bucket Filler"
- )
- public class BucketFiller extends AbstractScript implements InventoryListener{
- //Paint
- private Timer timer;
- private long startTime;
- private long timeRan;
- private int bucketsFilled;
- private int bucketsPerHour;
- //IDs
- public static final int BUCKET = 1925;
- //public static final int BUCKET_NOTE = 1926;
- //public static final int BUCKET_WATER = 1229;
- //public static final int BUCKET_WATER_NOTE = 1230;
- //Tiles
- private static Area fountainArea = new Area(3220,3210,3223,3212);
- //Other
- private static GameObject bankChest;
- private static GameObject fountain;
- private Item bucket;
- public void onStart() {
- log("Starting script...");
- //Timer
- //log("Starting Timer");
- startTime = System.currentTimeMillis();
- timer = new Timer();
- }
- @Override
- public int onLoop() {
- //Set Variables
- bankChest = getGameObjects().closest("Bank chest");
- fountain = getGameObjects().closest("Fountain");
- bucket = getInventory().get(BUCKET);
- //Roofs
- if(getClientSettings().roofsEnabled()){
- log("Turning off roofs.");
- getClientSettings().toggleRoofs(false);
- sleepUntil(() -> !getClientSettings().roofsEnabled(), 2500);
- }
- //Camera Pitch
- if(getCamera().getPitch() < 325){
- getCamera().rotateToPitch(Calculations.random( 325, 383));
- sleepUntil(() -> getCamera().getPitch() > 325, 2500);
- }
- //Open Bank
- if(!getInventory().contains(BUCKET)) {
- if(!getBank().isOpen()) {
- getBank().getClosestBank(BankType.CHEST).interact("Use");
- log("Waiting for transactions");
- sleepUntil(() -> getBank().isOpen(), 2500);
- }
- }
- //Using Bank
- if (getBank().isOpen()){
- log("Bank is Open");
- if (!getInventory().isEmpty()){
- log("Depot the water");
- getBank().depositAllItems();
- sleepUntil(() -> !getInventory().isFull(), 5000);
- } else {
- log("Taking the buckets");
- getBank().withdrawAll(BUCKET);
- sleepUntil(() -> getInventory().isFull(), 1500);
- }
- }
- //Using Buckets on Fountain
- if(getInventory().isFull() && getInventory().contains(BUCKET)){
- log("Inventory is full and we have buckets.");
- if(!getBank().isOpen()){
- if(!fountainArea.contains(getLocalPlayer())){
- getWalking().walk(fountainArea.getRandomTile());
- sleepUntil(() -> fountainArea.contains(getLocalPlayer()), 2500);
- } else {
- if (bucket != null && fountain != null) {
- log("Filling the buckets!");
- bucket.useOn(fountain);
- sleepUntil(() -> !getInventory().contains(BUCKET), 20000);
- }
- }
- } else {
- getBank().close();
- sleepUntil(() -> !getBank().isOpen(), 2500);
- }
- }
- return Calculations.random(25, 75);
- }
- @Override
- public void onPaint(Graphics g) {
- //Calculations
- timeRan = System.currentTimeMillis() - startTime;
- bucketsPerHour = (int) (bucketsFilled / ((System.currentTimeMillis() - this.startTime) / 3600000.0D));
- DecimalFormat df = new DecimalFormat("#");
- //Box
- g.setColor(Color.GRAY);
- g.fillRect(5, 35, 200, 55);
- //Heading
- //Formatting
- g.setFont(new Font("Arial", Font.BOLD, 14));
- g.setColor(Color.WHITE);
- //Paint
- g.drawString("WolfsRain's Bucket Filler", 10, 50);
- //Formatting
- g.setFont(new Font("Arial", Font.PLAIN, 12));
- g.setColor(Color.white);
- //Body
- //Paint
- g.drawString("Time Ran: " + timer.formatTime(), 10, 70);
- g.drawString("Buckets Filled: " + bucketsFilled + " (" + bucketsPerHour + ")/hr", 10, 85);
- }
- public void onItemChange(Item[] items) {
- for (Item item : items) {
- if (item != null && item.getName().equals("Bucket of water") && item.getAmount() > 0) {
- bucketsFilled += item.getAmount();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement