Search in sources :

Example 1 with ItemXMLParser

use of delta.games.lotro.lore.items.io.xml.ItemXMLParser in project lotro-tools by dmorcellet.

the class ItemsConcat method main.

/**
 * Main method.
 * @param args Not used.
 */
public static void main(String[] args) {
    System.out.println("Concatenation of legacy items into one file...");
    File itemsDir = new File("d:\\dam\\tmp\\items");
    FileFilter fileFilter = new ExtensionPredicate("xml");
    File[] itemFiles = itemsDir.listFiles(fileFilter);
    if (itemFiles != null) {
        // BonusConverter converter=new BonusConverter();
        ItemXMLParser parser = new ItemXMLParser();
        List<Item> itemsList = new ArrayList<Item>();
        for (File itemFile : itemFiles) {
            String idStr = itemFile.getName();
            idStr = idStr.substring(0, idStr.length() - 4);
            int id = NumericTools.parseInt(idStr, -1);
            if (id != -1) {
                // System.out.println(id);
                Item item = parser.parseXML(itemFile);
                /*
          List<String> bonuses=item.getBonus();
          if (bonuses.size()>0)
          {
            RawBonusParser bonusParser=new RawBonusParser();
            BonusManager bonusMgr=bonusParser.build(bonuses);
            if (bonusParser.hasWarn())
            {
              String name=item.getName();
              System.out.println("Item: "+id+", name="+name);
              for(String bonus : bonuses)
              {
                System.out.println("\t"+bonus);
              }
            }
            if (bonusMgr!=null)
            {
              BasicStatsSet stats=converter.getStats(bonusMgr);
              item.getStats().setStats(stats);
            }
          }
          */
                item.setIdentifier(id);
                itemsList.add(item);
            }
        }
        File toFile = new File("itemsLegacy.xml").getAbsoluteFile();
        ItemXMLWriter.writeItemsFile(toFile, itemsList);
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser) ArrayList(java.util.ArrayList) ExtensionPredicate(delta.common.utils.files.filter.ExtensionPredicate) FileFilter(java.io.FileFilter) File(java.io.File)

Example 2 with ItemXMLParser

use of delta.games.lotro.lore.items.io.xml.ItemXMLParser in project lotro-tools by dmorcellet.

the class IconsDbBuilder method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    ItemXMLParser parser = new ItemXMLParser();
    List<Item> items = parser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser)

Example 3 with ItemXMLParser

use of delta.games.lotro.lore.items.io.xml.ItemXMLParser in project lotro-tools by dmorcellet.

the class ItemIconsDownloader method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    ItemXMLParser parser = new ItemXMLParser();
    List<Item> items = parser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser)

Example 4 with ItemXMLParser

use of delta.games.lotro.lore.items.io.xml.ItemXMLParser in project lotro-tools by dmorcellet.

the class LegacyIconsExtractor method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    ItemXMLParser parser = new ItemXMLParser();
    List<Item> items = parser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser)

Aggregations

Item (delta.games.lotro.lore.items.Item)4 ItemXMLParser (delta.games.lotro.lore.items.io.xml.ItemXMLParser)4 HashMap (java.util.HashMap)3 ExtensionPredicate (delta.common.utils.files.filter.ExtensionPredicate)1 File (java.io.File)1 FileFilter (java.io.FileFilter)1 ArrayList (java.util.ArrayList)1