Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.powerbot.game.api.util.Random;
- import org.powerbot.concurrent.Task;
- import org.powerbot.game.api.Manifest;
- import org.powerbot.concurrent.action.Action;
- import org.powerbot.game.api.ActiveScript;
- import org.powerbot.game.api.methods.Tabs;
- import org.powerbot.game.api.methods.Widgets;
- import org.powerbot.game.api.methods.interactive.Npcs;
- import org.powerbot.game.api.methods.tab.Inventory;
- import org.powerbot.game.api.methods.widget.Camera;
- import org.powerbot.game.api.util.Filter;
- import org.powerbot.game.api.util.Time;
- import org.powerbot.game.api.wrappers.interactive.Npc;
- import org.powerbot.game.api.wrappers.widget.WidgetChild;
- import org.powerbot.lang.Activatable;
- @Manifest(
- name = "xScott's Lunar Plank Maker!",
- version = 1.0,
- description = "Makes planks using the Lunar spell Plank Make.",
- authors = { "xScott"}
- )
- public class LunarPlanker extends ActiveScript
- {
- //Banker ID - Dungeoneering bank
- private final static int banker = 9710;
- //Widgets
- private static WidgetChild[] InventoryItems;
- private static WidgetChild PlankMakeSpell;
- private static WidgetChild Logs;
- private static WidgetChild CloseBank;
- @Override
- public void setup()
- {
- InventoryItems = Widgets.get(679,0).getChildren();
- PlankMakeSpell = Widgets.get(430, 33);
- Logs = Widgets.get(762,99);
- CloseBank = Widgets.get(762, 45);
- MakePlank makePlanks = new MakePlank();
- Bank bank = new Bank();
- AntiBan anti = new AntiBan();
- Action doBank = new Action(bank, bank);
- Action myAction = new Action(makePlanks, makePlanks);
- Action DoAnti = new Action(anti,anti);
- provide(doBank);
- provide(myAction);
- provide(DoAnti);
- }
- public class MakePlank implements Task, Activatable
- {
- //checks if magic tab is open, if not open it.
- private void CheckMagicTabIsOpen()
- {
- if(!Tabs.MAGIC.open())
- Tabs.MAGIC.open();
- }
- @Override
- public void run()
- {
- CheckMagicTabIsOpen();//checks
- for(int x = 2; x < 28; x++)//Loops through all the inventory slots.
- {
- PlankMakeSpell.click(true);
- InventoryItems[x].click(true);
- Time.sleep(1100);
- CheckMagicTabIsOpen();
- }
- }
- @Override
- public boolean applicable()
- {
- return true;
- }
- }
- //Banking is temporary atm, extremely dogdy from the looks of it.
- public class Bank implements Task, Activatable
- {
- private void WithdrawLogs()
- {
- Logs.interact("Withdraw-All");
- Time.sleep(900);
- if(Inventory.getCount() == 2) { WithdrawLogs(); }
- }
- @Override
- public void run()
- {
- Npc bank = Npcs.getNearest(new Filter<Npc>()
- {
- @Override
- public boolean accept(Npc npc) { return npc.getId() == banker; }});
- if(bank !=null && bank.isOnScreen())
- {
- bank.interact("Bank");
- Time.sleep(500);
- InventoryItems[4].interact("Deposit-All");
- Time.sleep(500);
- WithdrawLogs();
- CloseBank.click(true);
- }
- }
- @Override
- public boolean applicable()
- {
- return true;
- }
- }
- public class AntiBan implements Task, Activatable
- {
- @Override
- public void run()
- {
- Antiban(Random.nextInt(0, 20));
- }
- @Override
- public boolean applicable() {
- return true;
- }
- private void Antiban(int randomNumber)
- {
- if(randomNumber % 2 == 0)
- {
- switch(randomNumber)
- {
- case 2:
- case 4:
- case 6:
- case 8:
- case 10:
- Camera.setAngle(Random.nextInt(43, 311));
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment