use of delta.games.lotro.plugins.LuaParser in project lotro-tools by dmorcellet.
the class LotroCompendiumDeedsLoader method doIt.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void doIt() throws Exception {
File root = new File(new File("data"), "deeds");
File luaDb = new File(root, "deeds.lua");
List<DeedDescription> deeds = new ArrayList<DeedDescription>();
// File luaDb=new File("indexes.lua");
LuaParser parser = new LuaParser();
Object map = parser.readObject(luaDb);
if (map instanceof Map) {
System.out.println(((Map) map).keySet());
} else if (map instanceof List) {
List<Object> datas = (List<Object>) map;
int length = datas.size();
System.out.println("Array of " + length + " items.");
for (Object data : datas) {
DeedDescription deed = buildDeedFromRawData(data);
normalizeDeed(deed);
deeds.add(deed);
}
}
resolveProxies(deeds);
File loreDir = LotroCoreConfig.getInstance().getLoreDir();
File out = new File(loreDir, "deeds_lc.xml");
DeedsContainer.writeSortedDeeds(deeds, out);
}