From 20cde3bc9822bcbfec2c0c55b0c65f5466cfbb26 Mon Sep 17 00:00:00 2001 From: konatakun Date: Thu, 5 Jun 2014 23:14:29 -0400 Subject: [PATCH] Update BSCombatKiller.java This cleans it up and makes it more consistent for public readability. Not perfect but still way better than the start. --- BSCombatKiller.java | 44 ++++++++++++-------------------------------- 1 file changed, 12 insertions(+), 32 deletions(-) diff --git a/BSCombatKiller.java b/BSCombatKiller.java index bedcb5f..348c607 100644 --- a/BSCombatKiller.java +++ b/BSCombatKiller.java @@ -20,18 +20,13 @@ public class BSCombatKiller extends Script{ private final ArrayList strategy = new ArrayList(); - @Override public boolean onExecute() { - strategy.add(new Scroll()); - strategy.add(new PickUp()); - strategy.add(new Attack()); - - + strategy.add(new Scroll()); + strategy.add(new PickUp()); + strategy.add(new Attack()); provide(strategy); - - - return (true); + return (true); } private static Item e; @@ -39,43 +34,35 @@ public class Scroll implements Strategy { @Override public boolean activate() { - for(Item d : Inventory.getItems(2774, 2775)){ e = d; - return d != null; } - return false; } @Override public void execute() { - - Menu.sendAction(961, 2774, e.getSlot(), 4521985); // Send actions (Change the actions,except for getSlot) Time.sleep(500); Menu.sendAction(961, 2773, e.getSlot(), 4521985); // Send actions (Change the actions,except for getSlot) Time.sleep(500); - } - - } + private static GroundItem f; public class PickUp implements Strategy { - @Override - public boolean activate() { - try{ - for(GroundItem n : GroundItems.getNearest(2774, 2775)){ // Got to change id here if you want more pickup. + @Override + public boolean activate() { + try{ + for(GroundItem n : GroundItems.getNearest(2774, 2775)){ // Got to change id here if you want more pickup. f = n; - return n != null; - - } - }catch(NullPointerException e){} + } + }catch(NullPointerException e){ + } return false; } @@ -84,7 +71,6 @@ public void execute() { f.interact(0); Time.sleep(500); } - } private static Npc q; public class Attack implements Strategy { @@ -95,7 +81,6 @@ public boolean activate() { q = n; return n != null && !Players.getMyPlayer().isInCombat() && !n.isInCombat(); } - return false; } @@ -104,12 +89,7 @@ public void execute() { if(q != null){ q.interact(0); // Change to 1 if 0 doesn't work. Time.sleep(500); - } - } - - } - }