Achtung!

Sowohl im Alpha-Release als auch in der aktuellen git-Fassung vom RPG-Reader haben sich noch große Bugs beim Schreiben der Datenbank versteckt. Nutzt diese Funktion vorerst nicht, ich versuche möglichst bald den oder die Fehler zu beheben. Allerdings hab ich derzeit viel Unistress, es kann also ein wenig dauern.

Aber als Entschädigung ein kleines Codebeispiel:

Code:
package tests;

import java.io.File;
import java.io.IOException;

import com.github.gotos.rpgreader.engine.DataReader;
import com.github.gotos.rpgreader.engine.LuciferEventCommand;
import com.github.gotos.rpgreader.engine.LuciferMapEvent;
import com.github.gotos.rpgreader.engine.LuciferMapEventPage;
import com.github.gotos.rpgreader.engine.LuciferMapUnit;

/**
 * Main Class, the class that will be started.
 * 
 * @author alina
 *
 */
public class Main {

	
	private Main() { }
	
	/**
	 * This loops through the maps, hunting for switch 748
	 * 
	 * @param args ignored
	 */
	public static void main(String[] args) {
		DataReader dr;
		
		//get Maps
		for (String filename : new File("/home/alina/Downloads/SternenkindSaga").list()) {
			if (filename.toLowerCase().startsWith("map")) {
				dr = DataReader.parseFile("/home/alina/Downloads/SternenkindSaga/" + filename);
				try {
					dr.nextUnitZeroID();
					LuciferMapUnit map = new LuciferMapUnit(dr);
					
					for (LuciferMapEvent event : map.getEvents()) {
						if (event != null) {
							int i = 1;
							for (LuciferMapEventPage page : event.getPages()) {
								if (page != null) {
									for (LuciferEventCommand command : page.getCommands()) {
										if (command.type == LuciferEventCommand.CHANGE_SWITCH && command.data[1] == 748) {
											System.out.println(
													"Found on Map: " + filename + "! Event: "
													+ event.getName() + " (" + event.getxPos()
													+ "|" + event.getyPos() + "), Page: " + i);
										}
									}
								}
							}
							i++;
						}
					}
				} catch (IOException e) {
					System.out.print("Map broken! ");
					System.out.println(filename);
				}
			}
		}
	}
}
Dieser Code durchsucht alle Maps von Sternenkind-Saga nach Change Switch befehlen, die den Switch 748 oder mehrere Switches, beginnend bei 748, betreffen und gibt aus, wo das passiert. Die Ausgabe könnte dann so aussehen:
Code:
Found on Map: Map0001.lmu! Event: EV0094 (39|9), Page: 1
Found on Map: Map0001.lmu! Event: EV0096 (40|8), Page: 1
Found on Map: Map0001.lmu! Event: EV0097 (40|10), Page: 1