Search in sources :

Example 11 with ArmourType

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

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

the class ItemFilterConfiguration method getShieldTypes.

/**
 * Get the selected shield types.
 * @return a possibly empty but not <code>null</code> list of sorted shield types.
 */
public List<ArmourType> getShieldTypes() {
    List<ArmourType> weaponTypes = new ArrayList<ArmourType>();
    weaponTypes.addAll(_shieldTypes);
    Collections.sort(weaponTypes, new ArmourTypeComparator());
    return weaponTypes;
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) ArrayList(java.util.ArrayList) ArmourTypeComparator(delta.games.lotro.lore.items.comparators.ArmourTypeComparator)

Example 13 with ArmourType

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

the class TulkasItemsLoader1 method buildItem.

private Item buildItem(Integer id, HashMap<Object, Object> map) {
    String name = (String) map.get("Name");
    String slot = (String) map.get("Slot");
    EquipmentLocation loc = EquipmentLocation.getByName(slot);
    Item ret = null;
    @SuppressWarnings("unchecked") HashMap<Object, Object> statsMap = (HashMap<Object, Object>) map.get("Stats");
    if (TulkasConstants.isArmor(loc)) {
        Armour a = new Armour();
        Integer armourValue = (Integer) statsMap.get("Armour");
        if (armourValue != null) {
            a.setArmourValue(armourValue.intValue());
        }
        String armourTypeStr = (String) map.get("Type");
        ArmourType armourType = ArmourType.getArmourTypeByName(armourTypeStr);
        if (loc == EquipmentLocation.OFF_HAND) {
            String subSlot = (String) map.get("SubSlot");
            if ("Heavy".equals(subSlot))
                armourType = ArmourType.HEAVY_SHIELD;
            else if ("Light".equals(subSlot))
                armourType = ArmourType.SHIELD;
            else if ("Warden".equals(subSlot))
                armourType = ArmourType.WARDEN_SHIELD;
            else {
                // SubSlots:
                // Heavy, Warden, Light,
                _logger.warn("Unmanaged shield type [" + subSlot + "]");
            }
        } else if (loc == EquipmentLocation.BACK) {
            armourType = ArmourType.LIGHT;
        }
        if (armourType == null) {
            _logger.warn("Unknown armour type: [" + armourTypeStr + "] (name=" + name + ")");
        }
        a.setArmourType(armourType);
        ret = a;
    } else {
        String subSlot = (String) map.get("SubSlot");
        WeaponType weaponType = null;
        if ((subSlot != null) && (subSlot.length() > 0)) {
            weaponType = WeaponType.getWeaponTypeByName(subSlot);
        }
        if (weaponType != null) {
            Weapon w = new Weapon();
            w.setWeaponType(weaponType);
            @SuppressWarnings("unchecked") HashMap<Object, Object> damageInfo = (HashMap<Object, Object>) statsMap.get("Damage");
            if (damageInfo != null) {
                Integer minDMG = (Integer) damageInfo.get("MinDMG");
                if (minDMG != null) {
                    w.setMinDamage(minDMG.intValue());
                }
                Integer maxDMG = (Integer) damageInfo.get("MaxDMG");
                if (maxDMG != null) {
                    w.setMaxDamage(maxDMG.intValue());
                }
                Object dpsValue = damageInfo.get("DPS");
                if (dpsValue instanceof Float) {
                    w.setDPS(((Float) dpsValue).floatValue());
                } else if (dpsValue instanceof Integer) {
                    w.setDPS(((Integer) dpsValue).floatValue());
                }
                String typeStr = (String) damageInfo.get("TypeDMG");
                DamageType type = DamageType.getDamageTypeByName(typeStr);
                if (type == null) {
                    type = DamageType.COMMON;
                    _logger.warn("Unmanaged damage type [" + typeStr + "]");
                }
                w.setDamageType(type);
            }
            ret = w;
        }
        if (ret == null) {
            ret = new Item();
        }
    }
    // Name
    ret.setName(name);
    // Slot
    ret.setEquipmentLocation(loc);
    // Required level
    Integer requiredLevel = (Integer) map.get("Level");
    ret.setMinLevel(requiredLevel);
    // Item level
    Integer itemLevel = (Integer) map.get("ItemLevel");
    ret.setItemLevel(itemLevel);
    // Class
    String classStr = (String) map.get("Class");
    if ((classStr != null) && (classStr.length() > 0)) {
        CharacterClass cClass = CharacterClass.getByName(classStr);
        if (cClass != null) {
            ret.setRequiredClass(cClass);
        } else {
            _logger.error("Unknown class: " + classStr);
        }
    }
    // Quality
    String colorStr = (String) map.get("Color");
    ItemQuality quality = null;
    if (colorStr != null) {
        quality = ItemQuality.fromColor(colorStr);
    }
    ret.setQuality((quality != null) ? quality : ItemQuality.COMMON);
    // Bonus
    if (statsMap != null) {
        BasicStatsSet stats = ret.getStats();
        final HashMap<String, Object> bonuses = new HashMap<String, Object>();
        loadBonusItemsVersion1(bonuses, statsMap);
        bonuses.remove("Armour");
        for (int index = 0; index < TulkasConstants.BONUS_NAMES.length; index++) {
            String bonusName = TulkasConstants.BONUS_NAMES[index];
            Object bonusValue = bonuses.get(bonusName);
            if (bonusValue != null) {
                STAT stat = TulkasConstants.STATS[index];
                if (stat != null) {
                    if (stat == STAT.ALL_SKILL_INDUCTION) {
                        if (bonusValue instanceof Integer)
                            bonusValue = Integer.valueOf(-((Integer) bonusValue).intValue());
                        else if (bonusValue instanceof Float)
                            bonusValue = Float.valueOf(-((Float) bonusValue).floatValue());
                    }
                    FixedDecimalsInteger value = TulkasValuesUtils.fromObjectValue(bonusValue);
                    stats.setStat(stat, value);
                } else {
                // _logger.warn("No stat associated to bonus: " + bonusName);
                }
                bonuses.remove(bonusName);
            }
        }
        if (bonuses.size() > 0) {
            _logger.warn("Unmanaged bonuses: " + bonuses);
        }
    }
    return ret;
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) HashMap(java.util.HashMap) ItemQuality(delta.games.lotro.lore.items.ItemQuality) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) Weapon(delta.games.lotro.lore.items.Weapon) DamageType(delta.games.lotro.lore.items.DamageType) CharacterClass(delta.games.lotro.common.CharacterClass) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Item(delta.games.lotro.lore.items.Item) STAT(delta.games.lotro.character.stats.STAT) Armour(delta.games.lotro.lore.items.Armour) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) WeaponType(delta.games.lotro.lore.items.WeaponType)

Example 14 with ArmourType

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

the class ItemNormalization method findArmourTypeFromFormulas.

private void findArmourTypeFromFormulas(Armour armour) {
    String slices = armour.getProperty(ItemPropertyNames.FORMULAS);
    if (slices != null) {
        SlicesBasedItemStatsProvider provider = SlicesBasedItemStatsProvider.fromPersistedString(slices);
        ItemStatSliceData data = provider.getSliceForStat(STAT.ARMOUR);
        if (data != null) {
            String armourDescription = data.getAdditionalParameter();
            ArmourType sliceType = SlicesBasedItemStatsProvider.getArmorType(armourDescription);
            if (sliceType != null) {
                ArmourType itemType = armour.getArmourType();
                if (itemType != sliceType) {
                    if (itemType != null) {
                        System.out.println("Updated armour type from: " + itemType + " to " + sliceType + " for " + armour);
                    }
                    armour.setArmourType(sliceType);
                }
            }
        }
    }
}
Also used : ArmourType(delta.games.lotro.lore.items.ArmourType) SlicesBasedItemStatsProvider(delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider) ItemStatSliceData(delta.games.lotro.lore.items.stats.ItemStatSliceData)

Example 15 with ArmourType

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

the class ScalableStatChartController method main.

/**
 * Main method for this test/tool.
 * @param args Not used.
 */
public static void main(String[] args) {
    ArmourType[] types = { ArmourType.HEAVY, ArmourType.MEDIUM, ArmourType.LIGHT };
    EquipmentLocation[] locations = { EquipmentLocation.FEET, EquipmentLocation.LEGS, EquipmentLocation.CHEST, EquipmentLocation.SHOULDER, EquipmentLocation.HEAD, EquipmentLocation.HAND, EquipmentLocation.BACK };
    for (ArmourType type : types) {
        for (EquipmentLocation location : locations) {
            JPanel panel = GuiFactory.buildBackgroundPanel(new BorderLayout());
            ScalableStatChartController chartController = new ScalableStatChartController(type, location);
            JPanel chartPanel = chartController.getPanel();
            panel.add(chartPanel, BorderLayout.CENTER);
            JFrame frame = new JFrame();
            frame.setTitle(chartController.getTitle());
            frame.getContentPane().add(chartPanel);
            frame.pack();
            frame.setVisible(true);
        }
    }
}
Also used : JPanel(javax.swing.JPanel) ArmourType(delta.games.lotro.lore.items.ArmourType) BorderLayout(java.awt.BorderLayout) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) JFrame(javax.swing.JFrame)

Aggregations

ArmourType (delta.games.lotro.lore.items.ArmourType)17 WeaponType (delta.games.lotro.lore.items.WeaponType)9 Armour (delta.games.lotro.lore.items.Armour)8 Item (delta.games.lotro.lore.items.Item)8 ItemQuality (delta.games.lotro.lore.items.ItemQuality)7 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)6 Weapon (delta.games.lotro.lore.items.Weapon)6 ArrayList (java.util.ArrayList)5 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)3 STAT (delta.games.lotro.character.stats.STAT)3 CharacterClass (delta.games.lotro.common.CharacterClass)3 DamageType (delta.games.lotro.lore.items.DamageType)3 ArmourTypeComparator (delta.games.lotro.lore.items.comparators.ArmourTypeComparator)3 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)3 HashMap (java.util.HashMap)3 ItemStatSliceData (delta.games.lotro.lore.items.stats.ItemStatSliceData)2 SlicesBasedItemStatsProvider (delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider)2 JPanel (javax.swing.JPanel)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1