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);
}
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;
}
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;
}
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);
}
}
}
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;
}
Aggregations