Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import java.awt.Color;
- import java.awt.Graphics;
- import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.NPC;
- import com.kbot2.scriptable.methods.wrappers.Obj;
- import com.kbot2.scriptable.methods.wrappers.Tile;
- public class WarbosEyeBuyer extends Script implements PaintListener {
- // PATHS \\
- Tile[] TO_SHOP = new Tile[] { new Tile(3093, 3093), new Tile(3089, 3089),
- new Tile(3085, 3085), new Tile(3082, 3082), new Tile(3078, 3078),
- new Tile(3074, 3074), new Tile(3074, 3074), new Tile(3071, 3071),
- new Tile(3066, 3066), new Tile(3061, 3061), new Tile(3056, 3056),
- new Tile(3051, 3051), new Tile(3046, 3046), new Tile(3041, 3041),
- new Tile(3036, 3036), new Tile(3031, 3031), new Tile(3027, 3027),
- new Tile(3022, 3022), new Tile(3020, 3020) };
- Tile[] TO_BANK;
- // Tile[] TO_SHOP_RAND = walking.randomizePath(TO_SHOP, 3, 3);
- // Tile[] TO_BANK_RAND = walking.randomizePath(TO_BANK, 3, 3);
- // TRADING VARIABLES \\
- int TRADER_ID = 583;
- int ITEM_ID = 221;
- int DOOR_ID = 40108;
- // OTHER VARIABLES \\
- int BANKER_ID[] = { 495 };
- int INTERFACE_ID_TRADE = 620;
- String Status;
- long startTime;
- boolean WALKING = false;
- public boolean active() {
- return true;
- }
- @SuppressWarnings("static-access")
- @Override
- public boolean onStart() {
- Status = "Starting Up";
- startTime = System.currentTimeMillis();
- TO_BANK = walking.reversePath(TO_SHOP);
- return true;
- }
- public String getName() {
- return "Warbos Eye Buyer";
- }
- public String getAuthor() {
- return "xWaRbOx";
- }
- public String getDescription() {
- return "Buys Newt Eyes";
- }
- public int loop() {
- if (inventory.getCount() == 28) {
- walkToBank();
- bankItems();
- }
- if (inventory.getCount() != 28) {
- walkToShop();
- openDoor();
- sleep(500, 600);
- tradeSeller();
- }
- return random(100, 300);
- }
- void walkToShop() {
- WALKING = true;
- walking.walkPath(walking.randomizePath(TO_SHOP, 3, 3));
- sleep(2000, 3000);
- if (!getMyPlayer().isMoving()) {
- WALKING = false;
- }
- }
- void walkToBank() {
- WALKING = true;
- walking.walkPath(walking.randomizePath(TO_BANK, 3, 3));
- sleep(2000, 3000);
- if (!getMyPlayer().isMoving()) {
- WALKING = false;
- }
- }
- int bankItems() {
- Status = "Banking";
- if (WALKING == false) {
- if (!bank.isOpen()) {
- NPC npc = npcs.getClosest(8, BANKER_ID);
- npc.doAction("Bank Banker");
- sleep(300, 1200);
- }
- if (bank.isOpen()) {
- if (inventory.getCount() == 28) {
- bank.depositAll(221);
- bank.close();
- return random(100, 500);
- }
- return random(100, 500);
- }
- }
- return random(1000, 2000);
- }
- void getItems() {
- Status = "Getting Items";
- if (WALKING == false) {
- if (interfaces.getInterfaceGroup(620).isValid()) {
- int X_POS = 391;
- int Y_POS = 106;
- clickMouse(X_POS, Y_POS, 5, 5, false);
- atMenu("Buy-X");
- sleep(100, 200);
- sendText(Integer.toString(random(27, 99)), true);
- } else {
- tradeSeller();
- }
- }
- }
- int openDoor() {
- Status = "Opening Door";
- if (WALKING == false) {
- Obj j = getClosestObject(10, DOOR_ID);
- if (j == null)
- return random(100, 500);
- if (j != null) {
- j.doActionAtDoor('w', "Open");
- }
- }
- return random(300, 200);
- }
- int tradeSeller() {
- if (WALKING == false) {
- Status = "Trading Seller";
- NPC n = npcs.getClosest(8, TRADER_ID);
- if (n == null)
- return random(100, 500);
- if (n != null) {
- n.doAction("Trade");
- sleep(1000, 2000);
- getItems();
- }
- }
- return random(1000, 2000);
- }
- /*
- * Methods
- */
- /**
- * Move And Click Mouse With Randomness
- *
- * @param x
- * where on the x axis to move the mouse
- * @param y
- * where on the y axis to move the mouse
- * @param randX
- * maximum randomness X axes
- * @param randY
- * maximum randomness Y axes
- * @param button
- * boolean: true = left click, false = right click
- */
- void clickMouse(int x, int y, int randx, int randy, boolean button) {
- mouse.moveMouse(x, y, randx, randy);
- sleep(100);
- mouse.clickMouse(button);
- }
- public void onRepaint(Graphics g) {
- long runTime = System.currentTimeMillis() - startTime;
- int secs = ((int) ((runTime / 1000) % 60));
- int mins = ((int) (((runTime / 1000) / 60) % 60));
- int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
- String hourss, minss, secss;
- if (secs < 10)
- secss = "0" + secs;
- else
- secss = "" + secs;
- if (mins < 10)
- minss = "0" + mins;
- else
- minss = "" + mins;
- if (hours < 10)
- hourss = "0" + hours;
- else
- hourss = "" + hours;
- g.setColor(new Color(60, 155, 200, 50));
- g.fill3DRect(5, 20, 150, 50, true);
- g.setColor(Color.white);
- g.drawString("Status: " + Status, 10, 38);
- g.drawString("Runtime: " + hourss + ":" + minss + ":" + secss, 10, 56);
- }
- }
Add Comment
Please, Sign In to add comment