use of delta.games.lotro.character.CharacterData in project lotro-tools by dmorcellet.
the class ItemNormalization method filterItems.
/**
* Filter items that are accessible within LotroCompanion.
* @param items List to filter.
* @return a list that contains the filtered items.
*/
private List<Item> filterItems(List<Item> items) {
ItemsManager manager = new ItemsManager(items);
Set<Integer> selectedIds = new HashSet<Integer>();
// Iterate on classes then on slots to find all reachable items
for (CharacterClass cClass : CharacterClass.ALL_CLASSES) {
CharacterData c = new CharacterData();
c.setCharacterClass(cClass);
c.setLevel(105);
for (EQUIMENT_SLOT slot : EQUIMENT_SLOT.values()) {
List<Item> selectedItems = manager.getItems(c, slot);
for (Item selectedItem : selectedItems) {
selectedIds.add(Integer.valueOf(selectedItem.getIdentifier()));
}
}
}
// Essences
List<Item> essences = manager.getEssences();
for (Item essence : essences) {
selectedIds.add(Integer.valueOf(essence.getIdentifier()));
}
// Build final list
List<Item> selectedItems = new ArrayList<Item>();
for (Item item : items) {
if (selectedIds.contains(Integer.valueOf(item.getIdentifier()))) {
selectedItems.add(item);
}
}
return selectedItems;
}
use of delta.games.lotro.character.CharacterData in project lotro-companion by dmorcellet.
the class EssencesSummaryWindowController 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 == _toon) {
_summaryController.update();
getWindow().pack();
}
}
}
use of delta.games.lotro.character.CharacterData in project lotro-companion by dmorcellet.
the class CharacterDataTableController 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();
_tableController.refresh(data);
}
if ((type == CharacterEventType.CHARACTER_DATA_ADDED) || (type == CharacterEventType.CHARACTER_DATA_REMOVED)) {
_tableController.refresh();
}
}
use of delta.games.lotro.character.CharacterData 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.CharacterData in project lotro-companion by dmorcellet.
the class CharacterFileWindowController method cloneCharacterData.
private void cloneCharacterData() {
GenericTableController<CharacterData> controller = _toonsTable.getTableController();
CharacterData data = controller.getSelectedItem();
if (data != null) {
// Build new configuration
CharacterData newInfos = new CharacterData(data);
newInfos.setDate(Long.valueOf(System.currentTimeMillis()));
// Register new configuration
CharacterInfosManager infos = _toon.getInfosManager();
boolean ok = infos.writeNewCharacterData(newInfos);
if (ok) {
CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_ADDED, _toon, newInfos);
EventsManager.invokeEvent(event);
}
}
}
Aggregations