Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.util.*;
- import java.lang.String;
- import org.rsbot.bot.Bot;
- import org.rsbot.script.*;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.accessors.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.util.ScreenshotUtil;
- @ScriptManifest(authors = { "Twistzor" }, category = "Money", name = "Twistzor's YDB buyer", version = 1.0, description = "<html><body bgcolor = Black><font color = Red><center><h2>Twister's Yanille Dragon Bitter Buyer</h2><BR><br></font>"
- +"</body></html>")
- public class TwistzorYDBbuyer extends Script implements PaintListener {
- final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- private int banker = 494;
- private int bartender = 739;
- private int coins = 995;
- private int DB = 1911;
- private int DoorClosed = 1533;
- private int DoorOpen = 1534;
- private String Currentstate = "Starting up";
- RSTile[] fromBanktoDoor = {new RSTile(2613,3094), new RSTile(2603,3097),
- new RSTile(2591,3097),new RSTile(2578,3095),
- new RSTile(2568,3090), new RSTile(2557,3088), new RSTile(2551,3083)};
- RSTile[] fromDoortoBank = reversePath(fromBanktoDoor);
- RSTile fromDoortoBar = new RSTile(2554,3080);
- RSTile doorInside = new RSTile(2551,3082);
- RSTile doorOutside = new RSTile(2551,3083); //= tile van deur
- public boolean onStart(Map<String, String> args) {
- return true;
- }
- public void onFinish(){
- return;
- }
- private void antiban() {
- final int random = random(1, 600);
- if (random == 546) {
- Point randomMouse;
- final int rndMovement = random(1, 5);
- for (int a = 0; a < rndMovement; a++) {
- randomMouse = new Point(random(15, 730), random(15, 465));
- moveMouse(randomMouse);
- wait(random(50, 800));
- }
- return;
- }
- if (random == 1) {
- setCameraRotation(random(1, 60));
- }
- if (random == 242 || random == 346) {
- int currentAngle = getCameraAngle();
- Bot.getClient().getCamPosZ();
- switch (random(0, 1)) {
- case 0:
- setCameraRotation(currentAngle + random(0, 230));
- return;
- case 1:
- setCameraRotation(currentAngle - random(0, 230));
- return;
- }
- }
- if (random == 456) {
- setCameraRotation(random(1, 400));
- }
- if (random == 74 || random == 536 || random == 383 || random == 432) {
- setCameraAltitude(true);
- }
- }
- private boolean atBank(){
- RSNPC bankzor = getNearestNPCByID(banker);
- if(bankzor == null) return false;
- if(bankzor.isOnScreen()){
- return true;
- }else{
- return false;
- }
- }
- private void BankMethod(){
- if(bank.isOpen()){
- Currentstate = "Banking";
- bank.depositAll();
- wait(random(500,750));
- bank.withdraw(coins, 56);
- wait(random(500,750));
- }else{
- RSNPC bankzor = getNearestNPCByID(banker);
- clickRSNPC(bankzor, "Bank");
- wait(random(500,750));
- }
- }
- private void OpenDoorIfNeeded(){
- RSObject DoorC = getNearestObjectByID(DoorClosed);
- if(DoorC != null){
- //atDoor(DoorClosed, 's'); outdated
- Point p = Calculations.tileToScreen(doorOutside, 0.5, 0, 50);
- clickMouse(p, true);
- }
- }
- private void walkfromDoortoBank() {
- RSTile[] randomizedfromDoortoBank = randomizePath(fromDoortoBank, 2, 2);
- Currentstate = "Walking to bank";
- walkPathMM(randomizedfromDoortoBank, 16);
- wait(random(100,1200));
- }
- private boolean atBartender(){
- RSNPC bart = getNearestNPCByID(bartender);
- if(bart == null) return false;
- if(bart.isOnScreen()){
- return true;
- }else{
- return false;
- }
- }
- private void BuyBeer(){
- RSNPC bart = getNearestNPCByID(bartender);
- Currentstate = "Buying";
- clickRSNPC(bart, "Talk-to");
- RSInterface chatint = RSInterface.getInterface(INTERFACE_CHAT_BOX);
- waitForIface(chatint , 5000);
- clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
- wait(random(350,450 ));
- clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
- wait(random(350,450 ));
- clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
- wait(random(350,450 ));
- clickMouse(random(173,344), random(417,406), true);
- wait(random(400,550));
- clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
- wait(random(350,450 ));
- clickMouse(random(234, 378), random(448, 458), true); //Random clickContinue
- wait(random(350,450 ));
- }
- private void walkfromDoortoBar() {
- RSTile randomizedfromDoortoBar = randomizeTile(fromDoortoBar, 2, 2);
- walkTileMM(randomizedfromDoortoBar);
- wait(random(100,1200));
- }
- private void walkfromBanktoDoor() {
- RSTile[] randomizedfromDoortoBar = randomizePath(fromBanktoDoor, 2, 2);
- Currentstate = "walking to bar";
- walkPathMM(randomizedfromDoortoBar, 16);
- wait(random(100,1200));
- }
- public int loop() {
- RSNPC bart = getNearestNPCByID(bartender);
- antiban();
- if(getEnergy() > random(40,70)) setRun(true);
- if(isInventoryFull() || getInventoryCount(coins) == 0){
- if(atBank()){
- BankMethod();
- }else{
- walkTileMM(doorInside, 2, 2);
- log("walking to doorinside");
- wait(random(1500,2500));
- OpenDoorIfNeeded();
- log("check");
- wait(random(1500,2500));
- walkfromDoortoBank();
- log("walktobank");
- }
- }else{
- if(getMyPlayer().getLocation() == doorOutside){
- log("" + getMyPlayer().getLocation().getX());
- OpenDoorIfNeeded();
- wait(random(500,750));
- walkfromDoortoBar();
- }else if(bart != null && atBartender()){
- log("" +getMyPlayer().getLocation());
- while(!isInventoryFull()){
- BuyBeer();
- }
- }else if (!bart.isOnScreen()) {
- RSTile nub = bart.getLocation();
- walkTileMM(nub);
- }else{
- walkfromBanktoDoor();
- atTile(doorOutside, "Walk here");
- }
- }
- return random(800,1000);
- }
- public void onRepaint(Graphics render) {
- if (isLoggedIn()) {
- render.setColor(Color.GREEN);
- render.drawString("State: " + Currentstate, 8, 335);
- Point p = Calculations.tileToScreen(doorOutside, 0.5, 0, 50);
- render.drawOval(p.x - 5, p.y - 5, 5, 5);
- }
- }
- }
Add Comment
Please, Sign In to add comment