Search in sources :

Example 96 with Item

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

the class IconsDbBuilder method handleIconList.

private void handleIconList(HashMap<Integer, Item> items, String key, List<Integer> ids) {
    int nbIcons = ids.size();
    File sourceFile = null;
    int fileIndex = 0;
    File[] dirs = { _sourceIconsDir, _sourceIconsDir2 };
    for (int i = 0; i < nbIcons; i++) {
        String id = ids.get(i).toString() + ".png";
        for (File dir : dirs) {
            File iconFile = new File(dir, id);
            if (iconFile.exists()) {
                if (sourceFile == null) {
                    sourceFile = iconFile;
                    _nbItemsWithIcon += nbIcons;
                    File to = new File(_iconsDbDir, key + ".png");
                    FileCopy.copy(iconFile, to);
                    fileIndex++;
                } else {
                    // Compare source file and icon file, warn if different
                    boolean same = ComparePngFiles.compareFiles(sourceFile, iconFile);
                    if (!same) {
                        _logger.warn("Icon file differ: source=" + sourceFile + ", new=" + iconFile);
                        File to = new File(_iconsDbDir, key + "-" + fileIndex + ".png");
                        FileCopy.copy(iconFile, to);
                        fileIndex++;
                    }
                }
            }
        }
    }
    if (sourceFile == null) {
        // _logger.warn("No icon for key: "+key);
        _nbDifferentIconsMissing++;
        _nbItemsWithNoIcon += nbIcons;
        for (Integer itemId : ids) {
            Item item = items.get(itemId);
            System.out.println(item.getName());
        }
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) File(java.io.File)

Example 97 with Item

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

the class IconsDbBuilder method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    ItemXMLParser parser = new ItemXMLParser();
    List<Item> items = parser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser)

Example 98 with Item

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

the class ItemIconsDownloader method doIt.

private void doIt() {
    DownloadService downloader = DownloadService.getInstance();
    File toFile = new File("items.xml").getAbsoluteFile();
    _toDir.mkdirs();
    HashMap<Integer, Item> items = loadItemsFile(toFile);
    System.out.println(items.size());
    for (Integer id : items.keySet()) {
        System.out.println(id);
        String url = "http://lotro.fr/img/bdd/items/" + id + ".png";
        File to = new File(_toDir, id + ".png");
        try {
            downloader.downloadToFile(url, to);
        } catch (DownloadException de) {
            _logger.error("Cannot fetch icon [" + url + "]!", de);
        }
    }
}
Also used : Item(delta.games.lotro.lore.items.Item) DownloadException(delta.downloads.DownloadException) File(java.io.File) DownloadService(delta.games.lotro.utils.DownloadService)

Example 99 with Item

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

the class ItemIconsDownloader method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    ItemXMLParser parser = new ItemXMLParser();
    List<Item> items = parser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ItemXMLParser(delta.games.lotro.lore.items.io.xml.ItemXMLParser)

Example 100 with Item

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

the class BigBattlesJewelsFinder method generateBigBattleJewels.

private Map<String, Item> generateBigBattleJewels() {
    Map<String, Item> ret = new HashMap<String, Item>();
    for (String prefix : PREFIXES) {
        for (String adjective : ADJECTIVES) {
            for (int i = 0; i < JEWELS.length; i++) {
                String jewel = JEWELS[i];
                String name = generateBigBattleJewelName(prefix, adjective, jewel);
                Item item = new Item();
                item.setName(name);
                item.setEquipmentLocation(JEWEL_LOCATIONS[i]);
                ret.put(name, item);
            }
        }
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap)

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