Search in sources :

Example 1 with StatContribution

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

the class StatContribsChartPanelController method setContributions.

/**
 * Set the contributions to display.
 * @param contribs Contributions to display.
 */
public void setContributions(ContribsByStat contribs) {
    // Update data
    _data.clear();
    for (StatContribution contrib : contribs.getContribs()) {
        String source = contrib.getSource().getLabel();
        FixedDecimalsInteger value = contrib.getValue();
        _data.setValue(source, value.doubleValue());
    }
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) StatContribution(delta.games.lotro.character.stats.contribs.StatContribution)

Example 2 with StatContribution

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

the class StatContribsPanelController method updateTotals.

private void updateTotals(ContribsByStat contribs, FixedDecimalsInteger expectedTotal) {
    FixedDecimalsInteger total = new FixedDecimalsInteger();
    List<StatContribution> statContribs = contribs.getContribs();
    for (StatContribution statContrib : statContribs) {
        total.add(statContrib.getValue());
    }
    int expected = (expectedTotal != null) ? expectedTotal.getInternalValue() : 0;
    boolean positive = (expected >= 0);
    int actual = total.getInternalValue();
    boolean same = (actual == Math.abs(expected));
    boolean isPercentage = _statChooser.getSelectedItem().isPercentage();
    String totalStr = StatDisplayUtils.getStatDisplay(total, isPercentage);
    if (!positive)
        totalStr = "-" + totalStr;
    String expectedTotalStr = StatDisplayUtils.getStatDisplay(expectedTotal, isPercentage);
    String label = "Total: " + (same ? totalStr : totalStr + " / " + expectedTotalStr);
    _totals.setText(label);
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) StatContribution(delta.games.lotro.character.stats.contribs.StatContribution)

Aggregations

StatContribution (delta.games.lotro.character.stats.contribs.StatContribution)2 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)2