示例#1
0
文件: Molly.java 项目: HKbotz/RSBot
 private boolean hasClawMoved(RSTile prevClawLoc) {
   RSObject claw = objects.getNearest(Molly.CLAW_ID);
   if (claw == null) {
     return false;
   }
   RSTile currentClawLoc = claw.getLocation();
   return (currentClawLoc.getX() - prevClawLoc.getX() != 0)
       || (currentClawLoc.getY() - prevClawLoc.getY() != 0);
 }
示例#2
0
文件: Molly.java 项目: HKbotz/RSBot
 private void navigateClaw() {
   if (!inControlInterface() || (mollyID < 1)) {
     return;
   }
   RSObject claw;
   RSNPC suspect;
   while ((claw = objects.getNearest(Molly.CLAW_ID)) != null
       && (suspect = npcs.getNearest(mollyID - 40)) != null) {
     final RSTile clawLoc = claw.getLocation();
     final RSTile susLoc = suspect.getLocation();
     final ArrayList<Integer> options = new ArrayList<Integer>();
     if (susLoc.getX() > clawLoc.getX()) {
       options.add(Molly.CONTROLS_LEFT);
     }
     if (susLoc.getX() < clawLoc.getX()) {
       options.add(Molly.CONTROLS_RIGHT);
     }
     if (susLoc.getY() > clawLoc.getY()) {
       options.add(Molly.CONTROLS_DOWN);
     }
     if (susLoc.getY() < clawLoc.getY()) {
       options.add(Molly.CONTROLS_UP);
     }
     if (options.isEmpty()) {
       options.add(Molly.CONTROLS_GRAB);
     }
     final RSInterface i = interfaces.get(Molly.CONTROL_INTERFACEGROUP);
     if ((i != null) && i.isValid()) {
       i.getComponent(options.get(random(0, options.size()))).doClick();
     }
     delayTime = System.currentTimeMillis();
     while (!hasClawMoved(clawLoc) && (System.currentTimeMillis() - delayTime < 3500)) {
       sleep(10);
     }
   }
 }