public void mousePressed(MouseEvent e) { Message(null, null, 1); Message(null, null, 2); Message(null, null, 3); if (EODtag) { deal(); update(Applet.this.getGraphics()); return; } Location l = findloc(e); if (l == null) return; if (l == button) { ShowSet(); return; } l.toggle(); update(Applet.this.getGraphics()); if (num_selected >= 3) { CheckSet(); } lastloc = l; }
/** if this line can not be current => stepOver & return true. return false on the other hand. */ boolean resolveCanBeCurrent(ThreadReference tr) { try { Location l = tr.frame(0).location(); if (l == null) return false; return resolveCanBeCurrent( tr, Utils.getLineForSource(l.declaringType().name(), l.sourceName(), l.lineNumber())); } catch (Exception e) { } return false; }
// Walk to the specified location, and set the nextState once you get there private void walk(Location loc, State nextState) { if (getFarmingArea(loc).contains(getMyPlayer().getLocation())) { currentLocation = loc; currentState = nextState; // This is the last spot of each run. Break here. } else { checkEnergy(); status = "Walking to " + loc.toString() + " herb patch"; step(pathList); } }
// Teleport to the specified location private void teleport(Location loc) { status = "Teleporting to " + loc.toString(); if (magic.castSpell(getSpell(loc))) { sleep(random(9000, 11000)); if (getTeleArea(loc) .contains( getMyPlayer().getLocation())) { // Teleport successful if player is in the tele area currentState = State.WALKING; pathList = generatePath(getPath(loc)); } } }
/** Executes breakpoint hit event. */ public void exec(com.sun.jdi.event.Event ev) { // S ystem.out.println ("exec "); // NOI18N removeStepRequest(); StepEvent event = (StepEvent) ev; ThreadReference tr = event.thread(); Location loc = event.location(); int ln = -1; String methodName = "?"; // NOI18N String className = "?"; // NOI18N String lineNumber = "?"; // NOI18N String threadName = tr.name(); Line l = null; if (loc != null) { if (loc.method() != null) methodName = loc.method().name(); className = loc.declaringType().name(); ln = loc.lineNumber(); if (ln >= 0) lineNumber = "" + loc.lineNumber(); } if (ln != -1) try { l = Utils.getLineForSource(className, loc.sourceName(), ln); } catch (AbsentInformationException e) { l = Utils.getLine(className, ln); } if (resolveCanBeCurrent(tr, l)) // if this line can not be current resolveCanBeCurrent () calls stepOver return; // line can be current if ((l == null) && (getLastAction() == ACTION_TRACE_INTO)) // try to find another "intelligent" line of code traceToSourceCode(tr); // you know - intelligent means that one with source code else { makeCurrent(threadName, className, methodName, lineNumber, l != null, tr); operator.stopRequest(); } }