use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class TraitPoints method save.
/**
* Save the trait points status for a character.
* @param character Targeted character.
* @param status Status to save.
* @return <code>true</code> if it succeeds, <code>false</code> otherwise.
*/
public boolean save(CharacterFile character, TraitPointsStatus status) {
File toFile = getStatusFile(character);
TraitPointsStatusXMLWriter writer = new TraitPointsStatusXMLWriter();
boolean ok = writer.write(toFile, status, EncodingNames.UTF_8);
return ok;
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class CharactersSelectorPanelController method itemStateChanged.
@Override
public void itemStateChanged(ItemEvent e) {
JCheckBox source = (JCheckBox) e.getItemSelectable();
for (Map.Entry<String, JCheckBox> entry : _checkboxes.entrySet()) {
JCheckBox cb = entry.getValue();
if (cb == source) {
String id = entry.getKey();
boolean selected = (e.getStateChange() == ItemEvent.SELECTED);
CharacterFile toon = _toonsMap.get(id);
if (selected) {
_selectedToons.add(toon);
} else {
_selectedToons.remove(toon);
}
broadcastToonSelectionChange(id, selected);
break;
}
}
}
use of delta.games.lotro.character.CharacterFile 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();
}
}
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class CharactersSelectorPanelController method refresh.
/**
* Refresh the managed panel (to synchronize with new/removed toons).
*/
public void refresh() {
if (_panel != null) {
_panel.removeAll();
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0);
int nbItems = _toons.size();
int[] size = getGridSize(nbItems);
for (CharacterFile toon : _toons) {
String toonID = toon.getIdentifier();
JCheckBox cb = _checkboxes.get(toonID);
if (cb == null) {
cb = buildToonCheckbox(toon);
}
if (cb != null) {
_panel.add(cb, c);
c.gridy++;
if (size[1] == c.gridy) {
c.gridx++;
c.gridy = 0;
}
}
}
_panel.revalidate();
_panel.repaint();
}
}
use of delta.games.lotro.character.CharacterFile in project lotro-companion by dmorcellet.
the class MainTestShowCharacterLog method main.
/**
* Basic main method for test.
* @param args Not used.
*/
public static void main(String[] args) {
LotroTestUtils utils = new LotroTestUtils();
CharacterFile toon = utils.getToonByName("Glumlug");
CharacterLog log = toon.getLastCharacterLog();
if (log != null) {
CharacterLogWindowController controller = new CharacterLogWindowController(toon);
controller.show();
}
}
Aggregations