Search in sources :

Example 1 with VirtueId

use of delta.games.lotro.common.VirtueId 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 VirtueId

use of delta.games.lotro.common.VirtueId in project lotro-companion by dmorcellet.

the class VirtuesStats method dump.

/**
 * Dump the contents of this object to the given stream.
 * @param ps Output stream to use.
 * @param verbose Verbose output or not.
 */
public void dump(PrintStream ps, boolean verbose) {
    ps.println("Virtues for [" + _name + "]:");
    Set<VirtueId> virtues = _virtues.keySet();
    List<VirtueId> sortedVirtues = new ArrayList<VirtueId>(virtues);
    Collections.sort(sortedVirtues);
    for (VirtueId virtue : sortedVirtues) {
        List<String> items = _virtues.get(virtue);
        int nb = items.size();
        ps.println(virtue + " (" + nb + "): " + items);
    }
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) ArrayList(java.util.ArrayList)

Example 3 with VirtueId

use of delta.games.lotro.common.VirtueId in project lotro-companion by dmorcellet.

the class VirtuesEditionPanelController method getVirtues.

/**
 * Get the current virtues values.
 * @return the currently displayed virtues definition.
 */
public VirtuesSet getVirtues() {
    VirtuesSet ret = new VirtuesSet();
    for (VirtueId virtueId : VirtueId.values()) {
        VirtueEditionUiController ui = _virtues.get(virtueId);
        int tier = ui.getTier();
        ret.setVirtueValue(virtueId, tier);
    }
    _selectedVirtues.getSelectedVirtues(ret);
    return ret;
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) VirtuesSet(delta.games.lotro.character.stats.virtues.VirtuesSet)

Example 4 with VirtueId

use of delta.games.lotro.common.VirtueId in project lotro-companion by dmorcellet.

the class DeedUiUtils method buildVirtueCombo.

/**
 * Build a combo-box controller to choose a virtue.
 * @return A new combo-box controller.
 */
public static ComboBoxController<VirtueId> buildVirtueCombo() {
    ComboBoxController<VirtueId> ctrl = new ComboBoxController<VirtueId>();
    ctrl.addEmptyItem("");
    for (VirtueId virtue : VirtueId.values()) {
        ctrl.addItem(virtue, virtue.getLabel());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 5 with VirtueId

use of delta.games.lotro.common.VirtueId in project lotro-tools by dmorcellet.

the class LotroCompendiumDeedsLoader method handleVirtues.

@SuppressWarnings("unchecked")
private void handleVirtues(Rewards rewards, List<Object> virtueItems) {
    // virtues={{val="Discipline"}}
    if (virtueItems == null) {
        return;
    }
    for (Object virtueItem : virtueItems) {
        Map<String, Object> virtueMap = (Map<String, Object>) virtueItem;
        String virtueName = (String) virtueMap.get("val");
        VirtueId virtueId = VirtueId.valueOf(virtueName.toUpperCase());
        if (virtueId != null) {
            Virtue virtue = new Virtue(virtueId, 1);
            rewards.addVirtue(virtue);
        } else {
            System.out.println("Not handled [" + virtueName + "]");
        }
    }
}
Also used : VirtueId(delta.games.lotro.common.VirtueId) Virtue(delta.games.lotro.common.Virtue) Map(java.util.Map)

Aggregations

VirtueId (delta.games.lotro.common.VirtueId)17 Virtue (delta.games.lotro.common.Virtue)6 ArrayList (java.util.ArrayList)3 Rewards (delta.games.lotro.common.Rewards)2 VirtueRewardFilter (delta.games.lotro.common.rewards.filters.VirtueRewardFilter)2 DeedDescription (delta.games.lotro.lore.deeds.DeedDescription)2 Faction (delta.games.lotro.lore.reputation.Faction)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharacterLog (delta.games.lotro.character.log.CharacterLog)1 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)1 VirtuesSet (delta.games.lotro.character.stats.virtues.VirtuesSet)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 Race (delta.games.lotro.common.Race)1 ReputationItem (delta.games.lotro.common.ReputationItem)1 Title (delta.games.lotro.common.Title)1 Trait (delta.games.lotro.common.Trait)1