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;
}
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);
}
}
}
}
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);
}
}
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;
}
}
}
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);
}
Aggregations