Search in sources :

Example 16 with DeedDescription

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

the class DeedLinksResolver method loadMapByKey.

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

Example 17 with DeedDescription

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

the class DeedLinksResolver method buildAdvancedSkirmishLieutenantDeed.

private DeedDescription buildAdvancedSkirmishLieutenantDeed(DeedDescription baseDeed) {
    DeedDescription deed = new DeedDescription();
    deed.setKey(baseDeed.getKey() + "_(Advanced)");
    deed.setName(baseDeed.getName() + " (Advanced)");
    deed.setType(DeedType.SLAYER);
    deed.setCategory(baseDeed.getCategory());
    deed.setDescription(baseDeed.getDescription());
    // Objectives
    // First line of base deed, replace (5) by (50)
    {
        String newObjectives = "";
        String objectives = baseDeed.getObjectives();
        int index = objectives.indexOf('\n');
        if (index != -1) {
            newObjectives = objectives.substring(0, index);
        } else {
            newObjectives = objectives;
        }
        newObjectives = newObjectives.replace("(5)", "(50)");
        deed.setObjectives(newObjectives);
    }
    // Previous
    DeedProxy previous = new DeedProxy();
    previous.setDeed(baseDeed);
    previous.setKey(previous.getKey());
    previous.setName(previous.getName());
    deed.setPreviousDeedProxy(previous);
    // Rewards
    ObjectItem item = new ObjectItem("Mark");
    item.setItemId(1879224343);
    deed.getRewards().getObjects().addObject(item, 500);
    return deed;
}
Also used : ObjectItem(delta.games.lotro.common.objects.ObjectItem) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Example 18 with DeedDescription

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

the class DeedLinksResolver method checkPrevious2NextSymetry.

private void checkPrevious2NextSymetry(DeedDescription deed) {
    DeedProxy previousProxy = deed.getPreviousDeedProxy();
    if (previousProxy != null) {
        String previousKey = previousProxy.getKey();
        DeedDescription previousDeed = _mapByKey.get(previousKey);
        if (previousDeed != null) {
            DeedProxy nextProxy = previousDeed.getPreviousDeedProxy();
            if (nextProxy == null) {
                nextProxy = new DeedProxy();
                nextProxy.setDeed(deed);
                nextProxy.setKey(deed.getKey());
                nextProxy.setName(deed.getName());
                previousDeed.setNextDeedProxy(nextProxy);
            }
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Example 19 with DeedDescription

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

the class DeedLinksResolver method checkForUnwantedChildren.

private void checkForUnwantedChildren(DeedDescription deed) {
    List<DeedProxy> children = deed.getChildDeedProxies().getDeedProxies();
    // Grab child deed names
    Map<String, DeedProxy> childNames = new HashMap<String, DeedProxy>();
    for (DeedProxy child : children) {
        childNames.put(child.getName(), child);
    }
    // For each child, check if one of its previous is the children list
    List<DeedProxy> toRemove = new ArrayList<DeedProxy>();
    for (DeedProxy child : children) {
        DeedDescription childDeed = child.getDeed();
        DeedProxy previous = childDeed.getPreviousDeedProxy();
        while (previous != null) {
            DeedProxy previousInChildren = childNames.get(previous.getName());
            if (previousInChildren != null) {
                toRemove.add(previousInChildren);
                break;
            }
            DeedDescription previousDeed = previous.getDeed();
            previous = (previousDeed != null) ? previousDeed.getPreviousDeedProxy() : null;
        }
    }
    children.removeAll(toRemove);
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) DeedProxy(delta.games.lotro.lore.deeds.DeedProxy) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList)

Example 20 with DeedDescription

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

the class DeedObjectivesParser method findDeedInObjectivesLine.

private DeedDescription findDeedInObjectivesLine(DeedDescription parentDeed, String line) {
    DeedDescription ret = null;
    List<String> links = TextTools.findAllBetween(line, "[[", "]]");
    if (links.size() > 0) {
        boolean ignore = false;
        for (String link : links) {
            int index = link.indexOf('|');
            String linkId;
            String linkText;
            if (index != -1) {
                linkId = link.substring(0, index).trim();
                linkText = link.substring(index + 1).trim();
            } else {
                linkId = null;
                linkText = link.trim();
            }
            if (linkId != null) {
                boolean ignoreLink = ignoreLink(linkId);
                if (ignoreLink) {
                    ignore = true;
                    continue;
                }
                ret = resolveDeed(linkId);
            }
            if (ret == null) {
                boolean ignoreLink = ignoreLink(linkText);
                if (ignoreLink) {
                    ignore = true;
                    continue;
                }
                ret = resolveDeed(linkText);
            }
        }
        if ((ret == null) && (!ignore)) {
            boolean ignoreLine = ignoreLine(line);
            if (!ignoreLine) {
                System.out.println(parentDeed.getName() + " => " + line);
            }
        }
    }
    return ret;
}
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