public static void setComplete(Thing q) { if (!q.getFlag("IsActive")) { throw new Error("Trying to complete a non-active quest"); } q.set("IsComplete", 1); q.set("IsActive", 0); if (q.handles("OnQuestComplete")) { Event e = new Event("QuestComplete"); e.set("Quest", q); q.handle(e); } Thing parent = q.getThing("Parent"); if (parent != null) { Event e = new Event("SubQuestComplete"); e.set("Quest", q); q.handle(e); } }
private static boolean notify(Event e) { ArrayList qs = getQuests(); for (Iterator it = qs.iterator(); it.hasNext(); ) { Thing q = (Thing) it.next(); if (q.getFlag("IsActive")) { q.handle(e); } } return false; }