Search in sources :

Example 21 with STAT

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

the class DetailedCharacterStatsPanelController method addHeaders.

private void addHeaders(JPanel panel, int x, int y, String[] labels, STAT[] stats, boolean horizontal, int gridwidth) {
    for (int i = 0; i < labels.length; i++) {
        int cellX = x + (horizontal ? (gridwidth * i) : 0);
        int cellY = y + (horizontal ? 0 : i);
        GridBagConstraints c = new GridBagConstraints(cellX, cellY, gridwidth, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0);
        STAT stat = (stats != null) ? stats[i] : null;
        JLabel label = buildLabelForStat(labels[i], stat);
        panel.add(label, c);
    }
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) STAT(delta.games.lotro.character.stats.STAT) Insets(java.awt.Insets) JLabel(javax.swing.JLabel)

Example 22 with STAT

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

the class DetailedCharacterStatsPanelController method buildAvoidancePanel.

private JPanel buildAvoidancePanel() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    String[] labelsV = new String[] { "Resistance", "Block", "Parry", "Evade" };
    STAT[] stats = { STAT.RESISTANCE, STAT.BLOCK, STAT.PARRY, STAT.EVADE };
    addHeaders(panel, 0, 1, labelsV, stats, false, 1);
    int x = 1;
    String[] labelsH = new String[] { "Rating", "Full %", "Partial %", "Mitigation %" };
    addHeaders(panel, x, 0, labelsH, null, true, 2);
    int y = 1;
    // Resist
    addStatWidgets(panel, STAT.RESISTANCE, x, y, false);
    addStatWidgets(panel, STAT.RESISTANCE_PERCENTAGE, x + 2, y, false);
    y++;
    // Block
    addStatWidgets(panel, STAT.BLOCK, x, y, false);
    addStatWidgets(panel, STAT.BLOCK_PERCENTAGE, x + 2, y, false);
    addStatWidgets(panel, STAT.PARTIAL_BLOCK_PERCENTAGE, x + 4, y, false);
    addStatWidgets(panel, STAT.PARTIAL_BLOCK_MITIGATION_PERCENTAGE, x + 6, y, false);
    y++;
    // Parry
    addStatWidgets(panel, STAT.PARRY, x, y, false);
    addStatWidgets(panel, STAT.PARRY_PERCENTAGE, x + 2, y, false);
    addStatWidgets(panel, STAT.PARTIAL_PARRY_PERCENTAGE, x + 4, y, false);
    addStatWidgets(panel, STAT.PARTIAL_PARRY_MITIGATION_PERCENTAGE, x + 6, y, false);
    y++;
    // Evade
    addStatWidgets(panel, STAT.EVADE, x, y, false);
    addStatWidgets(panel, STAT.EVADE_PERCENTAGE, x + 2, y, false);
    addStatWidgets(panel, STAT.PARTIAL_EVADE_PERCENTAGE, x + 4, y, false);
    addStatWidgets(panel, STAT.PARTIAL_EVADE_MITIGATION_PERCENTAGE, x + 6, y, false);
    TitledBorder border = GuiFactory.buildTitledBorder("Avoidance");
    panel.setBorder(border);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) STAT(delta.games.lotro.character.stats.STAT) GridBagLayout(java.awt.GridBagLayout) TitledBorder(javax.swing.border.TitledBorder)

Example 23 with STAT

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

the class StatValuesPanelController method buildContents.

private void buildContents() {
    // Clear
    _panel.removeAll();
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 5, 2, 5), 0, 0);
    // First line: Base stat
    // - First cell blank
    c.gridx++;
    // - Stat name
    STAT baseStat = _config.getBaseStat();
    JLabel baseStatNameLabel = GuiFactory.buildLabel(baseStat.getName());
    _panel.add(baseStatNameLabel, c);
    // - Stat value
    c.gridx++;
    FixedDecimalsInteger baseStatValue = _values.getStat(baseStat);
    JLabel baseStatValueLabel = GuiFactory.buildLabel(StatDisplayUtils.getStatDisplay(baseStatValue, baseStat.isPercentage()));
    _panel.add(baseStatValueLabel, c);
    c.gridy++;
    boolean doComputeDelta = (_deltaValues.size() == 0);
    // Stat lines
    int level = _config.getLevel();
    List<SingleStatCurveConfiguration> curveConfigs = _config.getCurveConfigurations();
    int nbCurves = curveConfigs.size();
    int index = 0;
    for (int curveIndex = 0; curveIndex < nbCurves; curveIndex++) {
        SingleStatCurveConfiguration curveConfig = curveConfigs.get(curveIndex);
        Color color = StatCurveChartPanelController.LINE_COLORS[curveIndex];
        List<STAT> stats = curveConfig.getStats();
        for (STAT stat : stats) {
            c.gridx = 0;
            c.fill = GridBagConstraints.NONE;
            c.weightx = 0.0;
            // Add color
            JLabel coloredLabel = buildColoredLabel(color);
            _panel.add(coloredLabel, c);
            c.gridx++;
            // Stat name
            JLabel statNameLabel = GuiFactory.buildLabel(stat.getName());
            _panel.add(statNameLabel, c);
            c.gridx++;
            // Stat value
            FixedDecimalsInteger statValueFromCurve = getStatValue(curveConfig, level, baseStatValue);
            FixedDecimalsInteger statValue = _values.getStat(stat);
            String statValueFromCurveStr = StatDisplayUtils.getStatDisplay(statValueFromCurve, stat.isPercentage());
            JLabel statValueFromCurveLabel = GuiFactory.buildLabel(statValueFromCurveStr);
            _panel.add(statValueFromCurveLabel, c);
            c.gridx++;
            // Bonus
            FixedDecimalsInteger deltaValue = null;
            if (doComputeDelta) {
                deltaValue = getDeltaValue(statValueFromCurve, statValue);
                _deltaValues.add(deltaValue);
            } else {
                deltaValue = _deltaValues.get(index);
            }
            if (deltaValue != null) {
                String deltaValueStr = StatDisplayUtils.getStatDisplay(deltaValue, stat.isPercentage());
                if (deltaValue.getInternalValue() > 0)
                    deltaValueStr = "+" + deltaValueStr;
                FixedDecimalsInteger totalValue = new FixedDecimalsInteger(statValueFromCurve);
                totalValue.add(deltaValue);
                String totalValueStr = StatDisplayUtils.getStatDisplay(totalValue, stat.isPercentage());
                String bonusStr = deltaValueStr + " = " + totalValueStr;
                JLabel bonusLabel = GuiFactory.buildLabel(bonusStr);
                _panel.add(bonusLabel, c);
                c.gridx++;
            }
            // Add 'buffer' empty column
            {
                c.fill = GridBagConstraints.BOTH;
                c.weightx = 1.0;
                Component glue = Box.createGlue();
                _panel.add(glue, c);
            }
            c.gridx++;
            c.gridy++;
            index++;
        }
    }
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) Color(java.awt.Color) JLabel(javax.swing.JLabel) STAT(delta.games.lotro.character.stats.STAT) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Component(java.awt.Component)

Example 24 with STAT

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

the class VirtueIconController method buildToolTip.

private String buildToolTip(VirtueId virtueId, int tier) {
    VirtuesContributionsMgr virtuesMgr = VirtuesContributionsMgr.get();
    BasicStatsSet stats = virtuesMgr.getContribution(virtueId, tier);
    StringBuilder sb = new StringBuilder();
    sb.append(virtueId.name()).append(EndOfLine.NATIVE_EOL);
    for (STAT stat : stats.getStats()) {
        String name = stat.getName();
        String value = stats.getStat(stat).toString();
        sb.append(name).append(": ").append(value).append(EndOfLine.NATIVE_EOL);
    }
    String text = sb.toString().trim();
    String html = "<html>" + text.replace(EndOfLine.NATIVE_EOL, "<br>") + "</html>";
    return html;
}
Also used : STAT(delta.games.lotro.character.stats.STAT) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) VirtuesContributionsMgr(delta.games.lotro.character.stats.virtues.VirtuesContributionsMgr)

Example 25 with STAT

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

the class MainTestStatContribsChart method doIt.

private void doIt(CharacterData data) {
    StatsContributionsManager contribs = new StatsContributionsManager(data.getCharacterClass());
    CharacterStatsComputer statsComputer = new CharacterStatsComputer(contribs);
    BasicStatsSet stats = statsComputer.getStats(data);
    System.out.println(stats);
    contribs.setResolveIndirectContributions(true);
    contribs.compute();
    JPanel panel = GuiFactory.buildBackgroundPanel(new BorderLayout());
    JTabbedPane tabs = GuiFactory.buildTabbedPane();
    panel.add(tabs, BorderLayout.CENTER);
    for (STAT stat : STAT.values()) {
        ContribsByStat contribsForStat = contribs.getContribs(stat);
        if (contribsForStat != null) {
            StatContribsChartPanelController chartController = new StatContribsChartPanelController();
            chartController.setContributions(contribsForStat);
            JPanel statPanel = chartController.getPanel();
            tabs.add(stat.getName(), statPanel);
        }
    }
    DefaultWindowController w = new DefaultWindowController();
    w.getFrame().add(panel);
    w.getFrame().pack();
    w.show();
}
Also used : JPanel(javax.swing.JPanel) STAT(delta.games.lotro.character.stats.STAT) ContribsByStat(delta.games.lotro.character.stats.contribs.ContribsByStat) BorderLayout(java.awt.BorderLayout) StatsContributionsManager(delta.games.lotro.character.stats.contribs.StatsContributionsManager) CharacterStatsComputer(delta.games.lotro.character.stats.CharacterStatsComputer) DefaultWindowController(delta.common.ui.swing.windows.DefaultWindowController) JTabbedPane(javax.swing.JTabbedPane) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

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