Search in sources :

Example 6 with DeedProxy

use of delta.games.lotro.lore.deeds.DeedProxy 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 7 with DeedProxy

use of delta.games.lotro.lore.deeds.DeedProxy 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 8 with DeedProxy

use of delta.games.lotro.lore.deeds.DeedProxy 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 9 with DeedProxy

use of delta.games.lotro.lore.deeds.DeedProxy 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 10 with DeedProxy

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

the class DeedLinksResolver method addChildDeed.

/**
 * Add child deed, if it does not exist.
 * @param parentDeed Parent deed.
 * @param childDeed Child deed.
 */
public static void addChildDeed(DeedDescription parentDeed, DeedDescription childDeed) {
    // Ignore links to self!
    if (parentDeed.getName().equals(childDeed.getName())) {
        return;
    }
    // Find child
    DeedProxy foundDeed = parentDeed.getChildDeedProxies().getByKey(childDeed.getKey());
    boolean found = (foundDeed != null);
    // Add it if it is not found!
    if (!found) {
        DeedProxy childProxy = new DeedProxy();
        childProxy.setDeed(childDeed);
        childProxy.setKey(childDeed.getKey());
        childProxy.setName(childDeed.getName());
        parentDeed.getChildDeedProxies().add(childProxy);
    }
}
Also used : DeedProxy(delta.games.lotro.lore.deeds.DeedProxy)

Aggregations

DeedProxy (delta.games.lotro.lore.deeds.DeedProxy)19 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)13 ArrayList (java.util.ArrayList)4 Rewards (delta.games.lotro.common.Rewards)2 Title (delta.games.lotro.common.Title)2 ObjectItem (delta.games.lotro.common.objects.ObjectItem)2 DeedProxies (delta.games.lotro.lore.deeds.DeedProxies)2 HashSet (java.util.HashSet)2 Emote (delta.games.lotro.common.Emote)1 ReputationItem (delta.games.lotro.common.ReputationItem)1 Trait (delta.games.lotro.common.Trait)1 Virtue (delta.games.lotro.common.Virtue)1 VirtueId (delta.games.lotro.common.VirtueId)1 ObjectsSet (delta.games.lotro.common.objects.ObjectsSet)1 Faction (delta.games.lotro.lore.reputation.Faction)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1