Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 6.02 KB | None | 0 0
  1. package nopackageweb;
  2.  
  3. import impsoft.bots.reflection.NPC;
  4. import impsoft.bots.reflection.PhysicalObject;
  5. import impsoft.scripting.ibot.aryanweb.AryanLine;
  6. import impsoft.scripting.ibot.aryanweb.AryanLineBase;
  7. import impsoft.scripting.ibot.aryanweb.AryanLineOneWay;
  8. import impsoft.scripting.ibot.aryanweb.AryanWebChanged;
  9. import impsoft.scripting.ibot.aryanweb.AryanWebReCalc;
  10. import impsoft.scripting.ibot.aryanweb.CachedInformation;
  11. import impsoft.scripting.ibot.aryanweb.ItemRequirement;
  12. import impsoft.scripting.ibot.enums.Quest;
  13. import impsoft.scripting.ibot.itemrec.ItemCondition;
  14. import impsoft.scripting.ibot.itemrec.ItemNameExact;
  15. import impsoft.scripting.ibot.structs.AryanTile;
  16. import impsoft.scripting.types.ColorSkeltonScriptable;
  17. import impsoft.utils.uber.UberClickOptions;
  18. import impsoft.utils.uber.UberNPCOptions;
  19. import impsoft.utils.uber.UberPhysicalObjectOptions;
  20. import impsoft.utils.uber.UberScriptUtils;
  21.  
  22. import java.util.EnumSet;
  23. import java.util.regex.Pattern;
  24.  
  25. public class WorldMapOlafDungeon {
  26.  
  27.     public static AryanLineBase[] getMap() {
  28.         AryanTile DIG_TILE_ENTER = new AryanTile(2749, 3733, 0, "DIG_TILE_ENTER");
  29.         AryanTile DIG_TILE_EXIT = new AryanTile(2697, 10121, 0, "DIG_TILE_EXIT");
  30.         AryanTile BOULDER_TILE = new AryanTile(2693, 10123, 0, "BOULDER_TILE");
  31.         AryanTile EXIT_TILE = new AryanTile(2692, 10124, 0, "EXIT_TILE");
  32.         AryanTile OLAF_TILE = new AryanTile(2724, 3722, 0, "OLAF_TILE");
  33.         return new AryanLineBase[] {
  34.             new AryanLine(new AryanTile(2744, 3719, 0), DIG_TILE_ENTER), /* Fairy ring to DIG_TILE */
  35.             new AryanLineOneWay(DIG_TILE_ENTER, DIG_TILE_EXIT) {
  36.             @Override
  37.             public boolean doActionForAToB(ColorSkeltonScriptable cs) throws InterruptedException, AryanWebReCalc, AryanWebChanged {
  38.                 cs.theTabs.Inventory.setSelected();
  39.                 cs.log("Using spade.");
  40.                 return cs.theTabs.Inventory.doAction("Spade", "Dig", 1, true) != 0;
  41.             }
  42.  
  43.             @Override
  44.             public boolean hasActionFromAToB() {
  45.                 return true;
  46.             }
  47.  
  48.             ItemCondition item = new ItemNameExact("Spade");
  49.             ItemRequirement req[] = new ItemRequirement[] { new ItemRequirement(item, 1) };
  50.  
  51.             public ItemRequirement[] getItemRequirementsFromAToB() {
  52.                 return req;
  53.             }
  54.  
  55.             @Override
  56.             public boolean hasBankRequirementFromAToB(ColorSkeltonScriptable cs, CachedInformation c) {
  57.                 return !c.hasItemInInventory(item);
  58.             }
  59.  
  60.             @Override
  61.             public boolean doBankActionRequiredForAToBAction(ColorSkeltonScriptable cs) throws InterruptedException {
  62.                 return cs.theBank.doWithDraw1(item, false);
  63.             }
  64.  
  65.             public int getDistanceFromAToB(ColorSkeltonScriptable cs, CachedInformation info) throws InterruptedException {
  66.                 if (cs.theTabs.Quest.isFinishedWithQuest(Quest.OlafsQuest)) {
  67.                     return super.getDistanceFromAToB(cs, info);
  68.                 }
  69.                 return -1;
  70.             }
  71.         },
  72.         // Cave lines
  73.         new AryanLine(DIG_TILE_EXIT, new AryanTile(2734, 10122, 0)),
  74.         new AryanLine(new AryanTile(2734, 10122, 0),new AryanTile(2735, 10128, 0)),
  75.         new AryanLine(new AryanTile(2735, 10128, 0), new AryanTile(2730, 10129, 0)),
  76.         new AryanLine(new AryanTile(2730, 10129, 0), new AryanTile(2730, 10132, 0)),
  77.         new AryanLine(new AryanTile(2730, 10132, 0), new AryanTile(2704, 10134, 0)),
  78.         new AryanLine(new AryanTile(2730, 10132, 0), new AryanTile(2737, 10134, 0)),
  79.         new AryanLine(new AryanTile(2737, 10134, 0), new AryanTile(2735, 10139, 0)),
  80.         new AryanLine(new AryanTile(2735, 10139, 0), new AryanTile(2707, 10147, 0)),
  81.         // Cave lines
  82.         new AryanLine(DIG_TILE_EXIT, BOULDER_TILE),
  83.         new AryanLine(BOULDER_TILE, EXIT_TILE),
  84.         new AryanLineOneWay(EXIT_TILE, OLAF_TILE) {
  85.                     @Override
  86.                     public boolean doActionForAToB(ColorSkeltonScriptable cs) throws InterruptedException, AryanWebReCalc, AryanWebChanged {
  87.                         cs.log("Attempting boulder");
  88.                         NPC[] boulders = UberScriptUtils.findNPC(cs, new int[] { 3708 }, null, null, null, null, null, null, cs.getLocation(), EnumSet.of(UberNPCOptions.RETURN_ONE_MATCH,
  89.                                 UberNPCOptions.RESTART_IF_REFLECTION_CAN_REACH_CHANGES, UberNPCOptions.SORT_BY_REAL_COST_25_TILES_OTHERWISE_LINEAR_TO_MYPLAYER));
  90.                         if(boulders.length > 0) {
  91.                             NPC boulder = boulders[0];
  92.                             UberScriptUtils.clickWorldObject(cs, boulder, Pattern.compile(".*" + boulder.getName() + ".*", Pattern.CASE_INSENSITIVE), Pattern.compile(".*" + "Roll" + ".*", Pattern.CASE_INSENSITIVE), EnumSet
  93.                                     .of(UberClickOptions.CLEAR_ANY_ITEM_SELECTION, UberClickOptions.WALK_GAME_ONLY, UberClickOptions.USE_MENU, UberClickOptions.LEFT_CLICK_ON_VALID_TOPTEXT));
  94.                             cs.sleep(2500);
  95.                         }
  96.                         PhysicalObject[] exits = UberScriptUtils.findPhysicalObject(cs, new int[][] { { 23158 } }, null, null, null, null, cs.getLocation(), EnumSet.of(UberPhysicalObjectOptions.TYPE_ANY,
  97.                                 UberPhysicalObjectOptions.RETURN_ONE_MATCH, UberPhysicalObjectOptions.RESTART_IF_REFLECTION_CAN_REACH_CHANGES,
  98.                                 UberPhysicalObjectOptions.SORT_BY_REAL_COST_25_TILES_OTHERWISE_LINEAR_TO_MYPLAYER));
  99.                         if(exits.length > 0) {
  100.                             PhysicalObject exit = exits[0];
  101.                             UberScriptUtils.clickWorldObject(cs, exit, Pattern.compile(".*" + "Cave" + ".*", Pattern.CASE_INSENSITIVE), Pattern.compile(".*" + "Exit" + ".*", Pattern.CASE_INSENSITIVE), EnumSet
  102.                                     .of(UberClickOptions.CLEAR_ANY_ITEM_SELECTION, UberClickOptions.WALK_GAME_ONLY, UberClickOptions.USE_MENU, UberClickOptions.LEFT_CLICK_ON_VALID_TOPTEXT));
  103.                             cs.sleep(100);
  104.                             return true;
  105.                         }
  106.                         return true;
  107.                     }
  108.  
  109.                     @Override
  110.                     public boolean hasActionFromAToB() {
  111.                         return true;
  112.                     }
  113.  
  114.                     @Override
  115.                     public boolean hasBankRequirementFromAToB(ColorSkeltonScriptable cs, CachedInformation c) {
  116.                         return false;
  117.                     }
  118.  
  119.                     public int getDistanceFromAToB(ColorSkeltonScriptable cs, CachedInformation info) throws InterruptedException {
  120.                         if (cs.theTabs.Quest.isFinishedWithQuest(Quest.OlafsQuest)) {
  121.                             return super.getDistanceFromAToB(cs, info);
  122.                         }
  123.                         return -1;
  124.                     }
  125.             }
  126.         };
  127.         /*
  128.                 new AryanLineOneWayObject(EXIT_TILE, OLAF_TILE, new int[] { 23158, 18, -60, 26, 30, 0, 167, 1, 1, 0 }, "Exit"),
  129.                 */
  130.     }
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement