use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class MergeWithTulkasNew method doIt.
/**
* Do the job.
*/
public void doIt() {
File file1 = new File("data/items/tmp/itemsLegacy+TulkasIndex.xml");
HashMap<Integer, Item> sourceItems = loadItemsFile(file1);
System.out.println(sourceItems.size());
File file2 = new File("data/items/tmp/itemsTulkas13.1.xml");
HashMap<Integer, Item> tulkasItems = loadItemsFile(file2);
System.out.println(tulkasItems.size());
HashMap<Integer, Item> mergeResult = new HashMap<Integer, Item>();
for (Integer id : sourceItems.keySet()) {
Item sourceItem = sourceItems.get(id);
Item result = sourceItem;
Item tulkasItem = tulkasItems.get(id);
if (tulkasItem != null) {
result = mergeItems(sourceItem, tulkasItem);
tulkasItems.remove(id);
}
mergeResult.put(Integer.valueOf(result.getIdentifier()), result);
}
System.out.println(tulkasItems.size() + ": " + tulkasItems);
File toFile = new File("data/items/tmp/itemsLegacy+Tulkas.xml").getAbsoluteFile();
List<Item> items = new ArrayList<Item>(mergeResult.values());
ItemXMLWriter.writeItemsFile(toFile, items);
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class MergeWithTulkasNew method loadItemsFile.
private HashMap<Integer, Item> loadItemsFile(File file) {
List<Item> items = ItemSaxParser.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 MainTestItemParsing method doIt.
private void doIt() {
String[] urls = getTestURLs();
List<Item> items = parseItems();
int index = 0;
for (Item item : items) {
if (item != null) {
System.out.println(item.dump());
} else {
System.out.println("Item [" + urls[index] + "] is null!");
}
index++;
}
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class MainCheckScalableItems method doIt.
private void doIt() {
ScalableItemsSamplesLoader loader = new ScalableItemsSamplesLoader();
List<Item> items = loader.loadTable("samples.txt");
for (Item item : items) {
System.out.println(item.dump());
}
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ScalableItemsSamplesLoader method buildItemFromLine.
private Item buildItemFromLine(String line) {
String[] fields = StringSplitter.split(line, '\t');
// Stats
BasicStatsSet stats = new BasicStatsSet();
int nbStats = STATS.length;
for (int i = 0; i < nbStats; i++) {
if ((STATS[i] != null) && (fields.length > i)) {
String valueStr = fields[i];
FixedDecimalsInteger value = StatValueParser.parseStatValue(valueStr);
if (value != null) {
stats.addStat(STATS[i], value);
}
}
}
// Item level
Integer itemLevel = NumericTools.parseInteger(fields[ITEM_LEVEL_INDEX]);
// Build item
FixedDecimalsInteger armorStat = stats.getStat(STAT.ARMOUR);
Item item = null;
Armour armour = null;
if (armorStat != null) {
armour = new Armour();
item = armour;
armour.setArmourValue(armorStat.intValue());
stats.removeStat(STAT.ARMOUR);
} else {
item = new Item();
}
// Item level
item.setItemLevel(itemLevel);
// Name
String name = fields[NAME_INDEX];
name = name.trim();
item.setName(name);
// Slots
String slotStr = fields[SLOTS_INDEX];
int nbSlots = NumericTools.parseInt(slotStr, 0);
item.setEssenceSlots(nbSlots);
// Min level
String requiredLevelStr = fields[REQUIRED_LEVEL_INDEX];
Integer requiredLevel = NumericTools.parseInteger(requiredLevelStr);
if (requiredLevelStr != null) {
item.setMinLevel(requiredLevel);
}
// Stats
item.getStats().setStats(stats);
return item;
}
Aggregations