Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package main;
- import org.dreambot.api.methods.Calculations;
- import org.dreambot.api.methods.container.impl.bank.BankLocation;
- import org.dreambot.api.methods.map.Area;
- import org.dreambot.api.script.AbstractScript;
- import org.dreambot.api.script.Category;
- import org.dreambot.api.script.ScriptManifest;
- import org.dreambot.api.wrappers.interactive.GameObject;
- import org.dreambot.api.wrappers.interactive.NPC;
- /**
- * Created by Yorrick on 30/06/2016.
- */
- @ScriptManifest(category = Category.MONEYMAKING, name = "Bless My Symbols", author = "Jagg3d", version = 1.0)
- public class Main extends AbstractScript {
- Area JeredArea = new Area(3044,3491,3058,3482,1);
- Area DownStairArea = new Area(3045,3484,3047,3482,0);
- Area UpStairArea = new Area(3045,3484,3047,3482,1);
- String state;
- @Override
- public void onStart() {
- log("Bless My Symbols started.");
- state = "Detecting";
- log("Current state - " + state);
- }
- @Override
- public int onLoop() {
- log("Current state - " + state);
- if (state == "Detecting"){
- if (!getInventory().isEmpty()){
- for (int i = 0; i<28;i++){
- if (!getInventory().getNameForSlot(i).contains("Unblessed symbol")){
- state = "Walking to bank";
- }
- }
- if (state == "Detecting"){
- state = "Walking to monastery";
- }
- }
- else {
- state = "Walking to bank";
- }
- }
- if (state == "Walking to bank"){
- GoBank();
- }
- if (state == "Banking..."){
- BankItems();
- }
- if (state == "Walking to monastery"){
- GoStairs("up");
- }
- if (state == "Going up"){
- if (JeredArea.contains(getNpcs().closest(npc -> npc != null && npc.getName().equals("Brother Jered")))){
- GameObject door = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().contains("Door") && gameObject.hasAction("Open") && gameObject.getID() == 1535);
- if (door.interact("Open")){
- sleep(1000);
- state = "Blessing Symbols";
- }
- }
- }
- if (state == "Blessing Symbols"){
- BlessSymbols();
- }
- return 800;
- }
- private void GoBank() {
- if (!BankLocation.EDGEVILLE.getArea(1).contains(getLocalPlayer())) {
- if (getWalking().walk(BankLocation.EDGEVILLE.getCenter())) {
- sleep(Calculations.random(2000, 4000));
- state = "Walking to bank";
- }
- }else {
- state = "Banking...";
- }
- }
- private void BankItems() {
- GameObject banker = getGameObjects().closest(gameObject -> gameObject != null && gameObject.hasAction("Bank"));
- if (sleepUntil(() -> banker.interact("Bank"),2000)){
- if (sleepUntil(() -> getBank().isOpen(),7500)){
- if (!getInventory().isEmpty()){
- if (getBank().depositAllItems()){
- if (sleepUntil(()->getInventory().isEmpty(),7500)) {
- WithDraw();
- }
- }
- }
- else {
- WithDraw();
- }
- }
- }
- }
- private void WithDraw(){
- if (getBank().contains(item -> item != null && item.getName().equals("Unblessed symbol"))){
- if (sleepUntil(() ->getBank().withdrawAll(item -> item != null && item.getName().equals("Unblessed symbol")),5000)){
- if (getBank().close()){
- sleepUntil(() -> !getBank().isOpen(),5000);
- if (getInventory().contains(item->item.getName().equals("Unblessed symbol"))) {
- state = "Walking to monastery";
- }
- }
- }
- }
- }
- private void GoStairs(String dir) {
- GameObject ladder;
- if (dir=="up"){
- if (!DownStairArea.contains(getLocalPlayer())) {
- if (getWalking().walk(DownStairArea.getTiles()[0])) {
- sleep(Calculations.random(2000, 4000));
- }
- }else {
- ladder = getGameObjects().closest(gameObject -> gameObject != null && gameObject.hasAction("Climb-up"));
- if (ladder.interact("Climb-up")){
- state = "Going up";
- }
- }
- }
- else {
- if (!UpStairArea.contains(getLocalPlayer())) {
- if (getWalking().walk(UpStairArea.getRandomTile())) {
- sleep(Calculations.random(2000, 4000));
- }
- }else {
- ladder = getGameObjects().closest(gameObject -> gameObject != null && gameObject.hasAction("Climb-down"));
- if (ladder.interact("Climb-down")){
- state = "Walking to bank";
- }
- }
- }
- }
- private void BlessSymbols() {
- NPC brother = getNpcs().closest(npc -> npc != null && npc.getName().equals("Brother Jered"));
- if (getInventory().contains(item -> item.getName().equals("Unblessed symbol"))) {
- int invCount = getInventory().size() - 1;
- for (int i = 0;i<=invCount;i++){
- if (!getDialogues().inDialogue()) {
- if(brother.interact("Talk-to")) {
- sleepUntil(getDialogues()::inDialogue, 5000);
- }
- }
- try {
- InDialogue : while (getDialogues().inDialogue()) {
- sleep(750);
- if (getDialogues().canContinue()) {
- getDialogues().continueDialogue();
- } else {
- for (String s : getDialogues().getOptions()) {
- if (s.contains("What can you do to help a bold adventurer like myself?") || s.contains("Bless star, please.")) {
- getDialogues().clickOption(s);
- } else if (s.contains("Tell me about holy symbols.")) {
- break InDialogue;
- }
- }
- }
- }
- log("Blessed symbol #" + String.valueOf(i) + " of " + invCount);
- sleep(300);
- }
- catch (Exception e){ }
- }
- }
- else {
- GameObject door = getGameObjects().closest(gameObject -> gameObject != null && gameObject.getName().contains("Door") && gameObject.hasAction("Open") && gameObject.getID() == 1535);
- sleepUntil(() -> door.interact("Open"), 5000);
- GoStairs("down");
- }
- }
- }
Add Comment
Please, Sign In to add comment