Search in sources :

Example 91 with Item

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

the class MergeWithTulkasNew method doIt.

/**
 * Do the job.
 */
public void doIt() {
    File file1 = new File("data/items/tmp/itemsLegacy+TulkasIndex.xml");
    HashMap<Integer, Item> sourceItems = loadItemsFile(file1);
    System.out.println(sourceItems.size());
    File file2 = new File("data/items/tmp/itemsTulkas13.1.xml");
    HashMap<Integer, Item> tulkasItems = loadItemsFile(file2);
    System.out.println(tulkasItems.size());
    HashMap<Integer, Item> mergeResult = new HashMap<Integer, Item>();
    for (Integer id : sourceItems.keySet()) {
        Item sourceItem = sourceItems.get(id);
        Item result = sourceItem;
        Item tulkasItem = tulkasItems.get(id);
        if (tulkasItem != null) {
            result = mergeItems(sourceItem, tulkasItem);
            tulkasItems.remove(id);
        }
        mergeResult.put(Integer.valueOf(result.getIdentifier()), result);
    }
    System.out.println(tulkasItems.size() + ": " + tulkasItems);
    File toFile = new File("data/items/tmp/itemsLegacy+Tulkas.xml").getAbsoluteFile();
    List<Item> items = new ArrayList<Item>(mergeResult.values());
    ItemXMLWriter.writeItemsFile(toFile, items);
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) File(java.io.File)

Example 92 with Item

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

the class MergeWithTulkasNew method loadItemsFile.

private HashMap<Integer, Item> loadItemsFile(File file) {
    List<Item> items = ItemSaxParser.parseItemsFile(file);
    HashMap<Integer, Item> ret = new HashMap<Integer, Item>();
    for (Item item : items) {
        ret.put(Integer.valueOf(item.getIdentifier()), item);
    }
    return ret;
}
Also used : Item(delta.games.lotro.lore.items.Item) HashMap(java.util.HashMap)

Example 93 with Item

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

the class MainTestItemParsing method doIt.

private void doIt() {
    String[] urls = getTestURLs();
    List<Item> items = parseItems();
    int index = 0;
    for (Item item : items) {
        if (item != null) {
            System.out.println(item.dump());
        } else {
            System.out.println("Item [" + urls[index] + "] is null!");
        }
        index++;
    }
}
Also used : Item(delta.games.lotro.lore.items.Item)

Example 94 with Item

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

the class MainCheckScalableItems method doIt.

private void doIt() {
    ScalableItemsSamplesLoader loader = new ScalableItemsSamplesLoader();
    List<Item> items = loader.loadTable("samples.txt");
    for (Item item : items) {
        System.out.println(item.dump());
    }
}
Also used : Item(delta.games.lotro.lore.items.Item)

Example 95 with Item

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

the class ScalableItemsSamplesLoader method buildItemFromLine.

private Item buildItemFromLine(String line) {
    String[] fields = StringSplitter.split(line, '\t');
    // Stats
    BasicStatsSet stats = new BasicStatsSet();
    int nbStats = STATS.length;
    for (int i = 0; i < nbStats; i++) {
        if ((STATS[i] != null) && (fields.length > i)) {
            String valueStr = fields[i];
            FixedDecimalsInteger value = StatValueParser.parseStatValue(valueStr);
            if (value != null) {
                stats.addStat(STATS[i], value);
            }
        }
    }
    // Item level
    Integer itemLevel = NumericTools.parseInteger(fields[ITEM_LEVEL_INDEX]);
    // Build item
    FixedDecimalsInteger armorStat = stats.getStat(STAT.ARMOUR);
    Item item = null;
    Armour armour = null;
    if (armorStat != null) {
        armour = new Armour();
        item = armour;
        armour.setArmourValue(armorStat.intValue());
        stats.removeStat(STAT.ARMOUR);
    } else {
        item = new Item();
    }
    // Item level
    item.setItemLevel(itemLevel);
    // Name
    String name = fields[NAME_INDEX];
    name = name.trim();
    item.setName(name);
    // Slots
    String slotStr = fields[SLOTS_INDEX];
    int nbSlots = NumericTools.parseInt(slotStr, 0);
    item.setEssenceSlots(nbSlots);
    // Min level
    String requiredLevelStr = fields[REQUIRED_LEVEL_INDEX];
    Integer requiredLevel = NumericTools.parseInteger(requiredLevelStr);
    if (requiredLevelStr != null) {
        item.setMinLevel(requiredLevel);
    }
    // Stats
    item.getStats().setStats(stats);
    return item;
}
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) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Aggregations

Item (delta.games.lotro.lore.items.Item)105 ArrayList (java.util.ArrayList)29 HashMap (java.util.HashMap)19 File (java.io.File)17 FixedDecimalsInteger (delta.games.lotro.utils.FixedDecimalsInteger)16 Armour (delta.games.lotro.lore.items.Armour)15 LegendaryItem (delta.games.lotro.lore.items.legendary.LegendaryItem)12 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)11 ArmourType (delta.games.lotro.lore.items.ArmourType)8 EquipmentLocation (delta.games.lotro.lore.items.EquipmentLocation)8 Weapon (delta.games.lotro.lore.items.Weapon)8 JMenuItem (javax.swing.JMenuItem)8 EQUIMENT_SLOT (delta.games.lotro.character.CharacterEquipment.EQUIMENT_SLOT)7 CharacterClass (delta.games.lotro.common.CharacterClass)7 ItemsManager (delta.games.lotro.lore.items.ItemsManager)7 CharacterEquipment (delta.games.lotro.character.CharacterEquipment)6 ItemsStash (delta.games.lotro.character.storage.ItemsStash)6 WeaponType (delta.games.lotro.lore.items.WeaponType)6 ItemQuality (delta.games.lotro.lore.items.ItemQuality)5 List (java.util.List)5