Search in sources :

Example 1 with Legendary

use of delta.games.lotro.lore.items.legendary.Legendary 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 Legendary

use of delta.games.lotro.lore.items.legendary.Legendary 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 Legendary

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

the class ConsistencyChecks method checkItemStats.

private void checkItemStats(Item item) {
    EquipmentLocation location = item.getEquipmentLocation();
    if (location != null) {
        boolean isLegendary = ((item instanceof Legendary) || (location == EquipmentLocation.BRIDLE));
        if (isLegendary) {
            _nbLegendaryItems++;
        } else {
            boolean ok = true;
            BasicStatsSet stats = item.getStats();
            if (stats.getStatsCount() == 0) {
                ok = false;
                if (item instanceof Armour) {
                    Armour armour = (Armour) item;
                    if (armour.getArmourValue() != 0) {
                        ok = true;
                    }
                }
            }
            if (!ok) {
                _missingStats.add(item);
                _nbMissingStats++;
                // if ((location==EquipmentLocation.BACK) || (location==EquipmentLocation.LEGS))
                {
                // System.out.println("No stat for item: " + item + " at " + location);
                }
            } else {
                _nbStats++;
            }
        }
    }
}
Also used : Legendary(delta.games.lotro.lore.items.legendary.Legendary) Armour(delta.games.lotro.lore.items.Armour) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Aggregations

Armour (delta.games.lotro.lore.items.Armour)3 Legendary (delta.games.lotro.lore.items.legendary.Legendary)3 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)2 Weapon (delta.games.lotro.lore.items.Weapon)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 StatsEditionPanelController (delta.games.lotro.gui.character.stats.StatsEditionPanelController)1 EssencesEditionPanelController (delta.games.lotro.gui.items.essences.EssencesEditionPanelController)1 RelicsEditionPanelController (delta.games.lotro.gui.items.relics.RelicsEditionPanelController)1 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)1 Item (delta.games.lotro.lore.items.Item)1 EssencesSet (delta.games.lotro.lore.items.essences.EssencesSet)1 LegendaryAttrs (delta.games.lotro.lore.items.legendary.LegendaryAttrs)1 BorderLayout (java.awt.BorderLayout)1 FlowLayout (java.awt.FlowLayout)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 JPanel (javax.swing.JPanel)1