Search in sources :

Example 1 with LegendaryItem

use of delta.games.lotro.lore.items.legendary.LegendaryItem 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;
}
Also used : EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) WeaponType(delta.games.lotro.lore.items.WeaponType) LegendaryWeapon(delta.games.lotro.lore.items.legendary.LegendaryWeapon) LegendaryItem(delta.games.lotro.lore.items.legendary.LegendaryItem) ItemQuality(delta.games.lotro.lore.items.ItemQuality) CharacterClass(delta.games.lotro.common.CharacterClass)

Aggregations

CharacterClass (delta.games.lotro.common.CharacterClass)1 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)1 ItemQuality (delta.games.lotro.lore.items.ItemQuality)1 WeaponType (delta.games.lotro.lore.items.WeaponType)1 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)1 LegendaryWeapon (delta.games.lotro.lore.items.legendary.LegendaryWeapon)1