Search in sources :

Example 11 with DeedDescription

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

the class CheckDeedLinks method checkParentDeed.

private void checkParentDeed(DeedDescription deed) {
    List<DeedProxy> childProxies = deed.getChildDeedProxies().getDeedProxies();
    for (DeedProxy childProxy : childProxies) {
        DeedDescription childDeed = childProxy.getDeed();
        DeedProxies parentProxies = childDeed.getParentDeedProxies();
        DeedProxy parentProxy = parentProxies.getByKey(deed.getKey());
        if (parentProxy == null) {
            parentProxy = new DeedProxy();
            parentProxy.setDeed(deed);
            parentProxy.setKey(deed.getKey());
            parentProxy.setName(deed.getName());
            parentProxies.add(parentProxy);
        // System.out.println("Added link from "+childDeed.getKey()+" to "+deed.getKey());
        }
    }
}
Also used : DeedProxies(delta.games.lotro.lore.deeds.DeedProxies) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Example 12 with DeedDescription

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

the class CheckDeedLinks method loadPreviousDeeds.

private Set<String> loadPreviousDeeds(DeedDescription deed) {
    Set<String> previousDeeds = new HashSet<String>();
    DeedProxy previousProxy = deed.getPreviousDeedProxy();
    while (previousProxy != null) {
        String key = previousProxy.getKey();
        previousDeeds.add(key);
        DeedDescription previousDeed = previousProxy.getDeed();
        if (previousDeed != null) {
            previousProxy = previousDeed.getPreviousDeedProxy();
        } else {
            previousProxy = null;
        }
    }
    return previousDeeds;
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy) HashSet(java.util.HashSet)

Example 13 with DeedDescription

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

the class DeedLinksResolver method resolveDeedProxy.

private void resolveDeedProxy(DeedProxy proxy) {
    if (proxy == null)
        return;
    // Already resolved
    if (proxy.getKey() != null)
        return;
    String deedName = proxy.getName();
    deedName = deedName.replace("  ", " ");
    if (deedName.endsWith("\u200e")) {
        deedName = deedName.substring(0, deedName.length() - 1);
    }
    DeedDescription proxiedDeed = _mapByName.get(deedName);
    if (proxiedDeed != null) {
        proxy.setName(deedName);
        proxy.setDeed(proxiedDeed);
        proxy.setKey(proxiedDeed.getKey());
    } else {
        boolean ok = false;
        if (deedName.endsWith(" (Advanced)")) {
            String baseDeedName = deedName.substring(0, deedName.length() - 10).trim();
            DeedDescription baseDeed = _mapByName.get(baseDeedName);
            if (baseDeed != null) {
                DeedDescription advancedDeed = buildAdvancedSkirmishLieutenantDeed(baseDeed);
                _toAdd.add(advancedDeed);
                ok = true;
            }
        }
        if (!ok) {
            System.out.println("Deed not found: " + deedName);
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

Example 14 with DeedDescription

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

the class DeedLinksResolver method doIt.

/**
 * Do resolve links.
 */
public void doIt() {
    // Resolve deed links
    for (DeedDescription deed : _deeds) {
        resolveDeed(deed);
    }
    // Add all missing deeds
    _deeds.addAll(_toAdd);
    // Load a map by key
    loadMapByKey();
    DeedObjectivesParser objectivesParser = new DeedObjectivesParser(_mapByName, _mapByKey);
    // Find additional links in objectives
    for (DeedDescription deed : _deeds) {
        objectivesParser.doIt(deed);
    }
    // Remove useless children
    for (DeedDescription deed : _deeds) {
        removeUnwantedChildren(deed);
        checkForUnwantedChildren(deed);
    }
    // Remove duplicates
    {
        _deeds.remove(_mapByKey.get("Ten_Years_of_Trifles_(Deed)"));
        _deeds.remove(_mapByKey.get("Threat_of_the_Wastes"));
    }
    // Check link symetry
    for (DeedDescription deed : _deeds) {
        checkDeedSymetry(deed);
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

Example 15 with DeedDescription

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

the class DeedLinksResolver method loadMapByName.

private void loadMapByName() {
    _mapByName = new HashMap<String, DeedDescription>();
    for (DeedDescription deed : _deeds) {
        String name = deed.getName();
        DeedDescription old = _mapByName.put(name, deed);
        if (old != null) {
            System.out.println("Multiple instances of deed name: " + name);
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription)

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