use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class TraitPointsSummaryPanelController method getPoints.
private String getPoints() {
CharacterClass characterClass = _summary.getCharacterClass();
int level = _summary.getLevel();
int maxPoints = TraitPoints.get().getMaxTraitPoints(characterClass, level);
int points = _status.getPointsCount(level);
String ret = points + " / " + maxPoints;
return ret;
}
use of delta.games.lotro.common.CharacterClass 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);
}
}
use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class WarbandsTableController method buildToonHeaderPanel.
private JPanel buildToonHeaderPanel(CharacterFile toon) {
JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
// Class icon
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 2, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
ImageIcon classIcon = null;
CharacterSummary summary = toon.getSummary();
if (summary != null) {
CharacterClass cClass = summary.getCharacterClass();
classIcon = LotroIconsManager.getClassIcon(cClass, LotroIconsManager.COMPACT_SIZE);
}
JLabel classLabel;
if (classIcon != null) {
classLabel = new JLabel(classIcon);
} else {
classLabel = new JLabel("(class)");
}
panel.add(classLabel, c);
// Toon name
String name = toon.getName();
JLabel nameLabel = GuiFactory.buildLabel(name, 16.0f);
c = new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 2, 2, 2), 0, 0);
panel.add(nameLabel, c);
// Log update
Date logDate = toon.getLastLogUpdate();
String logDateStr = "";
if (logDate != null) {
logDateStr = Formats.getDateString(logDate);
}
JLabel logDateLabel = GuiFactory.buildLabel(logDateStr);
c = new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 5, 2), 0, 0);
panel.add(logDateLabel, c);
return panel;
}
use of delta.games.lotro.common.CharacterClass in project lotro-companion by dmorcellet.
the class CharacterClassController method setRace.
/**
* Set the current race.
* @param race Race to set.
*/
public void setRace(Race race) {
if (_race != race) {
List<CharacterClass> classes = _classesByRace.get(race);
for (CharacterClass cClass : classes) {
_classController.addItem(cClass, cClass.getLabel());
}
if (_race != null) {
List<CharacterClass> oldClasses = _classesByRace.get(_race);
for (CharacterClass cClass : oldClasses) {
_classController.removeItem(cClass);
}
}
_race = race;
}
}
use of delta.games.lotro.common.CharacterClass in project lotro-tools by dmorcellet.
the class CharacterPageParser method parseCharacterDescription.
private void parseCharacterDescription(Element charPanel) {
// Character name
// <div class="char_name header_color">Glumlug of Elendilmir</div>
String charName = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "char_name header_color");
if (charName != null) {
int indexOf = charName.indexOf(OF);
if (indexOf != -1) {
String server = charName.substring(indexOf + OF.length());
_character.setServer(server);
charName = charName.substring(0, indexOf);
}
_character.setName(charName);
}
// System.out.println("Char name ["+charName+"]");
// Character core:
// <div class="char_core">
Element charCore = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(charPanel, HTMLElementName.DIV, "class", "char_core");
if (charCore != null) {
// <div class="char_class header_color">Hunter</div>
String charClassName = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "char_class header_color");
CharacterClass cClass = CharacterClass.getByName(charClassName);
_character.setCharacterClass(cClass);
// <div class="char_race header_color">Dwarf</div>
String charRace = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "char_race header_color");
Race race = Race.getByLabel(charRace);
_character.setRace(race);
// <div class="char_nat header_color">Grey Mountains</div>
String charNation = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "char_nat header_color");
_character.setRegion(charNation);
// <div class="char_level header_color">66</div>
String charLevelStr = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "char_level header_color");
int charLevel = NumericTools.parseInt(charLevelStr, 0);
_character.setLevel(charLevel);
// System.out.println("Class ["+charClassName+"], Race ["+charRace+"], Nation ["+charNation+"], Level="+charLevel);
}
// Character main stats:
// <div class="core_stats header_color">
Element charStats = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(charPanel, HTMLElementName.DIV, "class", "core_stats header_color");
if (charStats != null) {
// <div class="morale">4839</div>
String moraleStr = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "morale");
int morale = NumericTools.parseInt(moraleStr, 0);
BasicStatsSet stats = _character.getStats();
stats.setStat(STAT.MORALE, morale);
// <div class="power">2243</div>
String powerStr = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "power");
int power = NumericTools.parseInt(powerStr, 0);
stats.setStat(STAT.POWER, power);
// <div class="armour">3213</div>
String armourStr = JerichoHtmlUtils.getTagContents(charPanel, HTMLElementName.DIV, "class", "armour");
int armour = NumericTools.parseInt(armourStr, 0);
stats.setStat(STAT.ARMOUR, armour);
// System.out.println("Morale="+morale+", Power="+power+", Armour="+armour);
}
CharacterEquipment equipment = _character.getEquipment();
// Object slots:
// <a class="equipment_icon" href="http://lorebook.lotro.com/wiki/Special:LotroResource?id=1879205751">
// <img class="slot_2" src="http://lorebook.lotro.com/icon.php?id=1879205751&type=item">
// </a>
List<Element> objectSlots = JerichoHtmlUtils.findElementsByTagNameAndAttributeValue(charPanel, HTMLElementName.A, "class", "equipment_icon");
for (Element objectSlot : objectSlots) {
String objectPageURL = objectSlot.getAttributeValue("href");
// System.out.println("Object ["+objectPageURL+"]");
Element img = objectSlot.getFirstElement(HTMLElementName.IMG);
if (img != null) {
String slotName = img.getAttributeValue("class");
Integer slotNumber = null;
if ((slotName != null) && (slotName.startsWith(SLOT_SEED))) {
slotName = slotName.substring(SLOT_SEED.length());
slotNumber = NumericTools.parseInteger(slotName);
if (slotNumber != null) {
// String iconURL=img.getAttributeValue("src");
EQUIMENT_SLOT slot = CharacterEquipment.getSlotByIndex(slotNumber.intValue());
SlotContents contents = equipment.getSlotContents(slot, true);
Integer itemId = CharacterXMLParser.idFromURL(objectPageURL);
contents.setItemId(itemId);
// System.out.println("Slot ["+slotNumber+"], Icon URL ["+iconURL+"]");
}
}
}
}
}
Aggregations