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