use of delta.games.lotro.stats.traitPoints.TraitPoint in project lotro-companion by dmorcellet.
the class TraitPointsRegistryXMLParser method parsePoint.
/**
* Build a trait point from an XML tag.
* @param pointTag Point tag.
* @return A trait point.
*/
public TraitPoint parsePoint(Element pointTag) {
TraitPoint ret = null;
NamedNodeMap attrs = pointTag.getAttributes();
// Identifier
String id = DOMParsingTools.getStringAttribute(attrs, TraitPointsRegistryXMLConstants.TRAIT_POINT_ID_ATTR, null);
if (id != null) {
ret = new TraitPoint(id);
// Label
String label = DOMParsingTools.getStringAttribute(attrs, TraitPointsRegistryXMLConstants.TRAIT_POINT_LABEL_ATTR, null);
if (label != null) {
ret.setLabel(label);
}
// Category
String category = DOMParsingTools.getStringAttribute(attrs, TraitPointsRegistryXMLConstants.TRAIT_POINT_CATEGORY_ATTR, null);
if (category != null) {
ret.setCategory(category);
}
// Required class
String requiredClassesStr = DOMParsingTools.getStringAttribute(attrs, TraitPointsRegistryXMLConstants.TRAIT_POINT_REQUIRED_CLASSES_ATTR, null);
if (requiredClassesStr != null) {
String[] requiredClasses = requiredClassesStr.split(",");
for (String requiredClass : requiredClasses) {
CharacterClass characterClass = CharacterClass.getByKey(requiredClass);
ret.addRequiredClass(characterClass);
}
}
}
return ret;
}
use of delta.games.lotro.stats.traitPoints.TraitPoint in project lotro-tools by dmorcellet.
the class TraitPointsRegistryBuilder method checks.
private void checks() {
for (CharacterClass cClass : CharacterClass.ALL_CLASSES) {
List<TraitPoint> points = _registry.getPointsForClass(cClass);
Collections.sort(points, new TraitPointLabelComparator());
System.out.println(cClass + ":" + points.size());
for (TraitPoint point : points) {
System.out.println("\t" + point.getLabel() + " -- " + point.getId());
}
}
List<TraitPoint> all = _registry.getAll();
System.out.println("All:" + all.size());
}
use of delta.games.lotro.stats.traitPoints.TraitPoint in project lotro-tools by dmorcellet.
the class TraitPointsRegistryBuilder method buildClassPoints.
private void buildClassPoints() {
int classIndex = 0;
for (CharacterClass cClass : CharacterClass.ALL_CLASSES) {
String category = TraitPointCategories.CLASS;
String key = cClass.getKey();
String book1 = BOOK_NAMES[classIndex][0];
initPoint(key + ":LegendaryBook1", category, "Complete Legendary Book Pages '" + book1 + "'", cClass);
String book2 = BOOK_NAMES[classIndex][1];
initPoint(key + ":LegendaryBook2", category, "Complete Legendary Book Pages '" + book2 + "'", cClass);
String book3 = BOOK_NAMES[classIndex][2];
initPoint(key + ":LegendaryBook3", category, "Complete Legendary Book Pages '" + book3 + "'", cClass);
String chain1 = CLASS_QUESTS_CHAIN_NAMES[classIndex][0];
initPoint(key + ":ClassQuests50", category, "Complete the Level 50 Class Quest Chain '" + chain1 + "'", cClass);
String chain2 = CLASS_QUESTS_CHAIN_NAMES[classIndex][1];
initPoint(key + ":ClassQuests58", category, "Complete the Level 58 Class Quest Chain '" + chain2 + "'", cClass);
if (cClass != CharacterClass.BEORNING) {
String dwarfBook = IRON_GARNISON_GUARDS_BOOKS[classIndex];
initPoint(key + ":ReadGuardsBook", category, "Read book of Iron Garrison Guards: '" + dwarfBook + "'", cClass);
}
classIndex++;
}
// Epic
TraitPoint epicVol2Book6 = initPoint("EpicVol2Book6", TraitPointCategories.EPIC, "Complete Volume II, Book 6 (Moria)", null);
for (CharacterClass characterClass : CharacterClass.ALL_CLASSES) {
if (characterClass != CharacterClass.BEORNING) {
epicVol2Book6.addRequiredClass(characterClass);
}
}
// Add Beorning specifics
initPoint("Beorning:ClassQuests15", TraitPointCategories.CLASS, "Complete the Level 15 Class Quest Chain 'The Speech of Animals'", CharacterClass.BEORNING);
initPoint("Beorning:ClassQuests30", TraitPointCategories.CLASS, "Complete the Level 30 Class Quest Chain 'Hatred of Bear and Man'", CharacterClass.BEORNING);
}
use of delta.games.lotro.stats.traitPoints.TraitPoint in project lotro-companion by dmorcellet.
the class TraitPointsRegistryXMLWriter method write.
/**
* Write a trait points registry to the given XML stream.
* @param hd XML output stream.
* @param registry Registry to write.
* @throws Exception If an error occurs.
*/
public void write(TransformerHandler hd, TraitPointsRegistry registry) throws Exception {
AttributesImpl attrs = new AttributesImpl();
hd.startElement("", "", TraitPointsRegistryXMLConstants.TRAIT_POINTS_REGISTRY_TAG, attrs);
List<TraitPoint> points = registry.getAll();
Collections.sort(points, new TraitPointIdComparator());
for (TraitPoint point : points) {
write(hd, point);
}
hd.endElement("", "", TraitPointsRegistryXMLConstants.TRAIT_POINTS_REGISTRY_TAG);
}
use of delta.games.lotro.stats.traitPoints.TraitPoint in project lotro-companion by dmorcellet.
the class TraitPointsEditionPanelController method buildTables.
private void buildTables() {
_tableControllers = new ArrayList<TraitPointsTableController>();
_labels = new ArrayList<String>();
CharacterClass characterClass = _summary.getCharacterClass();
TraitPointsRegistry registry = TraitPoints.get().getRegistry();
List<TraitPoint> points = registry.getPointsForClass(characterClass);
Collections.sort(points, new TraitPointLabelComparator());
TraitPointsStatusListener listener = new TraitPointsStatusListener() {
@Override
public void statusUpdated() {
_summaryController.update();
}
};
String[] categories = { "Class", "Epic", "Quests", "Deeds" };
for (String category : categories) {
TraitPointFilter filter = new TraitPointFilter();
filter.setCategory(category);
List<TraitPoint> selectedPoints = new ArrayList<TraitPoint>();
for (TraitPoint point : points) {
if (filter.accept(point)) {
selectedPoints.add(point);
}
}
TraitPointsTableController tableController = new TraitPointsTableController(_status, selectedPoints);
_tableControllers.add(tableController);
_labels.add(category);
tableController.setListener(listener);
}
}
Aggregations