Search in sources :

Example 36 with BasicStatsSet

use of delta.games.lotro.character.stats.BasicStatsSet in project lotro-tools by dmorcellet.

the class ConsistencyChecks method checkItemStats.

private void checkItemStats(Item item) {
    EquipmentLocation location = item.getEquipmentLocation();
    if (location != null) {
        boolean isLegendary = ((item instanceof Legendary) || (location == EquipmentLocation.BRIDLE));
        if (isLegendary) {
            _nbLegendaryItems++;
        } else {
            boolean ok = true;
            BasicStatsSet stats = item.getStats();
            if (stats.getStatsCount() == 0) {
                ok = false;
                if (item instanceof Armour) {
                    Armour armour = (Armour) item;
                    if (armour.getArmourValue() != 0) {
                        ok = true;
                    }
                }
            }
            if (!ok) {
                _missingStats.add(item);
                _nbMissingStats++;
                // if ((location==EquipmentLocation.BACK) || (location==EquipmentLocation.LEGS))
                {
                // System.out.println("No stat for item: " + item + " at " + location);
                }
            } else {
                _nbStats++;
            }
        }
    }
}
Also used : Legendary(delta.games.lotro.lore.items.legendary.Legendary) Armour(delta.games.lotro.lore.items.Armour) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 37 with BasicStatsSet

use of delta.games.lotro.character.stats.BasicStatsSet in project lotro-tools by dmorcellet.

the class ItemsMerger method inspectScalableItems.

private Item inspectScalableItems(Item item, List<Item> selectedItems, StringBuilder sb) {
    List<Item> matchingItems = new ArrayList<Item>();
    String slices = item.getProperty(ItemPropertyNames.FORMULAS);
    if (slices != null) {
        SlicesBasedItemStatsProvider provider = SlicesBasedItemStatsProvider.fromPersistedString(slices);
        if (provider != null) {
            for (Item selectedItem : selectedItems) {
                Integer selectedItemLevel = selectedItem.getItemLevel();
                if ((selectedItemLevel != null) && (provider != null)) {
                    BasicStatsSet scaledStats = provider.getStats(selectedItemLevel.intValue());
                    scaledStats.removeStat(STAT.ARMOUR);
                    BasicStatsSet itemStats = selectedItem.getStats();
                    boolean same = compareStats(itemStats, scaledStats);
                    if (same) {
                        // System.out.println("Item " + item + " and " + selectedItem + " are versions of the same scalable item.");
                        String itemLevels = buildItemLevelProperty(selectedItemLevel, item.getItemLevel());
                        selectedItem.setProperty(ItemPropertyNames.LEVELS, itemLevels);
                        matchingItems.add(selectedItem);
                    } else {
                        sb.append("Stats are different: " + item + " != " + selectedItem + "\n");
                        sb.append("Scaled: " + scaledStats + "\n");
                        sb.append("Expected: " + itemStats + "\n");
                    }
                }
            }
        }
    }
    Item matchingItem = null;
    if (matchingItems.size() > 0) {
        if (matchingItems.size() > 1) {
            sb.append("Several matches for " + item + ": " + matchingItems + "\n");
        } else {
            matchingItem = matchingItems.get(0);
            sb.setLength(0);
        }
    }
    return matchingItem;
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Item(delta.games.lotro.lore.items.Item) ArrayList(java.util.ArrayList) SlicesBasedItemStatsProvider(delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 38 with BasicStatsSet

use of delta.games.lotro.character.stats.BasicStatsSet in project lotro-tools by dmorcellet.

the class ItemsMerger method mergeStats.

private void mergeStats(Item item, Item selectedItem) {
    Integer itemLevel = item.getItemLevel();
    Integer selectedItemLevel = selectedItem.getItemLevel();
    int compareLevels = compareItemLevels(itemLevel, selectedItemLevel);
    if (compareLevels != 0) {
        String itemLevels = buildItemLevelProperty(itemLevel, selectedItemLevel);
        selectedItem.setProperty(ItemPropertyNames.LEVELS, itemLevels);
    }
    if (compareLevels > 0) {
        selectedItem.setItemLevel(item.getItemLevel());
        BasicStatsSet itemStats = selectedItem.getStats();
        itemStats.clear();
        itemStats.setStats(item.getStats());
    }
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Aggregations

BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)38 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)13 STAT (delta.games.lotro.character.stats.STAT)12 Item (delta.games.lotro.lore.items.Item)11 Armour (delta.games.lotro.lore.items.Armour)9 CharacterClass (delta.games.lotro.common.CharacterClass)7 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)6 CharacterData (delta.games.lotro.character.CharacterData)5 CharacterStatsComputer (delta.games.lotro.character.stats.CharacterStatsComputer)4 SlicesBasedItemStatsProvider (delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider)4 JPanel (javax.swing.JPanel)4 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)3 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)3 ArmourType (delta.games.lotro.lore.items.ArmourType)3 ItemQuality (delta.games.lotro.lore.items.ItemQuality)3 Weapon (delta.games.lotro.lore.items.Weapon)3 ArrayList (java.util.ArrayList)3 JFrame (javax.swing.JFrame)3 Element (net.htmlparser.jericho.Element)3 DefaultWindowController (delta.common.ui.swing.windows.DefaultWindowController)2