Search in sources :

Example 11 with EquipmentLocation

use of delta.games.lotro.lore.items.EquipmentLocation in project lotro-tools by dmorcellet.

the class ItemNormalization method normalizeWeapons.

private Item normalizeWeapons(Item item) {
    item = setWeaponTypeFromCategory(item, "10", WeaponType.DAGGER);
    item = setWeaponTypeFromCategory(item, "36", WeaponType.HALBERD);
    item = setWeaponTypeFromCategory(item, "110", WeaponType.JAVELIN);
    item = setWeaponTypeFromCategory(item, "29", WeaponType.CROSSBOW);
    item = setWeaponTypeFromCategory(item, "46", WeaponType.SPEAR);
    item = setWeaponTypeFromCategory(item, "34", WeaponType.STAFF);
    // item=setWeaponTypeFromCategory(item,"12",WeaponType.ONE_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "One-handed Axe", WeaponType.ONE_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "Two-handed Axe", WeaponType.TWO_HANDED_AXE);
    item = setWeaponTypeFromCategory(item, "One-handed Sword", WeaponType.ONE_HANDED_SWORD);
    item = setWeaponTypeFromCategory(item, "Two-handed Sword", WeaponType.TWO_HANDED_SWORD);
    item = setWeaponTypeFromCategory(item, "One-handed Club", WeaponType.ONE_HANDED_CLUB);
    item = setWeaponTypeFromCategory(item, "Rune-stone", WeaponType.RUNE_STONE);
    item = setWeaponTypeFromCategory(item, "Staff", WeaponType.STAFF);
    item = setWeaponTypeFromCategory(item, "Dagger", WeaponType.DAGGER);
    if (item instanceof Weapon) {
        Weapon weapon = (Weapon) item;
        WeaponType type = weapon.getWeaponType();
        if (type != null) {
            EquipmentLocation loc = type.isRanged() ? EquipmentLocation.RANGED_ITEM : EquipmentLocation.MAIN_HAND;
            weapon.setEquipmentLocation(loc);
            item.removeProperty(ItemPropertyNames.TULKAS_CATEGORY);
            item.removeProperty(ItemPropertyNames.LEGACY_CATEGORY);
            item.setSubCategory(null);
            // Fix problem with Captains having Crossbows
            if (type == WeaponType.CROSSBOW) {
                if (item.getRequiredClass() == CharacterClass.CAPTAIN) {
                    item.setRequiredClass(null);
                }
            }
        }
    }
    return item;
}
Also used : EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) WeaponType(delta.games.lotro.lore.items.WeaponType) Weapon(delta.games.lotro.lore.items.Weapon) LegendaryWeapon(delta.games.lotro.lore.items.legendary.LegendaryWeapon)

Example 12 with EquipmentLocation

use of delta.games.lotro.lore.items.EquipmentLocation 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;
}
Also used : LegendaryItem(delta.games.lotro.lore.items.legendary.LegendaryItem) Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation)

Example 13 with EquipmentLocation

use of delta.games.lotro.lore.items.EquipmentLocation 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;
}
Also used : FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) Item(delta.games.lotro.lore.items.Item) Armour(delta.games.lotro.lore.items.Armour) FixedDecimalsInteger(delta.games.lotro.utils.FixedDecimalsInteger) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet) CharacterClass(delta.games.lotro.common.CharacterClass)

Example 14 with EquipmentLocation

use of delta.games.lotro.lore.items.EquipmentLocation in project lotro-tools by dmorcellet.

the class ScalableStatChartController method main.

/**
 * Main method for this test/tool.
 * @param args Not used.
 */
public static void main(String[] args) {
    ArmourType[] types = { ArmourType.HEAVY, ArmourType.MEDIUM, ArmourType.LIGHT };
    EquipmentLocation[] locations = { EquipmentLocation.FEET, EquipmentLocation.LEGS, EquipmentLocation.CHEST, EquipmentLocation.SHOULDER, EquipmentLocation.HEAD, EquipmentLocation.HAND, EquipmentLocation.BACK };
    for (ArmourType type : types) {
        for (EquipmentLocation location : locations) {
            JPanel panel = GuiFactory.buildBackgroundPanel(new BorderLayout());
            ScalableStatChartController chartController = new ScalableStatChartController(type, location);
            JPanel chartPanel = chartController.getPanel();
            panel.add(chartPanel, BorderLayout.CENTER);
            JFrame frame = new JFrame();
            frame.setTitle(chartController.getTitle());
            frame.getContentPane().add(chartPanel);
            frame.pack();
            frame.setVisible(true);
        }
    }
}
Also used : JPanel(javax.swing.JPanel) ArmourType(delta.games.lotro.lore.items.ArmourType) BorderLayout(java.awt.BorderLayout) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) JFrame(javax.swing.JFrame)

Example 15 with EquipmentLocation

use of delta.games.lotro.lore.items.EquipmentLocation in project lotro-tools by dmorcellet.

the class ScalableItemsFinder method generateItems.

private Map<String, Item> generateItems() {
    Map<String, Item> ret = new HashMap<String, Item>();
    for (int i = 0; i < PREFIXES.length; i++) {
        ItemQuality quality = PREFIX_QUALITY[i];
        String prefix = PREFIXES[i];
        for (String[] items : ITEMS) {
            for (int j = 0; j < items.length; j++) {
                String itemName = items[j];
                EquipmentLocation location = null;
                ArmourType armourType = null;
                WeaponType weaponType = null;
                if (items == JEWELS) {
                    location = JEWEL_LOCATIONS[j];
                } else if (items == ARMOURS) {
                    location = ARMOUR_LOCATIONS[j];
                    armourType = ARMOUR_TYPES[j];
                } else if (items == SHIELDS) {
                    location = EquipmentLocation.OFF_HAND;
                    armourType = SHIELD_TYPES[j];
                } else if (items == WEAPONS) {
                    weaponType = WEAPON_TYPES[j];
                    location = weaponType.isRanged() ? EquipmentLocation.RANGED_ITEM : EquipmentLocation.MAIN_HAND;
                }
                for (String adjective : ADJECTIVES) {
                    for (String suffix : SUFFIXES) {
                        String name = generateName(prefix, adjective, itemName, suffix);
                        Item item = null;
                        if (armourType != null) {
                            Armour armour = new Armour();
                            armour.setArmourType(armourType);
                            item = armour;
                        } else if (weaponType != null) {
                            Weapon weapon = new Weapon();
                            weapon.setWeaponType(weaponType);
                            item = weapon;
                        } else {
                            item = new Item();
                        }
                        item.setName(name);
                        item.setQuality(quality);
                        item.setEquipmentLocation(location);
                        ret.put(name, item);
                    }
                }
            }
        }
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) ArmourType(delta.games.lotro.lore.items.ArmourType) Armour(delta.games.lotro.lore.items.Armour) HashMap(java.util.HashMap) EquipmentLocation(delta.games.lotro.lore.items.EquipmentLocation) WeaponType(delta.games.lotro.lore.items.WeaponType) ItemQuality(delta.games.lotro.lore.items.ItemQuality) Weapon(delta.games.lotro.lore.items.Weapon)

Aggregations

EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)15 Armour (delta.games.lotro.lore.items.Armour)10 Item (delta.games.lotro.lore.items.Item)8 ItemQuality (delta.games.lotro.lore.items.ItemQuality)7 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)6 CharacterClass (delta.games.lotro.common.CharacterClass)6 ArmourType (delta.games.lotro.lore.items.ArmourType)6 WeaponType (delta.games.lotro.lore.items.WeaponType)6 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)6 Weapon (delta.games.lotro.lore.items.Weapon)5 STAT (delta.games.lotro.character.stats.STAT)3 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)3 HashMap (java.util.HashMap)3 DamageType (delta.games.lotro.lore.items.DamageType)2 LegendaryWeapon (delta.games.lotro.lore.items.legendary.LegendaryWeapon)2 SlicesBasedItemStatsProvider (delta.games.lotro.lore.items.stats.SlicesBasedItemStatsProvider)2 ArrayList (java.util.ArrayList)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 IntegerHolder (delta.common.utils.misc.IntegerHolder)1 ArmourTypeComparator (delta.games.lotro.lore.items.comparators.ArmourTypeComparator)1