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