Search in sources :

Example 6 with CharacterEventType

use of delta.games.lotro.character.events.CharacterEventType in project lotro-companion by dmorcellet.

the class CharacterDataWindowController method eventOccurred.

/**
 * Handle character events.
 * @param event Source event.
 */
@Override
public void eventOccurred(CharacterEvent event) {
    CharacterEventType type = event.getType();
    if (type == CharacterEventType.CHARACTER_DATA_UPDATED) {
        CharacterData data = event.getToonData();
        if (data == _data) {
            // Compute new stats
            CharacterStatsComputer computer = new CharacterStatsComputer();
            BasicStatsSet stats = computer.getStats(data);
            BasicStatsSet toonStats = _data.getStats();
            toonStats.clear();
            toonStats.setStats(stats);
            // Update stats display
            _statsController.update();
            // Update buffs display
            _buffsController.update();
        }
    }
    if (type == CharacterEventType.CHARACTER_SUMMARY_UPDATED) {
        CharacterFile toonFile = event.getToonFile();
        if (toonFile == _toonFile) {
            // Update sex
            _attrsController.updateSexDisplay();
        }
    }
}
Also used : CharacterEventType(delta.games.lotro.character.events.CharacterEventType) CharacterData(delta.games.lotro.character.CharacterData) CharacterStatsComputer(delta.games.lotro.character.stats.CharacterStatsComputer) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) CharacterFile(delta.games.lotro.character.CharacterFile)

Aggregations

CharacterEventType (delta.games.lotro.character.events.CharacterEventType)6 CharacterData (delta.games.lotro.character.CharacterData)4 CharacterFile (delta.games.lotro.character.CharacterFile)3 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)1 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)1