Search in sources :

Example 21 with CharacterClass

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

the class CharacterPreferencesManager method getUserProperties.

/**
 * Get the preferences for a character.
 * @param toonFile Character file.
 * @param id Identifier of the preferences set.
 * @return Some properties or <code>null</code> if not managed.
 */
public static TypedProperties getUserProperties(CharacterFile toonFile, String id) {
    TypedProperties props = null;
    if (id.startsWith(ItemChoiceWindowController.ITEM_CHOOSER_PROPERTIES_ID)) {
        if (toonFile != null) {
            Preferences prefs = toonFile.getPreferences();
            props = prefs.getPreferences(id);
            List<String> columnIds = props.getStringList(ItemChoiceWindowController.COLUMNS_PROPERTY);
            if (columnIds == null) {
                String slotKey = id.substring(id.indexOf("#") + 1);
                EQUIMENT_SLOT slot = EQUIMENT_SLOT.valueOf(slotKey);
                CharacterClass characterClass = toonFile.getSummary().getCharacterClass();
                ItemChoiceTableColumnsManager mgr = new ItemChoiceTableColumnsManager();
                columnIds = mgr.getItemChoiceColumns(characterClass, slot);
                props.setStringList(ItemChoiceWindowController.COLUMNS_PROPERTY, columnIds);
                prefs.savePreferences(props);
            }
        }
    } else if (ItemChoiceWindowController.ESSENCE_CHOOSER_PROPERTIES_ID.equals(id)) {
        Preferences prefs = toonFile.getPreferences();
        props = prefs.getPreferences(id);
        List<String> columnIds = props.getStringList(ItemChoiceWindowController.COLUMNS_PROPERTY);
        if (columnIds == null) {
            CharacterClass characterClass = toonFile.getSummary().getCharacterClass();
            ItemChoiceTableColumnsManager mgr = new ItemChoiceTableColumnsManager();
            columnIds = mgr.getEssenceChoiceColumns(characterClass);
            props.setStringList(ItemChoiceWindowController.COLUMNS_PROPERTY, columnIds);
            prefs.savePreferences(props);
        }
    }
    return props;
}
Also used : EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT) ItemChoiceTableColumnsManager(delta.games.lotro.gui.items.ItemChoiceTableColumnsManager) List(java.util.List) TypedProperties(delta.common.utils.misc.TypedProperties) Preferences(delta.common.utils.misc.Preferences) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 22 with CharacterClass

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

the class CharacterSummaryPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0);
    // Grab data
    CharacterClass cClass = null;
    Race race = null;
    CharacterSex sex = null;
    if (_summary != null) {
        cClass = _summary.getCharacterClass();
        race = _summary.getRace();
        sex = _summary.getCharacterSex();
    }
    // Class
    ImageIcon classIcon = LotroIconsManager.getClassIcon(cClass, LotroIconsManager.COMPACT_SIZE);
    panel.add(GuiFactory.buildIconLabel(classIcon), c);
    // Character icon
    ImageIcon characterIcon = LotroIconsManager.getCharacterIcon(race, sex);
    c.gridx = 1;
    _characterIconLabel = GuiFactory.buildIconLabel(characterIcon);
    panel.add(_characterIconLabel, c);
    // Name
    _nameLabel = GuiFactory.buildLabel("", 28.0f);
    c.gridx = 2;
    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 1.0;
    c.fill = GridBagConstraints.BOTH;
    panel.add(_nameLabel, c);
    // Level
    _levelLabel = GuiFactory.buildLabel("", 32.0f);
    c.gridx = 3;
    c.weightx = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    panel.add(_levelLabel, c);
    c.gridx = 4;
    JButton edit = GuiFactory.buildButton("Edit...");
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editSummary();
        }
    };
    edit.addActionListener(al);
    panel.add(edit, c);
    update();
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) Race(delta.games.lotro.common.Race) CharacterSex(delta.games.lotro.common.CharacterSex) JButton(javax.swing.JButton) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 23 with CharacterClass

use of delta.games.lotro.common.CharacterClass 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 point Trait point to write.
 * @throws Exception
 */
private void write(TransformerHandler hd, TraitPoint point) throws Exception {
    AttributesImpl attrs = new AttributesImpl();
    // Identifier
    String id = point.getId();
    if (id != null) {
        attrs.addAttribute("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_ID_ATTR, CDATA, id);
    }
    // Category
    String category = point.getCategory();
    if (category != null) {
        attrs.addAttribute("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_CATEGORY_ATTR, CDATA, category);
    }
    // Label
    String label = point.getLabel();
    if (label != null) {
        attrs.addAttribute("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_LABEL_ATTR, CDATA, label);
    }
    // Required class
    Set<CharacterClass> requiredClasses = point.getRequiredClasses();
    if (!requiredClasses.isEmpty()) {
        String classes = buildClassRequirement(requiredClasses);
        attrs.addAttribute("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_REQUIRED_CLASSES_ATTR, CDATA, classes);
    }
    hd.startElement("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_TAG, attrs);
    hd.endElement("", "", TraitPointsRegistryXMLConstants.TRAIT_POINT_TAG);
}
Also used : AttributesImpl(org.xml.sax.helpers.AttributesImpl) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 24 with CharacterClass

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

the class TraitPointsRegistryXMLWriter method buildClassRequirement.

private String buildClassRequirement(Set<CharacterClass> classes) {
    StringBuilder sb = new StringBuilder();
    int index = 0;
    for (CharacterClass characterClass : classes) {
        if (index > 0) {
            sb.append(',');
        }
        String key = characterClass.getKey();
        sb.append(key);
        index++;
    }
    return sb.toString();
}
Also used : TraitPoint(delta.games.lotro.stats.traitPoints.TraitPoint) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 25 with CharacterClass

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

the class ReputationSynopsisTableController 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);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) CharacterSummary(delta.games.lotro.character.CharacterSummary) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) CharacterClass(delta.games.lotro.common.CharacterClass)

Aggregations

CharacterClass (delta.games.lotro.common.CharacterClass)33 Race (delta.games.lotro.common.Race)9 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)7 Item (delta.games.lotro.lore.items.Item)7 Armour (delta.games.lotro.lore.items.Armour)6 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)6 TraitPoint (delta.games.lotro.stats.traitPoints.TraitPoint)5 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)5 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)4 CharacterSex (delta.games.lotro.common.CharacterSex)4 CharacterData (delta.games.lotro.character.CharacterData)3 STAT (delta.games.lotro.character.stats.STAT)3 DeedType (delta.games.lotro.lore.deeds.DeedType)3 ItemQuality (delta.games.lotro.lore.items.ItemQuality)3 Weapon (delta.games.lotro.lore.items.Weapon)3 WeaponType (delta.games.lotro.lore.items.WeaponType)3 GridBagConstraints (java.awt.GridBagConstraints)3 GridBagLayout (java.awt.GridBagLayout)3 Insets (java.awt.Insets)3 ArrayList (java.util.ArrayList)3