Search in sources :

Example 1 with RelicType

use of delta.games.lotro.lore.items.legendary.relics.RelicType in project lotro-companion by dmorcellet.

the class RelicsFilterController method setFilter.

/**
 * Set filter.
 */
public void setFilter() {
    // Type
    RelicType type = _filter.getRelicType();
    _type.selectItem(type);
    if (type != null) {
        _type.getComboBox().setEnabled(false);
    }
    // Category
    String category = _filter.getRelicCategory();
    _category.selectItem(category);
    // Name
    String contains = _filter.getNameFilter();
    if (contains != null) {
        _nameContains.setText(contains);
    }
    // Stats
    String statsContains = _filter.getStatsFilter();
    if (statsContains != null) {
        _statsContains.setText(statsContains);
    }
}
Also used : RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType)

Example 2 with RelicType

use of delta.games.lotro.lore.items.legendary.relics.RelicType in project lotro-companion by dmorcellet.

the class RelicsFilterController method buildTypesCombo.

private ComboBoxController<RelicType> buildTypesCombo() {
    final ComboBoxController<RelicType> ctrl = new ComboBoxController<RelicType>();
    ctrl.addEmptyItem("");
    for (RelicType type : RelicType.values()) {
        ctrl.addItem(type, type.getName());
    }
    ItemSelectionListener<RelicType> l = new ItemSelectionListener<RelicType>() {

        @Override
        public void itemSelected(RelicType type) {
            _filter.setRelicType(type);
            updateFilter();
        }
    };
    ctrl.addListener(l);
    return ctrl;
}
Also used : ComboBoxController(delta.common.ui.swing.combobox.ComboBoxController) ItemSelectionListener(delta.common.ui.swing.combobox.ItemSelectionListener) RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType)

Example 3 with RelicType

use of delta.games.lotro.lore.items.legendary.relics.RelicType in project lotro-tools by dmorcellet.

the class RelicsIndexPageParser method handleTableRow.

private Relic handleTableRow(Element tr, Integer level, RelicType defaultType) {
    Relic relic = null;
    List<Element> tds = JerichoHtmlUtils.findElementsByTagName(tr, HTMLElementName.TD);
    if (tds.size() == 2) {
        // Icon & name
        Element iconAndNameElement = tds.get(0);
        List<Element> as = JerichoHtmlUtils.findElementsByTagName(iconAndNameElement, HTMLElementName.A);
        Element iconElement = as.get(0);
        String iconPath = extractIcon(iconElement);
        // Name
        Element nameElement = as.get(1);
        String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.SPAN);
        if (name == null) {
            name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
        }
        // Type
        RelicType type = getTypeFromName(name);
        relic = new Relic(name, type, level);
        relic.setIconFilename(iconPath);
        // Stats
        Element statsElement = tds.get(1);
        String statsStr = JerichoHtmlUtils.getTextFromTag(statsElement);
        statsStr = statsStr.replaceAll(",", "\n");
        BasicStatsSet stats = parseStats(statsStr);
        relic.getStats().setStats(stats);
    } else if (tds.size() == 3) {
        // Icon
        Element iconElement = tds.get(0);
        String iconPath = extractIcon(iconElement);
        // Name
        Element nameElement = tds.get(1);
        String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
        // Type
        RelicType type = getTypeFromName(name);
        relic = new Relic(name, type, level);
        relic.setIconFilename(iconPath);
        // Stats
        Element statsElement = tds.get(2);
        String statsStr = JerichoHtmlUtils.getTextFromTag(statsElement);
        BasicStatsSet stats = parseStats(statsStr);
        relic.getStats().setStats(stats);
    } else if (// Retired relics
    tds.size() == 4) {
        // Icon
        Element iconElement = tds.get(0);
        String iconPath = extractIcon(iconElement);
        // Name
        Element nameElement = tds.get(1);
        String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
        if (name == null) {
            name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.TD);
        }
        if (name.startsWith("Relic:")) {
            name = name.substring(6).trim();
        }
        // Tier
        /*
      Element tierElement=tds.get(2);
      String tierStr=JerichoHtmlUtils.getTextFromTag(tierElement);
      Integer tier=null;
      if (tierStr.length()>0)
      {
        tier=NumericTools.parseInteger(tierStr.trim());
      }
      else
      {
        tier=null;
      }
      */
        relic = new Relic(name, defaultType, level);
        relic.setIconFilename(iconPath);
        // Stats
        Element statsElements = tds.get(3);
        String statsStr = JerichoHtmlUtils.getTextFromTag(statsElements);
        statsStr = statsStr.replace(", ", "\n");
        BasicStatsSet stats = parseStats(statsStr);
        relic.getStats().setStats(stats);
    } else if (// Crafted relics
    tds.size() == 5) {
        // Icon
        Element iconElement = tds.get(0);
        String iconPath = extractIcon(iconElement);
        // Name
        Element nameElement = tds.get(1);
        String name = JerichoHtmlUtils.getTagContents(nameElement, HTMLElementName.A);
        // Type
        RelicType type = RelicType.CRAFTED_RELIC;
        // Level
        Element levelElement = tds.get(2);
        String levelStr = JerichoHtmlUtils.getTextFromTag(levelElement);
        if (levelStr.length() > 0) {
            level = NumericTools.parseInteger(levelStr.trim());
        } else {
            level = null;
        }
        relic = new Relic(name, type, level);
        relic.setIconFilename(iconPath);
        // Stats
        Element statsElements = tds.get(3);
        String statsStr = JerichoHtmlUtils.getTextFromTag(statsElements);
        BasicStatsSet stats = parseStats(statsStr);
        relic.getStats().setStats(stats);
    }
    // System.out.println(relic);
    return relic;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType) Element(net.htmlparser.jericho.Element) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Example 4 with RelicType

use of delta.games.lotro.lore.items.legendary.relics.RelicType in project lotro-companion by dmorcellet.

the class RelicsEditionPanelController method actionPerformed.

@Override
public void actionPerformed(ActionEvent e) {
    Object source = e.getSource();
    // Relic icon button
    int index = _buttons.indexOf(source);
    if (index != -1) {
        Relic initialRelic = _legAttrs.getRelics().get(index);
        RelicType type = RELIC_TYPES[index];
        Relic relic = RelicChoiceWindowController.selectRelic(_parent, type, initialRelic);
        if (relic != null) {
            _legAttrs.slotRelic(relic);
            update();
        }
    } else {
        index = _deleteButtons.indexOf(source);
        if (index != -1) {
            RelicType type = RELIC_TYPES[index];
            if (type == RelicType.SETTING)
                _legAttrs.setSetting(null);
            if (type == RelicType.GEM)
                _legAttrs.setGem(null);
            if (type == RelicType.RUNE)
                _legAttrs.setRune(null);
            if (type == RelicType.CRAFTED_RELIC)
                _legAttrs.setCraftedRelic(null);
            update();
        }
    }
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType)

Example 5 with RelicType

use of delta.games.lotro.lore.items.legendary.relics.RelicType in project lotro-tools by dmorcellet.

the class LotroPlanMordorRelicsLoader method itemToRelic.

private Relic itemToRelic(Item item) {
    String name = item.getName();
    if (name.startsWith("-"))
        name = name.substring(1);
    name = name.trim();
    Integer requiredLevel = item.getItemLevel();
    RelicType type = getRelicTypeFromName(name);
    Relic relic = new Relic(name, type, requiredLevel);
    BasicStatsSet stats = relic.getStats();
    stats.setStats(item.getStats());
    return relic;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicType(delta.games.lotro.lore.items.legendary.relics.RelicType) BasicStatsSet(delta.games.lotro.character.stats.BasicStatsSet)

Aggregations

RelicType (delta.games.lotro.lore.items.legendary.relics.RelicType)5 Relic (delta.games.lotro.lore.items.legendary.relics.Relic)3 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)2 ComboBoxController (delta.common.ui.swing.combobox.ComboBoxController)1 ItemSelectionListener (delta.common.ui.swing.combobox.ItemSelectionListener)1 Element (net.htmlparser.jericho.Element)1