Search in sources :

Example 16 with Armour

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

the class MergeWithLotroPlanDb method mergeItems.

private Item mergeItems(Item source, Item lotroplan) {
    int id = source.getIdentifier();
    Item result = source;
    // Check types
    if (source.getClass() != lotroplan.getClass()) {
        // System.out.println("ID: " + id+": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
        if (source.getClass() == Item.class) {
            if (lotroplan instanceof Armour) {
                Armour armour = new Armour();
                Armour lotroplanArmour = (Armour) lotroplan;
                result = armour;
                armour.copyFrom(source);
                armour.setArmourValue(lotroplanArmour.getArmourValue());
                armour.setArmourType(lotroplanArmour.getArmourType());
            } else {
                System.out.println("ID: " + id + ": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
            }
        }
        if (source.getClass() == Weapon.class) {
            if (lotroplan.getClass() == Item.class) {
                result = source;
            } else {
                System.out.println("ID: " + id + ": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
            }
        }
    } else {
        result = source;
    }
    // Name
    {
        String sourceName = source.getName();
        /*
      String lotroplanName=lotroplan.getName();
      if (!lotroplanName.equals(sourceName))
      {
        System.out.println("ID: " + id+": name conflict: lotroplan=" + lotroplanName + ", source=" + sourceName);
        if (lotroplanName!=null)
        {
          result.setProperty(ItemPropertyNames.LOTRO_PLAN_NAME, lotroplanName);
        }
      }
      */
        result.setName(sourceName);
    }
    // Armour
    {
        if (lotroplan instanceof Armour) {
            Armour lotroplanArmour = (Armour) lotroplan;
            Armour resultArmour = (Armour) result;
            // Check values
            {
                int lotroplanArmourValue = lotroplanArmour.getArmourValue();
                /*
          int resultArmourValue=resultArmour.getArmourValue();
          if (lotroplanArmourValue!=resultArmourValue)
          {
            System.out.println("ID: " + id+": armour value conflict: lotroplan=" + lotroplanArmourValue + ", source=" + resultArmourValue);
          }
          */
                resultArmour.setArmourValue(lotroplanArmourValue);
            }
        }
    }
    // Item level
    {
        Integer sourceItemLevel = source.getItemLevel();
        Integer lotroPlanItemLevel = lotroplan.getItemLevel();
        boolean conflict = false;
        if (lotroPlanItemLevel != null) {
            if (sourceItemLevel == null) {
                conflict = true;
            // result.setMinLevel(tulkasMinLevel);
            } else {
                if (lotroPlanItemLevel.intValue() != sourceItemLevel.intValue()) {
                    conflict = true;
                // result.setMinLevel(tulkasMinLevel);
                }
            }
        } else {
            if (sourceItemLevel != null) {
                conflict = true;
            // result.setMinLevel(sourceMinLevel);
            }
        }
        if (conflict) {
        // System.out.println("ID: " + id+": item level conflict: lotroplan=" + lotroPlanItemLevel + ", source=" + sourceItemLevel);
        }
        result.setItemLevel(lotroplan.getItemLevel());
    }
    // Stats
    {
        BasicStatsSet resultStats = result.getStats();
        FixedDecimalsInteger stealth = resultStats.getStat(STAT.STEALTH_LEVEL);
        FixedDecimalsInteger tacticalCritMultiplier = resultStats.getStat(STAT.TACTICAL_CRITICAL_MULTIPLIER);
        resultStats.clear();
        resultStats.setStats(lotroplan.getStats());
        if (stealth != null) {
            resultStats.setStat(STAT.STEALTH_LEVEL, stealth);
        }
        if (tacticalCritMultiplier != null) {
            resultStats.setStat(STAT.TACTICAL_CRITICAL_MULTIPLIER, tacticalCritMultiplier);
        }
    }
    // Essence slots
    result.setEssenceSlots(lotroplan.getEssenceSlots());
    // Slot
    EquipmentLocation lpLocation = lotroplan.getEquipmentLocation();
    if (lpLocation != null) {
        EquipmentLocation location = result.getEquipmentLocation();
        boolean conflict = false;
        if ((location != null) && (location != lpLocation)) {
            conflict = true;
        }
        if (conflict) {
            System.out.println("ID: " + id + ": slot conflict: lotroplan=" + lpLocation + ", source=" + location);
        }
        result.setEquipmentLocation(lpLocation);
    }
    // Sub-category
    String lpSubCategory = lotroplan.getSubCategory();
    if ((lpSubCategory != null) && (lpSubCategory.length() > 0)) {
        /*
      String subCategory=result.getSubCategory();
      boolean conflict=false;
      if ((subCategory!=null) && (!subCategory.equals(lpSubCategory)))
      {
        conflict=true;
      }
      if (conflict)
      {
        System.out.println("ID: " + id+": category conflict: lotroplan=" + lpSubCategory + ", source=" + subCategory);
      }
      */
        result.setSubCategory("LP:" + lpSubCategory);
    }
    // Class requirement
    CharacterClass lpClass = lotroplan.getRequiredClass();
    if (lpClass != null) {
        CharacterClass cClass = result.getRequiredClass();
        boolean conflict = false;
        if ((cClass != null) && (cClass != lpClass)) {
            conflict = true;
        }
        if (conflict) {
            System.out.println("ID: " + id + ": class conflict: lotroplan=" + lpClass + ", source=" + cClass);
        }
        result.setRequiredClass(lpClass);
    }
    // Properties
    result.getProperties().putAll(lotroplan.getProperties());
    return result;
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 17 with Armour

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

the class ScalableItemsSamplesLoader method buildItemFromLine.

private Item buildItemFromLine(String line) {
    String[] fields = StringSplitter.split(line, '\t');
    // Stats
    BasicStatsSet stats = new BasicStatsSet();
    int nbStats = STATS.length;
    for (int i = 0; i < nbStats; i++) {
        if ((STATS[i] != null) && (fields.length > i)) {
            String valueStr = fields[i];
            FixedDecimalsInteger value = StatValueParser.parseStatValue(valueStr);
            if (value != null) {
                stats.addStat(STATS[i], value);
            }
        }
    }
    // Item level
    Integer itemLevel = NumericTools.parseInteger(fields[ITEM_LEVEL_INDEX]);
    // Build item
    FixedDecimalsInteger armorStat = stats.getStat(STAT.ARMOUR);
    Item item = null;
    Armour armour = null;
    if (armorStat != null) {
        armour = new Armour();
        item = armour;
        armour.setArmourValue(armorStat.intValue());
        stats.removeStat(STAT.ARMOUR);
    } else {
        item = new Item();
    }
    // Item level
    item.setItemLevel(itemLevel);
    // Name
    String name = fields[NAME_INDEX];
    name = name.trim();
    item.setName(name);
    // Slots
    String slotStr = fields[SLOTS_INDEX];
    int nbSlots = NumericTools.parseInt(slotStr, 0);
    item.setEssenceSlots(nbSlots);
    // Min level
    String requiredLevelStr = fields[REQUIRED_LEVEL_INDEX];
    Integer requiredLevel = NumericTools.parseInteger(requiredLevelStr);
    if (requiredLevelStr != null) {
        item.setMinLevel(requiredLevel);
    }
    // Stats
    item.getStats().setStats(stats);
    return item;
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 18 with Armour

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

Example 19 with Armour

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

the class ConsistencyChecks method checkItemStats.

private void checkItemStats(Item item) {
    EquipmentLocation location = item.getEquipmentLocation();
    if (location != null) {
        boolean isLegendary = ((item instanceof Legendary) || (location == EquipmentLocation.BRIDLE));
        if (isLegendary) {
            _nbLegendaryItems++;
        } else {
            boolean ok = true;
            BasicStatsSet stats = item.getStats();
            if (stats.getStatsCount() == 0) {
                ok = false;
                if (item instanceof Armour) {
                    Armour armour = (Armour) item;
                    if (armour.getArmourValue() != 0) {
                        ok = true;
                    }
                }
            }
            if (!ok) {
                _missingStats.add(item);
                _nbMissingStats++;
                // if ((location==EquipmentLocation.BACK) || (location==EquipmentLocation.LEGS))
                {
                // System.out.println("No stat for item: " + item + " at " + location);
                }
            } else {
                _nbStats++;
            }
        }
    }
}
Also used : Legendary(delta.games.lotro.lore.items.legendary.Legendary) Armour(delta.games.lotro.lore.items.Armour) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 20 with Armour

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

Aggregations

Armour (delta.games.lotro.lore.items.Armour)21 Item (delta.games.lotro.lore.items.Item)15 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)10 Weapon (delta.games.lotro.lore.items.Weapon)10 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)9 ArmourType (delta.games.lotro.lore.items.ArmourType)8 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)7 CharacterClass (delta.games.lotro.common.CharacterClass)6 WeaponType (delta.games.lotro.lore.items.WeaponType)6 ItemQuality (delta.games.lotro.lore.items.ItemQuality)5 STAT (delta.games.lotro.character.stats.STAT)3 DamageType (delta.games.lotro.lore.items.DamageType)3 Legendary (delta.games.lotro.lore.items.legendary.Legendary)3 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)3 HashMap (java.util.HashMap)3 SlicesBasedItemStatsProvider (delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider)2 ArrayList (java.util.ArrayList)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 FloatEditionController (delta.common.ui.swing.text.FloatEditionController)1 IntegerEditionController (delta.common.ui.swing.text.IntegerEditionController)1