Search in sources :

Example 1 with ScalingParametersFinder

use of delta.games.lotro.tools.lore.items.scalables.ScalingParametersFinder 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);
    */
}
Also used : ItemIdComparator(delta.games.lotro.lore.items.comparators.ItemIdComparator) EssenceStatsInjector(delta.games.lotro.tools.lore.items.lotroplan.essences.EssenceStatsInjector) ArrayList(java.util.ArrayList) BigBattlesJewelsFinder(delta.games.lotro.tools.lore.items.scalables.BigBattlesJewelsFinder) ConsistencyChecks(delta.games.lotro.tools.lore.items.ConsistencyChecks) ScalingParametersFinder(delta.games.lotro.tools.lore.items.scalables.ScalingParametersFinder) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) LegendaryItem(delta.games.lotro.lore.items.legendary.LegendaryItem) Item(delta.games.lotro.lore.items.Item) ItemStatistics(delta.games.lotro.tools.lore.items.ItemStatistics) ArrayList(java.util.ArrayList) List(java.util.List) File(java.io.File) ScalableItemsFinder(delta.games.lotro.tools.lore.items.scalables.ScalableItemsFinder)

Aggregations

Item (delta.games.lotro.lore.items.Item)1 ItemIdComparator (delta.games.lotro.lore.items.comparators.ItemIdComparator)1 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)1 ConsistencyChecks (delta.games.lotro.tools.lore.items.ConsistencyChecks)1 ItemStatistics (delta.games.lotro.tools.lore.items.ItemStatistics)1 EssenceStatsInjector (delta.games.lotro.tools.lore.items.lotroplan.essences.EssenceStatsInjector)1 BigBattlesJewelsFinder (delta.games.lotro.tools.lore.items.scalables.BigBattlesJewelsFinder)1 ScalableItemsFinder (delta.games.lotro.tools.lore.items.scalables.ScalableItemsFinder)1 ScalingParametersFinder (delta.games.lotro.tools.lore.items.scalables.ScalingParametersFinder)1 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1