Search in sources :

Example 1 with LuaParser

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);
}
Also used : LuaParser(delta.games.lotro.plugins.LuaParser) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) Map(java.util.Map)

Aggregations

DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)1 LuaParser (delta.games.lotro.plugins.LuaParser)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1