Search in sources :

Example 1 with Weapon

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

the class ItemEditionPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    // Main data line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Icon
        _icon = GuiFactory.buildIconLabel(null);
        panelLine.add(_icon);
        // Name
        _name = GuiFactory.buildTextField("");
        _name.setFont(_name.getFont().deriveFont(16f).deriveFont(Font.BOLD));
        _name.setColumns(25);
        panelLine.add(_name);
        // Slot
        _slot = buildSlotCombo();
        panelLine.add(_slot.getComboBox());
        // Unicity
        _unique = GuiFactory.buildCheckbox("Unique");
        panelLine.add(_unique);
    }
    // Armour specifics line
    if (_item instanceof Armour) {
        _armourPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(_armourPanel, c);
        c.gridy++;
        _armourPanel.setVisible(true);
        // Armour
        JTextField armourValue = GuiFactory.buildTextField("");
        _armourValue = new IntegerEditionController(armourValue);
        _armourValue.setValueRange(Integer.valueOf(0), Integer.valueOf(50000));
        _armourPanel.add(GuiFactory.buildLabel("Armour:"));
        _armourPanel.add(_armourValue.getTextField());
        // Armour Type
        _armourType = ItemUiTools.buildArmourTypeCombo();
        _armourPanel.add(GuiFactory.buildLabel("Armour Type:"));
        _armourPanel.add(_armourType.getComboBox());
    }
    // Weapon specifics line
    if (_item instanceof Weapon) {
        _weaponPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(_weaponPanel, c);
        c.gridy++;
        _weaponPanel.setVisible(false);
        // Weapon type
        _weaponType = ItemUiTools.buildWeaponTypeCombo();
        _weaponPanel.add(GuiFactory.buildLabel("Type:"));
        _weaponPanel.add(_weaponType.getComboBox());
        // Damage
        JTextField minDamage = GuiFactory.buildTextField("");
        _minDamage = new IntegerEditionController(minDamage, 3);
        _minDamage.setValueRange(Integer.valueOf(0), Integer.valueOf(10000));
        _weaponPanel.add(GuiFactory.buildLabel("Damage:"));
        _weaponPanel.add(_minDamage.getTextField());
        _weaponPanel.add(GuiFactory.buildLabel("-"));
        JTextField maxDamage = GuiFactory.buildTextField("");
        _maxDamage = new IntegerEditionController(maxDamage, 3);
        _maxDamage.setValueRange(Integer.valueOf(0), Integer.valueOf(10000));
        _weaponPanel.add(_maxDamage.getTextField());
        // Damage type
        _damageType = buildDamageTypeCombo();
        _weaponPanel.add(_damageType.getComboBox());
        // DPS
        JTextField dps = GuiFactory.buildTextField("");
        _dps = new FloatEditionController(dps);
        _dps.setValueRange(Float.valueOf(0), Float.valueOf(1000));
        _weaponPanel.add(GuiFactory.buildLabel("DPS:"));
        _weaponPanel.add(_dps.getTextField());
    }
    // Level and binding line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Item level
        _itemLevel = new ComboBoxController<Integer>(true, Integer.class);
        panelLine.add(GuiFactory.buildLabel("Item level:"));
        panelLine.add(_itemLevel.getComboBox());
        // Minimum level
        _minLevel = new ComboBoxController<Integer>(true, Integer.class);
        panelLine.add(GuiFactory.buildLabel("Required level:"));
        panelLine.add(_minLevel.getComboBox());
        // Binding
        _binding = buildBindingCombo();
        panelLine.add(GuiFactory.buildLabel("Binding:"));
        panelLine.add(_binding.getComboBox());
    }
    // Durability/sturdiness/quality line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Durability
        JTextField durability = GuiFactory.buildTextField("");
        _durability = new IntegerEditionController(durability, 3);
        _durability.setValueRange(Integer.valueOf(1), Integer.valueOf(150));
        panelLine.add(GuiFactory.buildLabel("Durability:"));
        panelLine.add(_durability.getTextField());
        // Sturdiness
        _sturdiness = buildSturdinessCombo();
        panelLine.add(GuiFactory.buildLabel("Sturdiness:"));
        panelLine.add(_sturdiness.getComboBox());
        // Quality
        _quality = ItemUiTools.buildQualityCombo();
        panelLine.add(GuiFactory.buildLabel("Quality:"));
        panelLine.add(_quality.getComboBox());
        // Stack max
        JTextField stackMax = GuiFactory.buildTextField("");
        _stackMax = new IntegerEditionController(stackMax);
        _stackMax.setValueRange(Integer.valueOf(1), Integer.valueOf(1000));
        panelLine.add(GuiFactory.buildLabel("Stack:"));
        panelLine.add(_stackMax.getTextField());
    }
    // Contextual data line
    {
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        // Birth name
        _birthName = GuiFactory.buildTextField("");
        _birthName.setColumns(20);
        panelLine.add(GuiFactory.buildLabel("Name:"));
        panelLine.add(_birthName);
        // Crafter name
        _crafterName = GuiFactory.buildTextField("");
        _crafterName.setColumns(20);
        panelLine.add(GuiFactory.buildLabel("Crafter:"));
        panelLine.add(_crafterName);
    }
    // User comments
    {
        _userComments = GuiFactory.buildTextField("");
        _userComments.setColumns(40);
        JPanel panelLine = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEFT));
        panel.add(panelLine, c);
        c.gridy++;
        panelLine.add(GuiFactory.buildLabel("Comments:"));
        panelLine.add(_userComments);
    }
    // Tabbed pane at the bottom
    // Description
    JPanel descriptionPanel = GuiFactory.buildBackgroundPanel(new BorderLayout());
    _description = GuiFactory.buildTextArea("", false);
    _description.setColumns(40);
    _description.setLineWrap(true);
    descriptionPanel.add(_description, BorderLayout.CENTER);
    // Stats
    _stats = new StatsEditionPanelController();
    // Essences
    _essencesEditor = new EssencesEditionPanelController(_parent);
    // Tabbed pane assembly
    JTabbedPane tabbedPane = GuiFactory.buildTabbedPane();
    tabbedPane.add("Stats", _stats.getPanel());
    tabbedPane.add("Description", descriptionPanel);
    tabbedPane.add("Essences", _essencesEditor.getPanel());
    // Legendary specifics
    // - relics
    JPanel relicsPanel = null;
    if (_item instanceof Legendary) {
        Legendary legItem = (Legendary) _item;
        LegendaryAttrs attrs = new LegendaryAttrs(legItem.getLegendaryAttrs());
        _relicsEditor = new RelicsEditionPanelController(_parent, attrs);
        relicsPanel = _relicsEditor.getPanel();
        tabbedPane.add("Relics", relicsPanel);
    }
    JPanel ret = GuiFactory.buildBackgroundPanel(new BorderLayout());
    ret.add(panel, BorderLayout.NORTH);
    ret.add(tabbedPane, BorderLayout.CENTER);
    _panel = ret;
    setItem();
    return ret;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) LegendaryAttrs(delta.games.lotro.lore.items.legendary.LegendaryAttrs) GridBagLayout(java.awt.GridBagLayout) Legendary(delta.games.lotro.lore.items.legendary.Legendary) IntegerEditionController(delta.common.ui.swing.text.IntegerEditionController) RelicsEditionPanelController(delta.games.lotro.gui.items.relics.RelicsEditionPanelController) JTabbedPane(javax.swing.JTabbedPane) JTextField(javax.swing.JTextField) Weapon(delta.games.lotro.lore.items.Weapon) Armour(delta.games.lotro.lore.items.Armour) BorderLayout(java.awt.BorderLayout) ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) FloatEditionController(delta.common.ui.swing.text.FloatEditionController) EssencesEditionPanelController(delta.games.lotro.gui.items.essences.EssencesEditionPanelController) StatsEditionPanelController(delta.games.lotro.gui.character.stats.StatsEditionPanelController)

Example 2 with Weapon

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

the class ItemEditionPanelController method getItem.

/**
 * Get the current value of the edited item.
 * @return An item.
 */
public Item getItem() {
    // Name
    _item.setName(_name.getText());
    // Slot
    _item.setEquipmentLocation(_slot.getSelectedItem());
    // Stats
    BasicStatsSet stats = _item.getStats();
    stats.clear();
    stats.setStats(_stats.getStats());
    // Item level
    _item.setItemLevel(_itemLevel.getSelectedItem());
    // Minimum level
    _item.setMinLevel(_minLevel.getSelectedItem());
    // Description
    _item.setDescription(_description.getText());
    // Birth name
    _item.setBirthName(_birthName.getText());
    // Crafter name
    _item.setCrafterName(_crafterName.getText());
    // User comments
    String userComments = _userComments.getText();
    if (userComments.length() > 0) {
        _item.setProperty(ItemConstants.USER_COMMENT, userComments);
    } else {
        _item.removeProperty(ItemConstants.USER_COMMENT);
    }
    // Binding
    _item.setBinding(_binding.getSelectedItem());
    // Unicity
    _item.setUnique(_unique.isSelected());
    // Durability
    _item.setDurability(_durability.getValue());
    // Sturdiness
    _item.setSturdiness(_sturdiness.getSelectedItem());
    // Stack max
    _item.setStackMax(_stackMax.getValue());
    // Quality
    _item.setQuality(_quality.getSelectedItem());
    // Essences
    List<Item> selectedEssences = _essencesEditor.getEssences();
    EssencesSet essences = null;
    if (selectedEssences.size() > 0) {
        essences = new EssencesSet(selectedEssences.size());
        for (int i = 0; i < selectedEssences.size(); i++) {
            essences.setEssence(i, selectedEssences.get(i));
        }
    }
    _item.setEssences(essences);
    // Armour specifics
    if (_item instanceof Armour) {
        Armour armour = (Armour) _item;
        Integer armourValue = _armourValue.getValue();
        if (armourValue != null) {
            armour.setArmourValue(armourValue.intValue());
        }
        armour.setArmourType(_armourType.getSelectedItem());
    }
    // Weapon specifics
    if (_item instanceof Weapon) {
        Weapon weapon = (Weapon) _item;
        Integer minDamage = _minDamage.getValue();
        if (minDamage != null) {
            weapon.setMinDamage(minDamage.intValue());
        }
        Integer maxDamage = _maxDamage.getValue();
        if (maxDamage != null) {
            weapon.setMaxDamage(maxDamage.intValue());
        }
        Float dps = _dps.getValue();
        if (dps != null) {
            weapon.setDPS(dps.floatValue());
        }
        weapon.setDamageType(_damageType.getSelectedItem());
        weapon.setWeaponType(_weaponType.getSelectedItem());
    }
    // Legendary specifics
    if (_item instanceof Legendary) {
        Legendary legendary = (Legendary) _item;
        _relicsEditor.getData(legendary.getLegendaryAttrs());
    }
    return _item;
}
Also used : Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) Legendary(delta.games.lotro.lore.items.legendary.Legendary) EssencesSet(delta.games.lotro.lore.items.essences.EssencesSet) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) Weapon(delta.games.lotro.lore.items.Weapon)

Example 3 with Weapon

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

the class ItemEditionPanelController method setItem.

/**
 * Set the item to display.
 */
private void setItem() {
    String name = _item.getName();
    _parent.setTitle(name);
    // Icon
    String iconId = _item.getProperty(ItemPropertyNames.ICON_ID);
    String backgroundIconId = _item.getProperty(ItemPropertyNames.BACKGROUND_ICON_ID);
    ImageIcon icon = LotroIconsManager.getItemIcon(iconId, backgroundIconId);
    _icon.setIcon(icon);
    // Name
    _name.setText(name);
    // Slot
    _slot.selectItem(_item.getEquipmentLocation());
    // Stats
    _stats.initFromStats(_item.getStats());
    // Configure scaling
    configureScaling(_item);
    // Item level
    Integer itemLevel = _item.getItemLevel();
    _itemLevel.selectItem(itemLevel);
    // Minimum level
    Integer minLevel = _item.getMinLevel();
    _minLevel.selectItem(minLevel);
    // Description
    _description.setText(_item.getDescription());
    // Birth name
    _birthName.setText(_item.getBirthName());
    // Crafter name
    _crafterName.setText(_item.getCrafterName());
    // User comments
    String userComments = _item.getProperty(ItemConstants.USER_COMMENT);
    if (userComments == null)
        userComments = "";
    _userComments.setText(userComments);
    // Binding
    _binding.selectItem(_item.getBinding());
    // Unicity
    _unique.setSelected(_item.isUnique());
    // Durability
    _durability.setValue(_item.getDurability());
    // Sturdiness
    _sturdiness.selectItem(_item.getSturdiness());
    // Stack max
    _stackMax.setValue(_item.getStackMax());
    // Quality
    _quality.selectItem(_item.getQuality());
    // Armour specifics
    if (_item instanceof Armour) {
        Armour armour = (Armour) _item;
        _armourValue.setValue(Integer.valueOf(armour.getArmourValue()));
        _armourType.selectItem(armour.getArmourType());
    }
    // Weapon specifics
    if (_item instanceof Weapon) {
        Weapon weapon = (Weapon) _item;
        _minDamage.setValue(Integer.valueOf(weapon.getMinDamage()));
        _maxDamage.setValue(Integer.valueOf(weapon.getMaxDamage()));
        _dps.setValue(Float.valueOf(weapon.getDPS()));
        _weaponType.selectItem(weapon.getWeaponType());
        _damageType.selectItem(weapon.getDamageType());
    }
    // Essences
    _essencesEditor.initFromItem(_item);
}
Also used : ImageIcon(javax.swing.ImageIcon) Armour(delta.games.lotro.lore.items.Armour) Weapon(delta.games.lotro.lore.items.Weapon)

Example 4 with Weapon

use of delta.games.lotro.lore.items.Weapon 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 5 with Weapon

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

the class ItemNormalization method setWeaponTypeFromCategory.

private Item setWeaponTypeFromCategory(Item item, String category, WeaponType type) {
    Weapon ret = null;
    if ((category == null) || (category.equals(item.getSubCategory()))) {
        if (item.getClass() == Item.class) {
            ret = new Weapon();
            ret.copyFrom(item);
        } else {
            ret = (Weapon) item;
        }
        WeaponType oldType = ret.getWeaponType();
        if (oldType == null) {
            ret.setWeaponType(type);
        } else {
            if (type != oldType) {
                System.out.println("Conflict weapon type for ID:" + item.getIdentifier() + ", name:" + item.getName() + ": from:" + oldType + " to:" + type);
            }
        }
    }
    if (ret != null) {
        if (type.isRanged()) {
            ret.setEquipmentLocation(EquipmentLocation.RANGED_ITEM);
        } else {
            ret.setEquipmentLocation(EquipmentLocation.MAIN_HAND);
        }
    }
    return (ret != null) ? ret : item;
}
Also used : WeaponType(delta.games.lotro.lore.items.WeaponType) Weapon(delta.games.lotro.lore.items.Weapon) LegendaryWeapon(delta.games.lotro.lore.items.legendary.LegendaryWeapon)

Aggregations

Weapon (delta.games.lotro.lore.items.Weapon)13 Armour (delta.games.lotro.lore.items.Armour)10 WeaponType (delta.games.lotro.lore.items.WeaponType)9 Item (delta.games.lotro.lore.items.Item)8 ArmourType (delta.games.lotro.lore.items.ArmourType)6 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)5 CharacterClass (delta.games.lotro.common.CharacterClass)4 ItemQuality (delta.games.lotro.lore.items.ItemQuality)4 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)3 DamageType (delta.games.lotro.lore.items.DamageType)3 LegendaryWeapon (delta.games.lotro.lore.items.legendary.LegendaryWeapon)3 HashMap (java.util.HashMap)3 STAT (delta.games.lotro.character.stats.STAT)2 Legendary (delta.games.lotro.lore.items.legendary.Legendary)2 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)2 ArrayList (java.util.ArrayList)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 FloatEditionController (delta.common.ui.swing.text.FloatEditionController)1 IntegerEditionController (delta.common.ui.swing.text.IntegerEditionController)1 Money (delta.games.lotro.common.Money)1