Search in sources :

Example 1 with StoredItem

use of delta.games.lotro.character.storage.StoredItem in project lotro-companion by dmorcellet.

the class MainTestShowCharacterStorage method getAllItems.

private List<StoredItem> getAllItems(Vault container) {
    List<StoredItem> items = new ArrayList<StoredItem>();
    int chests = container.getChestCount();
    // int itemsCount=0;
    for (int i = 0; i < chests; i++) {
        Chest chest = container.getChest(i);
        if (chest != null) {
            List<StoredItem> chestItems = chest.getAllItemsByName();
            // itemsCount+=chestItems.size();
            items.addAll(chestItems);
        }
    }
    // System.out.println(itemsCount);
    return items;
}
Also used : Chest(delta.games.lotro.character.storage.Chest) ArrayList(java.util.ArrayList) StoredItem(delta.games.lotro.character.storage.StoredItem)

Example 2 with StoredItem

use of delta.games.lotro.character.storage.StoredItem in project lotro-companion by dmorcellet.

the class MainTestShowCharacterStorage method show.

private void show(List<StoredItem> storedItems) {
    List<Item> items = getItems(storedItems);
    ItemFilterController filterController = new ItemFilterController();
    Filter<Item> filter = filterController.getFilter();
    ItemChoiceWindowController choiceCtrl = new ItemChoiceWindowController(null, null, items, filter, filterController);
    choiceCtrl.show();
}
Also used : StoredItem(delta.games.lotro.character.storage.StoredItem) Item(delta.games.lotro.lore.items.Item) ItemChoiceWindowController(delta.games.lotro.gui.items.ItemChoiceWindowController) ItemFilterController(delta.games.lotro.gui.items.ItemFilterController)

Example 3 with StoredItem

use of delta.games.lotro.character.storage.StoredItem 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)

Aggregations

StoredItem (delta.games.lotro.character.storage.StoredItem)3 Item (delta.games.lotro.lore.items.Item)2 ArrayList (java.util.ArrayList)2 Chest (delta.games.lotro.character.storage.Chest)1 ItemChoiceWindowController (delta.games.lotro.gui.items.ItemChoiceWindowController)1 ItemFilterController (delta.games.lotro.gui.items.ItemFilterController)1 ItemsManager (delta.games.lotro.lore.items.ItemsManager)1