Search in sources :

Example 66 with Item

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

the class StashWindowController method cloneItem.

private void cloneItem() {
    GenericTableController<Item> controller = _itemsTable.getTableController();
    Item item = controller.getSelectedItem();
    if (item != null) {
        Item clone = ItemFactory.clone(item);
        clone.setStashIdentifier(null);
        ItemsStash stash = _toon.getStash();
        stash.addItem(clone);
        _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 67 with Item

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

the class ItemChoiceWindowController method buildFormPanel.

@Override
protected JPanel buildFormPanel() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    // Table
    _panelController = new ItemChoicePanelController(this, _tableController);
    _filterController.setFilterUpdateListener(_panelController);
    JPanel tablePanel = _panelController.getPanel();
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ok();
        }
    };
    GenericTableController<Item> controller = _tableController.getTableController();
    controller.addActionListener(al);
    // Filter
    JPanel filterPanel = _filterController.getPanel();
    TitledBorder filterBorder = GuiFactory.buildTitledBorder("Filter");
    filterPanel.setBorder(filterBorder);
    // Whole panel
    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);
    c.gridy = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    panel.add(tablePanel, c);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) Item(delta.games.lotro.lore.items.Item) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) TitledBorder(javax.swing.border.TitledBorder)

Example 68 with Item

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

the class EssenceChoice method chooseEssence.

/**
 * Choose an essence.
 * @param parent Parent controller.
 * @return An essence item or <code>null</code>.
 */
public static Item chooseEssence(WindowController parent) {
    List<Item> essences = ItemsManager.getInstance().getEssences();
    EssenceFilterController filterController = new EssenceFilterController(_filter);
    TypedProperties prefs = null;
    if (parent != null) {
        prefs = parent.getUserProperties(ItemChoiceWindowController.ESSENCE_CHOOSER_PROPERTIES_ID);
    }
    ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(parent, prefs, essences, _filter, filterController);
    Item ret = choiceCtrl.editModal();
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemChoiceWindowController(delta.games.lotro.gui.items.ItemChoiceWindowController) TypedProperties(delta.common.utils.misc.TypedProperties)

Example 69 with Item

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

the class MainTestShowCharacterStorage method getItems.

private List<Item> getItems(List<StoredItem> storedItems) {
    ItemsManager itemsMgr = ItemsManager.getInstance();
    List<Item> allItems = itemsMgr.getAllItems();
    List<Item> selection = new ArrayList<Item>();
    for (StoredItem storedItem : storedItems) {
        Item selectedItem = null;
        for (Item item : allItems) {
            Item match = match(item, storedItem);
            if (match != null) {
                selectedItem = item;
                break;
            }
        }
        if (selectedItem != null) {
            selection.add(selectedItem);
        } else {
            LOGGER.warn("Could not find item: " + storedItem.getName());
        }
    }
    return selection;
}
Also used : StoredItem(delta.games.lotro.character.storage.StoredItem) Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) ArrayList(java.util.ArrayList) StoredItem(delta.games.lotro.character.storage.StoredItem)

Example 70 with Item

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

the class MainTestItemEditionWindowController method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    ItemsManager itemsMgr = ItemsManager.getInstance();
    List<Item> items = itemsMgr.getAllItems();
    int nbWindows = 0;
    int index = 0;
    int nbItems = items.size();
    while ((index < nbItems) && (nbWindows < 1)) {
        // Item item=itemsMgr.getItem(1879313783); // Light Nadhin Hood (level 192)
        // Item item=itemsMgr.getItem(1879323547); // Bridge-warden's Shield (level 201)
        // Item item=itemsMgr.getItem(1879134849); // Javelin of Ire
        // Item item=itemsMgr.getItem(1879311750); // Reshaped Minstrel's Club of the First Age
        // Lesser Valourous Helm of Fate
        Item item = itemsMgr.getItem(1879279194);
        // Item item=items.get(index);
        // if ((item.getQuality()==ItemQuality.LEGENDARY) && (Integer.valueOf(192).equals(item.getItemLevel())))
        // if (item instanceof Armour)
        // if (item instanceof Weapon)
        {
            ItemEditionWindowController ctrl = new ItemEditionWindowController(null, item);
            ctrl.show(true);
            nbWindows++;
        }
        index++;
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager)

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