Search in sources :

Example 1 with QuestsManager

use of delta.games.lotro.lore.quests.QuestsManager in project lotro-companion by dmorcellet.

the class MainTestQuestCompletionStats method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    LotroTestUtils utils = new LotroTestUtils();
    // CharacterFile mainToon=utils.getMainToon();
    CharacterFile mainToon = utils.getToonByName("Feroce");
    CharacterSummary summary = mainToon.getSummary();
    CharacterLog log = mainToon.getLastCharacterLog();
    if (log != null) {
        QuestsManager qm = QuestsManager.getInstance();
        QuestsIndex index = qm.getIndex();
        String[] categories = index.getCategories();
        for (String category : categories) {
            // String category="Epic - Vol. I, Book 1: Stirrings in the Darkness";
            QuestsCompletionStats stats = new QuestsCompletionStats(category, summary, log);
            stats.dump(System.out, true);
        }
    }
}
Also used : CharacterSummary(delta.games.lotro.character.CharacterSummary) LotroTestUtils(delta.games.lotro.character.log.LotroTestUtils) QuestsManager(delta.games.lotro.lore.quests.QuestsManager) CharacterFile(delta.games.lotro.character.CharacterFile) QuestsIndex(delta.games.lotro.lore.quests.index.QuestsIndex) CharacterLog(delta.games.lotro.character.log.CharacterLog)

Example 2 with QuestsManager

use of delta.games.lotro.lore.quests.QuestsManager in project lotro-companion by dmorcellet.

the class QuestsCompletionStats method loadQuestIdentifiers.

private void loadQuestIdentifiers() {
    QuestsManager qm = QuestsManager.getInstance();
    QuestsIndex index = qm.getIndex();
    if (index != null) {
        QuestCategory category = index.getCategory(_category);
        if (category != null) {
            QuestSummary[] summaries = category.getQuests();
            for (QuestSummary summary : summaries) {
                int id = summary.getIdentifier();
                QuestDescription q = qm.getQuest(id);
                if (q != null) {
                    boolean useIt = true;
                    if (USE_CLASS_RESTRICTIONS) {
                        List<String> classes = q.getRequiredClasses();
                        if ((classes != null) && (classes.size() > 0)) {
                            CharacterClass cClass = _character.getCharacterClass();
                            String className = cClass.getKey();
                            if (classes.contains(className)) {
                                useIt = true;
                            } else {
                                String key = q.getKey();
                                if (_logger.isInfoEnabled()) {
                                    _logger.info("Ignored quest [" + key + "]. Class=" + className + ", Required:" + classes);
                                }
                                useIt = false;
                            }
                        }
                    }
                    if (USE_RACE_RESTRICTIONS) {
                        List<String> races = q.getRequiredRaces();
                        if ((races != null) && (races.size() > 0)) {
                            Race cRace = _character.getRace();
                            String raceName = cRace.getLabel();
                            if (races.contains(raceName)) {
                                useIt = true;
                            } else {
                                String key = q.getKey();
                                if (_logger.isInfoEnabled()) {
                                    _logger.info("Ignored quest [" + key + "]. Race=" + raceName + ", Required:" + races);
                                }
                                useIt = false;
                            }
                        }
                    }
                    if (!USE_INSTANCES) {
                        boolean instanced = q.isInstanced();
                        if (instanced) {
                            useIt = false;
                        }
                    }
                    if (useIt) {
                        _expectedIds.add(Integer.valueOf(id));
                    }
                }
            }
            _nbExpectedQuests = _expectedIds.size();
        }
    }
}
Also used : QuestDescription(delta.games.lotro.lore.quests.QuestDescription) QuestsManager(delta.games.lotro.lore.quests.QuestsManager) Race(delta.games.lotro.common.Race) QuestsIndex(delta.games.lotro.lore.quests.index.QuestsIndex) QuestCategory(delta.games.lotro.lore.quests.index.QuestCategory) QuestSummary(delta.games.lotro.lore.quests.index.QuestSummary) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 3 with QuestsManager

use of delta.games.lotro.lore.quests.QuestsManager in project lotro-companion by dmorcellet.

the class VirtuesStats method parseQuestItems.

private void parseQuestItems(List<CharacterLogItem> items) {
    QuestsManager qm = QuestsManager.getInstance();
    for (CharacterLogItem item : items) {
        Integer id = item.getResourceIdentifier();
        if (id != null) {
            QuestDescription quest = qm.getQuest(id.intValue());
            if (quest != null) {
                Rewards rewards = quest.getQuestRewards();
                handleRewards("Quest:" + id, rewards);
            }
        }
    }
}
Also used : QuestDescription(delta.games.lotro.lore.quests.QuestDescription) QuestsManager(delta.games.lotro.lore.quests.QuestsManager) Rewards(delta.games.lotro.common.Rewards) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Example 4 with QuestsManager

use of delta.games.lotro.lore.quests.QuestsManager in project lotro-tools by dmorcellet.

the class QuestsItemsLoader method doIt.

private void doIt() {
    List<QuestDescription> storage = new ArrayList<QuestDescription>();
    QuestsManager qm = QuestsManager.getInstance();
    QuestsIndex index = qm.getIndex();
    if (index != null) {
        String[] categories = index.getCategories();
        System.out.println(Arrays.deepToString(categories));
        for (String category : categories) {
            QuestCategory c = index.getCategory(category);
            QuestSummary[] quests = c.getQuests();
            int indexQ = 0;
            for (QuestSummary questSum : quests) {
                int id = questSum.getIdentifier();
                QuestDescription q = qm.getQuest(id);
                handleQuest(indexQ, q);
                storage.add(q);
                indexQ++;
            }
        }
        System.out.println("Resolved: " + _resolved + ", missed: " + _missed);
        writeQuestsDatabase(storage);
    } else {
        _logger.error("Cannot gets quests index file!");
    }
}
Also used : QuestDescription(delta.games.lotro.lore.quests.QuestDescription) QuestsManager(delta.games.lotro.lore.quests.QuestsManager) ArrayList(java.util.ArrayList) QuestsIndex(delta.games.lotro.lore.quests.index.QuestsIndex) QuestCategory(delta.games.lotro.lore.quests.index.QuestCategory) QuestSummary(delta.games.lotro.lore.quests.index.QuestSummary)

Example 5 with QuestsManager

use of delta.games.lotro.lore.quests.QuestsManager in project lotro-companion by dmorcellet.

the class QuestsCompletionStats method dump.

/**
 * Dump the contents of this object to the given stream.
 * @param ps Output stream to use.
 * @param verbose Verbose output or not.
 */
public void dump(PrintStream ps, boolean verbose) {
    ps.println("Quest completion for [" + _name + "], category [" + _category + "]");
    ps.println("Nb quests: expected=" + _nbExpectedQuests + ", done=" + _nbQuestsDone + ": " + getPercentage() + "%");
    if (verbose) {
        QuestsManager qm = QuestsManager.getInstance();
        for (Integer id : _expectedIds) {
            int nb = 0;
            Integer n = _nbTimesPerQuest.get(id);
            if (n != null) {
                nb = n.intValue();
            }
            QuestDescription q = qm.getQuest(id.intValue());
            String name = null;
            if (q != null) {
                name = q.getKey();
            }
            ps.println(nb + ": " + name);
        }
    }
}
Also used : QuestDescription(delta.games.lotro.lore.quests.QuestDescription) QuestsManager(delta.games.lotro.lore.quests.QuestsManager)

Aggregations

QuestsManager (delta.games.lotro.lore.quests.QuestsManager)5 QuestDescription (delta.games.lotro.lore.quests.QuestDescription)4 QuestsIndex (delta.games.lotro.lore.quests.index.QuestsIndex)3 QuestCategory (delta.games.lotro.lore.quests.index.QuestCategory)2 QuestSummary (delta.games.lotro.lore.quests.index.QuestSummary)2 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharacterSummary (delta.games.lotro.character.CharacterSummary)1 CharacterLog (delta.games.lotro.character.log.CharacterLog)1 CharacterLogItem (delta.games.lotro.character.log.CharacterLogItem)1 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 Race (delta.games.lotro.common.Race)1 Rewards (delta.games.lotro.common.Rewards)1 ArrayList (java.util.ArrayList)1