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);
}
}
}
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);
}
}
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;
}
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;
}
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 + "]");
}
}
}
Aggregations