Search in sources :

Example 6 with ItemsManager

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

the class MainTestShowCharacterStorage method getItems.

private List<Item> getItems(List<StoredItem> storedItems) {
    ItemsManager itemsMgr = ItemsManager.getInstance();
    List<Item> allItems = itemsMgr.getAllItems();
    List<Item> selection = new ArrayList<Item>();
    for (StoredItem storedItem : storedItems) {
        Item selectedItem = null;
        for (Item item : allItems) {
            Item match = match(item, storedItem);
            if (match != null) {
                selectedItem = item;
                break;
            }
        }
        if (selectedItem != null) {
            selection.add(selectedItem);
        } else {
            LOGGER.warn("Could not find item: " + storedItem.getName());
        }
    }
    return selection;
}
Also used : StoredItem(delta.games.lotro.character.storage.StoredItem) Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager) ArrayList(java.util.ArrayList) StoredItem(delta.games.lotro.character.storage.StoredItem)

Example 7 with ItemsManager

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

the class MainTestItemEditionWindowController method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    ItemsManager itemsMgr = ItemsManager.getInstance();
    List<Item> items = itemsMgr.getAllItems();
    int nbWindows = 0;
    int index = 0;
    int nbItems = items.size();
    while ((index < nbItems) && (nbWindows < 1)) {
        // Item item=itemsMgr.getItem(1879313783); // Light Nadhin Hood (level 192)
        // Item item=itemsMgr.getItem(1879323547); // Bridge-warden's Shield (level 201)
        // Item item=itemsMgr.getItem(1879134849); // Javelin of Ire
        // Item item=itemsMgr.getItem(1879311750); // Reshaped Minstrel's Club of the First Age
        // Lesser Valourous Helm of Fate
        Item item = itemsMgr.getItem(1879279194);
        // Item item=items.get(index);
        // if ((item.getQuality()==ItemQuality.LEGENDARY) && (Integer.valueOf(192).equals(item.getItemLevel())))
        // if (item instanceof Armour)
        // if (item instanceof Weapon)
        {
            ItemEditionWindowController ctrl = new ItemEditionWindowController(null, item);
            ctrl.show(true);
            nbWindows++;
        }
        index++;
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) ItemsManager(delta.games.lotro.lore.items.ItemsManager)

Example 8 with ItemsManager

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

ItemsManager (delta.games.lotro.lore.items.ItemsManager)8 Item (delta.games.lotro.lore.items.Item)7 ArrayList (java.util.ArrayList)4 File (java.io.File)3 ExtensionPredicate (delta.common.utils.files.filter.ExtensionPredicate)2 FileFilter (java.io.FileFilter)2 HashMap (java.util.HashMap)2 IntegerHolder (delta.common.utils.misc.IntegerHolder)1 TypedProperties (delta.common.utils.misc.TypedProperties)1 CharacterData (delta.games.lotro.character.CharacterData)1 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)1 StoredItem (delta.games.lotro.character.storage.StoredItem)1 CharacterClass (delta.games.lotro.common.CharacterClass)1 ItemChoiceWindowController (delta.games.lotro.gui.items.ItemChoiceWindowController)1 ItemFilterConfiguration (delta.games.lotro.gui.items.ItemFilterConfiguration)1 ItemFilterController (delta.games.lotro.gui.items.ItemFilterController)1 Bonus (delta.games.lotro.lore.items.bonus.Bonus)1 BonusManager (delta.games.lotro.lore.items.bonus.BonusManager)1 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)1 LotroDataSource (delta.games.lotro.lore.sql.LotroDataSource)1