Search in sources :

Example 61 with Item

use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.

the class EquipmentPanelController method chooseItem.

private Item chooseItem(EQUIMENT_SLOT slot, List<Item> items) {
    ItemsManager itemsManager = new ItemsManager(items);
    List<Item> selectedItems = itemsManager.getItems(_toonData, slot);
    ItemFilterConfiguration cfg = new ItemFilterConfiguration();
    cfg.initFromItems(selectedItems);
    ItemFilterController filterController = new ItemFilterController(cfg);
    Filter<Item> filter = filterController.getFilter();
    String id = ItemChoiceWindowController.ITEM_CHOOSER_PROPERTIES_ID + "#" + slot.name();
    TypedProperties props = _parentWindow.getUserProperties(id);
    ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(_parentWindow, props, selectedItems, filter, filterController);
    Item ret = choiceCtrl.editModal();
    return ret;
}
Also used : JMenuItem(javax.swing.JMenuItem) Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) ItemChoiceWindowController(delta.games.lotro.gui.items.ItemChoiceWindowController) ItemFilterController(delta.games.lotro.gui.items.ItemFilterController) TypedProperties(delta.common.utils.misc.TypedProperties) ItemFilterConfiguration(delta.games.lotro.gui.items.ItemFilterConfiguration)

Example 62 with Item

use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.

the class EquipmentPanelController method handleChooseItem.

private void handleChooseItem(EQUIMENT_SLOT slot, List<Item> items) {
    Item item = chooseItem(slot, items);
    if (item != null) {
        CharacterEquipment equipment = _toonData.getEquipment();
        SlotContents contents = equipment.getSlotContents(slot, true);
        Item clonedItem = ItemFactory.clone(item);
        contents.setItem(clonedItem);
        refreshToon();
    }
}
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)

Example 63 with Item

use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.

the class EquipmentPanelController method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    String cmd = e.getActionCommand();
    if (cmd.startsWith(SLOT_SEED)) {
        cmd = cmd.substring(SLOT_SEED.length());
        // Straight click
        EQUIMENT_SLOT slot = EQUIMENT_SLOT.valueOf(cmd);
        if (slot != null) {
            Item currentItem = getItemForSlot(slot);
            if (currentItem != null) {
                handleEditItem(slot);
            } else {
                List<Item> items = ItemsManager.getInstance().getAllItems();
                handleChooseItem(slot, items);
            }
        }
    } else {
        // From contextual menu
        Component invoker = _contextMenu.getInvoker();
        EQUIMENT_SLOT slot = findSlotForButton(invoker);
        if (slot != null) {
            if (EDIT_COMMAND.equals(cmd)) {
                handleEditItem(slot);
            } else if (CHOOSE_COMMAND.equals(cmd)) {
                List<Item> items = ItemsManager.getInstance().getAllItems();
                handleChooseItem(slot, items);
            } else if (CHOOSE_FROM_STASH_COMMAND.equals(cmd)) {
                ItemsStash stash = _toon.getStash();
                List<Item> items = stash.getAll();
                handleChooseItem(slot, items);
            } else if (REMOVE_COMMAND.equals(cmd)) {
                handleRemoveItem(slot);
            } else if (COPY_TO_STASH_COMMAND.equals(cmd)) {
                handleCopyToStash(slot);
            }
        }
    }
}
Also used : JMenuItem(javax.swing.JMenuItem) Item(delta.games.lotro.lore.items.Item) ItemsStash(delta.games.lotro.character.storage.ItemsStash) EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT) List(java.util.List) Component(java.awt.Component)

Example 64 with Item

use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.

the class StashWindowController method removeItem.

private void removeItem() {
    GenericTableController<Item> controller = _itemsTable.getTableController();
    Item item = controller.getSelectedItem();
    if (item != null) {
        ItemsStash stash = _toon.getStash();
        stash.removeItem(item.getStashIdentifier());
        _toon.saveStash();
        _itemsTable.getTableController().refresh();
    }
}
Also used : ToolbarIconItem(delta.common.ui.swing.toolbar.ToolbarIconItem) Item(delta.games.lotro.lore.items.Item) ItemsStash(delta.games.lotro.character.storage.ItemsStash)

Example 65 with Item

use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.

the class StashWindowController method buildContents.

@Override
protected JComponent buildContents() {
    // Whole panel
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Build table
    JPanel tablePanel = buildTablePanel();
    // Filter
    ItemFilterController filterController = new ItemFilterController();
    Filter<Item> filter = filterController.getFilter();
    filterController.setFilterUpdateListener(this);
    JPanel filterPanel = filterController.getPanel();
    TitledBorder filterBorder = GuiFactory.buildTitledBorder("Filter");
    filterPanel.setBorder(filterBorder);
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(filterPanel, c);
    // Items table
    c.gridy = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    panel.add(tablePanel, c);
    tablePanel.setBorder(GuiFactory.buildTitledBorder("Items"));
    _itemsTable.getTableController().setFilter(filter);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ToolbarIconItem(delta.common.ui.swing.toolbar.ToolbarIconItem) Item(delta.games.lotro.lore.items.Item) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ItemFilterController(delta.games.lotro.gui.items.ItemFilterController) TitledBorder(javax.swing.border.TitledBorder)

Aggregations

Item (delta.games.lotro.lore.items.Item)105 ArrayList (java.util.ArrayList)29 HashMap (java.util.HashMap)19 File (java.io.File)17 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)16 Armour (delta.games.lotro.lore.items.Armour)15 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)12 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)11 ArmourType (delta.games.lotro.lore.items.ArmourType)8 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)8 Weapon (delta.games.lotro.lore.items.Weapon)8 JMenuItem (javax.swing.JMenuItem)8 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)7 CharacterClass (delta.games.lotro.common.CharacterClass)7 ItemsManager (delta.games.lotro.lore.items.ItemsManager)7 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)6 ItemsStash (delta.games.lotro.character.storage.ItemsStash)6 WeaponType (delta.games.lotro.lore.items.WeaponType)6 ItemQuality (delta.games.lotro.lore.items.ItemQuality)5 List (java.util.List)5