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();
}
}
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;
}
}
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);
}
}
}
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;
}
}
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!");
}
}
Aggregations