- package Potion;
- import com.kbotpro.scriptsystem.events.PaintEventListener;
- import com.kbotpro.scriptsystem.interfaces.Looped;
- import com.kbotpro.scriptsystem.runnable.Script;
- import com.kbotpro.scriptsystem.various.KTimer;
- import com.kbotpro.scriptsystem.wrappers.IComponent;
- import com.kbotpro.scriptsystem.wrappers.PhysicalObject;
- import com.kbotpro.scriptsystem.wrappers.Tile;
- import com.kbotpro.scriptsystem.fetch.Game;
- import com.kbotpro.scriptsystem.wrappers.Item;
- import java.awt.*;
- public class Potion extends Script implements PaintEventListener {
- public int Vial = 227;
- public int Flax = 2998;
- public int unf = 3002;
- public int wellID = 11661;
- private final int[] boothID = {11758,11402,36786,2213,14367};
- public Tile wellLocation = new Tile(2949, 3382),bankLocation = new Tile(2946, 3368);
- private final Tile[] bankpath = new Tile[]{new Tile(2950, 3379), new Tile(2946,3374),new Tile(2946,3369)};
- public PhysicalObject bankBooth;
- private PhysicalObject well;
- private int paintX = 0;
- private int paintY = 0;
- private boolean paintSetup = true;
- private KTimer runTime = new KTimer();
- private KTimer waitTime;
- public String status;
- public boolean NoMore = false;
- public int numBucket =0;
- public boolean justClicked = false;
- public void onRepaint(Graphics g) {
- paintX = 15;
- paintY = 195;
- Color transBlack = new Color(0, 0, 0, 170);
- g.setColor(transBlack);
- g.drawRoundRect(paintX - 17, paintY - 20, 200, 190, 20, 20);
- g.fillRoundRect(paintX - 17, paintY - 20, 200, 190, 20, 20);
- g.setColor(Color.WHITE);
- g.drawString(getName() + " v" + getVersion(), paintX, paintY);
- paintY += 15;
- g.drawString("By " + getAuthor(), paintX, paintY);
- paintY += 15;
- g.drawString("Running for "
- + runTime.getFormattedTime(runTime.getTimeElapsed()),
- paintX, paintY);
- paintY += 15;
- g.drawString(" -Current Status- " , paintX, paintY);
- paintY += 15;
- g.drawString( status , paintX, paintY);
- }
- @Override
- public void stop() {
- //To change body of implemented methods use File | Settings | File Templates.
- }
- public void onStart(){
- setUserInputEnabled(false);
- }
- private Tile randomizeTile(Tile t) {
- return new Tile(t.getX() + random(-2, 3), t.getY() + random(-2, 3));
- }
- private boolean clickItem(int id, String act) {
- for(Item i : inventory.getItems()) {
- if(i.getID() != id) continue;
- return i.doAction(act);
- }
- return false;
- }
- public boolean inventoryItem(){
- status = "Inventory at item";
- if(!inventory.isOpen()){
- game.openTab(Game.TAB_INVENTORY);
- while (game.getCurrentTab() != Game.TAB_INVENTORY) {
- sleep(200);
- }
- }
- if(inventory.contains(Vial) && inventory.contains(Flax)){
- if(random(0, 1) == 0) {
- if(clickItem(Vial, "Use")){
- sleep(100,200);
- if(clickItem(Flax, "Clean toadflax"))
- return true;
- } else{
- if(inventory.atItem(Flax, "Use")){
- sleep(100,200);
- if(inventory.atItem(Vial, "water"))
- return true;
- }
- }
- }
- }
- return true;
- }
- public boolean clickAll(){
- status = "Clicking Interface";
- if(interfaces.interfaceExists(513)){
- IComponent ClickAll = interfaces.getInterface(513).getComponent(4); //Gets an IComponent of the interface with the specified ID
- if(ClickAll.doAction("Make All")){
- justClicked = true;
- return true;
- }else return false;
- } else return false;
- // close the other one, opena new tab
- }
- public boolean openBank(){ //thanks but why dose it do 2 times? let me check somethingkk go on :P
- status = "Opening Bank";
- if(bank.isOpen()){
- return true;
- }
- bankBooth = objects.getClosestObject(15, boothID);
- if(bankBooth != null && calculations.onScreen(bankBooth.getScreenPos())) {
- bankBooth.doAction("quick");
- sleep(1000,1500);
- if(getMyPlayer().isMoving())
- sleep(1000,2500);
- return bank.isOpen();
- } else return false;
- }
- public void withdraw(){
- status = "Withdrawing items.";
- if(bank.isOpen()){
- if(!inventory.contains(Vial)){
- if(bank.contains(Vial)) {
- if(bank.getCount(Vial) < 14)
- bank.withdrawAll(Vial);
- bank.withdrawX(Vial,14);
- sleep(1000,2000);
- } else NoMore = true;
- }
- if(!inventory.contains(Flax)){
- if(bank.contains(Flax)){
- if(bank.getCount(Flax) < 14)
- bank.withdrawAll(Flax);
- bank.withdrawX(Flax,14);
- sleep(1000,2000);
- } else NoMore = true;
- }
- bank.close();
- }
- }
- public void deposit(){
- status = "Depositing items";
- if(bank.isOpen()){
- if(inventory.contains(Vial) || inventory.contains(Flax) || inventory.contains(unf))
- // bank.depositAll(softclayID);
- bank.depositAllInventory();
- // if(inventory.contains(bucketID))
- // bank.depositAll(bucketID);
- }
- }
- @Override
- public void registerWorkers() {
- createWorker(new Looped() {
- public int loop() {
- if(!isLoggedIn()) {
- return random(1000, 2000);
- }
- if(inventoryItem()){
- sleep(1500,2000);
- clickAll();
- }
- while(justClicked){
- status = "Making Ur Pots";
- KTimer waitTime = new KTimer(17000);
- sleep(100);
- if(waitTime.isDone())
- justClicked = false;
- if(!inventory.contains(Vial) || !inventory.contains(Flax) || waitTime.isDone()){
- justClicked = false;
- }
- }
- if(!inventory.contains(Vial) || !inventory.contains(Flax)){
- if(openBank()){
- deposit();
- withdraw();
- }
- }
- if(NoMore){
- status = "Script Stopping";
- sleep(1000,2000);
- log("NEXT TIME BRING MORE STUFF :)<3");
- stopAllScripts();
- }
- return random(100, 200);
- }
- });
- createWorker(new Looped() {
- public int loop() {
- if(justClicked){
- switch (random(0, 20)) {
- case 1:
- if(random(0,4)==0)
- camera.setAngle((int) (camera.getAngle()+random(-180,180)));
- break;
- case 2: if(random(0,4)==0)
- camera.setAltitude(random(0, 2) == 0, random(100,1000));
- break;
- }
- }
- return 100;
- }
- });
- // Create more workers here as needed
- }
- @Override
- public String getName() {
- return "WhenEazy'sDrunk"; //To change body of implemented methods use File | Settings | File Templates.
- }
- public double getVersion() {
- return 1.0;
- }
- public String getAuthor() {
- return "Eazy-II :)<3";
- }
- }