use of delta.games.lotro.lore.items.ItemQuality in project lotro-companion by dmorcellet.
the class ItemFilterController method build.
private JPanel build() {
JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
JPanel line1Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
// Quality
{
JPanel qualityPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
qualityPanel.add(GuiFactory.buildLabel("Quality:"));
_quality = ItemUiTools.buildQualityCombo();
ItemSelectionListener<ItemQuality> qualityListener = new ItemSelectionListener<ItemQuality>() {
@Override
public void itemSelected(ItemQuality quality) {
_qualityFilter.setQuality(quality);
filterUpdated();
}
};
_quality.addListener(qualityListener);
qualityPanel.add(_quality.getComboBox());
line1Panel.add(qualityPanel);
}
// Label filter
{
JPanel containsPanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
containsPanel.add(GuiFactory.buildLabel("Label filter:"));
_contains = GuiFactory.buildTextField("");
_contains.setColumns(20);
containsPanel.add(_contains);
TextListener listener = new TextListener() {
@Override
public void textChanged(String newText) {
if (newText.length() == 0)
newText = null;
_nameFilter.setPattern(newText);
filterUpdated();
}
};
_textController = new DynamicTextEditionController(_contains, listener);
line1Panel.add(containsPanel);
}
// Line 2: weapon type, armour type, shield type
JPanel line2Panel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
// Weapon type
if (_weaponType != null) {
JPanel weaponTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING, 5, 0));
weaponTypePanel.add(GuiFactory.buildLabel("Weapon type:"));
ItemSelectionListener<WeaponType> weaponTypeListener = new ItemSelectionListener<WeaponType>() {
@Override
public void itemSelected(WeaponType type) {
_weaponTypeFilter.setWeaponType(type);
// If a weapon type is selected,
if (type != null) {
// Reset the shield type combo
if (_armourType != null) {
_armourType.selectItem(null);
}
// Reset the shield type combo
if (_shieldType != null) {
_shieldType.selectItem(null);
}
}
filterUpdated();
}
};
_weaponType.addListener(weaponTypeListener);
weaponTypePanel.add(_weaponType.getComboBox());
line2Panel.add(weaponTypePanel);
}
// Armour type
if (_armourType != null) {
JPanel armourTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
armourTypePanel.add(GuiFactory.buildLabel("Armour type:"));
ItemSelectionListener<ArmourType> armourTypeListener = new ItemSelectionListener<ArmourType>() {
@Override
public void itemSelected(ArmourType type) {
_armourTypeFilter.setArmourType(type);
// If an armour type is selected,
if (type != null) {
// Reset the weapon type combo
if (_weaponType != null) {
_weaponType.selectItem(null);
}
// Reset the shield type combo
if (_shieldType != null) {
_shieldType.selectItem(null);
}
}
filterUpdated();
}
};
_armourType.addListener(armourTypeListener);
armourTypePanel.add(_armourType.getComboBox());
line2Panel.add(armourTypePanel);
}
// Shield type
if (_shieldType != null) {
JPanel shieldTypePanel = GuiFactory.buildPanel(new FlowLayout(FlowLayout.LEADING));
shieldTypePanel.add(GuiFactory.buildLabel("Shield type:"));
ItemSelectionListener<ArmourType> shieldTypeListener = new ItemSelectionListener<ArmourType>() {
@Override
public void itemSelected(ArmourType type) {
_shieldTypeFilter.setArmourType(type);
// If a shield type is selected,
if (type != null) {
// Reset the weapon type combo
if (_weaponType != null) {
_weaponType.selectItem(null);
}
// Reset the armour type combo
if (_armourType != null) {
_armourType.selectItem(null);
}
}
filterUpdated();
}
};
_shieldType.addListener(shieldTypeListener);
shieldTypePanel.add(_shieldType.getComboBox());
line2Panel.add(shieldTypePanel);
}
GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(line1Panel, c);
c = new GridBagConstraints(0, 1, 1, 1, 1.0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
panel.add(line2Panel, c);
return panel;
}
use of delta.games.lotro.lore.items.ItemQuality in project lotro-tools by dmorcellet.
the class ItemNormalization method normalizeLegendaryItem.
private Item normalizeLegendaryItem(Item item) {
String name = item.getName();
ItemQuality quality = null;
if (name == null)
return item;
if (name.endsWith("of the First Age"))
quality = ItemQuality.LEGENDARY;
else if (name.endsWith("of the Second Age"))
quality = ItemQuality.INCOMPARABLE;
else if (name.endsWith("of the Third Age"))
quality = ItemQuality.RARE;
if (quality != null) {
CharacterClass cClass = null;
if (name.indexOf("Champion") != -1)
cClass = CharacterClass.CHAMPION;
else if (name.indexOf("Captain") != -1)
cClass = CharacterClass.CAPTAIN;
else if (name.indexOf("Beorning") != -1)
cClass = CharacterClass.BEORNING;
else if (name.indexOf("Burglar") != -1)
cClass = CharacterClass.BURGLAR;
else if (name.indexOf("Guardian") != -1)
cClass = CharacterClass.GUARDIAN;
else if (name.indexOf("Hunter") != -1)
cClass = CharacterClass.HUNTER;
else if (name.indexOf("Lore-master") != -1)
cClass = CharacterClass.LORE_MASTER;
else if (name.indexOf("Minstrel") != -1)
cClass = CharacterClass.MINSTREL;
else if (name.indexOf("Rune-keeper") != -1)
cClass = CharacterClass.RUNE_KEEPER;
else if (name.indexOf("Warden") != -1)
cClass = CharacterClass.WARDEN;
WeaponType weaponType = null;
String classItemType = null;
boolean bridle = false;
if (name.indexOf("Great Club") != -1)
weaponType = WeaponType.TWO_HANDED_CLUB;
else if (name.indexOf("Great Axe") != -1)
weaponType = WeaponType.TWO_HANDED_AXE;
else if (name.indexOf("Great Sword") != -1)
weaponType = WeaponType.TWO_HANDED_SWORD;
else if (name.indexOf("Greatsword") != -1)
weaponType = WeaponType.TWO_HANDED_SWORD;
else if (name.indexOf("Great Hammer") != -1)
weaponType = WeaponType.TWO_HANDED_HAMMER;
else if (name.indexOf("Halberd") != -1)
weaponType = WeaponType.HALBERD;
else if (name.indexOf("Club") != -1)
weaponType = WeaponType.ONE_HANDED_CLUB;
else if (name.indexOf("Axe") != -1)
weaponType = WeaponType.ONE_HANDED_AXE;
else if (name.indexOf("Sword") != -1)
weaponType = WeaponType.ONE_HANDED_SWORD;
else if (name.indexOf("Hammer") != -1)
weaponType = WeaponType.ONE_HANDED_HAMMER;
else if (name.indexOf("Dagger") != -1)
weaponType = WeaponType.DAGGER;
else if (name.indexOf("Spear") != -1)
weaponType = WeaponType.SPEAR;
else if (name.indexOf("Mace") != -1)
weaponType = WeaponType.ONE_HANDED_MACE;
else if (name.indexOf("Rune-stone") != -1) {
weaponType = WeaponType.RUNE_STONE;
cClass = CharacterClass.RUNE_KEEPER;
} else if (name.indexOf("Stone") != -1) {
weaponType = WeaponType.RUNE_STONE;
cClass = CharacterClass.RUNE_KEEPER;
} else if (name.indexOf("Staff") != -1)
weaponType = WeaponType.STAFF;
else if (name.indexOf("Carving") != -1)
classItemType = "Carving";
else if (name.indexOf("Tools") != -1)
classItemType = "Tools";
else if (name.indexOf("Emblem") != -1)
classItemType = "Emblem";
else if (name.indexOf("Rune-satchel") != -1)
classItemType = "Rune-satchel";
else if (name.indexOf("Rune") != -1)
classItemType = "Rune";
else if (name.indexOf("Belt") != -1)
classItemType = "Belt";
else if (name.indexOf("Crossbow") != -1)
weaponType = WeaponType.CROSSBOW;
else if (name.indexOf("Bow") != -1)
weaponType = WeaponType.BOW;
else if (name.indexOf("Book") != -1)
classItemType = "Book";
else if (name.indexOf("Songbook") != -1)
classItemType = "Songbook";
else if (name.indexOf("Javelin") != -1)
weaponType = WeaponType.JAVELIN;
else if (name.indexOf("Bridle") != -1)
bridle = true;
if ((weaponType != null) || (classItemType != null) || (bridle)) {
item.setQuality(quality);
item.setRequiredClass(cClass);
String category = null;
if ((classItemType != null) || (bridle)) {
LegendaryItem legendaryItem;
if (item instanceof LegendaryItem) {
legendaryItem = (LegendaryItem) item;
} else {
legendaryItem = new LegendaryItem();
legendaryItem.copyFrom(item);
item = legendaryItem;
}
}
if (bridle) {
category = "Bridle";
item.setEquipmentLocation(EquipmentLocation.BRIDLE);
} else if (classItemType != null) {
category = cClass.getLabel() + ":" + classItemType;
item.setEquipmentLocation(EquipmentLocation.CLASS_SLOT);
} else if (weaponType != null) {
LegendaryWeapon weapon;
if (item instanceof LegendaryWeapon) {
weapon = (LegendaryWeapon) item;
} else {
weapon = new LegendaryWeapon();
weapon.copyFrom(item);
item = weapon;
}
EquipmentLocation location = weaponType.isRanged() ? EquipmentLocation.RANGED_ITEM : EquipmentLocation.MAIN_HAND;
weapon.setEquipmentLocation(location);
weapon.setWeaponType(weaponType);
}
item.setSubCategory(category);
item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
// System.out.println(name+", class="+cClass+", category="+category+", weapon type="+type);
}
}
return item;
}
use of delta.games.lotro.lore.items.ItemQuality 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.ItemQuality in project lotro-tools by dmorcellet.
the class TulkasItemsLoader2 method buildItem.
private Item buildItem(Integer id, HashMap<Object, Object> map) {
/*
[1879300219]={
[1]={[1]="Thirteenth Exquisite Captain's Earring of Glittering Caves";[2]="";[3]="";[4]="";};
[2]=85;[3]=136;[4]=5;[5]=1;
[6]={[12]=435;[9]=161;[1]=140;[7]=184;[14]=435;};
[14]=24;
[15]={[1]=
{[1]="Stalwart Captain's Jewelry of Helm's Deep";[2]="";[3]="";[4]="";};
[2]={1879294461,1879295053,1879299996,1879300219};};};
*/
@SuppressWarnings("unchecked") HashMap<Object, Object> map1 = (HashMap<Object, Object>) map.get(Integer.valueOf(1));
// label US
String name = (String) map1.get(Integer.valueOf(1));
WeaponType weaponType = null;
EquipmentLocation loc = null;
// slot
Integer locValue = (Integer) map.get(Integer.valueOf(5));
// 5=armor piece: 12=boots, 11=leggings, 10=gauntlets, 8=cloak, 7=shoulders, 6=Head
if (locValue != null) {
switch(locValue.intValue()) {
// Jewels
case 1:
loc = EquipmentLocation.EAR;
break;
case 2:
loc = EquipmentLocation.NECK;
break;
case 3:
loc = EquipmentLocation.POCKET;
break;
case 4:
loc = EquipmentLocation.WRIST;
break;
case 5:
loc = EquipmentLocation.FINGER;
break;
// Armours
case 6:
loc = EquipmentLocation.HEAD;
break;
case 7:
loc = EquipmentLocation.SHOULDER;
break;
case 8:
loc = EquipmentLocation.BACK;
break;
case 9:
loc = EquipmentLocation.CHEST;
break;
case 10:
loc = EquipmentLocation.HAND;
break;
case 11:
loc = EquipmentLocation.LEGS;
break;
case 12:
loc = EquipmentLocation.FEET;
break;
// Weapons/tools/class items
case 13:
loc = EquipmentLocation.MAIN_HAND;
break;
case 14:
loc = EquipmentLocation.OFF_HAND;
break;
case 15:
loc = EquipmentLocation.RANGED_ITEM;
break;
// Rune-stone
case 16:
{
loc = EquipmentLocation.MAIN_HAND;
weaponType = WeaponType.RUNE_STONE;
}
break;
default:
{
_logger.warn("Unmanaged loc value: " + locValue);
}
}
}
Item ret = null;
if (TulkasConstants.isArmor(loc)) {
Armour a = new Armour();
// 8=armour value
Integer armourValue = (Integer) map.get(Integer.valueOf(8));
if (armourValue != null) {
a.setArmourValue(armourValue.intValue());
} else {
_logger.warn("No armour value!");
}
// 7=armor type: 1=light, 2=medium, 3=heavy
Integer armourTypeInt = (Integer) map.get(Integer.valueOf(7));
ArmourType armourType = null;
if (armourTypeInt != null) {
switch(armourTypeInt.intValue()) {
case 1:
armourType = ArmourType.LIGHT;
break;
case 2:
armourType = ArmourType.MEDIUM;
break;
case 3:
armourType = ArmourType.HEAVY;
break;
default:
{
_logger.warn("Unmanaged armour type : " + armourTypeInt);
}
}
}
armourTypeInt = (Integer) map.get(Integer.valueOf(9));
if (armourTypeInt != null) {
switch(armourTypeInt.intValue()) {
case 14:
armourType = ArmourType.SHIELD;
break;
case 15:
armourType = ArmourType.HEAVY_SHIELD;
break;
case 16:
armourType = ArmourType.WARDEN_SHIELD;
break;
default:
{
_logger.warn("Unmanaged armour type : " + armourTypeInt);
}
}
}
if (loc == EquipmentLocation.BACK) {
armourType = ArmourType.LIGHT;
}
if (armourType == null) {
_logger.warn("Unknown armour type: [" + armourTypeInt + "] (name=" + name + ")");
}
a.setArmourType(armourType);
ret = a;
} else {
Integer weaponTypeInt = (Integer) map.get(Integer.valueOf(9));
if (weaponTypeInt != null) {
switch(weaponTypeInt.intValue()) {
case 1:
weaponType = WeaponType.ONE_HANDED_AXE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 2:
weaponType = WeaponType.TWO_HANDED_AXE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 3:
weaponType = WeaponType.ONE_HANDED_CLUB;
loc = EquipmentLocation.MAIN_HAND;
break;
case 4:
weaponType = WeaponType.TWO_HANDED_CLUB;
loc = EquipmentLocation.MAIN_HAND;
break;
case 5:
weaponType = WeaponType.DAGGER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 6:
weaponType = WeaponType.HALBERD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 7:
weaponType = WeaponType.ONE_HANDED_HAMMER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 8:
weaponType = WeaponType.TWO_HANDED_HAMMER;
loc = EquipmentLocation.MAIN_HAND;
break;
case 9:
weaponType = WeaponType.ONE_HANDED_MACE;
loc = EquipmentLocation.MAIN_HAND;
break;
case 10:
weaponType = WeaponType.SPEAR;
loc = EquipmentLocation.MAIN_HAND;
break;
case 11:
weaponType = WeaponType.STAFF;
loc = EquipmentLocation.MAIN_HAND;
break;
case 12:
weaponType = WeaponType.ONE_HANDED_SWORD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 13:
weaponType = WeaponType.TWO_HANDED_SWORD;
loc = EquipmentLocation.MAIN_HAND;
break;
case 17:
weaponType = WeaponType.BOW;
loc = EquipmentLocation.RANGED_ITEM;
break;
case 18:
weaponType = WeaponType.CROSSBOW;
loc = EquipmentLocation.RANGED_ITEM;
break;
case 19:
weaponType = WeaponType.JAVELIN;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Instrument
case 20:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Chisel
case 21:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
// Riffler
case 22:
weaponType = null;
loc = EquipmentLocation.RANGED_ITEM;
break;
default:
_logger.warn("ID=" + id + ": unmanaged weapon type: " + weaponTypeInt.intValue());
}
}
if (weaponType != null) {
// weapon:
Weapon w = new Weapon();
w.setWeaponType(weaponType);
// [10]=Min damage;
Integer minDMG = (Integer) map.get(Integer.valueOf(10));
if (minDMG != null) {
w.setMinDamage(minDMG.intValue());
}
// [11]=Max damage;
Integer maxDMG = (Integer) map.get(Integer.valueOf(11));
if (maxDMG != null) {
w.setMaxDamage(maxDMG.intValue());
}
// [12]=DPS;
Object dpsValue = map.get(Integer.valueOf(12));
if (dpsValue instanceof Float) {
w.setDPS(((Float) dpsValue).floatValue());
} else if (dpsValue instanceof Integer) {
w.setDPS(((Integer) dpsValue).floatValue());
}
// Damage type
DamageType type = null;
Integer damageTypeInt = (Integer) map.get(Integer.valueOf(13));
if (damageTypeInt != null) {
switch(damageTypeInt.intValue()) {
case 1:
type = DamageType.COMMON;
break;
case 2:
type = DamageType.BELERIAND;
break;
case 3:
type = DamageType.WESTERNESSE;
break;
case 4:
type = DamageType.ANCIENT_DWARF;
break;
case 5:
type = DamageType.FIRE;
break;
case 6:
type = DamageType.LIGHT;
break;
case 7:
type = DamageType.LIGHTNING;
break;
case 8:
type = DamageType.FROST;
break;
}
}
if (type == null) {
type = DamageType.COMMON;
_logger.warn("Unmanaged damage type [" + damageTypeInt + "]");
}
w.setDamageType(type);
ret = w;
}
if (ret == null) {
ret = new Item();
}
}
// Name
ret.setName(name);
// Slot
ret.setEquipmentLocation(loc);
// Required level
Integer requiredLevel = (Integer) map.get(Integer.valueOf(2));
if ((requiredLevel != null) && (requiredLevel.intValue() > 0)) {
ret.setMinLevel(requiredLevel);
}
// Item level
Integer itemLevel = (Integer) map.get(Integer.valueOf(3));
if ((itemLevel != null) && (itemLevel.intValue() > 0)) {
ret.setItemLevel(itemLevel);
}
// Class
CharacterClass cClass = null;
Integer classInt = (Integer) map.get(Integer.valueOf(14));
if (classInt != null) {
switch(classInt.intValue()) {
case 40:
cClass = CharacterClass.BURGLAR;
break;
case 24:
cClass = CharacterClass.CAPTAIN;
break;
case 172:
cClass = CharacterClass.CHAMPION;
break;
case 23:
cClass = CharacterClass.GUARDIAN;
break;
case 162:
cClass = CharacterClass.HUNTER;
break;
case 185:
cClass = CharacterClass.LORE_MASTER;
break;
case 31:
cClass = CharacterClass.MINSTREL;
break;
case 193:
cClass = CharacterClass.RUNE_KEEPER;
break;
case 194:
cClass = CharacterClass.WARDEN;
break;
default:
{
_logger.warn("Unmanaged class [" + classInt + "]");
}
}
}
if (cClass != null) {
ret.setRequiredClass(cClass);
}
// Quality
ItemQuality quality = ItemQuality.COMMON;
Integer qualityInt = (Integer) map.get(Integer.valueOf(4));
if (qualityInt != null) {
switch(qualityInt.intValue()) {
case 1:
quality = ItemQuality.COMMON;
break;
case 2:
quality = ItemQuality.UNCOMMON;
break;
case 3:
quality = ItemQuality.RARE;
break;
case 4:
quality = ItemQuality.INCOMPARABLE;
break;
case 5:
quality = ItemQuality.LEGENDARY;
break;
default:
{
_logger.warn("ID: " + id + ": unmanaged quality [" + qualityInt + "]");
}
}
} else {
_logger.warn("ID: " + id + ": no quality!");
}
ret.setQuality(quality);
// Bonus
@SuppressWarnings("unchecked") HashMap<Integer, Object> bonuses = (HashMap<Integer, Object>) map.get(Integer.valueOf(6));
if (bonuses != null) {
BasicStatsSet stats = ret.getStats();
List<Integer> keys = new ArrayList<Integer>(bonuses.keySet());
Collections.sort(keys);
for (Integer key : keys) {
int index = key.intValue();
if ((index >= 0) && (index < TulkasConstants.BONUS_NAMES.length)) {
String bonusName = TulkasConstants.BONUS_NAMES[index];
Object bonusValue = bonuses.get(key);
STAT stat = TulkasConstants.STATS[index];
if (stat != null) {
FixedDecimalsInteger value = TulkasValuesUtils.fromObjectValue(bonusValue);
stats.setStat(stat, value);
} else {
_logger.warn("No stat associated to bonus: " + bonusName);
/*
BonusType type=BonusType.getByName(bonusName);
Bonus bonus=new Bonus(type,BONUS_OCCURRENCE.ALWAYS);
Object value=type.buildValue(bonusValue);
bonus.setValue(value);
bonusMgr.add(bonus);
ret.getBonus().add(bonusName+" : "+bonuses.get(key));
*/
}
bonuses.remove(key);
} else {
_logger.warn("Unmanaged index: " + index);
}
}
if (bonuses.size() > 0) {
_logger.warn("Unmanaged bonuses: " + bonuses);
}
}
return ret;
}
use of delta.games.lotro.lore.items.ItemQuality in project lotro-tools by dmorcellet.
the class ItemStatistics method showStatistics.
private void showStatistics() {
// Items
System.out.println("Items: " + _itemsCount);
// - qualities
System.out.println("- by quality:");
List<ItemQuality> itemQualities = new ArrayList<ItemQuality>(_itemsByQuality.keySet());
Collections.sort(itemQualities, new ItemQualityComparator());
for (ItemQuality itemQuality : itemQualities) {
IntegerHolder count = _itemsByQuality.get(itemQuality);
System.out.println("\t" + itemQuality + ": " + count);
}
// - sub-categories
System.out.println("- by sub-category:");
List<String> itemSubCategories = new ArrayList<String>(_itemsBySubCategory.keySet());
Collections.sort(itemSubCategories);
for (String itemSubCategory : itemSubCategories) {
IntegerHolder count = _itemsBySubCategory.get(itemSubCategory);
System.out.println("\t" + itemSubCategory + ": " + count);
}
// - slot
System.out.println("- by slot:");
List<EquipmentLocation> locations = new ArrayList<EquipmentLocation>(_itemsBySlot.keySet());
Collections.sort(locations, new EquipmentLocationComparator());
for (EquipmentLocation location : locations) {
IntegerHolder count = _itemsBySlot.get(location);
System.out.println("\t" + location + ": " + count);
List<String> names = _itemNamesBySlot.get(location);
if (location != null) {
Collections.sort(names);
for (String name : names) {
System.out.println("\t\t" + name);
}
}
}
// - scaling rules
System.out.println("- by scaling rules:");
List<String> scalingRules = new ArrayList<String>(_scalingRules.keySet());
Collections.sort(scalingRules);
for (String scalingRule : scalingRules) {
List<String> names = _scalingRules.get(scalingRule);
System.out.println("\t" + scalingRule + ": " + names.size());
if (names.size() < 300) {
Collections.sort(names);
for (String name : names) {
System.out.println("\t\t" + name);
}
}
}
// Armours
System.out.println("Armours: " + _armoursCount);
List<ArmourType> armourTypes = new ArrayList<ArmourType>(_armoursByType.keySet());
Collections.sort(armourTypes, new ArmourTypeComparator());
for (ArmourType armourType : armourTypes) {
IntegerHolder count = _armoursByType.get(armourType);
System.out.println("\t" + armourType + ": " + count);
}
// Weapons
System.out.println("Weapons: " + _weaponsCount);
List<WeaponType> weaponTypes = new ArrayList<WeaponType>(_weaponsByType.keySet());
Collections.sort(weaponTypes, new WeaponTypeComparator());
for (WeaponType weaponType : weaponTypes) {
IntegerHolder count = _weaponsByType.get(weaponType);
System.out.println("\t" + weaponType + ": " + count);
}
}
Aggregations