Search in sources :

Example 11 with WeaponType

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

the class ConsistencyChecks method consistencyChecks.

/**
 * Perform consistency checks.
 * @param items Items to use.
 */
public void consistencyChecks(List<Item> items) {
    int nbMissingArmourValues = 0;
    int nbMissingArmourTypes = 0;
    int nbMissingWeaponTypes = 0;
    int nbScalables = 0;
    int nbFormulas = 0;
    for (Item item : items) {
        checkItemStats(item);
        // Armours
        if (item instanceof Armour) {
            Armour armour = (Armour) item;
            int armourValue = armour.getArmourValue();
            if (armourValue == 0) {
                nbMissingArmourValues++;
            // System.out.println("No armour value for: " + name + " (" + id + ')');
            }
            ArmourType type = armour.getArmourType();
            if (type == null) {
                nbMissingArmourTypes++;
            // System.out.println("No armour type for: " + name + " (" + id + ')');
            }
        }
        // Weapons
        if (item instanceof Weapon) {
            Weapon weapon = (Weapon) item;
            WeaponType type = weapon.getWeaponType();
            if (type == null) {
                nbMissingWeaponTypes++;
            // System.out.println("No weapon type for: " + name + " (" + id + ')');
            }
        }
        // Scalables
        String scalingIds = item.getProperty(ItemPropertyNames.SCALING);
        String slicedStats = item.getProperty(ItemPropertyNames.FORMULAS);
        if (slicedStats != null) {
            nbFormulas++;
            if (scalingIds != null) {
                nbScalables++;
                _scalableItems.add(item);
                if (item instanceof Armour) {
                    Armour armour = (Armour) item;
                    ArmourType type = armour.getArmourType();
                    if (type == null) {
                        System.out.println("No armour type for: " + item + " with formula: " + slicedStats);
                    }
                }
            }
        }
    }
    System.out.println("Nb armours with missing armour type: " + nbMissingArmourTypes);
    System.out.println("Nb armours with missing armour value: " + nbMissingArmourValues);
    System.out.println("Nb weapons with missing type: " + nbMissingWeaponTypes);
    System.out.println("Nb legendary items: " + _nbLegendaryItems);
    System.out.println("Nb items with stats: " + _nbStats);
    System.out.println("Nb items with missing stats: " + _nbMissingStats);
    System.out.println("Nb items with formula: " + nbFormulas);
    System.out.println("Nb scalable items: " + nbScalables);
// new ItemStatistics().showStatistics(_scalableItems);
}
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 12 with WeaponType

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

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

the class ItemNormalization method normalizeMiscWeapons.

private Item normalizeMiscWeapons(Item item) {
    String category = item.getProperty(ItemPropertyNames.TULKAS_CATEGORY);
    String name = item.getName();
    if (name == null)
        return item;
    name = name.toLowerCase();
    WeaponType type = null;
    if (("1".equals(category)) || ("12".equals(category)) || ("24".equals(category)) || ("30".equals(category)) || ("40".equals(category)) || ("44".equals(category))) {
        if (item instanceof Weapon) {
            type = ((Weapon) item).getWeaponType();
        }
        if (type == null) {
            if ("12".equals(category)) {
                if (name.indexOf("great axe") != -1)
                    type = WeaponType.TWO_HANDED_AXE;
                else
                    type = WeaponType.ONE_HANDED_AXE;
            } else if ("1".equals(category)) {
                if (name.indexOf("bow") != -1)
                    type = WeaponType.BOW;
                else if (name.indexOf("javelin") != -1)
                    type = WeaponType.JAVELIN;
                else
                    type = null;
            } else if ("24".equals(category)) {
                if (name.indexOf("mallet") != -1)
                    type = WeaponType.TWO_HANDED_HAMMER;
                else
                    type = WeaponType.ONE_HANDED_HAMMER;
            } else if ("40".equals(category)) {
                type = WeaponType.ONE_HANDED_CLUB;
            } else if ("30".equals(category)) {
                if (name.indexOf("mace") != -1)
                    type = WeaponType.ONE_HANDED_MACE;
                else if (name.indexOf("hammer") != -1)
                    type = WeaponType.ONE_HANDED_HAMMER;
                else if (name.indexOf("club") != -1)
                    type = WeaponType.ONE_HANDED_CLUB;
                else if (name.indexOf("old reliable") != -1)
                    type = WeaponType.ONE_HANDED_CLUB;
            } else if ("44".equals(category)) {
                if (name.indexOf("mace") != -1)
                    type = WeaponType.ONE_HANDED_MACE;
                else if (name.indexOf("hammer") != -1)
                    type = WeaponType.ONE_HANDED_HAMMER;
                else if (name.indexOf("club") != -1)
                    type = WeaponType.ONE_HANDED_CLUB;
                else if (name.indexOf("sword") != -1)
                    type = WeaponType.ONE_HANDED_SWORD;
                else if (name.indexOf("blade") != -1)
                    type = WeaponType.ONE_HANDED_SWORD;
                else if (name.indexOf("great axe") != -1)
                    type = WeaponType.TWO_HANDED_AXE;
                else if (name.indexOf("oathbreaker's bane") != -1)
                    type = WeaponType.ONE_HANDED_SWORD;
                else if (name.indexOf("falchion") != -1)
                    type = WeaponType.ONE_HANDED_SWORD;
            }
        }
        if (type == null) {
            System.out.println("Weapon type not found: category:" + category + ", name:" + name);
            type = WeaponType.OTHER;
        }
        item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
        item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
        item = setWeaponTypeFromCategory(item, null, type);
        item.setSubCategory(null);
    }
    return item;
}
Also used : WeaponType(delta.games.lotro.lore.items.WeaponType) Weapon(delta.games.lotro.lore.items.Weapon) LegendaryWeapon(delta.games.lotro.lore.items.legendary.LegendaryWeapon)

Example 14 with WeaponType

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

the class ItemNormalization method normalizeWeapons.

private Item normalizeWeapons(Item item) {
    item = setWeaponTypeFromCategory(item, "10", WeaponType.DAGGER);
    item = setWeaponTypeFromCategory(item, "36", WeaponType.HALBERD);
    item = setWeaponTypeFromCategory(item, "110", WeaponType.JAVELIN);
    item = setWeaponTypeFromCategory(item, "29", WeaponType.CROSSBOW);
    item = setWeaponTypeFromCategory(item, "46", WeaponType.SPEAR);
    item = setWeaponTypeFromCategory(item, "34", WeaponType.STAFF);
    // item=setWeaponTypeFromCategory(item,"12",WeaponType.ONE_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "One-handed Axe", WeaponType.ONE_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "Two-handed Axe", WeaponType.TWO_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "One-handed Sword", WeaponType.ONE_HANDED_SWORD);
    item = setWeaponTypeFromCategory(item, "Two-handed Sword", WeaponType.TWO_HANDED_SWORD);
    item = setWeaponTypeFromCategory(item, "One-handed Club", WeaponType.ONE_HANDED_CLUB);
    item = setWeaponTypeFromCategory(item, "Rune-stone", WeaponType.RUNE_STONE);
    item = setWeaponTypeFromCategory(item, "Staff", WeaponType.STAFF);
    item = setWeaponTypeFromCategory(item, "Dagger", WeaponType.DAGGER);
    if (item instanceof Weapon) {
        Weapon weapon = (Weapon) item;
        WeaponType type = weapon.getWeaponType();
        if (type != null) {
            EquipmentLocation loc = type.isRanged() ? EquipmentLocation.RANGED_ITEM : EquipmentLocation.MAIN_HAND;
            weapon.setEquipmentLocation(loc);
            item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
            item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
            item.setSubCategory(null);
            // Fix problem with Captains having Crossbows
            if (type == WeaponType.CROSSBOW) {
                if (item.getRequiredClass() == CharacterClass.CAPTAIN) {
                    item.setRequiredClass(null);
                }
            }
        }
    }
    return item;
}
Also used : EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) WeaponType(delta.games.lotro.lore.items.WeaponType) Weapon(delta.games.lotro.lore.items.Weapon) LegendaryWeapon(delta.games.lotro.lore.items.legendary.LegendaryWeapon)

Example 15 with WeaponType

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

the class ScalableItemsFinder method generateItems.

private Map<String, Item> generateItems() {
    Map<String, Item> ret = new HashMap<String, Item>();
    for (int i = 0; i < PREFIXES.length; i++) {
        ItemQuality quality = PREFIX_QUALITY[i];
        String prefix = PREFIXES[i];
        for (String[] items : ITEMS) {
            for (int j = 0; j < items.length; j++) {
                String itemName = items[j];
                EquipmentLocation location = null;
                ArmourType armourType = null;
                WeaponType weaponType = null;
                if (items == JEWELS) {
                    location = JEWEL_LOCATIONS[j];
                } else if (items == ARMOURS) {
                    location = ARMOUR_LOCATIONS[j];
                    armourType = ARMOUR_TYPES[j];
                } else if (items == SHIELDS) {
                    location = EquipmentLocation.OFF_HAND;
                    armourType = SHIELD_TYPES[j];
                } else if (items == WEAPONS) {
                    weaponType = WEAPON_TYPES[j];
                    location = weaponType.isRanged() ? EquipmentLocation.RANGED_ITEM : EquipmentLocation.MAIN_HAND;
                }
                for (String adjective : ADJECTIVES) {
                    for (String suffix : SUFFIXES) {
                        String name = generateName(prefix, adjective, itemName, suffix);
                        Item item = null;
                        if (armourType != null) {
                            Armour armour = new Armour();
                            armour.setArmourType(armourType);
                            item = armour;
                        } else if (weaponType != null) {
                            Weapon weapon = new Weapon();
                            weapon.setWeaponType(weaponType);
                            item = weapon;
                        } else {
                            item = new Item();
                        }
                        item.setName(name);
                        item.setQuality(quality);
                        item.setEquipmentLocation(location);
                        ret.put(name, item);
                    }
                }
            }
        }
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) ArmourType(delta.games.lotro.lore.items.ArmourType) Armour(delta.games.lotro.lore.items.Armour) HashMap(java.util.HashMap) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) WeaponType(delta.games.lotro.lore.items.WeaponType) ItemQuality(delta.games.lotro.lore.items.ItemQuality) Weapon(delta.games.lotro.lore.items.Weapon)

Aggregations

WeaponType (delta.games.lotro.lore.items.WeaponType)15 ArmourType (delta.games.lotro.lore.items.ArmourType)9 Weapon (delta.games.lotro.lore.items.Weapon)9 ItemQuality (delta.games.lotro.lore.items.ItemQuality)7 Armour (delta.games.lotro.lore.items.Armour)6 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)6 Item (delta.games.lotro.lore.items.Item)6 CharacterClass (delta.games.lotro.common.CharacterClass)4 LegendaryWeapon (delta.games.lotro.lore.items.legendary.LegendaryWeapon)4 ArrayList (java.util.ArrayList)4 DamageType (delta.games.lotro.lore.items.DamageType)3 HashMap (java.util.HashMap)3 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)2 STAT (delta.games.lotro.character.stats.STAT)2 WeaponTypeComparator (delta.games.lotro.lore.items.comparators.WeaponTypeComparator)2 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)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