Search in sources :

Example 1 with QuestXMLParser

use of delta.games.lotro.lore.quests.io.xml.QuestXMLParser in project lotro-tools by dmorcellet.

the class QuestsIndexBuilder method doIt.

/**
 * Do build quests index.
 * @return <code>true</code> if it was done, <code>false</code> otherwise.
 */
public boolean doIt() {
    boolean ret = false;
    if (_questsDir.exists()) {
        QuestsIndex index = new QuestsIndex();
        ExtensionPredicate extFilter = new ExtensionPredicate(".xml");
        File[] questFiles = _questsDir.listFiles(extFilter);
        if (questFiles != null) {
            QuestXMLParser parser = new QuestXMLParser();
            for (File questFile : questFiles) {
                QuestDescription q = parser.parseXML(questFile);
                String category = q.getCategory();
                String key = q.getKey();
                String title = q.getTitle();
                int id = q.getIdentifier();
                index.addQuest(category, id, key, title);
            }
            QuestsIndexWriter writer = new QuestsIndexWriter();
            ret = writer.write(_indexFile, index, EncodingNames.UTF_8);
        }
    }
    return ret;
}
Also used : QuestDescription(delta.games.lotro.lore.quests.QuestDescription) QuestXMLParser(delta.games.lotro.lore.quests.io.xml.QuestXMLParser) ExtensionPredicate(delta.common.utils.files.filter.ExtensionPredicate) QuestsIndex(delta.games.lotro.lore.quests.index.QuestsIndex) File(java.io.File) QuestsIndexWriter(delta.games.lotro.lore.quests.index.io.xml.QuestsIndexWriter)

Aggregations

ExtensionPredicate (delta.common.utils.files.filter.ExtensionPredicate)1 QuestDescription (delta.games.lotro.lore.quests.QuestDescription)1 QuestsIndex (delta.games.lotro.lore.quests.index.QuestsIndex)1 QuestsIndexWriter (delta.games.lotro.lore.quests.index.io.xml.QuestsIndexWriter)1 QuestXMLParser (delta.games.lotro.lore.quests.io.xml.QuestXMLParser)1 File (java.io.File)1