Search in sources :

Example 6 with Relic

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

the class RelicsIndexPageParser method addGorgorothRelics.

private void addGorgorothRelics(RelicsManager relicsMgr) {
    RelicsCategory category = findGorgorothCategory(relicsMgr);
    if (category != null) {
        LotroPlanMordorRelicsLoader relicsLoader = new LotroPlanMordorRelicsLoader();
        List<Relic> relics = relicsLoader.loadGorgorothRelics();
        for (Relic relic : relics) {
            String name = relic.getName();
            Relic oldOne = category.getByName(name);
            if (oldOne != null) {
                mergeRelics(oldOne, relic);
            } else {
                category.addRelic(relic);
            }
        }
    }
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) RelicsCategory(delta.games.lotro.lore.items.legendary.relics.RelicsCategory) LotroPlanMordorRelicsLoader(delta.games.lotro.tools.lore.items.lotroplan.relics.LotroPlanMordorRelicsLoader)

Example 7 with Relic

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

the class LotroPlanMordorRelicsLoader method loadGorgorothRelics.

/**
 * Load Gorgoroth relics.
 * @return A list of relics.
 */
public List<Relic> loadGorgorothRelics() {
    List<Relic> relics = new ArrayList<Relic>();
    LotroPlanItemsDbLoader tableLoader = new LotroPlanItemsDbLoader();
    List<Item> items = tableLoader.loadTable("mordor_relics.txt");
    for (Item item : items) {
        Relic relic = itemToRelic(item);
        relics.add(relic);
    }
    return relics;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) Item(delta.games.lotro.lore.items.Item) ArrayList(java.util.ArrayList) LotroPlanItemsDbLoader(delta.games.lotro.tools.lore.items.lotroplan.LotroPlanItemsDbLoader)

Example 8 with Relic

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

the class RelicChoiceWindowController method doShow.

private Relic doShow(RelicType type, Relic selectedRelic) {
    // Ensure that the dialog is built
    getDialog();
    // Filter
    if (type != null) {
        _filter.setRelicType(type);
        _filterController.setFilter();
    }
    // Set selection
    _tableController.selectRelic(selectedRelic);
    // Show modal
    Relic chosenRelic = editModal();
    return chosenRelic;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic)

Example 9 with Relic

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

the class RelicChoiceWindowController method buildFormPanel.

@Override
protected JPanel buildFormPanel() {
    RelicsManager relicsMgr = RelicsManager.getInstance();
    List<Relic> relics = relicsMgr.getAllRelics();
    JPanel panel = GuiFactory.buildPanel(new GridBagLayout());
    _tableController = new RelicsTableController(relics, _filter);
    ActionListener al = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            ok();
        }
    };
    _tableController.getTableController().addActionListener(al);
    // Relics table
    _panelController = new RelicChoicePanelController(_tableController);
    JPanel tablePanel = _panelController.getPanel();
    // Filter
    _filterController = new RelicsFilterController(_filter, _panelController);
    JPanel filterPanel = _filterController.getPanel();
    TitledBorder filterBorder = GuiFactory.buildTitledBorder("Filter");
    filterPanel.setBorder(filterBorder);
    // Whole panel
    GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0);
    panel.add(filterPanel, c);
    c.gridy = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    panel.add(tablePanel, c);
    return panel;
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) RelicsManager(delta.games.lotro.lore.items.legendary.relics.RelicsManager) ActionEvent(java.awt.event.ActionEvent) TitledBorder(javax.swing.border.TitledBorder) ActionListener(java.awt.event.ActionListener)

Example 10 with Relic

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

the class RelicsEditionPanelController method update.

/**
 * Update UI from the managed data.
 */
private void update() {
    List<Relic> relics = _legAttrs.getRelics();
    int nbRelics = relics.size();
    for (int i = 0; i < nbRelics; i++) {
        Relic relic = relics.get(i);
        // Set relic icon
        JButton button = _buttons.get(i);
        ImageIcon icon = null;
        if (relic != null) {
            String filename = relic.getIconFilename();
            icon = LotroIconsManager.getRelicIcon(filename);
        } else {
            icon = IconsManager.getIcon(ITEM_WITH_NO_ICON);
        }
        button.setIcon(icon);
        // Text
        String text = (relic != null) ? relic.getName() : "";
        JLabel relicName = _relicNames.get(i);
        relicName.setText(text);
    }
}
Also used : Relic(delta.games.lotro.lore.items.legendary.relics.Relic) ImageIcon(javax.swing.ImageIcon) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel)

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