Search in sources :

Example 6 with CharacterEvent

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

the class EquipmentPanelController method handleCopyToStash.

private void handleCopyToStash(EQUIMENT_SLOT slot) {
    CharacterEquipment equipment = _toonData.getEquipment();
    SlotContents contents = equipment.getSlotContents(slot, false);
    if (contents != null) {
        Item item = contents.getItem();
        if (item != null) {
            ItemsStash stash = _toon.getStash();
            Item newItem = ItemFactory.clone(item);
            stash.addItem(newItem);
            Integer stashId = newItem.getStashIdentifier();
            item.setStashIdentifier(stashId);
            _toon.saveStash();
            // Broadcast stash update event...
            CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_STASH_UPDATED, _toon, null);
            EventsManager.invokeEvent(event);
        }
    }
}
Also used : SlotContents(delta.games.lotro.character.CharacterEquipment.SlotContents) JMenuItem(javax.swing.JMenuItem) Item(delta.games.lotro.lore.items.Item) CharacterEquipment(delta.games.lotro.character.CharacterEquipment) ItemsStash(delta.games.lotro.character.storage.ItemsStash) CharacterEvent(delta.games.lotro.character.events.CharacterEvent)

Example 7 with CharacterEvent

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

the class TomesEditionPanelController method updateTier.

private void updateTier(int index, int delta) {
    TomesSet tomes = _toon.getTomes();
    STAT stat = TomesSet.AVAILABLE_TOMES[index];
    int currentTierIndex = tomes.getTomeRank(stat);
    currentTierIndex += delta;
    if (currentTierIndex > TomesSet.MAX_RANK) {
        currentTierIndex = 0;
    }
    if (currentTierIndex < 0) {
        currentTierIndex = TomesSet.MAX_RANK;
    }
    tomes.setTomeRank(stat, currentTierIndex);
    _tomeControllers.get(index).update();
    // Broadcast toon update event...
    CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
    EventsManager.invokeEvent(event);
}
Also used : STAT(delta.games.lotro.character.stats.STAT) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) TomesSet(delta.games.lotro.character.stats.tomes.TomesSet)

Example 8 with CharacterEvent

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

the class EquipmentPanelController method refreshToon.

private void refreshToon() {
    updateIcons();
    // Broadcast equipment update event...
    CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, _toon, _toonData);
    EventsManager.invokeEvent(event);
}
Also used : CharacterEvent(delta.games.lotro.character.events.CharacterEvent)

Example 9 with CharacterEvent

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

Example 10 with CharacterEvent

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

the class CharacterMainAttrsEditionPanelController method buildPanel.

private JPanel buildPanel() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    // 1st line
    JPanel firstLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(firstLinePanel, c);
    // Class icon
    _classIcon = GuiFactory.buildIconLabel(null);
    firstLinePanel.add(_classIcon);
    // Race icon
    _raceIcon = GuiFactory.buildIconLabel(null);
    firstLinePanel.add(_raceIcon);
    // Name
    _name = GuiFactory.buildTextField("");
    _name.setFont(_name.getFont().deriveFont(16f).deriveFont(Font.BOLD));
    _name.setColumns(25);
    firstLinePanel.add(_name);
    // Level
    _level = CharacterUiUtils.buildLevelCombo();
    firstLinePanel.add(_level.getComboBox());
    ItemSelectionListener<Integer> levelListener = new ItemSelectionListener<Integer>() {

        @Override
        public void itemSelected(Integer level) {
            _toon.setLevel(level.intValue());
            // Broadcast level update event...
            CharacterEvent event = new CharacterEvent(CharacterEventType.CHARACTER_DATA_UPDATED, null, _toon);
            EventsManager.invokeEvent(event);
        }
    };
    _level.addListener(levelListener);
    // Date
    _date = new DateEditionController(DateFormat.getDateTimeCodec());
    firstLinePanel.add(_date.getTextField());
    // 2nd line
    JPanel secondLinePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
    // Short description
    secondLinePanel.add(GuiFactory.buildLabel("Description:"));
    _shortDescription = GuiFactory.buildTextField("");
    _shortDescription.setColumns(50);
    secondLinePanel.add(_shortDescription);
    c = new GridBagConstraints(0, 1, 1, 1, 0.0, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(secondLinePanel, c);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) CharacterEvent(delta.games.lotro.character.events.CharacterEvent) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) DateEditionController(delta.common.ui.swing.text.dates.DateEditionController)

Aggregations

CharacterEvent (delta.games.lotro.character.events.CharacterEvent)17 CharacterData (delta.games.lotro.character.CharacterData)4 CharacterInfosManager (delta.games.lotro.character.CharacterInfosManager)3 BuffsManager (delta.games.lotro.character.stats.buffs.BuffsManager)3 CharacterSummary (delta.games.lotro.character.CharacterSummary)2 BuffInstance (delta.games.lotro.character.stats.buffs.BuffInstance)2 FlowLayout (java.awt.FlowLayout)2 JPanel (javax.swing.JPanel)2 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 DateEditionController (delta.common.ui.swing.text.dates.DateEditionController)1 DefaultWindowController (delta.common.ui.swing.windows.DefaultWindowController)1 WindowController (delta.common.ui.swing.windows.WindowController)1 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)1 SlotContents (delta.games.lotro.character.CharacterEquipment.SlotContents)1 CharacterFile (delta.games.lotro.character.CharacterFile)1 CharactersManager (delta.games.lotro.character.CharactersManager)1 CharacterXMLParser (delta.games.lotro.character.io.xml.CharacterXMLParser)1 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)1 STAT (delta.games.lotro.character.stats.STAT)1 Buff (delta.games.lotro.character.stats.buffs.Buff)1