@Override public void parse(Element p_elem) { if (kind == null) { throw new RuntimeException("Action kind is unknown !"); } // Store XML element in order to read easier from ZEditor xmlElement = p_elem; // Read common attributes who = readAttribute("who"); what = readAttribute("what"); fx = readAttribute("fx"); unblock = isTrue("unblock"); speed = Float.valueOf("0" + p_elem.getAttribute("speed")); unstoppable = isTrue("unstoppable"); foreground = isTrue("foreground"); // Read less common ones String strPos = p_elem.getAttribute("pos"); String strAngle = p_elem.getAttribute("angle"); switch (kind) { case spawn: delta = isTrue("delta"); reverse = readInt("reverse"); rotation = readInt("rotation"); case animation: case impact: location = Point.fromString(strPos); if (!"".equals(strAngle)) { val = Integer.valueOf(strAngle); } case perso: text = readAttribute("type"); info = readAttribute("info"); break; case speak: text = readAttribute("text"); break; case sound: case map: case music: // String text = readAttribute("name"); break; case moveTo: backward = isTrue("backward"); open = isTrue("open"); case pos: // Position if (!strPos.isEmpty()) { location = Point.fromString(strPos); } delta = isTrue("delta"); z = readInt("z", -1); break; case script: text = readAttribute("text"); case angle: case wait: case zoom: case herospecial: val = readInt("value"); break; case fadeIn: case fadeOut: case filter: case end: // Integer val = readInt("type"); break; case focus: delta = isTrue("delta"); if (readAttribute("unblock") == null) { unblock = true; } break; case take: val = readInt("value"); case putDown: case attack: text = readAttribute("item"); break; case exec: text = p_elem.getAttribute("script"); break; case mapReplace: case zikReplace: text = p_elem.getAttribute("name"); break; case markQuest: text = readAttribute("name"); val = isTrue("value") ? 1 : 0; break; case visible: case activate: activate = isTrue("value"); break; case tile: location = Point.fromString(strPos); back = readInt("back", -1); back2 = readInt("back2", -1); fore = readInt("fore", -1); break; } }
public PointFixed(String str) { p = Point.fromString(str); }