use of delta.games.lotro.character.stats.BasicStatsSet 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.BasicStatsSet in project lotro-companion by dmorcellet.
the class EssencesSummaryPanelController method updateStatsPanel.
private void updateStatsPanel() {
// Raw
BasicStatsSet raw = _summary.getStats();
updateStatsPanel(_rawStatsPanel, raw);
// Cumulated
DerivatedStatsContributionsMgr derivedStatsMgr = new DerivatedStatsContributionsMgr();
CharacterClass characterClass = _toon.getCharacterClass();
BasicStatsSet derivated = derivedStatsMgr.getContribution(characterClass, raw);
BasicStatsSet cumulated = new BasicStatsSet();
cumulated.addStats(raw);
cumulated.addStats(derivated);
updateStatsPanel(_cumulatedStatsPanel, cumulated);
}
use of delta.games.lotro.character.stats.BasicStatsSet in project lotro-companion by dmorcellet.
the class EssencesSummaryPanelController method updateStatsPanel.
private void updateStatsPanel(JPanel panel, BasicStatsSet stats) {
panel.removeAll();
int rowIndex = 0;
GridBagConstraints strutConstraints = new GridBagConstraints(0, rowIndex, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0);
panel.add(Box.createHorizontalStrut(100), strutConstraints);
rowIndex++;
int statsCount = stats.getStatsCount();
if (statsCount > 0) {
// Grab toon stats
BasicStatsSet toonStats = _toon.getStats();
// Build display
for (STAT stat : STAT.values()) {
FixedDecimalsInteger value = stats.getStat(stat);
if (value != null) {
// Value label
JLabel valueLabel = GuiFactory.buildLabel(value.toString());
GridBagConstraints c = new GridBagConstraints(0, rowIndex, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, 0);
panel.add(valueLabel, c);
// Name label
String name = StatLabels.getStatLabel(stat);
JLabel statLabel = GuiFactory.buildLabel(name);
c = new GridBagConstraints(1, rowIndex, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 0), 0, 0);
panel.add(statLabel, c);
// Percentage
FixedDecimalsInteger toonStat = toonStats.getStat(stat);
String percentageStr = "";
if (toonStat != null) {
float percentage = 100 * (value.floatValue() / toonStat.floatValue());
percentageStr = String.format("%.1f%%", Float.valueOf(percentage));
}
JLabel percentageLabel = GuiFactory.buildLabel(percentageStr);
c = new GridBagConstraints(2, rowIndex, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 5), 0, 0);
panel.add(percentageLabel, c);
rowIndex++;
}
}
}
}
use of delta.games.lotro.character.stats.BasicStatsSet in project lotro-companion by dmorcellet.
the class BuffIconController method buildToolTip.
private String buildToolTip() {
Buff buff = _buff.getBuff();
StringBuilder sb = new StringBuilder();
sb.append(buff.getLabel()).append(EndOfLine.NATIVE_EOL);
BasicStatsSet stats = _buff.getStats(_toon);
if (stats != null) {
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.BasicStatsSet in project lotro-tools by dmorcellet.
the class RelicsIndexPageParser method handleTableRow.
private Relic handleTableRow(Element tr, Integer level, RelicType defaultType) {
Relic relic = null;
List<Element> tds = JerichoHtmlUtils.findElementsByTagName(tr, HTMLElementName.TD);
if (tds.size() == 2) {
// Icon & name
Element iconAndNameElement = tds.get(0);
List<Element> as = JerichoHtmlUtils.findElementsByTagName(iconAndNameElement, HTMLElementName.A);
Element iconElement = as.get(0);
String iconPath = extractIcon(iconElement);
// Name
Element nameElement = as.get(1);
String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.SPAN);
if (name == null) {
name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
}
// Type
RelicType type = getTypeFromName(name);
relic = new Relic(name, type, level);
relic.setIconFilename(iconPath);
// Stats
Element statsElement = tds.get(1);
String statsStr = JerichoHtmlUtils.getTextFromTag(statsElement);
statsStr = statsStr.replaceAll(",", "\n");
BasicStatsSet stats = parseStats(statsStr);
relic.getStats().setStats(stats);
} else if (tds.size() == 3) {
// Icon
Element iconElement = tds.get(0);
String iconPath = extractIcon(iconElement);
// Name
Element nameElement = tds.get(1);
String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
// Type
RelicType type = getTypeFromName(name);
relic = new Relic(name, type, level);
relic.setIconFilename(iconPath);
// Stats
Element statsElement = tds.get(2);
String statsStr = JerichoHtmlUtils.getTextFromTag(statsElement);
BasicStatsSet stats = parseStats(statsStr);
relic.getStats().setStats(stats);
} else if (// Retired relics
tds.size() == 4) {
// Icon
Element iconElement = tds.get(0);
String iconPath = extractIcon(iconElement);
// Name
Element nameElement = tds.get(1);
String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
if (name == null) {
name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.TD);
}
if (name.startsWith("Relic:")) {
name = name.substring(6).trim();
}
// Tier
/*
Element tierElement=tds.get(2);
String tierStr=JerichoHtmlUtils.getTextFromTag(tierElement);
Integer tier=null;
if (tierStr.length()>0)
{
tier=NumericTools.parseInteger(tierStr.trim());
}
else
{
tier=null;
}
*/
relic = new Relic(name, defaultType, level);
relic.setIconFilename(iconPath);
// Stats
Element statsElements = tds.get(3);
String statsStr = JerichoHtmlUtils.getTextFromTag(statsElements);
statsStr = statsStr.replace(", ", "\n");
BasicStatsSet stats = parseStats(statsStr);
relic.getStats().setStats(stats);
} else if (// Crafted relics
tds.size() == 5) {
// Icon
Element iconElement = tds.get(0);
String iconPath = extractIcon(iconElement);
// Name
Element nameElement = tds.get(1);
String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
// Type
RelicType type = RelicType.CRAFTED_RELIC;
// Level
Element levelElement = tds.get(2);
String levelStr = JerichoHtmlUtils.getTextFromTag(levelElement);
if (levelStr.length() > 0) {
level = NumericTools.parseInteger(levelStr.trim());
} else {
level = null;
}
relic = new Relic(name, type, level);
relic.setIconFilename(iconPath);
// Stats
Element statsElements = tds.get(3);
String statsStr = JerichoHtmlUtils.getTextFromTag(statsElements);
BasicStatsSet stats = parseStats(statsStr);
relic.getStats().setStats(stats);
}
// System.out.println(relic);
return relic;
}
Aggregations