Search in sources :

Example 1 with Relic

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

the class MainTestShowRelicChoiceWindow method main.

/**
 * Basic main method for test.
 * @param args Not used.
 */
public static void main(String[] args) {
    RelicsManager relicsMgr = RelicsManager.getInstance();
    Relic initialRelic = relicsMgr.getAllRelics().get(10);
    System.out.println(initialRelic);
    Relic relic = RelicChoiceWindowController.selectRelic(null, RelicType.SETTING, initialRelic);
    // Relic relic=RelicChoiceWindowController.selectRelic(null,null,initialRelic);
    System.out.println(relic);
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicsManager(delta.games.lotro.lore.items.legendary.relics.RelicsManager)

Example 2 with Relic

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

the class RelicChoiceWindowController method selectRelic.

/**
 * Show the relic selection dialog.
 * @param parent Parent controller.
 * @param type Relic type to use (locks filter) or <code>null</code>.
 * @param selectedRelic Selected relic.
 * @return The selected relic or <code>null</code> if the window was closed or canceled.
 */
public static Relic selectRelic(WindowController parent, RelicType type, Relic selectedRelic) {
    RelicChoiceWindowController controller = new RelicChoiceWindowController(parent);
    Relic chosenRelic = controller.doShow(type, selectedRelic);
    return chosenRelic;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic)

Example 3 with Relic

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

the class RelicsEditionPanelController method build.

private JPanel build() {
    JPanel panel = GuiFactory.buildBackgroundPanel(new GridBagLayout());
    List<Relic> relics = _legAttrs.getRelics();
    int nbRelics = relics.size();
    _buttons = new ArrayList<JButton>();
    _relicNames = new ArrayList<JLabel>();
    _deleteButtons = new ArrayList<JButton>();
    for (int i = 0; i < nbRelics; i++) {
        // Button
        JButton relicIconButton = GuiFactory.buildButton("");
        relicIconButton.setOpaque(false);
        _buttons.add(relicIconButton);
        relicIconButton.setBorderPainted(false);
        relicIconButton.setMargin(new Insets(0, 0, 0, 0));
        GridBagConstraints c = new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
        panel.add(relicIconButton, c);
        relicIconButton.addActionListener(this);
        // Label
        JLabel relicName = GuiFactory.buildLabel("");
        _relicNames.add(relicName);
        c = new GridBagConstraints(1, i, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
        panel.add(relicName, c);
        // Delete button
        ImageIcon icon = IconsManager.getIcon("/resources/gui/icons/cross.png");
        JButton deleteButton = GuiFactory.buildButton("");
        deleteButton.setIcon(icon);
        deleteButton.setMargin(new Insets(0, 0, 0, 0));
        deleteButton.setContentAreaFilled(false);
        deleteButton.setBorderPainted(false);
        deleteButton.addActionListener(this);
        _deleteButtons.add(deleteButton);
        c = new GridBagConstraints(2, i, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
        panel.add(deleteButton, c);
    }
    return panel;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) JPanel(javax.swing.JPanel) ImageIcon(javax.swing.ImageIcon) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

Example 4 with Relic

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

the class BuildRelicsIconsDb method doIt.

private void doIt() {
    System.out.println("Output dir: " + _toDir);
    RelicsManager relicsMgr = RelicsManager.getInstance();
    List<String> categories = relicsMgr.getCategories();
    for (String categoryName : categories) {
        RelicsCategory category = relicsMgr.getRelicCategory(categoryName, false);
        List<Relic> relics = category.getAllRelics();
        for (Relic relic : relics) {
            checkRelic(relic);
        }
    }
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicsCategory(delta.games.lotro.lore.items.legendary.relics.RelicsCategory) RelicsManager(delta.games.lotro.lore.items.legendary.relics.RelicsManager)

Example 5 with Relic

use of delta.games.lotro.lore.items.legendary.relics.Relic 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)

Aggregations

Relic (delta.games.lotro.lore.items.legendary.relics.Relic)13 RelicType (delta.games.lotro.lore.items.legendary.relics.RelicType)3 RelicsCategory (delta.games.lotro.lore.items.legendary.relics.RelicsCategory)3 RelicsManager (delta.games.lotro.lore.items.legendary.relics.RelicsManager)3 BasicStatsSet (delta.games.lotro.character.stats.BasicStatsSet)2 GridBagConstraints (java.awt.GridBagConstraints)2 GridBagLayout (java.awt.GridBagLayout)2 Insets (java.awt.Insets)2 ImageIcon (javax.swing.ImageIcon)2 JButton (javax.swing.JButton)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 Element (net.htmlparser.jericho.Element)2 Item (delta.games.lotro.lore.items.Item)1 LotroPlanItemsDbLoader (delta.games.lotro.tools.lore.items.lotroplan.LotroPlanItemsDbLoader)1 LotroPlanMordorRelicsLoader (delta.games.lotro.tools.lore.items.lotroplan.relics.LotroPlanMordorRelicsLoader)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 ArrayList (java.util.ArrayList)1 TitledBorder (javax.swing.border.TitledBorder)1