/** returns the current state of this quest, ie, how many mobs to kill,etc */ public String toString() { String status = "Quest=" + getName() + "\n"; Iterator<String> iter = getObjectiveStatus().iterator(); while (iter.hasNext()) { String s = iter.next(); status = status + " " + s + "\n"; } return status; }
/** for client display: current state */ public List<String> getObjectiveStatus() { lock.lock(); try { List<String> l = new LinkedList<String>(); Iterator<CollectionGoalStatus> iter = goalsStatus.iterator(); while (iter.hasNext()) { CollectionGoalStatus status = iter.next(); String itemName = status.getTemplateName(); int numNeeded = status.targetCount; int cur = Math.min(status.currentCount, numNeeded); String objective = itemName + ": " + cur + "/" + numNeeded; l.add(objective); } return l; } finally { lock.unlock(); } }