Search in sources :

Example 1 with CharactersManager

use of delta.games.lotro.character.CharactersManager 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 2 with CharactersManager

use of delta.games.lotro.character.CharactersManager 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)

Example 3 with CharactersManager

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

the class MainTestReputationSynopsis method doIt.

private void doIt() {
    CharactersManager mgr = CharactersManager.getInstance();
    List<CharacterFile> allToons = mgr.getAllToons();
    ReputationSynopsisTableController table = new ReputationSynopsisTableController(null);
    table.setToons(allToons);
    JTable jtable = table.getTable();
    JScrollPane scroll = GuiFactory.buildScrollPane(jtable);
    DefaultWindowController w = new DefaultWindowController();
    w.getFrame().add(scroll);
    w.getFrame().pack();
    w.show();
}
Also used : CharactersManager(delta.games.lotro.character.CharactersManager) JScrollPane(javax.swing.JScrollPane) DefaultWindowController(delta.common.ui.swing.windows.DefaultWindowController) JTable(javax.swing.JTable) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 4 with CharactersManager

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

the class CraftingSynopsisPanelController method doChooseToons.

private void doChooseToons() {
    CharactersManager manager = CharactersManager.getInstance();
    List<CharacterFile> toons = manager.getAllToons();
    List<CharacterFile> selectedToons = _tableController.getToons();
    List<CharacterFile> newSelectedToons = CharactersChooserController.selectToons(_parent, toons, selectedToons);
    if (newSelectedToons != null) {
        _tableController.setToons(newSelectedToons);
    }
}
Also used : CharactersManager(delta.games.lotro.character.CharactersManager) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 5 with CharactersManager

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

the class WarbandsPanelController method doChooseToons.

private void doChooseToons() {
    CharactersManager manager = CharactersManager.getInstance();
    List<CharacterFile> toons = manager.getAllToons();
    List<CharacterFile> selectedToons = _tableController.getToons();
    List<CharacterFile> enabledToons = new ArrayList<CharacterFile>();
    for (CharacterFile toon : toons) {
        if (toon.hasLog()) {
            enabledToons.add(toon);
        }
    }
    List<CharacterFile> newSelectedToons = CharactersChooserController.selectToons(_parent, enabledToons, selectedToons);
    if (newSelectedToons != null) {
        _tableController.refresh(newSelectedToons);
    }
}
Also used : CharactersManager(delta.games.lotro.character.CharactersManager) ArrayList(java.util.ArrayList) CharacterFile(delta.games.lotro.character.CharacterFile)

Aggregations

CharacterFile (delta.games.lotro.character.CharacterFile)9 CharactersManager (delta.games.lotro.character.CharactersManager)9 CharacterData (delta.games.lotro.character.CharacterData)2 ArrayList (java.util.ArrayList)2 DefaultWindowController (delta.common.ui.swing.windows.DefaultWindowController)1 WindowController (delta.common.ui.swing.windows.WindowController)1 CharacterInfosManager (delta.games.lotro.character.CharacterInfosManager)1 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)1 CharacterXMLParser (delta.games.lotro.character.io.xml.CharacterXMLParser)1 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 CharacterSex (delta.games.lotro.common.CharacterSex)1 Race (delta.games.lotro.common.Race)1 CharacterFileWindowController (delta.games.lotro.gui.character.CharacterFileWindowController)1 FileChooserController (delta.games.lotro.utils.gui.filechooser.FileChooserController)1 Window (java.awt.Window)1 File (java.io.File)1 JScrollPane (javax.swing.JScrollPane)1 JTable (javax.swing.JTable)1