Search in sources :

Example 6 with Item

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

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

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

the class AllEssencesEditionPanelController method initEditors.

private void initEditors() {
    CharacterEquipment equipment = _toon.getEquipment();
    for (EQUIMENT_SLOT slot : EQUIMENT_SLOT.values()) {
        SingleItemEssencesEditionController controller = new SingleItemEssencesEditionController(_parent, slot);
        Item item = equipment.getItemForSlot(slot);
        controller.setItem(item);
        _editors.add(controller);
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) CharacterEquipment(delta.games.lotro.character.CharacterEquipment) EQUIMENT_SLOT(delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)

Example 9 with Item

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

the class AllEssencesEditionPanelController method essenceUpdated.

/**
 * Invoked when an essence has been updated.
 * @param source Source controller.
 */
@Override
public void essenceUpdated(SingleEssenceEditionController source) {
    for (SingleItemEssencesEditionController itemEssences : _editors) {
        List<SingleEssenceEditionController> essenceCtrls = itemEssences.getEssenceControllers();
        int index = essenceCtrls.indexOf(source);
        if (index != -1) {
            Item item = itemEssences.getItem();
            EssencesSet essences = item.getEssences();
            if (essences == null) {
                essences = new EssencesSet(essenceCtrls.size());
                item.setEssences(essences);
            }
            essences.setEssence(index, source.getEssence());
            refreshToon();
            break;
        }
    }
}
Also used : SingleEssenceEditionController(delta.games.lotro.gui.items.essences.SingleEssenceEditionController) Item(delta.games.lotro.lore.items.Item) EssencesSet(delta.games.lotro.lore.items.essences.EssencesSet)

Example 10 with Item

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

the class SingleItemEssencesEditionController method setItem.

/**
 * Set the managed item.
 * @param item Item to set.
 */
public void setItem(Item item) {
    _item = item;
    _controllers.clear();
    String label = "-";
    if (item != null) {
        // Label
        label = item.getName();
        // Essences
        EssencesSet essences = item.getEssences();
        int nbEssences = 0;
        if (essences != null) {
            nbEssences = essences.getSize();
        }
        int nbEssenceSlots = item.getEssenceSlots();
        int size = Math.max(nbEssences, nbEssenceSlots);
        for (int i = 0; i < size; i++) {
            SingleEssenceEditionController controller = new SingleEssenceEditionController(_parent, 2);
            Item essence = null;
            if (essences != null) {
                essence = essences.getEssence(i);
            }
            controller.setEssence(essence);
            _controllers.add(controller);
        }
    }
    _iconController.setItem(item);
    _icon.setIcon(_iconController.getIcon());
    _icon.setToolTipText(_iconController.getTooltip());
    _itemName.setText(label, 2);
}
Also used : SingleEssenceEditionController(delta.games.lotro.gui.items.essences.SingleEssenceEditionController) Item(delta.games.lotro.lore.items.Item) EssencesSet(delta.games.lotro.lore.items.essences.EssencesSet)

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