use of delta.games.lotro.tools.lore.items.ItemStatistics in project lotro-tools by dmorcellet.
the class ItemNormalization method doIt.
/**
* Do the job.
*/
public void doIt() {
File file1 = new File("data/items/tmp/items-rc.xml");
HashMap<Integer, Item> sourceItems = loadItemsFile(file1);
System.out.println(sourceItems.size());
List<Integer> ids = new ArrayList<Integer>(sourceItems.keySet());
for (Integer id : ids) {
Item sourceItem = sourceItems.get(id);
sourceItem = normalizeItem(sourceItem);
if (sourceItem != null) {
sourceItems.put(id, sourceItem);
} else {
sourceItems.remove(id);
}
}
// Essences stats injection
new EssenceStatsInjector().doIt(sourceItems.values());
// Build final items list
List<Item> items = new ArrayList<Item>(sourceItems.values());
// Find/handle scalable items
// - scalable instances rewards
{
List<Item> scalableInstancesRewards = new ScalableItemsFinder().findScalableItems(items);
System.out.println("Found " + scalableInstancesRewards.size() + " scalable instances rewards");
new ScalingParametersFinder(ScalingRulesNames.SCALABLE_REWARDS).findScalingParameters(scalableInstancesRewards);
}
// - Big Battles rewards
{
List<Item> bbJewels = new BigBattlesJewelsFinder().findScalableItems(items);
System.out.println("Found " + bbJewels.size() + " BB jewels:");
new ScalingParametersFinder(ScalingRulesNames.BIG_BATTLES).findScalingParameters(bbJewels);
new ItemStatistics().showStatistics(bbJewels);
}
// Guess armor types from formulas
findArmourTypeFromFormulas(items);
// Trim useless data
trimData(items);
// Sort items by ID
Collections.sort(items, new ItemIdComparator());
// Consistency checks
new ConsistencyChecks().consistencyChecks(items);
// Filtering items
List<Item> filteredItems = filterItems(items);
// Write result files
File toFile = new File("data/items/items.xml").getAbsoluteFile();
ItemXMLWriter.writeItemsFile(toFile, items);
File filteredItemsFile = new File("data/items/items_filtered.xml").getAbsoluteFile();
ItemXMLWriter.writeItemsFile(filteredItemsFile, filteredItems);
// Dump unmanaged items
if (_byCategory.size() > 0) {
System.out.println("There are unmanaged item categories:");
List<String> categories = new ArrayList<String>(_byCategory.keySet());
Collections.sort(categories);
int totalSize = 0;
for (String category : categories) {
int size = _byCategory.get(category).size();
System.out.println(category + " => " + size + _byCategory.get(category));
totalSize += size;
}
System.out.println(totalSize);
}
new ItemStatistics().showStatistics(filteredItems);
/*
ItemsSorter sorter=new ItemsSorter();
sorter.sortItems(items);
File rootDir=new File("sorted");
rootDir.mkdirs();
sorter.writeToFiles(rootDir);
*/
}
Aggregations