Search in sources :

Example 1 with ArmourType

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

the class ItemFilterConfiguration method getArmourTypes.

/**
 * Get the selected armour types.
 * @return a possibly empty but not <code>null</code> list of sorted armour types.
 */
public List<ArmourType> getArmourTypes() {
    List<ArmourType> armourTypes = new ArrayList<ArmourType>();
    armourTypes.addAll(_armourTypes);
    Collections.sort(armourTypes, new ArmourTypeComparator());
    return armourTypes;
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) ArrayList(java.util.ArrayList) ArmourTypeComparator(delta.games.lotro.lore.items.comparators.ArmourTypeComparator)

Example 2 with ArmourType

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

the class ItemFilterConfiguration method initFromItems.

/**
 * Init from a collection of items.
 * @param items Items to use.
 */
public void initFromItems(List<Item> items) {
    _armourTypes.clear();
    _shieldTypes.clear();
    _weaponTypes.clear();
    for (Item item : items) {
        // Armour
        if (item instanceof Armour) {
            Armour weapon = (Armour) item;
            ArmourType type = weapon.getArmourType();
            if (type != null) {
                if (type.isShield()) {
                    _shieldTypes.add(type);
                } else {
                    _armourTypes.add(type);
                }
            }
        }
        // Weapon
        if (item instanceof Weapon) {
            Weapon weapon = (Weapon) item;
            WeaponType type = weapon.getWeaponType();
            if (type != null) {
                _weaponTypes.add(type);
            }
        }
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) ArmourType(delta.games.lotro.lore.items.ArmourType) Armour(delta.games.lotro.lore.items.Armour) WeaponType(delta.games.lotro.lore.items.WeaponType) Weapon(delta.games.lotro.lore.items.Weapon)

Example 3 with ArmourType

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

the class ItemUiTools method buildArmourTypeCombo.

/**
 * Build a controller for a combo box to choose a armour type.
 * @param armourTypes Armour types to use.
 * @return A new controller.
 */
public static ComboBoxController<ArmourType> buildArmourTypeCombo(Iterable<ArmourType> armourTypes) {
    ComboBoxController<ArmourType> ctrl = new ComboBoxController<ArmourType>();
    ctrl.addEmptyItem("");
    for (ArmourType quality : armourTypes) {
        ctrl.addItem(quality, quality.getName());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController)

Example 4 with ArmourType

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

the class ItemFilterController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    JPanel line1Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
    // Quality
    {
        JPanel qualityPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
        qualityPanel.add(GuiFactory.buildLabel("Quality:"));
        _quality = ItemUiTools.buildQualityCombo();
        ItemSelectionListener<ItemQuality> qualityListener = new ItemSelectionListener<ItemQuality>() {

            @Override
            public void itemSelected(ItemQuality quality) {
                _qualityFilter.setQuality(quality);
                filterUpdated();
            }
        };
        _quality.addListener(qualityListener);
        qualityPanel.add(_quality.getComboBox());
        line1Panel.add(qualityPanel);
    }
    // Label filter
    {
        JPanel containsPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
        containsPanel.add(GuiFactory.buildLabel("Label filter:"));
        _contains = GuiFactory.buildTextField("");
        _contains.setColumns(20);
        containsPanel.add(_contains);
        TextListener listener = new TextListener() {

            @Override
            public void textChanged(String newText) {
                if (newText.length() == 0)
                    newText = null;
                _nameFilter.setPattern(newText);
                filterUpdated();
            }
        };
        _textController = new DynamicTextEditionController(_contains, listener);
        line1Panel.add(containsPanel);
    }
    // Line 2: weapon type, armour type, shield type
    JPanel line2Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
    // Weapon type
    if (_weaponType != null) {
        JPanel weaponTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
        weaponTypePanel.add(GuiFactory.buildLabel("Weapon type:"));
        ItemSelectionListener<WeaponType> weaponTypeListener = new ItemSelectionListener<WeaponType>() {

            @Override
            public void itemSelected(WeaponType type) {
                _weaponTypeFilter.setWeaponType(type);
                // If a weapon type is selected,
                if (type != null) {
                    // Reset the shield type combo
                    if (_armourType != null) {
                        _armourType.selectItem(null);
                    }
                    // Reset the shield type combo
                    if (_shieldType != null) {
                        _shieldType.selectItem(null);
                    }
                }
                filterUpdated();
            }
        };
        _weaponType.addListener(weaponTypeListener);
        weaponTypePanel.add(_weaponType.getComboBox());
        line2Panel.add(weaponTypePanel);
    }
    // Armour type
    if (_armourType != null) {
        JPanel armourTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
        armourTypePanel.add(GuiFactory.buildLabel("Armour type:"));
        ItemSelectionListener<ArmourType> armourTypeListener = new ItemSelectionListener<ArmourType>() {

            @Override
            public void itemSelected(ArmourType type) {
                _armourTypeFilter.setArmourType(type);
                // If an armour type is selected,
                if (type != null) {
                    // Reset the weapon type combo
                    if (_weaponType != null) {
                        _weaponType.selectItem(null);
                    }
                    // Reset the shield type combo
                    if (_shieldType != null) {
                        _shieldType.selectItem(null);
                    }
                }
                filterUpdated();
            }
        };
        _armourType.addListener(armourTypeListener);
        armourTypePanel.add(_armourType.getComboBox());
        line2Panel.add(armourTypePanel);
    }
    // Shield type
    if (_shieldType != null) {
        JPanel shieldTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
        shieldTypePanel.add(GuiFactory.buildLabel("Shield type:"));
        ItemSelectionListener<ArmourType> shieldTypeListener = new ItemSelectionListener<ArmourType>() {

            @Override
            public void itemSelected(ArmourType type) {
                _shieldTypeFilter.setArmourType(type);
                // If a shield type is selected,
                if (type != null) {
                    // Reset the weapon type combo
                    if (_weaponType != null) {
                        _weaponType.selectItem(null);
                    }
                    // Reset the armour type combo
                    if (_armourType != null) {
                        _armourType.selectItem(null);
                    }
                }
                filterUpdated();
            }
        };
        _shieldType.addListener(shieldTypeListener);
        shieldTypePanel.add(_shieldType.getComboBox());
        line2Panel.add(shieldTypePanel);
    }
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(line1Panel, c);
    c = new GridBagConstraints(0, 1, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(line2Panel, c);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) ArmourType(delta.games.lotro.lore.items.ArmourType) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) TextListener(delta.common.ui.swing.text.TextListener) ItemQuality(delta.games.lotro.lore.items.ItemQuality) DynamicTextEditionController(delta.common.ui.swing.text.DynamicTextEditionController) WeaponType(delta.games.lotro.lore.items.WeaponType)

Example 5 with ArmourType

use of delta.games.lotro.lore.items.ArmourType in project lotro-tools by dmorcellet.

the class LotroPlanItemsDbLoader method handleAdditionalTable.

private void handleAdditionalTable(String tableName) {
    ArmourType armourType = null;
    if ("heavy.txt".equals(tableName))
        armourType = ArmourType.HEAVY;
    else if ("medium.txt".equals(tableName))
        armourType = ArmourType.MEDIUM;
    else if ("light.txt".equals(tableName))
        armourType = ArmourType.LIGHT;
    List<Item> items = loadTable(tableName);
    for (Item item : items) {
        _merger.newItem(item, armourType);
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) ArmourType(delta.games.lotro.lore.items.ArmourType)

Aggregations

ArmourType (delta.games.lotro.lore.items.ArmourType)17 WeaponType (delta.games.lotro.lore.items.WeaponType)9 Armour (delta.games.lotro.lore.items.Armour)8 Item (delta.games.lotro.lore.items.Item)8 ItemQuality (delta.games.lotro.lore.items.ItemQuality)7 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)6 Weapon (delta.games.lotro.lore.items.Weapon)6 ArrayList (java.util.ArrayList)5 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)3 STAT (delta.games.lotro.character.stats.STAT)3 CharacterClass (delta.games.lotro.common.CharacterClass)3 DamageType (delta.games.lotro.lore.items.DamageType)3 ArmourTypeComparator (delta.games.lotro.lore.items.comparators.ArmourTypeComparator)3 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)3 HashMap (java.util.HashMap)3 ItemStatSliceData (delta.games.lotro.lore.items.stats.ItemStatSliceData)2 SlicesBasedItemStatsProvider (delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider)2 JPanel (javax.swing.JPanel)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1