Search in sources :

Example 41 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class MergeDeedsDatabases method mergeLotroCompendium2Lorebook.

private void mergeLotroCompendium2Lorebook() {
    List<DeedDescription> lotroCompendiumDeeds = _lotroCompendium.getAll();
    int nbDeeds = lotroCompendiumDeeds.size();
    for (int i = 0; i < nbDeeds; i++) {
        DeedDescription lotroCompendiumDeed = lotroCompendiumDeeds.get(i);
        if (lotroCompendiumDeed.getIdentifier() < 10000) {
            _lorebook.addDeed(lotroCompendiumDeed);
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

Example 42 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class MergeDeedsDatabases method findMatchingDeedInContainer.

private DeedDescription findMatchingDeedInContainer(DeedsContainer container, DeedDescription deed) {
    List<DeedDescription> matches = container.getDeedByName(deed.getName());
    if (matches.size() == 1) {
        // Single match: good!
        return matches.get(0);
    }
    // Multiple matches
    // - look at description
    List<DeedDescription> matches2 = new ArrayList<DeedDescription>();
    for (DeedDescription match : matches) {
        String description = match.getDescription();
        if (description.equals(deed.getDescription())) {
            matches2.add(match);
        }
    }
    int nbNameAndDescriptionMatches = matches2.size();
    if (nbNameAndDescriptionMatches == 1) {
        return matches2.get(0);
    }
    if (nbNameAndDescriptionMatches != 1) {
        List<DeedDescription> matches3 = new ArrayList<DeedDescription>();
        for (DeedDescription match : matches) {
            if (Objects.equals(match.getObjectives(), deed.getObjectives())) {
                matches3.add(match);
            }
        }
        int count = matches3.size();
        if (count == 1) {
            return matches3.get(0);
        }
    }
    if (nbNameAndDescriptionMatches > 1) {
        // Still multiple matches, look at class
        List<DeedDescription> matches3 = new ArrayList<DeedDescription>();
        for (DeedDescription match : matches2) {
            if (Objects.equals(match.getRequiredClass(), deed.getRequiredClass())) {
                matches3.add(match);
            }
        }
        int nbNameDescriptionAndClassMatches = matches3.size();
        if (nbNameDescriptionAndClassMatches == 1) {
            return matches3.get(0);
        }
    }
    System.out.println("No match for: " + deed + "nb matches=" + nbNameAndDescriptionMatches);
    return null;
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ArrayList(java.util.ArrayList)

Example 43 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class DeedLinksResolver method checkNext2PreviousSymetry.

private void checkNext2PreviousSymetry(DeedDescription deed) {
    DeedProxy nextProxy = deed.getNextDeedProxy();
    if (nextProxy != null) {
        String nextKey = nextProxy.getKey();
        DeedDescription nextDeed = _mapByKey.get(nextKey);
        if (nextDeed != null) {
            DeedProxy previousProxy = nextDeed.getPreviousDeedProxy();
            if (previousProxy == null) {
                previousProxy = new DeedProxy();
                previousProxy.setDeed(deed);
                previousProxy.setKey(deed.getKey());
                previousProxy.setName(deed.getName());
                nextDeed.setPreviousDeedProxy(previousProxy);
            }
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Example 44 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class DeedLinksResolver method checkParent2ChildSymetry.

private void checkParent2ChildSymetry(DeedDescription deed) {
    for (DeedProxy parentProxy : deed.getParentDeedProxies().getDeedProxies()) {
        String parentKey = parentProxy.getKey();
        DeedDescription parentDeed = _mapByKey.get(parentKey);
        if (parentDeed != null) {
            addChildDeed(parentDeed, deed);
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Example 45 with DeedDescription

use of delta.games.lotro.lore.deeds.DeedDescription in project lotro-tools by dmorcellet.

the class LotroWikiDeedCategoryPageParser method doCategory.

/**
 * Handle a deed category.
 * @param categoryId Category identifier.
 * @return a list of loaded deeds.
 */
public List<DeedDescription> doCategory(String categoryId) {
    String url = LotroWikiConstants.BASE_URL + "/index.php/Category:" + Escapes.escapeUrl(categoryId);
    String file = categoryId + "/main.html";
    File deedsCategoryFile = _lotroWiki.download(url, Escapes.escapeFile(file));
    List<String> deedIds = parseDeedCategoryPage(deedsCategoryFile);
    List<DeedDescription> deeds = loadDeeds(categoryId, deedIds);
    writeFile(categoryId, deeds);
    return deeds;
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) File(java.io.File)

Aggregations

DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)45 DeedProxy (delta.games.lotro.lore.deeds.DeedProxy)13 ArrayList (java.util.ArrayList)13 File (java.io.File)6 Rewards (delta.games.lotro.common.Rewards)5 DeedsManager (delta.games.lotro.lore.deeds.DeedsManager)4 HashSet (java.util.HashSet)4 DeedXMLParser (delta.games.lotro.lore.deeds.io.xml.DeedXMLParser)3 ActionEvent (java.awt.event.ActionEvent)3 ActionListener (java.awt.event.ActionListener)3 List (java.util.List)3 Title (delta.games.lotro.common.Title)2 Virtue (delta.games.lotro.common.Virtue)2 VirtueId (delta.games.lotro.common.VirtueId)2 ObjectItem (delta.games.lotro.common.objects.ObjectItem)2 ObjectsSet (delta.games.lotro.common.objects.ObjectsSet)2 DeedXMLWriter (delta.games.lotro.lore.deeds.io.xml.DeedXMLWriter)2 BorderLayout (java.awt.BorderLayout)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2