Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.Point;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Random;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.wrappers.RSArea;
- import org.rsbot.script.wrappers.RSComponent;
- import org.rsbot.script.wrappers.RSItem;
- import org.rsbot.script.wrappers.RSInterface;
- import org.rsbot.script.wrappers.RSNPC;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSPlayer;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSTilePath;
- import org.rsbot.script.methods.Bank;
- import org.rsbot.script.methods.Camera;
- import org.rsbot.script.methods.Equipment;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.methods.Interfaces;
- import org.rsbot.script.methods.Magic;
- import org.rsbot.script.methods.Objects;
- import org.rsbot.script.methods.Players;
- import org.rsbot.script.methods.Skills;
- @ScriptManifest(authors = "qwerty", name = "lawcrafter", version = 1.3, description = "start at daemonheim banker with law tiara equiped")
- public class lawcrafter extends Script{
- //
- // NPC
- //
- public int bankerID = 9710;
- public int mamarosID = 9711;
- public int monkID[] = {657, 2728, 2729};
- //
- //Paths
- //
- public RSTile[] PORTAL_TO_ALTAR = { new RSTile(2464, 4819), new RSTile(2464, 4825), new RSTile(2464, 4830) };
- public RSTile[] PIER_TO_RUINS = { new RSTile(2834, 3335), new RSTile(2840, 3335), new RSTile(2845, 3335),
- new RSTile(2850, 3336), new RSTile(2855, 3340), new RSTile(2859, 3341),
- new RSTile(2859, 3345), new RSTile(2859, 3350), new RSTile(2859, 3355),
- new RSTile(2857, 3357), new RSTile(2857, 3360), new RSTile(2857, 3365),
- new RSTile(2858, 3370), new RSTile(2858, 3375), new RSTile(2858, 3379)};
- public RSTile[] STILE_TO_DEPOSIT_BOX = { new RSTile(3063, 3282), new RSTile(3063, 3278), new RSTile(3063, 3273),
- new RSTile(3062, 3269), new RSTile(3061, 3263), new RSTile(3058, 3260),
- new RSTile(3056, 3254), new RSTile(3053, 3249), new RSTile(3049, 3246),
- new RSTile(3043, 3245), new RSTile(3042, 3241), new RSTile(3043, 3237),
- new RSTile(3047, 3236)};
- public RSTile[] DAEMONHEIM_TO_BANK = { new RSTile(3450, 3700), new RSTile(3450, 3705), new RSTile(3450, 3710),
- new RSTile(3450, 3715), new RSTile(3450, 3720)};
- public RSTile[] CABBAGE_TO_STILE = { new RSTile(3054, 3289), new RSTile(3058, 3288), new RSTile(3063, 3284)};
- //
- // Objects IDs
- //
- public int altarObjectID = 2485;
- public int ruinsObjectID = 2459;
- public int stileID = 7527;
- public int dboxID = 36788;
- public int gangplankID = 2415;
- //
- // Item IDs
- //
- public int law_rune_ID = 563;
- public int pure_ess_ID = 7936;
- public int exp_ring_ID = 19760;
- //public int exp_ring_ID = 13562;
- //
- // Area
- //
- //public RSArea BankArea = new RSArea(new RSTile(3447, 3719), new RSTile(3449, 3721));
- public RSArea BankArea = new RSArea(new RSTile(3446, 3718), new RSTile(3450, 3722));
- public RSArea AltarArea = new RSArea(new RSTile(2459, 4827), new RSTile(2469, 4837));
- public RSArea CabbageArea = new RSArea(new RSTile(3053, 3284), new RSTile(3064, 3290));
- public RSArea stileArea = new RSArea(new RSTile(3061, 3283), new RSTile(3065, 3285));
- public RSArea dboxArea = new RSArea(new RSTile(3046, 3236), new RSTile(3048, 3237));
- public RSArea ruinsArea = new RSArea(new RSTile(2856, 3379), new RSTile(2860, 3382));
- //
- // Methods
- //
- public void banking() {
- RSNPC bank_obj = npcs.getNearest(bankerID);
- camera.setPitch(true);
- if ( !getMyPlayer().isMoving() && !(interfaces.get(Bank.INTERFACE_BANK).isValid()) ) {
- bank_obj.interact("Bank Fremennik Banker");
- sleep(2000);
- }
- if( interfaces.get( Bank.INTERFACE_BANK).isValid() ) {
- bank.depositAll();
- sleep(2000);
- bank.withdraw(exp_ring_ID, 0);
- sleep(2000);
- bank.withdraw(pure_ess_ID, 0);
- while ( bank.isOpen() ) {
- bank.close();
- sleep(1000);
- }
- }
- }
- public void rest() {
- if ( interfaces.getComponent(750, 6).doAction("Rest") ) {
- mouse.moveSlightly();
- while ( walking.getEnergy() < 100 ) {
- sleep(1500, 2000);
- }
- }
- if ( !walking.isRunEnabled() ) {
- walking.setRun(true);
- }
- }
- public void teleport() {
- if (getMyPlayer().getAnimation() != 13652) {
- if ( equipment.getItem(Equipment.RING).doAction("Teleport") ) {
- sleep(15000);
- }
- }
- }
- public boolean IsInRandom() {
- RSInterface bugger = magic.getInterface();
- if ( bugger == null) {
- return true;
- } else {
- return false;
- }
- }
- public void cabbageport() {
- RSItem explorer_ring = inventory.getItem(exp_ring_ID);
- if ( !(explorer_ring == null) ){
- explorer_ring.doAction("Cabbage-port");
- sleep(3000);
- }
- }
- public void crimb_stile() {
- RSObject stile = objects.getNearest(stileID);
- if ( !(stile == null) ){
- if ( !getMyPlayer().isMoving() ) {
- stile.doAction("Climb");
- sleep(3000);
- }
- }
- }
- public void deposit() {
- RSObject depositbox = objects.getNearest(dboxID);
- depositbox.doClick();
- sleep(3000);
- if ( bank.isDepositOpen() ){
- bank.deposit(exp_ring_ID, 0);
- }
- bank.close();
- }
- public void boating() {
- int counter = 0;
- RSNPC monk = npcs.getNearest(monkID);
- if ( (monk != null) ){
- monk.interact("Take-boat");
- sleep(3000);
- if ( interfaces.get(64).isValid() ) {
- while ( (objects.getNearest(gangplankID) == null) && (counter < 7) ) {
- sleep(1000);
- mouse.click(random(245,255), random(450,460), true);
- counter++;
- }
- }
- }
- }
- public void depart() {
- RSObject gangplank = objects.getNearest(gangplankID);
- if ( gangplank != null ){
- gangplank.doAction("Cross Gangplank");
- sleep(3000);
- }
- }
- public void enter_ruins() {
- RSObject ruins = objects.getNearest(ruinsObjectID);
- if ( ruins != null ){
- ruins.doAction("Enter");
- }
- }
- public void craft_essence() {
- RSObject altar = objects.getNearest(altarObjectID);
- if ( altar != null ){
- altar.doAction("Craft-rune");
- }
- }
- public int loop(){
- if (game.isLoggedIn()){
- if ( walking.getEnergy() < random(10, 20) ) {
- log("Resting");
- rest();
- return 0;
- }
- else if ( ((npcs.getNearest(mamarosID) != null) || (npcs.getNearest(bankerID) != null)) && !BankArea.contains(getMyPlayer().getLocation()) && walking.newTilePath(DAEMONHEIM_TO_BANK).isValid() ){
- log("Walking to bank");
- walking.newTilePath(DAEMONHEIM_TO_BANK).traverse();
- sleep(1000);
- return 0;
- }
- else if ( (npcs.getNearest(bankerID) != null) && (!inventory.isFull() || !inventory.contains(exp_ring_ID) || !inventory.contains(pure_ess_ID)) ){
- log("Banking");
- banking();
- return 0;
- }
- else if ( !bank.isOpen() && BankArea.contains(getMyPlayer().getLocation()) && inventory.contains(pure_ess_ID) && inventory.contains(exp_ring_ID) ){
- log("Cabbageport");
- cabbageport();
- sleep(1000);
- return 0;
- }
- else if ( CabbageArea.contains(getMyPlayer().getLocation()) && !stileArea.contains(getMyPlayer().getLocation()) ){
- log("Walking to stile");
- walking.newTilePath(CABBAGE_TO_STILE).randomize(0,0).traverse();
- sleep(1000);
- return 0;
- }
- else if ( stileArea.contains(getMyPlayer().getLocation()) ) {
- log("Crimbing over stile");
- crimb_stile();
- return 0;
- }
- else if ( inventory.contains(exp_ring_ID) && !stileArea.contains(getMyPlayer().getLocation()) && !dboxArea.contains(getMyPlayer().getLocation()) && walking.newTilePath(STILE_TO_DEPOSIT_BOX).isValid() ){
- log("Walking to deposit box");
- walking.newTilePath(STILE_TO_DEPOSIT_BOX).traverse();
- return 0;
- }
- else if ( objects.getNearest(dboxID) != null && inventory.contains(exp_ring_ID) ) {
- log("Deposit explorer ring");
- deposit();
- return 0;
- }
- else if ( npcs.getNearest(monkID) != null ) {
- log("Taking boat");
- boating();
- return 0;
- }
- else if ( objects.getNearest(gangplankID) != null ) {
- log("Departing boat");
- depart();
- return 0;
- }
- else if ( !inventory.contains(exp_ring_ID) && inventory.contains(pure_ess_ID) && walking.newTilePath(PIER_TO_RUINS).isValid() && !ruinsArea.contains(getMyPlayer().getLocation()) ) {
- log("Walking to ruins");
- walking.newTilePath(PIER_TO_RUINS).traverse();
- if ( !getMyPlayer().isMoving() ) {
- log("Walking to ruins (method #2)");
- walking.walkTileMM(new RSTile(2858, 3379));
- }
- return 0;
- }
- else if ( objects.getNearest(ruinsObjectID) != null ) {
- log("Entering ruins");
- enter_ruins();
- return 0;
- }
- else if ( walking.newTilePath(PORTAL_TO_ALTAR).isValid() && !AltarArea.contains(getMyPlayer().getLocation()) ) {
- log("Walking to altar");
- walking.newTilePath(PORTAL_TO_ALTAR).traverse();;
- return 0;
- }
- else if ( AltarArea.contains(getMyPlayer().getLocation()) && inventory.contains(pure_ess_ID) ) {
- log("Crafting runes");
- craft_essence();
- return 0;
- }
- else if ( AltarArea.contains(getMyPlayer().getLocation()) && !inventory.contains(pure_ess_ID) ) {
- log("teleport to daemonheim");
- teleport();
- return 0;
- }
- else if ( !IsInRandom() ) {
- sleep(5000);
- if ( !walking.newTilePath(DAEMONHEIM_TO_BANK).isValid() &&
- !walking.newTilePath(STILE_TO_DEPOSIT_BOX).isValid() &&
- !walking.newTilePath(PIER_TO_RUINS).isValid() &&
- !walking.newTilePath(PORTAL_TO_ALTAR).isValid() ) {
- log("Teleport: Lost the way/Failed random event");
- teleport();
- return 0;
- }
- }
- }
- return 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement