Search in sources :

Example 1 with STAT

use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.

the class CharacterStatsSummaryPanelController method update.

/**
 * Update contents.
 */
public void update() {
    STAT[] stats = STAT.values();
    int nbStats = stats.length;
    for (int i = 0; i < nbStats; i++) {
        String statValue = "";
        if (_toon != null) {
            BasicStatsSet characterStats = _toon.getStats();
            FixedDecimalsInteger value = characterStats.getStat(stats[i]);
            if (value != null) {
                statValue = String.valueOf(value.intValue());
            } else {
                statValue = "-";
            }
        }
        if (_statValues[i] != null) {
            _statValues[i].setText(statValue);
        }
    }
    DetailedCharacterStatsWindowController detailsStatsController = getDetailsController();
    if (detailsStatsController != null) {
        detailsStatsController.update();
    }
    StatContribsWindowController contribsController = getContribsController();
    if (contribsController != null) {
        contribsController.update();
    }
}
Also used : STAT(delta.games.lotro.character.stats.STAT) StatContribsWindowController(delta.games.lotro.gui.character.stats.contribs.StatContribsWindowController) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) DetailedCharacterStatsWindowController(delta.games.lotro.gui.character.stats.details.DetailedCharacterStatsWindowController) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 2 with STAT

use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.

the class CharacterStatsSummaryPanelController method buildPanel.

private JPanel buildPanel() {
    STAT[] stats = STAT.values();
    int nbStats = stats.length;
    _statLabels = new JLabel[nbStats];
    _statValues = new JLabel[nbStats];
    for (int i = 0; i < nbStats; i++) {
        String label = stats[i].getName() + ":";
        _statLabels[i] = GuiFactory.buildLabel(label);
        _statValues[i] = GuiFactory.buildLabel("99999");
    }
    // Morale, Power, Armor
    STAT[] main = { STAT.MORALE, STAT.POWER, STAT.ARMOUR };
    // Might, Agility, Vitality, Will, Fate
    STAT[] mainStats = { STAT.MIGHT, STAT.AGILITY, STAT.VITALITY, STAT.WILL, STAT.FATE };
    // Offence: Critical hit, finesse, Physical mastery Tactical Mastery
    STAT[] offence = { STAT.CRITICAL_RATING, STAT.FINESSE, STAT.PHYSICAL_MASTERY, STAT.TACTICAL_MASTERY };
    // Defence: Light of EƤrendil, Resistance, crit hit avoidance, incoming healing
    STAT[] defence = { STAT.LIGHT_OF_EARENDIL, STAT.RESISTANCE, STAT.CRITICAL_DEFENCE, STAT.INCOMING_HEALING };
    // - Avoidance: block, parry, evade
    STAT[] avoidance = { STAT.BLOCK, STAT.PARRY, STAT.EVADE };
    // - mitigations:
    // -- source: melee X , ranged X, tactical X
    // -- type: physical, tactical
    STAT[] mitigation = { STAT.PHYSICAL_MITIGATION, STAT.TACTICAL_MITIGATION };
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c1 = new GridBagConstraints(0, 0, 1, 2, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    STAT[][] statGroups1 = { main, mainStats, offence };
    String[] groupNames1 = { "Vitals", "Main", "Offence" };
    JPanel p1 = showStatsColumn(statGroups1, groupNames1, true);
    panel.add(p1, c1);
    STAT[][] statGroups2 = { defence, avoidance, mitigation };
    String[] groupNames2 = { "Defence", "Avoidance", "Mitigation" };
    JPanel p2 = showStatsColumn(statGroups2, groupNames2, false);
    GridBagConstraints c2 = new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(p2, c2);
    // Buttons
    JPanel buttonsPanel = GuiFactory.buildPanel(new FlowLayout());
    // Details button
    JButton details = GuiFactory.buildButton("Details...");
    ActionListener alDetails = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doDetails();
        }
    };
    details.addActionListener(alDetails);
    buttonsPanel.add(details);
    // Contribs button
    JButton contribs = GuiFactory.buildButton("Contribs...");
    ActionListener alContribs = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            doContribs();
        }
    };
    contribs.addActionListener(alContribs);
    buttonsPanel.add(contribs);
    GridBagConstraints cButtons = new GridBagConstraints(1, 1, 1, 1, 0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0);
    panel.add(buttonsPanel, cButtons);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) STAT(delta.games.lotro.character.stats.STAT) ActionListener(java.awt.event.ActionListener)

Example 3 with STAT

use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.

the class StatsEditionPanelController method initFromStats.

/**
 * Initialize the managed panel with the given stats.
 * @param stats Stats to set.
 */
public void initFromStats(BasicStatsSet stats) {
    _statControllers.clear();
    for (STAT stat : STAT.values()) {
        FixedDecimalsInteger value = stats.getStat(stat);
        if (value != null) {
            SingleStatController ctrl = new SingleStatController();
            ctrl.setStat(stat, value);
            _statControllers.add(ctrl);
        }
    }
    if (_statControllers.size() == 0) {
        addNewStatController();
    }
    updateUi();
}
Also used : STAT(delta.games.lotro.character.stats.STAT) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger)

Example 4 with STAT

use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.

the class StatsEditionPanelController method getStats.

/**
 * Get the current stats.
 * @return the current stats.
 */
public BasicStatsSet getStats() {
    BasicStatsSet stats = new BasicStatsSet();
    for (SingleStatController ctrl : _statControllers) {
        ComboBoxController<STAT> comboCtrl = ctrl.getStatComboController();
        STAT stat = comboCtrl.getSelectedItem();
        if (stat != null) {
            String valueStr = ctrl.getValue().getText();
            Float value = NumericTools.parseFloat(valueStr, false);
            if (value != null) {
                stats.setStat(stat, value.floatValue());
            }
        }
    }
    return stats;
}
Also used : STAT(delta.games.lotro.character.stats.STAT) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 5 with STAT

use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.

the class StatContribsPanelController method updateStatCombo.

private void updateStatCombo() {
    STAT currentStat = _statChooser.getSelectedItem();
    _statChooser.removeAllItems();
    boolean found = false;
    for (STAT stat : STAT.values()) {
        ContribsByStat contribs = _contribs.getContribs(stat);
        if (contribs != null) {
            _statChooser.addItem(stat, stat.getName());
            if (stat == currentStat) {
                found = true;
            }
        }
    }
    if (found) {
        _statChooser.selectItem(currentStat);
    }
}
Also used : STAT(delta.games.lotro.character.stats.STAT) ContribsByStat(delta.games.lotro.character.stats.contribs.ContribsByStat)

Aggregations

STAT (delta.games.lotro.character.stats.STAT)30 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)12 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)11 JPanel (javax.swing.JPanel)7 GridBagLayout (java.awt.GridBagLayout)6 TitledBorder (javax.swing.border.TitledBorder)5 GridBagConstraints (java.awt.GridBagConstraints)4 Insets (java.awt.Insets)4 CharacterClass (delta.games.lotro.common.CharacterClass)3 Armour (delta.games.lotro.lore.items.Armour)3 ArmourType (delta.games.lotro.lore.items.ArmourType)3 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)3 ItemQuality (delta.games.lotro.lore.items.ItemQuality)3 ItemStatSliceData (delta.games.lotro.lore.items.stats.ItemStatSliceData)3 JLabel (javax.swing.JLabel)3 ContribsByStat (delta.games.lotro.character.stats.contribs.ContribsByStat)2 TomesSet (delta.games.lotro.character.stats.tomes.TomesSet)2 DamageType (delta.games.lotro.lore.items.DamageType)2 Item (delta.games.lotro.lore.items.Item)2 Weapon (delta.games.lotro.lore.items.Weapon)2