use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeThrownWeapon.
private Item normalizeThrownWeapon(Item item) {
String category = item.getProperty(ItemPropertyNames.TULKAS_CATEGORY);
if ("54".equals(category)) {
// Normalize to item (instead of weapon)
Item newItem = new Item();
newItem.copyFrom(item);
item = newItem;
String name = item.getName();
if (name.contains("Knife")) {
item.setRequiredClass(CharacterClass.BURGLAR);
item.setSubCategory(CharacterClass.BURGLAR.getLabel() + ":Knife");
} else if (name.contains("Throwing Hatchet")) {
item.setRequiredClass(CharacterClass.BURGLAR);
item.setSubCategory(CharacterClass.BURGLAR.getLabel() + ":Throwing Hatchet");
} else if (name.contains("Throwing Axe")) {
item.setSubCategory("Throwing Axe");
} else if (name.contains("Throwing Dagger")) {
item.setSubCategory("Throwing Dagger");
}
item.setEquipmentLocation(null);
item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
}
return item;
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeCrafting.
private Item normalizeCrafting(Item item, String categoryInt) {
Item ret = item;
// int id=item.getIdentifier();
String categoryProp = item.getProperty(ItemPropertyNames.TULKAS_CATEGORY);
if (categoryInt.equals(categoryProp)) {
String previousSubCategory = ret.getSubCategory();
if ((previousSubCategory != null) && (previousSubCategory.length() > 0) && (!previousSubCategory.equals(categoryInt))) {
// System.out.println("ID: " + id+": crafting category conflict: was=" + previousSubCategory);
}
ret.setSubCategory("Crafting Item");
ret.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
ret.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
}
return ret;
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeArmour.
private Item normalizeArmour(Item item, String categoryInt, String expectedCategoryStr, EquipmentLocation loc) {
Item ret = item;
int id = item.getIdentifier();
String categoryProp = item.getProperty(ItemPropertyNames.TULKAS_CATEGORY);
if (categoryInt.equals(categoryProp)) {
Armour armour = checkArmour(item);
ret = armour;
// Location
{
EquipmentLocation previousLoc = ret.getEquipmentLocation();
if (previousLoc == null) {
armour.setEquipmentLocation(loc);
}
/* Previous value is probably good, so keep it...
if ((previousLoc!=null) && (previousLoc!=loc))
{
String name=ret.getName();
System.out.println("ID: " + id+"("+name+"): loc conflict: was=" + previousLoc + ", should be=" + loc);
}
armour.setEquipmentLocation(loc);
*/
}
// Sub category
{
String previousSubCategory = ret.getSubCategory();
if ((previousSubCategory != null) && (previousSubCategory.length() > 0) && (!previousSubCategory.equals(categoryInt)) && (!previousSubCategory.equalsIgnoreCase(expectedCategoryStr))) {
System.out.println("ID: " + id + ": armour category conflict: was=" + previousSubCategory + ", should be=" + expectedCategoryStr);
}
armour.setSubCategory(null);
}
armour.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
armour.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
}
return ret;
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeCrafting.
private Item normalizeCrafting(Item item) {
Item ret = normalizeCrafting(item, "37");
ret = normalizeCrafting(ret, "38");
ret = normalizeCrafting(ret, "56");
ret = normalizeCrafting(ret, "188");
return ret;
}
use of delta.games.lotro.lore.items.Item in project lotro-tools by dmorcellet.
the class MergeWithLotroPlanDb method mergeItems.
private Item mergeItems(Item source, Item lotroplan) {
int id = source.getIdentifier();
Item result = source;
// Check types
if (source.getClass() != lotroplan.getClass()) {
// System.out.println("ID: " + id+": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
if (source.getClass() == Item.class) {
if (lotroplan instanceof Armour) {
Armour armour = new Armour();
Armour lotroplanArmour = (Armour) lotroplan;
result = armour;
armour.copyFrom(source);
armour.setArmourValue(lotroplanArmour.getArmourValue());
armour.setArmourType(lotroplanArmour.getArmourType());
} else {
System.out.println("ID: " + id + ": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
}
}
if (source.getClass() == Weapon.class) {
if (lotroplan.getClass() == Item.class) {
result = source;
} else {
System.out.println("ID: " + id + ": type conflict: lotroplan=" + lotroplan.getClass() + ", source=" + source.getClass());
}
}
} else {
result = source;
}
// Name
{
String sourceName = source.getName();
/*
String lotroplanName=lotroplan.getName();
if (!lotroplanName.equals(sourceName))
{
System.out.println("ID: " + id+": name conflict: lotroplan=" + lotroplanName + ", source=" + sourceName);
if (lotroplanName!=null)
{
result.setProperty(ItemPropertyNames.LOTRO_PLAN_NAME, lotroplanName);
}
}
*/
result.setName(sourceName);
}
// Armour
{
if (lotroplan instanceof Armour) {
Armour lotroplanArmour = (Armour) lotroplan;
Armour resultArmour = (Armour) result;
// Check values
{
int lotroplanArmourValue = lotroplanArmour.getArmourValue();
/*
int resultArmourValue=resultArmour.getArmourValue();
if (lotroplanArmourValue!=resultArmourValue)
{
System.out.println("ID: " + id+": armour value conflict: lotroplan=" + lotroplanArmourValue + ", source=" + resultArmourValue);
}
*/
resultArmour.setArmourValue(lotroplanArmourValue);
}
}
}
// Item level
{
Integer sourceItemLevel = source.getItemLevel();
Integer lotroPlanItemLevel = lotroplan.getItemLevel();
boolean conflict = false;
if (lotroPlanItemLevel != null) {
if (sourceItemLevel == null) {
conflict = true;
// result.setMinLevel(tulkasMinLevel);
} else {
if (lotroPlanItemLevel.intValue() != sourceItemLevel.intValue()) {
conflict = true;
// result.setMinLevel(tulkasMinLevel);
}
}
} else {
if (sourceItemLevel != null) {
conflict = true;
// result.setMinLevel(sourceMinLevel);
}
}
if (conflict) {
// System.out.println("ID: " + id+": item level conflict: lotroplan=" + lotroPlanItemLevel + ", source=" + sourceItemLevel);
}
result.setItemLevel(lotroplan.getItemLevel());
}
// Stats
{
BasicStatsSet resultStats = result.getStats();
FixedDecimalsInteger stealth = resultStats.getStat(STAT.STEALTH_LEVEL);
FixedDecimalsInteger tacticalCritMultiplier = resultStats.getStat(STAT.TACTICAL_CRITICAL_MULTIPLIER);
resultStats.clear();
resultStats.setStats(lotroplan.getStats());
if (stealth != null) {
resultStats.setStat(STAT.STEALTH_LEVEL, stealth);
}
if (tacticalCritMultiplier != null) {
resultStats.setStat(STAT.TACTICAL_CRITICAL_MULTIPLIER, tacticalCritMultiplier);
}
}
// Essence slots
result.setEssenceSlots(lotroplan.getEssenceSlots());
// Slot
EquipmentLocation lpLocation = lotroplan.getEquipmentLocation();
if (lpLocation != null) {
EquipmentLocation location = result.getEquipmentLocation();
boolean conflict = false;
if ((location != null) && (location != lpLocation)) {
conflict = true;
}
if (conflict) {
System.out.println("ID: " + id + ": slot conflict: lotroplan=" + lpLocation + ", source=" + location);
}
result.setEquipmentLocation(lpLocation);
}
// Sub-category
String lpSubCategory = lotroplan.getSubCategory();
if ((lpSubCategory != null) && (lpSubCategory.length() > 0)) {
/*
String subCategory=result.getSubCategory();
boolean conflict=false;
if ((subCategory!=null) && (!subCategory.equals(lpSubCategory)))
{
conflict=true;
}
if (conflict)
{
System.out.println("ID: " + id+": category conflict: lotroplan=" + lpSubCategory + ", source=" + subCategory);
}
*/
result.setSubCategory("LP:" + lpSubCategory);
}
// Class requirement
CharacterClass lpClass = lotroplan.getRequiredClass();
if (lpClass != null) {
CharacterClass cClass = result.getRequiredClass();
boolean conflict = false;
if ((cClass != null) && (cClass != lpClass)) {
conflict = true;
}
if (conflict) {
System.out.println("ID: " + id + ": class conflict: lotroplan=" + lpClass + ", source=" + cClass);
}
result.setRequiredClass(lpClass);
}
// Properties
result.getProperties().putAll(lotroplan.getProperties());
return result;
}
Aggregations