Search in sources :

Example 71 with Item

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

the class ItemEditionPanelController method selectItemLevel.

private void selectItemLevel(Integer itemLevel) {
    if (itemLevel != null) {
        ScalingRule rule = Scaling.getScalingRule(_item);
        if (rule != null) {
            Item item = ItemFactory.clone(_item);
            Scaling.scaleToItemLevel(item, itemLevel.intValue());
            BasicStatsSet stats = item.getStats();
            _stats.initFromStats(stats);
            if (item instanceof Armour) {
                Armour armour = (Armour) item;
                int armourValue = armour.getArmourValue();
                _armourValue.setValue(Integer.valueOf(armourValue));
            }
            Integer requiredLevel = rule.getRequiredLevel(itemLevel.intValue());
            if (requiredLevel != null) {
                _minLevel.selectItem(requiredLevel);
            }
        }
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) ScalingRule(delta.games.lotro.lore.items.stats.ScalingRule) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 72 with Item

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

the class LorebookDeedsDatabaseNormalization method normalizeDeed.

private void normalizeDeed(DeedDescription deed) {
    // Remove key
    deed.setKey(null);
    // Normalize EOL/LF
    // - description
    deed.setDescription(normalizeText(deed.getDescription()));
    // - objectives
    deed.setObjectives(normalizeText(deed.getObjectives()));
    // Find item IDs
    // TODO Use ItemsResolver
    Rewards rewards = deed.getRewards();
    ObjectsSet objects = rewards.getObjects();
    int nbItems = objects.getNbObjectItems();
    for (int i = 0; i < nbItems; i++) {
        ObjectItem objectItem = objects.getItem(i);
        String name = objectItem.getName();
        Item item = getItemByName(name);
        if (item != null) {
            objectItem.setItemId(item.getIdentifier());
            objectItem.setObjectURL(null);
            objectItem.setIconURL(null);
        } else {
            System.out.println("Item not found [" + name + "]");
        }
    }
}
Also used : ObjectItem(delta.games.lotro.common.objects.ObjectItem) Item(delta.games.lotro.lore.items.Item) ObjectItem(delta.games.lotro.common.objects.ObjectItem) Rewards(delta.games.lotro.common.Rewards) ObjectsSet(delta.games.lotro.common.objects.ObjectsSet)

Example 73 with Item

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

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

the class ItemsResolver method resolveLorebookKey.

/**
 * Resolve an item using its lorebook key.
 * @param key Key to use.
 * @return An item or <code>null</code> if not found.
 */
public Item resolveLorebookKey(String key) {
    /*
    key=key.replace("'","%27");
    key=key.replace("â","%C3%A2");
    key=key.replace("ú","%C3%BA");
    key=key.replace("ó","%C3%B3");
    key=key.replace("û","%C3%BB");
    */
    Item item = getItem(key);
    if (item == null) {
        if (key.startsWith("Item:")) {
            key = key.substring(5);
            key = key.replace("_", " ");
            item = getItem(key);
        }
    }
    return item;
}
Also used : Item(delta.games.lotro.lore.items.Item)

Example 75 with Item

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

the class ItemsResolver method loadFileIds.

/**
 * Load map (keys/names)->list of item ids
 * @return a map.
 */
private HashMap<String, List<Item>> loadFileIds() {
    HashMap<String, List<Item>> idStr2Id = new HashMap<String, List<Item>>();
    ItemsManager mgr = ItemsManager.getInstance();
    List<Item> items = mgr.getAllItems();
    for (Item item : items) {
        String key = item.getKey();
        registerMapping(idStr2Id, key, item);
        String name = item.getName();
        registerMapping(idStr2Id, name, item);
        String legacyName = item.getProperty(ItemPropertyNames.LEGACY_NAME);
        registerMapping(idStr2Id, legacyName, item);
        String oldTulkasName = item.getProperty(ItemPropertyNames.OLD_TULKAS_NAME);
        registerMapping(idStr2Id, oldTulkasName, item);
        String iconUrl = item.getProperty(ItemPropertyNames.ICON_URL);
        iconUrl = normalizeIconUrl(iconUrl);
        registerMapping(idStr2Id, iconUrl, item);
    }
    /*
    List<String> keys=new ArrayList<String>(idStr2Id.keySet());
    Collections.sort(keys);
    for(String key : keys)
    {
      List<Item> itemsForId=idStr2Id.get(key);
      //if (ids.size()>1)
      {
        System.out.println("*************** "+key+" ******************");
        Collections.sort(items,new ItemIdComparator());
        for(Item item : itemsForId)
        {
          System.out.println("\t"+item);
        }
      }
    }
    */
    return idStr2Id;
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) HashMap(java.util.HashMap) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

Item (delta.games.lotro.lore.items.Item)105 ArrayList (java.util.ArrayList)29 HashMap (java.util.HashMap)19 File (java.io.File)17 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)16 Armour (delta.games.lotro.lore.items.Armour)15 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)12 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)11 ArmourType (delta.games.lotro.lore.items.ArmourType)8 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)8 Weapon (delta.games.lotro.lore.items.Weapon)8 JMenuItem (javax.swing.JMenuItem)8 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)7 CharacterClass (delta.games.lotro.common.CharacterClass)7 ItemsManager (delta.games.lotro.lore.items.ItemsManager)7 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)6 ItemsStash (delta.games.lotro.character.storage.ItemsStash)6 WeaponType (delta.games.lotro.lore.items.WeaponType)6 ItemQuality (delta.games.lotro.lore.items.ItemQuality)5 List (java.util.List)5