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());
}
}
}
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;
}
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);
}
}
}
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;
}
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;
}
Aggregations