use of delta.games.lotro.lore.items.Armour in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeArmours.
private Item normalizeArmours(Item item) {
int id = item.getIdentifier();
String category = item.getSubCategory();
Armour armour = null;
if ("Heavy Armour".equals(category)) {
armour = checkArmour(item);
ArmourType previous = armour.getArmourType();
if ((previous != null) && (previous != ArmourType.HEAVY)) {
System.out.println("ID: " + id + ": armour type conflict: was=" + previous + ", should be=" + ArmourType.HEAVY);
}
armour.setArmourType(ArmourType.HEAVY);
armour.setSubCategory(null);
} else if ("Medium Armour".equals(category)) {
armour = checkArmour(item);
ArmourType previous = armour.getArmourType();
if ((previous != null) && (previous != ArmourType.MEDIUM)) {
System.out.println("ID: " + id + ": armour type conflict: was=" + previous + ", should be=" + ArmourType.MEDIUM);
}
armour.setArmourType(ArmourType.MEDIUM);
armour.setSubCategory(null);
} else if ("Light Armour".equals(category)) {
armour = checkArmour(item);
ArmourType previous = armour.getArmourType();
if ((previous != null) && (previous != ArmourType.LIGHT)) {
System.out.println("ID: " + id + ": armour type conflict: was=" + previous + ", should be=" + ArmourType.LIGHT);
}
armour.setArmourType(ArmourType.LIGHT);
armour.setSubCategory(null);
} else if ("Shield".equals(category)) {
armour = checkArmour(item);
ArmourType previous = armour.getArmourType();
if ((previous == ArmourType.LIGHT) || (previous == null)) {
armour.setArmourType(ArmourType.SHIELD);
}
armour.setSubCategory(null);
armour.setEquipmentLocation(EquipmentLocation.OFF_HAND);
armour.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
armour.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
} else if ("Heavy Shield".equals(category)) {
armour = checkArmour(item);
armour.setArmourType(ArmourType.HEAVY_SHIELD);
armour.setSubCategory(null);
armour.setEquipmentLocation(EquipmentLocation.OFF_HAND);
armour.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
armour.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
} else if ("Warden's Shield".equals(category)) {
armour = checkArmour(item);
armour.setArmourType(ArmourType.WARDEN_SHIELD);
armour.setSubCategory(null);
armour.setEquipmentLocation(EquipmentLocation.OFF_HAND);
armour.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
armour.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
} else if ("33".equals(category)) {
armour = checkArmour(item);
ArmourType type = armour.getArmourType();
if (type == null) {
String name = armour.getName();
if (name.toLowerCase().contains("warden")) {
armour.setArmourType(ArmourType.WARDEN_SHIELD);
} else if ((name.indexOf("Heavy Shield") != -1) || (name.indexOf("Bulwark") != -1) || (name.indexOf("Battle-shield") != -1)) {
armour.setArmourType(ArmourType.HEAVY_SHIELD);
} else {
// Default as shield
armour.setArmourType(ArmourType.SHIELD);
}
}
type = armour.getArmourType();
if (type != null) {
armour.setSubCategory(null);
armour.setEquipmentLocation(EquipmentLocation.OFF_HAND);
armour.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
armour.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
if (type == ArmourType.WARDEN_SHIELD) {
armour.setRequiredClass(CharacterClass.WARDEN);
}
}
}
Item ret = (armour != null) ? armour : item;
ret = normalizeArmour(ret, "3", "Chest", EquipmentLocation.CHEST);
ret = normalizeArmour(ret, "5", "Hands", EquipmentLocation.HAND);
ret = normalizeArmour(ret, "6", "Shoulders", EquipmentLocation.SHOULDER);
ret = normalizeArmour(ret, "7", "Head", EquipmentLocation.HEAD);
ret = normalizeArmour(ret, "15", "Leggings", EquipmentLocation.LEGS);
ret = normalizeArmour(ret, "23", "Boots", EquipmentLocation.FEET);
ret = normalizeArmour(ret, "45", "Cloak", EquipmentLocation.BACK);
// => Shield (any type)
return ret;
}
use of delta.games.lotro.lore.items.Armour in project lotro-tools by dmorcellet.
the class ItemNormalization method checkArmour.
private Armour checkArmour(Item item) {
Armour ret = null;
if (item instanceof Armour) {
ret = (Armour) item;
} else {
ret = new Armour();
ret.copyFrom(item);
}
return ret;
}
use of delta.games.lotro.lore.items.Armour 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.Armour in project lotro-tools by dmorcellet.
the class MergeWithTulkasNew method mergeItems.
private Item mergeItems(Item source, Item tulkas) {
int id = source.getIdentifier();
Item result = source;
// Check types
if (source.getClass() != tulkas.getClass()) {
// System.out.println("ID: " + id+": type conflict: tulkas=" + tulkas.getClass() + ", source=" + source.getClass());
if (source.getClass() == Item.class) {
if (tulkas instanceof Weapon) {
Weapon weapon = new Weapon();
Weapon tulkasWeapon = (Weapon) tulkas;
result = weapon;
weapon.copyFrom(source);
weapon.setMinDamage(tulkasWeapon.getMinDamage());
weapon.setMaxDamage(tulkasWeapon.getMaxDamage());
weapon.setDPS(tulkasWeapon.getDPS());
weapon.setDamageType(tulkasWeapon.getDamageType());
weapon.setWeaponType(tulkasWeapon.getWeaponType());
} else if (tulkas instanceof Armour) {
Armour armour = new Armour();
Armour tulkasArmour = (Armour) tulkas;
result = armour;
armour.copyFrom(source);
armour.setArmourValue(tulkasArmour.getArmourValue());
armour.setArmourType(tulkasArmour.getArmourType());
}
} else {
System.out.println("Unmanaged cast");
}
} else {
result = source;
}
String sourceName = source.getName();
// Name
{
String tulkasName = tulkas.getName();
if (!tulkasName.equals(sourceName)) {
// System.out.println("ID: " + id+": name conflict: tulkas=" + tulkasName + ", source=" + sourceName);
if (tulkasName != null) {
result.setProperty(ItemPropertyNames.OLD_TULKAS_NAME, tulkasName);
}
}
}
// Required level
{
Integer tulkasMinLevel = tulkas.getMinLevel();
Integer sourceMinLevel = result.getMinLevel();
boolean conflict = false;
if (tulkasMinLevel != null) {
if (sourceMinLevel == null) {
// conflict=true;
result.setMinLevel(tulkasMinLevel);
} else {
if (tulkasMinLevel.intValue() != sourceMinLevel.intValue()) {
conflict = true;
result.setMinLevel(tulkasMinLevel);
}
}
} else {
if (sourceMinLevel != null) {
conflict = true;
result.setMinLevel(sourceMinLevel);
}
}
if (conflict) {
// System.out.println("ID: " + id+": min level conflict: tulkas=" + tulkasMinLevel + ", source=" + sourceMinLevel);
}
}
// Item level
{
result.setItemLevel(tulkas.getItemLevel());
}
// Required class
{
CharacterClass tulkasClass = tulkas.getRequiredClass();
CharacterClass sourceClass = source.getRequiredClass();
if (tulkasClass != sourceClass) {
if ((tulkasClass != null) && (sourceClass == null)) {
result.setRequiredClass(tulkasClass);
} else {
System.out.println("ID: " + id + ": required class conflict: tulkas=" + tulkasClass + ", source=" + sourceClass);
}
}
}
// Quality
{
ItemQuality tulkasQuality = tulkas.getQuality();
ItemQuality sourceQuality = source.getQuality();
if (tulkasQuality != sourceQuality) {
// Use source quality since it comes from tulkas index (17.1), which is more recent that tulkas new (13.1)
result.setQuality(sourceQuality);
// System.out.println("ID: " + id+": quality conflict: tulkas=" + tulkasQuality + ", source=" + sourceQuality);
}
}
// Bonus
if (result != source) {
result.getBonus().clear();
result.getBonus().addAll(source.getBonus());
}
// Stats
result.getStats().setStats(tulkas.getStats());
// Slot
{
EquipmentLocation tulkasSlot = tulkas.getEquipmentLocation();
EquipmentLocation sourceSlot = source.getEquipmentLocation();
if (tulkasSlot != sourceSlot) {
// Use tulkas slot since it is not set in source
result.setEquipmentLocation(tulkasSlot);
// System.out.println("ID: " + id+": slot conflict: tulkas=" + tulkasSlot + ", source=" + sourceSlot);
}
}
return result;
}
use of delta.games.lotro.lore.items.Armour in project lotro-tools by dmorcellet.
the class ItemPageParser method parseItemDescription.
private void parseItemDescription(Element itemTooltip) {
// Name
String name = findName(itemTooltip);
// Find out type of item
Armour armour = null;
// Armor?
// <div class="itemarmor">1130 Armour Value</div>
String armorStr = getTagContent(itemTooltip, "itemarmor");
Weapon weapon = null;
// Weapon?
// <div class="itemdps">126.5 DPS</div>
String dpsStr = getTagContent(itemTooltip, "itemdps");
if (armorStr != null) {
// Armour!
armour = new Armour();
_item = armour;
Integer armourValue = getArmour(armorStr);
if (armourValue != null) {
armour.setArmourValue(armourValue.intValue());
}
String armourTypeStr = getTagContent(itemTooltip, "itemtype");
ArmourType armourType = ArmourType.getArmourTypeByName(armourTypeStr);
if (armourType == null) {
// Assume light armour...
armourType = ArmourType.LIGHT;
_logger.warn("Unknown armour type: " + armourTypeStr + " (name=" + name + ")");
}
armour.setArmourType(armourType);
} else if (dpsStr != null) {
// Weapon!
weapon = new Weapon();
_item = weapon;
Float dpsValue = getDPS(dpsStr);
if (dpsValue != null) {
weapon.setDPS(dpsValue.floatValue());
}
String weaponTypeStr = getTagContent(itemTooltip, "itemtype");
if (weaponTypeStr != null) {
WeaponType type = WeaponType.getWeaponTypeByName(weaponTypeStr);
if (type != null) {
weapon.setWeaponType(type);
} else {
_logger.warn("Unknown weapon type: " + weaponTypeStr + " (name=" + name + ")");
}
}
} else {
_item = new Item();
}
// Icon
// <div class="itemicon"><img src="http://content.turbine.com/sites/lorebook.lotro.com/images/icons/item/tool/eq_c_craft_tool_voc_explorer_tier6.png"></div>
String url = getIconURL(itemTooltip);
// Name
_item.setName(name);
if (url != null) {
_item.setIconURL(url);
}
// Item sub-category
// <div class="itemtype">Craft Tool</div>
// TODO: duplicated with weapon type and armor type...
String subCategory = getTagContent(itemTooltip, "itemtype");
_item.setSubCategory(subCategory);
// Uniqueness
// <div class="itemunique"></div>
String uniqueStr = getTagContent(itemTooltip, "itemunique");
if ("Unique".equalsIgnoreCase(uniqueStr)) {
_item.setUnique(true);
}
// Item bind
// <div class="itembind">Bind on Equip</div>
String itemBindStr = getTagContent(itemTooltip, "itembind");
ItemBinding binding = getBinding(itemBindStr);
_item.setBinding(binding);
// Damage:
// <div class="itemdamage">197 - 359 Common Damage</div>
String damage = getTagContent(itemTooltip, "itemdamage");
if (damage != null) {
try {
if (damage.endsWith("Damage")) {
String tmp = damage.substring(0, damage.length() - 6).trim();
String[] split = tmp.split(" ", 4);
int minDamage = Integer.parseInt(split[0]);
int maxDamage = Integer.parseInt(split[2]);
String typeStr = split[3];
DamageType type = DamageType.getDamageTypeByName(typeStr);
if (type == null) {
type = DamageType.COMMON;
_logger.warn("Unmanaged damage type [" + typeStr + "]");
}
weapon.setMinDamage(minDamage);
weapon.setMaxDamage(maxDamage);
weapon.setDamageType(type);
}
} catch (Exception e) {
_logger.error("Damage parsing exception on [" + damage + "]", e);
}
}
// Bonuses
// <div class="itemes">
// <div class="iteme">
// <div>-3s Forester Chopping Duration</div>
// </div>
// ...
// </div>
List<String> bonuses = new ArrayList<String>();
Element itemsContainer = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(itemTooltip, HTMLElementName.DIV, "class", "itemes");
if (itemsContainer != null) {
List<Element> itemsList = JerichoHtmlUtils.findElementsByTagNameAndAttributeValue(itemsContainer, HTMLElementName.DIV, "class", "iteme");
for (Element item : itemsList) {
List<Element> children = item.getChildElements();
if (children != null) {
for (Element child : children) {
String line = JerichoHtmlUtils.getTagContents(child, HTMLElementName.DIV);
bonuses.add(line);
}
}
}
}
_item.setBonus(bonuses);
// TODO <div class="itemmsi">+5 Damage to The Dead</div>
String msi = getTagContent(itemTooltip, "itemmsi");
if ((msi != null) && (msi.length() > 0)) {
_logger.warn("Unmanaged itemmsi [" + msi + "] for " + _item.getName());
}
// Item set
ItemsSet set = parseItemsSet(itemTooltip);
if (set != null) {
_item.setSetKey(set.getKey());
_item.setItemsSet(set);
}
// Possible legacies TODO
/*
<div class="itemes">Possible Initial Legacies:</div>
<div>Focus Bow Critical Multiplier (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>Focus Bow Power Cost (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
Induction Bow Critical Multiplier (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
<div>
Merciful Shot Cooldown (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
Quick Shot Critical Chance (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
Ranged Skill Block Chance Modifier (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
Ranged Skill Evade Chance Modifier (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
<div>
Strength Quick Shot Slow (Tier(s):
<span class="legacytier rare">4</span>
,
<span class="legacytier incomparable">5</span>
,
<span class="legacytier incomparable">6</span>
)
</div>
*
*/
// Item durability:
// - durability
// <div class="itemdurability">Durability 60 / 60</div>
String durabilityStr = getTagContent(itemTooltip, "itemdurability");
Integer durability = getDurability(durabilityStr);
_item.setDurability(durability);
// - sturdiness
// <div class="itemsturdiness">Tough</div>
String sturdinessStr = getTagContent(itemTooltip, "itemsturdiness");
ItemSturdiness sturdiness = getSturdiness(sturdinessStr);
_item.setSturdiness(sturdiness);
// Item requirements
List<Element> requirements = JerichoHtmlUtils.findElementsByTagNameAndAttributeValue(itemTooltip, HTMLElementName.DIV, "class", "itemrequirement");
for (Element requirement : requirements) {
// String contents=getTagContent(requirement,"itemrequirement");
String contents = CharacterReference.decodeCollapseWhiteSpace(requirement.getContent());
if (contents.contains("Minimum Level")) {
// - minimum level
// <div class="itemrequirement">Minimum Level: 55</div>
String minLevelStr = getTagContent(itemTooltip, "itemrequirement");
Integer minLevel = getMinLevel(minLevelStr);
_item.setMinLevel(minLevel);
} else if (contents.contains("Class")) {
// - class
String className = parseClassRequirement(requirement);
if (className != null) {
CharacterClass cClass = CharacterClass.getByName(className);
_item.setRequiredClass(cClass);
}
}
}
// Description
// <div class="itemdescription">A collection of indispensable tools for tailors, foresters, and prospectors.</div>
// String description=getTagContent(itemTooltip,"");
Element element = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(itemTooltip, HTMLElementName.DIV, "class", "itemdescription");
if (element != null) {
String description = JerichoHtmlUtils.getTextFromTag(element);
_item.setDescription(description);
}
// Money
// <div class="itemworth">
Element worth = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(itemTooltip, HTMLElementName.DIV, "class", "itemworth");
if (worth != null) {
Money m = parseMoneyReward(worth);
_item.setValue(m);
}
// Stackability
// <div class="itemstacksize">Stacks to 100</div>
String stackabilityStr = getTagContent(itemTooltip, "itemstacksize");
Integer stackSize = getStackSize(stackabilityStr);
_item.setStackMax(stackSize);
/*
// Item category: Armour, Tool, ...
private ItemCategory _category;
// Item identifier: "Jacket_of_the_Impossible_Shot", ...
private String _id;
*/
}
Aggregations