Search in sources :

Example 11 with STAT

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);
    }
}
Also used : STAT(delta.games.lotro.character.stats.STAT) TomesSet(delta.games.lotro.character.stats.tomes.TomesSet)

Example 12 with STAT

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);
}
Also used : STAT(delta.games.lotro.character.stats.STAT) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) TomesSet(delta.games.lotro.character.stats.tomes.TomesSet)

Example 13 with STAT

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;
}
Also used : STAT(delta.games.lotro.character.stats.STAT) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) SlicesBasedItemStatsProvider(delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider) ItemStatSliceData(delta.games.lotro.lore.items.stats.ItemStatSliceData)

Example 14 with STAT

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;
}
Also used : STAT(delta.games.lotro.character.stats.STAT) ItemStatSliceData(delta.games.lotro.lore.items.stats.ItemStatSliceData)

Example 15 with STAT

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);
    }
}
Also used : BONUS_OCCURRENCE(delta.games.lotro.tools.lore.items.lorebook.bonus.Bonus.BONUS_OCCURRENCE) BonusType(delta.games.lotro.tools.lore.items.lorebook.bonus.BonusType) STAT(delta.games.lotro.character.stats.STAT) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger)

Aggregations

STAT (delta.games.lotro.character.stats.STAT)30 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)12 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)11 JPanel (javax.swing.JPanel)7 GridBagLayout (java.awt.GridBagLayout)6 TitledBorder (javax.swing.border.TitledBorder)5 GridBagConstraints (java.awt.GridBagConstraints)4 Insets (java.awt.Insets)4 CharacterClass (delta.games.lotro.common.CharacterClass)3 Armour (delta.games.lotro.lore.items.Armour)3 ArmourType (delta.games.lotro.lore.items.ArmourType)3 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)3 ItemQuality (delta.games.lotro.lore.items.ItemQuality)3 ItemStatSliceData (delta.games.lotro.lore.items.stats.ItemStatSliceData)3 JLabel (javax.swing.JLabel)3 ContribsByStat (delta.games.lotro.character.stats.contribs.ContribsByStat)2 TomesSet (delta.games.lotro.character.stats.tomes.TomesSet)2 DamageType (delta.games.lotro.lore.items.DamageType)2 Item (delta.games.lotro.lore.items.Item)2 Weapon (delta.games.lotro.lore.items.Weapon)2