Search in sources :

Example 11 with CharacterFile

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

the class CharacterLevelPanelController method doChooseToons.

private void doChooseToons() {
    CharactersManager manager = CharactersManager.getInstance();
    List<CharacterFile> toons = manager.getAllToons();
    List<CharacterFile> selectedToons = _stats.getToonsList();
    List<CharacterFile> enabledToons = new ArrayList<CharacterFile>();
    for (CharacterFile toon : toons) {
        // if (toon.hasLog())
        {
            enabledToons.add(toon);
        }
    }
    List<CharacterFile> newSelectedToons = CharactersSelectorWindowController.selectToons(_parentController, toons, selectedToons, enabledToons);
    if (newSelectedToons != null) {
        for (CharacterFile toon : newSelectedToons) {
            if (selectedToons.contains(toon)) {
                selectedToons.remove(toon);
            } else {
                _stats.addToon(toon);
                _toonSelectionController.addToon(toon, true);
                _toonSelectionController.setToonEnabled(toon, true);
            }
        }
        for (CharacterFile removedToon : selectedToons) {
            _stats.removeToon(removedToon);
            _toonSelectionController.removeToon(removedToon);
        }
        _toonSelectionController.refresh();
        _chartController.refresh();
    }
}
Also used : CharactersManager(delta.games.lotro.character.CharactersManager) ArrayList(java.util.ArrayList) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 12 with CharacterFile

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

the class CharacterLevelWindowController method dispose.

/**
 * Release all managed resources.
 */
@Override
public void dispose() {
    super.dispose();
    List<CharacterFile> toons = _stats.getToonsList();
    Preferences preferences = Config.getInstance().getPreferences();
    TypedProperties props = preferences.getPreferences(LEVELLING_PREFERENCES_NAME);
    List<String> toonIds = new ArrayList<String>();
    for (CharacterFile toon : toons) {
        toonIds.add(toon.getIdentifier());
    }
    props.setStringList(TOON_NAME_PREFERENCE, toonIds);
    _stats = null;
    if (_levellingPanelController != null) {
        _levellingPanelController.dispose();
        _levellingPanelController = null;
    }
}
Also used : ArrayList(java.util.ArrayList) Preferences(delta.common.utils.misc.Preferences) TypedProperties(delta.common.utils.misc.TypedProperties) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 13 with CharacterFile

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

the class ReputationSynopsisPanelController method eventOccurred.

/**
 * Handle character events.
 * @param event Source event.
 */
@Override
public void eventOccurred(CharacterEvent event) {
    CharacterEventType type = event.getType();
    if (type == CharacterEventType.CHARACTER_REPUTATION_UPDATED) {
        CharacterFile toon = event.getToonFile();
        List<CharacterFile> currentToons = _tableController.getToons();
        if (currentToons.contains(toon)) {
            _tableController.updateToon(toon);
        }
    }
}
Also used : CharacterEventType(delta.games.lotro.character.events.CharacterEventType) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 14 with CharacterFile

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

the class WarbandsWindowController method dispose.

/**
 * Release all managed resources.
 */
@Override
public void dispose() {
    saveBoundsPreferences();
    super.dispose();
    if (_warbandsStatisticsPanelController != null) {
        Preferences preferences = Config.getInstance().getPreferences();
        TypedProperties props = preferences.getPreferences(WARBANDS_PREFERENCES_NAME);
        List<String> toonIds = new ArrayList<String>();
        for (CharacterFile toon : _warbandsStatisticsPanelController.getTableController().getToons()) {
            toonIds.add(toon.getIdentifier());
        }
        props.setStringList(TOON_NAME_PREFERENCE, toonIds);
        _warbandsStatisticsPanelController.dispose();
        _warbandsStatisticsPanelController = null;
    }
}
Also used : ArrayList(java.util.ArrayList) Preferences(delta.common.utils.misc.Preferences) TypedProperties(delta.common.utils.misc.TypedProperties) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 15 with CharacterFile

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

the class NewToonDialogController method okImpl.

@Override
protected void okImpl() {
    String toonName = _toonName.getText();
    String server = _server.getSelectedItem();
    CharacterClass cClass = _class.getComboBoxController().getSelectedItem();
    Race race = _race.getSelectedItem();
    CharacterSex sex = _sex.getSelectedItem();
    CharacterData info = new CharacterData();
    info.setName(toonName);
    info.setServer(server);
    info.setCharacterClass(cClass);
    info.setCharacterSex(sex);
    info.setRace(race);
    info.setLevel(1);
    info.setDate(Long.valueOf(System.currentTimeMillis()));
    // Compute stats
    CharacterStatsComputer computer = new CharacterStatsComputer();
    info.getStats().setStats(computer.getStats(info));
    CharactersManager manager = CharactersManager.getInstance();
    CharacterFile toon = manager.addToon(info);
    if (toon == null) {
        showErrorMessage("Character creation failed!");
    }
}
Also used : CharactersManager(delta.games.lotro.character.CharactersManager) CharacterData(delta.games.lotro.character.CharacterData) CharacterStatsComputer(delta.games.lotro.character.stats.CharacterStatsComputer) Race(delta.games.lotro.common.Race) CharacterSex(delta.games.lotro.common.CharacterSex) CharacterFile(delta.games.lotro.character.CharacterFile) CharacterClass(delta.games.lotro.common.CharacterClass)

Aggregations

CharacterFile (delta.games.lotro.character.CharacterFile)42 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)13 ArrayList (java.util.ArrayList)11 CharactersManager (delta.games.lotro.character.CharactersManager)9 JPanel (javax.swing.JPanel)6 CharacterData (delta.games.lotro.character.CharacterData)5 CharacterLog (delta.games.lotro.character.log.CharacterLog)5 Preferences (delta.common.utils.misc.Preferences)4 TypedProperties (delta.common.utils.misc.TypedProperties)4 CraftingStatus (delta.games.lotro.character.crafting.CraftingStatus)3 CharacterEventType (delta.games.lotro.character.events.CharacterEventType)3 File (java.io.File)3 CellDataProvider (delta.common.ui.swing.tables.CellDataProvider)2 TableColumnController (delta.common.ui.swing.tables.TableColumnController)2 CharacterInfosManager (delta.games.lotro.character.CharacterInfosManager)2 CharacterSummary (delta.games.lotro.character.CharacterSummary)2 ProfessionStatus (delta.games.lotro.character.crafting.ProfessionStatus)2 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)2 Profession (delta.games.lotro.lore.crafting.Profession)2 GridBagConstraints (java.awt.GridBagConstraints)2