Created
May 10, 2018 16:55
-
-
Save drusepth/22127e2e5ebe9542781ba97e87b4db6d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package scripts.tasks.train.magic; | |
| import org.powerbot.script.Condition; | |
| import org.powerbot.script.Random; | |
| import org.powerbot.script.rt4.ClientContext; | |
| import org.powerbot.script.rt4.Magic; | |
| import scripts.Task; | |
| import scripts.reference.items.RuneId; | |
| import scripts.reference.towns.TownWaypoint; | |
| import scripts.services.InventoryService; | |
| import scripts.services.SkillService; | |
| import scripts.tasks.banking.BankingTask; | |
| import scripts.tasks.banking.DepositItemsTask; | |
| import scripts.tasks.banking.WithdrawItemTask; | |
| import scripts.tasks.gather.BonesGatherer; | |
| import scripts.tasks.navigation.NavigationTask; | |
| public class BonesToBananasTask extends Task { | |
| public BonesToBananasTask(ClientContext ctx) { | |
| super(ctx); | |
| } | |
| @Override | |
| public boolean activate() { | |
| return InventoryService.items_by_id(ctx, RuneId.NATURE_RUNE_ID).poll().stackSize() > 0 | |
| && InventoryService.items_by_id(ctx, RuneId.WATER_RUNE_ID).poll().stackSize() > 0; | |
| } | |
| @Override | |
| public void execute() { | |
| // Go get runes first if we need them | |
| if (InventoryService.items_by_id(ctx, new int[] { RuneId.NATURE_RUNE_ID, RuneId.NATURE_RUNE_ID }).count() == 0) { | |
| System.out.println("Walking to Draynor to get initial runes"); | |
| new NavigationTask(ctx, TownWaypoint.Lumbridge_GeneralStore).execute(); | |
| new NavigationTask(ctx, TownWaypoint.Draynor_Bank).execute(); | |
| new BankingTask(ctx).execute(); | |
| new WithdrawItemTask(ctx, new int[]{RuneId.NATURE_RUNE_ID, RuneId.WATER_RUNE_ID}).execute_if_activateable(); | |
| } | |
| System.out.println("Walking to Lumby General"); | |
| new NavigationTask(ctx, TownWaypoint.Lumbridge_GeneralStore).execute(); | |
| System.out.println("Walking to chickens"); | |
| new NavigationTask(ctx, TownWaypoint.Lumbridge_Chickens).execute(); | |
| System.out.println("Picking up bones"); | |
| new BonesGatherer(ctx).execute_if_activateable(); | |
| while (InventoryService.isnt_full(ctx)) { | |
| if (ctx.controller.isStopping()) { | |
| return; | |
| } | |
| new BonesGatherer(ctx).execute_if_activateable(); | |
| } | |
| // Cast spell | |
| System.out.println("Casting bones to bananas"); | |
| ctx.magic.cast(Magic.Spell.BONES_TO_BANANAS); | |
| Condition.sleep(Random.nextInt(1000, 3000)); | |
| // Lets go bank it and start again! | |
| System.out.println("Walking to Lumby General"); | |
| new NavigationTask(ctx, TownWaypoint.Lumbridge_GeneralStore).execute(); | |
| System.out.println("Walking to Draynor"); | |
| new NavigationTask(ctx, TownWaypoint.Draynor_Bank).execute(); | |
| new DepositItemsTask(ctx, new int[] { 1963 }).execute_if_activateable(); | |
| if (InventoryService.items_by_id(ctx, new int[] { RuneId.NATURE_RUNE_ID, RuneId.NATURE_RUNE_ID }).count() == 0) { | |
| new WithdrawItemTask(ctx, new int[]{RuneId.NATURE_RUNE_ID, RuneId.WATER_RUNE_ID}).execute_if_activateable(); | |
| } | |
| } | |
| @Override | |
| public int related_skill_id() { | |
| return SkillService.MAGIC; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment