Search in sources :

Example 1 with DeedDescription

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

the class MainTestVirtuesStats 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");
    CharacterLog log = mainToon.getLastCharacterLog();
    VirtuesStats stats = null;
    if (log != null) {
        stats = new VirtuesStats(log);
        stats.dump(System.out, true);
    }
    HashMap<VirtueId, List<String>> virtuesMap = new HashMap<VirtueId, List<String>>();
    {
        DeedsManager dm = DeedsManager.getInstance();
        List<DeedDescription> deeds = dm.getAll();
        for (DeedDescription deed : deeds) {
            String name = deed.getName();
            Rewards rewards = deed.getRewards();
            Virtue[] virtues = rewards.getVirtues();
            if (virtues != null) {
                for (Virtue virtue : virtues) {
                    VirtueId virtueId = virtue.getIdentifier();
                    List<String> items = virtuesMap.get(virtueId);
                    if (items == null) {
                        items = new ArrayList<String>();
                        virtuesMap.put(virtueId, items);
                    }
                    items.add("Deed:" + name);
                }
            }
        }
    }
    List<String> toShow = new ArrayList<String>();
    toShow.add("Valour");
    toShow.add("Loyalty");
    toShow.add("Justice");
    toShow.add("Honour");
    toShow.add("Innocence");
    toShow.add("Zeal");
    List<VirtueId> virtueIds = new ArrayList<VirtueId>(virtuesMap.keySet());
    Collections.sort(virtueIds);
    for (VirtueId virtueId : virtueIds) {
        if (toShow.contains(virtueId)) {
            List<String> deeds = virtuesMap.get(virtueId);
            System.out.println(virtueId + " (" + deeds.size() + "): " + deeds);
            String[] got = stats.getIDsForAVirtue(virtueId);
            if (got != null) {
                System.out.println("GOT:" + virtueId + " (" + got.length + "): " + Arrays.toString(got));
                for (String id : got) deeds.remove(id);
            }
            System.out.println("MISSING: " + virtueId + " (" + deeds.size() + "): " + deeds);
        }
    }
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) CharacterFile(delta.games.lotro.character.CharacterFile) DeedsManager(delta.games.lotro.lore.deeds.DeedsManager) LotroTestUtils(delta.games.lotro.character.log.LotroTestUtils) VirtueId(delta.games.lotro.common.VirtueId) Rewards(delta.games.lotro.common.Rewards) Virtue(delta.games.lotro.common.Virtue) ArrayList(java.util.ArrayList) List(java.util.List) CharacterLog(delta.games.lotro.character.log.CharacterLog)

Example 2 with DeedDescription

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

the class VirtuesStats method parseDeedItems.

private void parseDeedItems(List<CharacterLogItem> items) {
    DeedsManager dm = DeedsManager.getInstance();
    for (CharacterLogItem item : items) {
        Integer id = item.getResourceIdentifier();
        if (id != null) {
            DeedDescription deed = dm.getDeed(id.intValue());
            if (deed != null) {
                Rewards rewards = deed.getRewards();
                String name = deed.getName();
                handleRewards("Deed:" + name, rewards);
            }
        }
    }
}
Also used : DeedsManager(delta.games.lotro.lore.deeds.DeedsManager) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) Rewards(delta.games.lotro.common.Rewards) CharacterLogItem(delta.games.lotro.character.log.CharacterLogItem)

Example 3 with DeedDescription

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

the class DeedUtils method getCategories.

/**
 * Load available categories from deeds manager.
 * @return A sorted list of deed categories.
 */
public static List<String> getCategories() {
    Set<String> categories = new HashSet<String>();
    List<DeedDescription> deeds = DeedsManager.getInstance().getAll();
    for (DeedDescription deed : deeds) {
        categories.add(deed.getCategory());
    }
    List<String> ret = new ArrayList<String>(categories);
    ret.remove(null);
    Collections.sort(ret);
    return ret;
}
Also used : DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 4 with DeedDescription

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

the class DeedsExplorerWindowController method initDeedsTable.

private void initDeedsTable() {
    TypedProperties prefs = GlobalPreferences.getGlobalProperties("DeedsExplorer");
    _tableController = new DeedsTableController(prefs, _filter);
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent event) {
            String action = event.getActionCommand();
            if (DeedsTableController.DOUBLE_CLICK.equals(action)) {
                DeedDescription deed = (DeedDescription) event.getSource();
                DeedDisplayWindowController window = new DeedDisplayWindowController(DeedsExplorerWindowController.this);
                window.setDeed(deed);
                window.show(false);
            }
        }
    };
    _tableController.addActionListener(al);
}
Also used : DeedDisplayWindowController(delta.games.lotro.gui.deed.form.DeedDisplayWindowController) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) TypedProperties(delta.common.utils.misc.TypedProperties)

Example 5 with DeedDescription

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

the class DeedsTableController method init.

private void init() {
    reset();
    DeedsManager manager = DeedsManager.getInstance();
    List<DeedDescription> deeds = manager.getAll();
    for (DeedDescription deed : deeds) {
        _deeds.add(deed);
    }
}
Also used : DeedsManager(delta.games.lotro.lore.deeds.DeedsManager) 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