use of delta.games.lotro.lore.items.Item in project lotro-companion by dmorcellet.
the class ItemEditionPanelController method selectItemLevel.
private void selectItemLevel(Integer itemLevel) {
if (itemLevel != null) {
ScalingRule rule = Scaling.getScalingRule(_item);
if (rule != null) {
Item item = ItemFactory.clone(_item);
Scaling.scaleToItemLevel(item, itemLevel.intValue());
BasicStatsSet stats = item.getStats();
_stats.initFromStats(stats);
if (item instanceof Armour) {
Armour armour = (Armour) item;
int armourValue = armour.getArmourValue();
_armourValue.setValue(Integer.valueOf(armourValue));
}
Integer requiredLevel = rule.getRequiredLevel(itemLevel.intValue());
if (requiredLevel != null) {
_minLevel.selectItem(requiredLevel);
}
}
}
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class LorebookDeedsDatabaseNormalization method normalizeDeed.
private void normalizeDeed(DeedDescription deed) {
// Remove key
deed.setKey(null);
// Normalize EOL/LF
// - description
deed.setDescription(normalizeText(deed.getDescription()));
// - objectives
deed.setObjectives(normalizeText(deed.getObjectives()));
// Find item IDs
// TODO Use ItemsResolver
Rewards rewards = deed.getRewards();
ObjectsSet objects = rewards.getObjects();
int nbItems = objects.getNbObjectItems();
for (int i = 0; i < nbItems; i++) {
ObjectItem objectItem = objects.getItem(i);
String name = objectItem.getName();
Item item = getItemByName(name);
if (item != null) {
objectItem.setItemId(item.getIdentifier());
objectItem.setObjectURL(null);
objectItem.setIconURL(null);
} else {
System.out.println("Item not found [" + name + "]");
}
}
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ConsistencyChecks method consistencyChecks.
/**
* Perform consistency checks.
* @param items Items to use.
*/
public void consistencyChecks(List<Item> items) {
int nbMissingArmourValues = 0;
int nbMissingArmourTypes = 0;
int nbMissingWeaponTypes = 0;
int nbScalables = 0;
int nbFormulas = 0;
for (Item item : items) {
checkItemStats(item);
// Armours
if (item instanceof Armour) {
Armour armour = (Armour) item;
int armourValue = armour.getArmourValue();
if (armourValue == 0) {
nbMissingArmourValues++;
// System.out.println("No armour value for: " + name + " (" + id + ')');
}
ArmourType type = armour.getArmourType();
if (type == null) {
nbMissingArmourTypes++;
// System.out.println("No armour type for: " + name + " (" + id + ')');
}
}
// Weapons
if (item instanceof Weapon) {
Weapon weapon = (Weapon) item;
WeaponType type = weapon.getWeaponType();
if (type == null) {
nbMissingWeaponTypes++;
// System.out.println("No weapon type for: " + name + " (" + id + ')');
}
}
// Scalables
String scalingIds = item.getProperty(ItemPropertyNames.SCALING);
String slicedStats = item.getProperty(ItemPropertyNames.FORMULAS);
if (slicedStats != null) {
nbFormulas++;
if (scalingIds != null) {
nbScalables++;
_scalableItems.add(item);
if (item instanceof Armour) {
Armour armour = (Armour) item;
ArmourType type = armour.getArmourType();
if (type == null) {
System.out.println("No armour type for: " + item + " with formula: " + slicedStats);
}
}
}
}
}
System.out.println("Nb armours with missing armour type: " + nbMissingArmourTypes);
System.out.println("Nb armours with missing armour value: " + nbMissingArmourValues);
System.out.println("Nb weapons with missing type: " + nbMissingWeaponTypes);
System.out.println("Nb legendary items: " + _nbLegendaryItems);
System.out.println("Nb items with stats: " + _nbStats);
System.out.println("Nb items with missing stats: " + _nbMissingStats);
System.out.println("Nb items with formula: " + nbFormulas);
System.out.println("Nb scalable items: " + nbScalables);
// new ItemStatistics().showStatistics(_scalableItems);
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemsResolver method resolveLorebookKey.
/**
* Resolve an item using its lorebook key.
* @param key Key to use.
* @return An item or <code>null</code> if not found.
*/
public Item resolveLorebookKey(String key) {
/*
key=key.replace("'","%27");
key=key.replace("â","%C3%A2");
key=key.replace("ú","%C3%BA");
key=key.replace("ó","%C3%B3");
key=key.replace("û","%C3%BB");
*/
Item item = getItem(key);
if (item == null) {
if (key.startsWith("Item:")) {
key = key.substring(5);
key = key.replace("_", " ");
item = getItem(key);
}
}
return item;
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemsResolver method loadFileIds.
/**
* Load map (keys/names)->list of item ids
* @return a map.
*/
private HashMap<String, List<Item>> loadFileIds() {
HashMap<String, List<Item>> idStr2Id = new HashMap<String, List<Item>>();
ItemsManager mgr = ItemsManager.getInstance();
List<Item> items = mgr.getAllItems();
for (Item item : items) {
String key = item.getKey();
registerMapping(idStr2Id, key, item);
String name = item.getName();
registerMapping(idStr2Id, name, item);
String legacyName = item.getProperty(ItemPropertyNames.LEGACY_NAME);
registerMapping(idStr2Id, legacyName, item);
String oldTulkasName = item.getProperty(ItemPropertyNames.OLD_TULKAS_NAME);
registerMapping(idStr2Id, oldTulkasName, item);
String iconUrl = item.getProperty(ItemPropertyNames.ICON_URL);
iconUrl = normalizeIconUrl(iconUrl);
registerMapping(idStr2Id, iconUrl, item);
}
/*
List<String> keys=new ArrayList<String>(idStr2Id.keySet());
Collections.sort(keys);
for(String key : keys)
{
List<Item> itemsForId=idStr2Id.get(key);
//if (ids.size()>1)
{
System.out.println("*************** "+key+" ******************");
Collections.sort(items,new ItemIdComparator());
for(Item item : itemsForId)
{
System.out.println("\t"+item);
}
}
}
*/
return idStr2Id;
}
Aggregations