use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.
the class TomesEditionPanelController method buildTomesControllers.
private void buildTomesControllers(JPanel panel) {
TomesSet tomes = _toon.getTomes();
for (STAT stat : TomesSet.AVAILABLE_TOMES) {
TomeIconController controller = buildTomeController(tomes, stat);
_tomeControllers.add(controller);
}
}
use of delta.games.lotro.character.stats.STAT in project lotro-companion by dmorcellet.
the class TomesEditionPanelController method updateTier.
private void updateTier(int index, int delta) {
TomesSet tomes = _toon.getTomes();
STAT stat = TomesSet.AVAILABLE_TOMES[index];
int currentTierIndex = tomes.getTomeRank(stat);
currentTierIndex += delta;
if (currentTierIndex > TomesSet.MAX_RANK) {
currentTierIndex = 0;
}
if (currentTierIndex < 0) {
currentTierIndex = TomesSet.MAX_RANK;
}
tomes.setTomeRank(stat, currentTierIndex);
_tomeControllers.get(index).update();
// Broadcast toon update event...
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
EventsManager.invokeEvent(event);
}
use of delta.games.lotro.character.stats.STAT in project lotro-tools by dmorcellet.
the class LotroPlanTable method loadStats.
/**
* Load stats from fields.
* @param fields Fields to read.
* @return An item stats provider or <code>null</code>.
*/
public ItemStatsProvider loadStats(String[] fields) {
SlicesBasedItemStatsProvider provider = new SlicesBasedItemStatsProvider();
int nbStats = _stats.length;
for (int index = 0; index < nbStats; index++) {
STAT stat = _stats[index];
if (stat == null)
continue;
if (index >= fields.length)
continue;
String valueStr = fields[index];
if (valueStr.contains("CALCSLICE")) {
ItemStatSliceData slice = SliceFormulaParser.parse(valueStr);
if (slice != null) {
provider.addSlice(slice);
}
} else {
FixedDecimalsInteger value = StatValueParser.parseStatValue(valueStr);
if (value != null) {
provider.setStat(stat, value);
}
}
}
return provider;
}
use of delta.games.lotro.character.stats.STAT in project lotro-tools by dmorcellet.
the class SliceFormulaParser method parse.
/**
* Parse formula.
* @param formula Formula string.
* @return Slice parameters or <code>null</code>.
*/
public static ItemStatSliceData parse(String formula) {
ItemStatSliceData ret = null;
if ((formula.startsWith(CALCSLICE_SEED)) && (formula.endsWith(CALCSLICE_END))) {
String paramsStr = formula.substring(CALCSLICE_SEED.length());
paramsStr = paramsStr.substring(0, paramsStr.length() - CALCSLICE_END.length());
String[] params = paramsStr.split(";");
if ((params.length == 2) || (params.length == 3)) {
String statName = params[0];
// String itemLevelCell=params[1];
String sliceCountStr = (params.length == 3) ? params[2] : null;
if ((statName.startsWith("\"")) && (statName.endsWith("\""))) {
statName = statName.substring(1, statName.length() - 1);
Float sliceCount = null;
if (sliceCountStr != null) {
sliceCountStr = sliceCountStr.replace(',', '.').trim();
sliceCount = NumericTools.parseFloat(sliceCountStr);
}
STAT stat = getStatFromStatName(statName);
String additionalParameter = null;
if (stat == STAT.ARMOUR) {
additionalParameter = statName;
}
if (stat != null) {
ret = new ItemStatSliceData(stat, sliceCount, additionalParameter);
}
}
}
}
return ret;
}
use of delta.games.lotro.character.stats.STAT in project lotro-tools by dmorcellet.
the class BonusConverter method parseBonus.
private void parseBonus(Bonus bonus, BasicStatsSet stats) {
BONUS_OCCURRENCE occurrence = bonus.getBonusOccurrence();
if (occurrence == BONUS_OCCURRENCE.ALWAYS) {
BonusType type = bonus.getBonusType();
if (type != BonusType.OTHER) {
STAT stat = getStatFromBonusType(type);
if (stat != null) {
Object value = bonus.getValue();
FixedDecimalsInteger statValue = TulkasValuesUtils.fromObjectValue(value);
stats.addStat(stat, statValue);
// TODO remove bonus from manager
} else {
System.out.println("Ignored: " + bonus);
}
}
} else {
// System.out.println("Ignored: "+bonus);
}
}
Aggregations