Search in sources :

Example 1 with DeedsManager

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

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

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

Example 4 with DeedsManager

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

the class MainTestRewardsDisplay method main.

/**
 * Main method for this test.
 * @param args Not used.
 */
public static void main(String[] args) {
    DeedsManager deedsManager = DeedsManager.getInstance();
    List<DeedDescription> deeds = deedsManager.getAll();
    for (int i = 0; i < 50; i++) {
        DeedDescription deed = deeds.get(i);
        Rewards rewards = deed.getRewards();
        ObjectsSet objects = rewards.getObjects();
        int lotroPoints = rewards.getLotroPoints();
        if ((objects.getNbObjectItems() > 0) || (lotroPoints > 0)) {
            RewardsPanelController panelCtrl = new RewardsPanelController(rewards);
            JPanel panel = panelCtrl.getPanel();
            JFrame frame = new JFrame();
            JPanel background = GuiFactory.buildBackgroundPanel(new BorderLayout());
            background.add(panel, BorderLayout.CENTER);
            frame.add(background);
            frame.pack();
            frame.setVisible(true);
        }
    }
}
Also used : JPanel(javax.swing.JPanel) DeedsManager(delta.games.lotro.lore.deeds.DeedsManager) DeedDescription(delta.games.lotro.lore.deeds.DeedDescription) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) Rewards(delta.games.lotro.common.Rewards) ObjectsSet(delta.games.lotro.common.objects.ObjectsSet)

Aggregations

DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)4 DeedsManager (delta.games.lotro.lore.deeds.DeedsManager)4 Rewards (delta.games.lotro.common.Rewards)3 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharacterLog (delta.games.lotro.character.log.CharacterLog)1 CharacterLogItem (delta.games.lotro.character.log.CharacterLogItem)1 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)1 Virtue (delta.games.lotro.common.Virtue)1 VirtueId (delta.games.lotro.common.VirtueId)1 ObjectsSet (delta.games.lotro.common.objects.ObjectsSet)1 BorderLayout (java.awt.BorderLayout)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 JFrame (javax.swing.JFrame)1 JPanel (javax.swing.JPanel)1