Search in sources :

Example 11 with CharacterData

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;
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) LegendaryItem(delta.games.lotro.lore.items.legendary.LegendaryItem) Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) CharacterData(delta.games.lotro.character.CharacterData) EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT) ArrayList(java.util.ArrayList) CharacterClass(delta.games.lotro.common.CharacterClass) HashSet(java.util.HashSet)

Example 12 with CharacterData

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();
        }
    }
}
Also used : CharacterEventType(delta.games.lotro.character.events.CharacterEventType) CharacterData(delta.games.lotro.character.CharacterData)

Example 13 with CharacterData

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();
    }
}
Also used : CharacterEventType(delta.games.lotro.character.events.CharacterEventType) CharacterData(delta.games.lotro.character.CharacterData)

Example 14 with CharacterData

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();
        }
    }
}
Also used : CharacterEventType(delta.games.lotro.character.events.CharacterEventType) CharacterData(delta.games.lotro.character.CharacterData) CharacterStatsComputer(delta.games.lotro.character.stats.CharacterStatsComputer) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) CharacterFile(delta.games.lotro.character.CharacterFile)

Example 15 with CharacterData

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);
        }
    }
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent) CharacterData(delta.games.lotro.character.CharacterData) CharacterInfosManager(delta.games.lotro.character.CharacterInfosManager)

Aggregations

CharacterData (delta.games.lotro.character.CharacterData)31 CharacterGenerationTools (delta.games.lotro.character.stats.CharacterGenerationTools)8 JFrame (javax.swing.JFrame)7 CharacterFile (delta.games.lotro.character.CharacterFile)6 CharacterGeneratorMeva (delta.games.lotro.character.stats.CharacterGeneratorMeva)6 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)5 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)5 CharacterInfosManager (delta.games.lotro.character.CharacterInfosManager)4 CharacterEvent (delta.games.lotro.character.events.CharacterEvent)4 CharacterEventType (delta.games.lotro.character.events.CharacterEventType)4 DefaultWindowController (delta.common.ui.swing.windows.DefaultWindowController)3 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)3 CharacterClass (delta.games.lotro.common.CharacterClass)3 File (java.io.File)3 JPanel (javax.swing.JPanel)3 WindowController (delta.common.ui.swing.windows.WindowController)2 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)2 CharactersManager (delta.games.lotro.character.CharactersManager)2 LotroTestUtils (delta.games.lotro.character.log.LotroTestUtils)2 CharacterGeneratorGiswald (delta.games.lotro.character.stats.CharacterGeneratorGiswald)2