use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization method trimData.
private void trimData(List<Item> items) {
for (Item item : items) {
// Remove money
item.setValue(null);
// Remove bonuses
item.getBonus().clear();
// Remove useless properties
item.removeProperty(ItemPropertyNames.ICON_URL);
item.removeProperty(ItemPropertyNames.ITEM_KEY);
item.removeProperty(ItemPropertyNames.LEGACY_NAME);
item.removeProperty(ItemPropertyNames.OLD_TULKAS_NAME);
item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
}
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization 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 ItemNormalization method normalizeJewels.
private Item normalizeJewels(Item item) {
Item ret = item;
// int id=item.getIdentifier();
String categoryProp = item.getProperty(ItemPropertyNames.TULKAS_CATEGORY);
String subCategory = item.getSubCategory();
if (("49".equals(categoryProp)) || ("49".equals(subCategory))) {
String previousSubCategory = ret.getSubCategory();
// Pocket=103, Wrist=211, Ear=211, Neck=170, Finger=198
if ("Pocket".equals(previousSubCategory)) {
ret.setEquipmentLocation(EquipmentLocation.POCKET);
ret.setSubCategory(null);
} else if ("Wrist".equals(previousSubCategory)) {
ret.setEquipmentLocation(EquipmentLocation.WRIST);
ret.setSubCategory(null);
} else if ("Ear".equals(previousSubCategory)) {
ret.setEquipmentLocation(EquipmentLocation.EAR);
ret.setSubCategory(null);
} else if ("Neck".equals(previousSubCategory)) {
ret.setEquipmentLocation(EquipmentLocation.NECK);
ret.setSubCategory(null);
} else if ("Finger".equals(previousSubCategory)) {
ret.setEquipmentLocation(EquipmentLocation.FINGER);
ret.setSubCategory(null);
} else {
EquipmentLocation loc = ret.getEquipmentLocation();
if (loc != null) {
ret.setSubCategory(null);
} else {
ret.setSubCategory("Jewelry");
normalizeJewelByName(ret, "Token", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Earring", EquipmentLocation.EAR);
normalizeJewelByName(ret, "Bauble", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Necklace", EquipmentLocation.NECK);
normalizeJewelByName(ret, "Ring", EquipmentLocation.FINGER);
normalizeJewelByName(ret, "Bracelet", EquipmentLocation.WRIST);
normalizeJewelByName(ret, "Cuff", EquipmentLocation.WRIST);
normalizeJewelByName(ret, "Ear Cuff", EquipmentLocation.EAR);
normalizeJewelByName(ret, "Barrow-brie", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Stone", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Pendant", EquipmentLocation.NECK);
normalizeJewelByName(ret, "Choker", EquipmentLocation.NECK);
normalizeJewelByName(ret, "Band ", EquipmentLocation.FINGER);
normalizeJewelByName(ret, "Armlet", EquipmentLocation.WRIST);
// normalizeJewelByName(ret,"Bangle of Deep Waters",EquipmentLocation.WRIST);
normalizeJewelByName(ret, "Mountain-stone", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Scroll", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Phial", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Pocket-square", EquipmentLocation.POCKET);
normalizeJewelByName(ret, "Locket", EquipmentLocation.POCKET);
// Specific names for pocket items
normalizeJewelByName(ret, "Carved Jewellery Box", EquipmentLocation.POCKET);
String name = ret.getName();
if ("Plains Walker's Symbol".equals(name)) {
ret.setRequiredClass(CharacterClass.BEORNING);
ret.setEquipmentLocation(EquipmentLocation.POCKET);
ret.setSubCategory(null);
} else if ("Talisman of the Tundra Cub".equals(name)) {
ret.setRequiredClass(CharacterClass.LORE_MASTER);
ret.setEquipmentLocation(null);
ret.setSubCategory(CharacterClass.LORE_MASTER.getLabel() + ":Talisman");
}
}
}
EquipmentLocation slot = ret.getEquipmentLocation();
if (slot == null) {
String name = ret.getName();
System.out.println("Slot not found for jewel: " + name);
}
ret.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
ret.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
if (ret instanceof Armour) {
Armour armour = (Armour) ret;
int armourValue = armour.getArmourValue();
// Transmutate to item so that further filtering works good
Item newItem = new Item();
newItem.copyFrom(ret);
newItem.getStats().setStat(STAT.ARMOUR, new FixedDecimalsInteger(armourValue));
ret = newItem;
}
}
return ret;
}
use of delta.games.lotro.lore.items.Item 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);
*/
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class MergeItemsLegacyAndTulkasIndex method loadItemsFile.
// Map tulkas subcategories int ids to list of legacy subcategories names
// private HashMap<String,HashMap<String,IntegerHolder>> _tulkas2legacySubCategoriesMap;
// private HashMap<String,Set<String>> _legacy2tulkasSubCategoriesMap;
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;
}
Aggregations