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);
}
}
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;
}
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++;
}
}
}
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;
}
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();
}
Aggregations