Search in sources :

Example 1 with RelicsManager

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

use of delta.games.lotro.lore.items.legendary.relics.RelicsManager 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 3 with RelicsManager

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

the class RelicsIndexPageParser method doIt.

private void doIt() {
    RelicsIndexPageParser parser = new RelicsIndexPageParser();
    RelicsManager relicsMgr = parser.parseRelicsIndex();
    addGorgorothRelics(relicsMgr);
    File toFile = new File("relics.xml").getAbsoluteFile();
    relicsMgr.writeRelicsFile(toFile);
    System.out.println("Wrote file: " + toFile);
}
Also used : RelicsManager(delta.games.lotro.lore.items.legendary.relics.RelicsManager) File(java.io.File)

Example 4 with RelicsManager

use of delta.games.lotro.lore.items.legendary.relics.RelicsManager 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 5 with RelicsManager

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

the class RelicsIndexPageParser method parseRelicsIndex.

/**
 * Parse a page file.
 * @return A list of relics or <code>null</code> if an error occurred.
 */
public RelicsManager parseRelicsIndex() {
    _relicsMgr = new RelicsManager();
    try {
        // Relics
        URL url = URLTools.getFromClassPath("relics.txt", RelicsIndexPageParser.class.getPackage());
        Source source = new Source(url);
        source.fullSequentialParse();
        handleTable("Tier 1", source, "Tier_1_Relics", null, null);
        handleTable("Tier 2", source, "Tier_2_Relics", null, null);
        handleTable("Tier 3", source, "Tier_3_Relics", null, null);
        handleTable("Tier 4", source, "Tier_4_Relics", null, null);
        handleTable("Tier 5", source, "Tier_5_Relics", null, null);
        handleTable("Tier 6", source, "Tier_6_Relics", null, null);
        handleTable("Tier 7", source, "Tier_7_Relics", null, null);
        handleTable("Tier 8", source, "Tier_8_Relics", null, null);
        handleTable("Tier 9", source, "Tier_9_Relics", null, null);
        handleTable("Tier 10", source, "Tier_10_Relics", null, null);
        // Unique relics (55)
        handleTable("Unique relics (55)", source, "Unique_Relics_.28Level_55.29", Integer.valueOf(55), null);
        // Singular relics (60)
        handleTable("Singular relics (60)", source, "Singular_Relics_.28Level_60.29", Integer.valueOf(60), null);
        // Extraordinary Relics (Level 65)
        handleTable("Extraordinary Relics (Level 65)", source, "Extraordinary_Relics_.28Level_65.29", Integer.valueOf(65), null);
        // Westfold Relics (Level 70)
        handleTable("Westfold Relics (Level 70)", source, "Westfold_Relics_.28Level_70.29", Integer.valueOf(70), null);
        // Great River Relics (Level 75)
        handleTable("Great River Relics (Level 75)", source, "Great_River_Relics_.28Level_75.29", Integer.valueOf(75), null);
        // Eastemnet Relics (Level 80)
        handleTable("Eastemnet Relics (Level 80)", source, "Eastemnet_Relics_.28Level_80.29", Integer.valueOf(80), null);
        // Wildermore Relics (Level 85)
        handleTable("Wildermore Relics (Level 85)", source, "Wildermore_Relics_.28Level_85.29", Integer.valueOf(85), null);
        // Westemnet Relics (Level 90)
        handleTable("Westemnet Relics (Level 90)", source, "Westemnet_Relics_.28Level_90.29", Integer.valueOf(90), null);
        // Gorgoroth Relics
        handleTable("Gorgoroth Relics", source, "Gorgoroth_.28Last_Alliance.29_Relics_.28Level_100.29", null, null);
        // Ignore bridles
        /*
      // Basic Mounted (Level 75)
      handleTable(relics,source,"Basic_Mounted_.28Level_75.29",Integer.valueOf(75));
      // Unique Mounted (Level 75)
      handleTable(relics,source,"Unique_Mounted_.28Level_75.29",Integer.valueOf(75));
      // Eastemnet Mounted (Level 80)
      handleTable(relics,source,"Eastemnet_Mounted_.28Level_80.29",Integer.valueOf(80));
      // Riddermark Mounted (Level 85)
      handleTable(relics,source,"Riddermark_Mounted_.28Level_85.29",Integer.valueOf(85));
      // Westemnet Mounted (Level 90)
      handleTable(relics,source,"Westemnet_Mounted_.28Level_90.29",Integer.valueOf(90));
      */
        // Crafted_Relics_Index
        handleTable("Crafted", source, "Crafted_Relics_Index", null, null);
        // Retired relics
        URL urlRetired = URLTools.getFromClassPath("retired_relics.txt", RelicsIndexPageParser.class.getPackage());
        Source sourceRetired = new Source(urlRetired);
        sourceRetired.fullSequentialParse();
        handleTable("Retired Settings", sourceRetired, "Retired_Settings_Index", null, RelicType.SETTING);
        handleTable("Retired Gems", sourceRetired, "Retired_Gems_Index", null, RelicType.GEM);
        handleTable("Retired Runes", sourceRetired, "Retired_Runes_Index", null, RelicType.RUNE);
    } catch (Exception e) {
        _relicsMgr = null;
        _logger.error("Cannot parse relics page!", e);
    }
    return _relicsMgr;
}
Also used : RelicsManager(delta.games.lotro.lore.items.legendary.relics.RelicsManager) URL(java.net.URL) Source(net.htmlparser.jericho.Source)

Aggregations

RelicsManager (delta.games.lotro.lore.items.legendary.relics.RelicsManager)5 Relic (delta.games.lotro.lore.items.legendary.relics.Relic)3 RelicsCategory (delta.games.lotro.lore.items.legendary.relics.RelicsCategory)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 File (java.io.File)1 URL (java.net.URL)1 JPanel (javax.swing.JPanel)1 TitledBorder (javax.swing.border.TitledBorder)1 Source (net.htmlparser.jericho.Source)1