Search in sources :

Example 6 with ItemQuality

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

the class ScalingParametersFinder method findScalingParameters.

private void findScalingParameters(Item item) {
    BasicStatsSet stats = item.getStats();
    if (stats.getStatsCount() == 0) {
        System.err.println("Cannot manage item: " + item + ": no stats");
        return;
    }
    Integer itemLevel = item.getItemLevel();
    if (itemLevel == null) {
        System.err.println("Cannot manage item: " + item + ": no item level");
        return;
    }
    SliceCountFinder converter = _converters.get(itemLevel);
    if (converter == null) {
        converter = new SliceCountFinder(itemLevel.intValue());
        _converters.put(itemLevel, converter);
    }
    if (item instanceof Armour) {
        Armour armour = (Armour) item;
        int armourValue = armour.getArmourValue();
        stats.setStat(STAT.ARMOUR, new FixedDecimalsInteger(armourValue));
    }
    SlicesBasedItemStatsProvider provider = new SlicesBasedItemStatsProvider();
    for (STAT stat : stats.getStats()) {
        FixedDecimalsInteger value = stats.getStat(stat);
        int statValue = value.getInternalValue();
        ItemStatSliceData slice = null;
        // Specific case for armour
        if (stat == STAT.ARMOUR) {
            ArmourDescriptionFinder armourConverter = _armourConverters.get(itemLevel);
            if (armourConverter == null) {
                armourConverter = new ArmourDescriptionFinder(itemLevel.intValue(), false);
                _armourConverters.put(itemLevel, armourConverter);
            }
            ArmourType armourType = ((Armour) item).getArmourType();
            EquipmentLocation location = item.getEquipmentLocation();
            ItemQuality quality = item.getQuality();
            String label = armourConverter.getArmourDescription(statValue, armourType, location, quality);
            if (label != null) {
                slice = new ItemStatSliceData(stat, null, label);
            } else {
                System.err.println("Armour not found: " + statValue + " for item " + item + ", quality=" + item.getQuality() + ", slot=" + item.getEquipmentLocation() + ", type=" + armourType);
            }
        } else if ((stat == STAT.PARRY_PERCENTAGE) || (stat == STAT.RANGED_DEFENCE_PERCENTAGE)) {
        // Skip... will be put as raw stats
        } else // Other stats
        {
            Float sliceCount = converter.getSliceCount(stat, statValue);
            if (sliceCount != null) {
                slice = new ItemStatSliceData(stat, sliceCount, null);
            } else {
                System.err.println("Stat not found: " + stat + "=" + statValue + " for item " + item + ", quality=" + item.getQuality() + ", slot=" + item.getEquipmentLocation());
            }
        }
        if (slice != null) {
            provider.addSlice(slice);
        } else {
            provider.setStat(stat, value);
        }
    }
    stats.removeStat(STAT.ARMOUR);
    String slices = provider.toPersistableString();
    item.setProperty(ItemPropertyNames.FORMULAS, slices);
    item.setProperty(ItemPropertyNames.SCALING, _scalingId);
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) ItemQuality(delta.games.lotro.lore.items.ItemQuality) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) STAT(delta.games.lotro.character.stats.STAT) Armour(delta.games.lotro.lore.items.Armour) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) SlicesBasedItemStatsProvider(delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider) ItemStatSliceData(delta.games.lotro.lore.items.stats.ItemStatSliceData)

Example 7 with ItemQuality

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

the class TulkasItemsIndexLoader method buildItems.

/**
 * Build items from raw data items.
 * @param items Loaded data items.
 */
public void buildItems(HashMap<Integer, HashMap<Object, Object>> items) {
    List<Integer> keys = new ArrayList<Integer>(items.keySet());
    Collections.sort(keys);
    List<Item> itemsList = new ArrayList<Item>();
    int nbKeys = keys.size();
    System.out.println("Min: " + keys.get(0) + ", max: " + keys.get(nbKeys - 1));
    for (int i = 0; i < nbKeys; i++) {
        Integer id = keys.get(i);
        HashMap<Object, Object> data = items.get(id);
        String name = (String) data.get(Integer.valueOf(1));
        if ("GNDN".equals(name)) {
            continue;
        }
        String description = (String) data.get(Integer.valueOf(2));
        if (description != null) {
            if (description.indexOf("string table error") != -1) {
                description = "";
            }
        // description=description.replace("  ", " ");
        }
        Integer categoryInt = (Integer) data.get(Integer.valueOf(3));
        // 4..5: see below (quality, sturdiness)
        // 6: isMagic is always false
        Boolean isUnique = (Boolean) data.get(Integer.valueOf(7));
        Integer iconID = (Integer) data.get(Integer.valueOf(8));
        Integer backgroundIconId = (Integer) data.get(Integer.valueOf(9));
        Item item = new Item();
        item.setIdentifier(id.intValue());
        item.setName(name);
        item.setDescription(description);
        if (iconID != null) {
            item.setProperty(ItemPropertyNames.ICON_ID, iconID.toString());
        }
        if (backgroundIconId != null) {
            item.setProperty(ItemPropertyNames.BACKGROUND_ICON_ID, backgroundIconId.toString());
        }
        if (isUnique != null) {
            item.setUnique(isUnique.booleanValue());
        }
        if (categoryInt != null) {
            item.setSubCategory(String.valueOf(categoryInt));
        }
        // Quality
        {
            Integer qualityInt = (Integer) data.get(Integer.valueOf(4));
            ItemQuality quality = null;
            switch(qualityInt.intValue()) {
                // special items
                case 0:
                    quality = null;
                    break;
                case 1:
                    quality = ItemQuality.LEGENDARY;
                    break;
                case 2:
                    quality = ItemQuality.RARE;
                    break;
                case 3:
                    quality = ItemQuality.INCOMPARABLE;
                    break;
                case 4:
                    quality = ItemQuality.UNCOMMON;
                    break;
                case 5:
                    quality = ItemQuality.COMMON;
                    break;
            }
            item.setQuality(quality);
        }
        // Sturdiness
        {
            Integer durabilityInt = (Integer) data.get(Integer.valueOf(5));
            ItemSturdiness sturdiness = null;
            switch(durabilityInt.intValue()) {
                // consumables
                case 0:
                    sturdiness = null;
                    break;
                case 1:
                    sturdiness = ItemSturdiness.SUBSTANTIAL;
                    break;
                case 2:
                    sturdiness = ItemSturdiness.BRITTLE;
                    break;
                case 3:
                    sturdiness = ItemSturdiness.NORMAL;
                    break;
                case 4:
                    sturdiness = ItemSturdiness.TOUGH;
                    break;
                // cosmetics
                case 6:
                    sturdiness = null;
                    break;
                case 7:
                    sturdiness = ItemSturdiness.WEAK;
                    break;
            }
            item.setSturdiness(sturdiness);
        }
        itemsList.add(item);
    // System.out.println(i);
    // System.out.println(item.dump());
    // writeItemToDB(item);
    }
    File toFile = new File("data/items/tmp/itemsTulkasIndex.xml").getAbsoluteFile();
    ItemXMLWriter.writeItemsFile(toFile, itemsList);
}
Also used : ArrayList(java.util.ArrayList) ItemQuality(delta.games.lotro.lore.items.ItemQuality) Item(delta.games.lotro.lore.items.Item) ItemSturdiness(delta.games.lotro.lore.items.ItemSturdiness) File(java.io.File)

Example 8 with ItemQuality

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

the class ItemFilterController method setFilter.

private void setFilter() {
    // Name
    String contains = _nameFilter.getPattern();
    if (contains != null) {
        _contains.setText(contains);
    }
    // Quality
    ItemQuality quality = _qualityFilter.getQuality();
    _quality.selectItem(quality);
    // Weapon type
    if (_weaponType != null) {
        WeaponType weaponType = _weaponTypeFilter.getWeaponType();
        _weaponType.selectItem(weaponType);
    }
    // Armour type
    if (_armourType != null) {
        ArmourType armourType = _armourTypeFilter.getArmourType();
        _armourType.selectItem(armourType);
    }
    // Shield type
    if (_shieldType != null) {
        ArmourType shieldType = _shieldTypeFilter.getArmourType();
        _shieldType.selectItem(shieldType);
    }
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) WeaponType(delta.games.lotro.lore.items.WeaponType) ItemQuality(delta.games.lotro.lore.items.ItemQuality)

Example 9 with ItemQuality

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

the class ItemUiTools method buildQualityCombo.

/**
 * Build a controller for a combo box to choose an item quality.
 * @return A new controller.
 */
public static ComboBoxController<ItemQuality> buildQualityCombo() {
    ComboBoxController<ItemQuality> ctrl = new ComboBoxController<ItemQuality>();
    ctrl.addEmptyItem("");
    for (ItemQuality quality : ItemQuality.ALL) {
        ctrl.addItem(quality, quality.getMeaning());
    }
    ctrl.selectItem(null);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) ItemQuality(delta.games.lotro.lore.items.ItemQuality)

Example 10 with ItemQuality

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

the class EssenceFilterController method setFilter.

private void setFilter() {
    // Name
    String contains = _filter.getNameFilter().getPattern();
    if (contains != null) {
        _contains.setText(contains);
    }
    // Quality
    ItemQuality quality = _filter.getQualityFilter().getQuality();
    _quality.selectItem(quality);
    // Tier
    Integer tier = _filter.getEssenceTierFilter().getTier();
    _tier.selectItem(tier);
}
Also used : ItemQuality(delta.games.lotro.lore.items.ItemQuality)

Aggregations

ItemQuality (delta.games.lotro.lore.items.ItemQuality)13 ArmourType (delta.games.lotro.lore.items.ArmourType)7 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)7 WeaponType (delta.games.lotro.lore.items.WeaponType)7 Armour (delta.games.lotro.lore.items.Armour)5 Item (delta.games.lotro.lore.items.Item)5 CharacterClass (delta.games.lotro.common.CharacterClass)4 Weapon (delta.games.lotro.lore.items.Weapon)4 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)3 STAT (delta.games.lotro.character.stats.STAT)3 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 DamageType (delta.games.lotro.lore.items.DamageType)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 DynamicTextEditionController (delta.common.ui.swing.text.DynamicTextEditionController)1 TextListener (delta.common.ui.swing.text.TextListener)1 IntegerHolder (delta.common.utils.misc.IntegerHolder)1 ItemSturdiness (delta.games.lotro.lore.items.ItemSturdiness)1