Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //aioWcer version 0.1
- //future updates will include-more places!!! and other requests
- ///////IMPORTS//////
- import java.awt.Graphics;
- import java.util.Map;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.script.Bank;
- import org.rsbot.script.Script;
- import org.rsbot.script.wrappers.RSItemTile;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- @org.rsbot.script.ScriptManifest(authors = { "Indaface" }, category = "Woodcutting", name = "aio Wcer", version = 0.1, description = "<html><head></head><body bgcolor='#222222'><center><table><tr><td width='350' valign='top'><center><div style='font-family:Calibri, Arial;color:#FF3300; font-size:36px'>aioWcer</div><div style='font-family:Calibri, Arial;color:#FFFFFF; font-size:16px'>v0.1 by Indaface <br /></a></div><div style='font-family:Calibri, Arial;color:#FF3300; font-size:16px'>Quick Select</div><div><table bordercolor='#FF3300' border='1' cellpadding='0' cellspacing='0' ><tr><td align='center' style='font-family:Calibri, Arial;color:#FFFFFF; font-size:12px'><b>Tree Locations</b> <br /><select name='trees'><option>WestVarrock RegularLogs<option>EastVarrock Oaks<option>Draynor Willows</select>")
- public class aioWcer extends Script implements PaintListener, ServerMessageListener {
- public enum actions { WALKING_TO_TREES, CHOPPING, BANKING, WALKING_TO_BANK,
- PICKUP_NEST , NULL
- }
- public int myx = getMyPlayer().getLocation().getX();
- public int myy = getMyPlayer().getLocation().getY();
- public String bankAt = "";
- public long startTime = System.currentTimeMillis();
- public boolean isNPC = false;
- public double x1;
- public int[] axes = { 1349, 1351, 1353, 1355, 1357, 1359, 1361, 6739 };
- public int[] treeID;
- public int[] logsID; //TODO: make new integers for this
- public int[] nestIDs = { 5070, 5071, 5072, 5073, 5074, 5075, 7413 };
- public RSTile[] toBank, toTrees;
- public int price, bankID, wcanimation = 867, profit, banker, nestzFound,
- cut, startExp;
- // /////////LOCATIONS///////////////
- public boolean onStart(Map<String, String> args) {
- log("aioWcer Initialized!");
- return true;
- }
- public void serverMessageRecieved(ServerMessageEvent e) {
- String message = e.getMessage();
- if(message.contains("YOU GET SOME LOGS OR SOMETHING??")) {
- cut += 1;
- }
- }
- public actions getAction() {
- if(!inventoryContains(logsID) && isInBank(bankAt)) {
- return actions.WALKING_TO_TREES;
- }
- if(isInventoryFull()) {
- return actions.WALKING_TO_BANK;
- }
- if(isInventoryFull() && isInBank(bankAt)) {
- return actions.BANKING;
- }
- if(findLootItem(10, nestIDs)) {
- return actions.PICKUP_NEST;
- }
- return actions.NULL;
- }
- // /////LOOP/////////
- public int loop() {
- actions act = getAction();
- switch(act) {
- case WALKING_TO_TREES:
- continueWalk(toTrees);
- break;
- case WALKING_TO_BANK:
- continueWalk(toBank);
- break;
- case BANKING:
- RSNPC banker = getNearestNPCByName("Banker");
- if(banker != null) {
- atNPC(banker, "Bank");
- }
- if(inventoryContains(logsID)) {
- bank.depositAllExcept(axes);
- } else {
- bank.close();
- log("Banked logs.");
- }
- break;
- case CHOPPING:
- if(getMyPlayer().getAnimation() == - 1
- && !getMyPlayer().isMoving()) {
- RSObject tree = getNearestObjectByID(treeID);
- if(tree != null) {
- atObject(tree, "Chop");
- }
- }
- break;
- case PICKUP_NEST:
- break;
- case NULL:
- break;
- }
- return random(500,800);
- }
- public boolean hasAxe(int axeID) {
- for(int i=0; i < axes.length; i++ ) {
- return axes[i] == axeID;
- }
- return false;
- }
- boolean findLootItem(final int range, final int[] ids) {
- int minX = myx - range; int minY = myy - range;
- int maxX = myx + range; int maxY = myy + range;
- for (int x = minX; x <= maxX; x++) {
- for (int y = minY; y <= maxY; y++) {
- final RSItemTile[] items = getGroundItemsAt(x, y);
- for (final RSItemTile item : items) {
- int itemID = item.getItem().getID();
- for (final int id : ids) {
- if (itemID == id) {
- return true;
- }
- }
- }
- }
- }
- return false;
- }
- public void continueWalk(final RSTile[] path) {
- if (!getMyPlayer().isMoving() || distanceTo(getDestination()) < random(4, 6)) {
- walkPathMM(randomizePath(path, 2, 2), 16);
- }
- }
- public boolean isInBank(String whatBank) {
- int x = getMyPlayer().getLocation().getX();
- int y = getMyPlayer().getLocation().getY();
- if(whatBank.equals("Varrock East"))
- if(whatBank.equals("Varrock West"))
- if(whatBank.equals("Draynor")) {
- return x < 100 && x > 100 && y < 100 && y > 100;
- }
- return false;
- }
- @Override
- public void onRepaint(Graphics render) {
- }
- }
Add Comment
Please, Sign In to add comment