Search in sources :

Example 1 with RewardsHTMLParser

use of delta.games.lotro.tools.lore.common.RewardsHTMLParser in project lotro-tools by dmorcellet.

the class QuestPageParser method parseQuestDescription.

private void parseQuestDescription(Element officialSection) {
    // Title
    String title = null;
    Element titleElement = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(officialSection, HTMLElementName.DIV, "class", "lorebooktitle");
    if (titleElement != null) {
        title = CharacterReference.decodeCollapseWhiteSpace(titleElement.getContent());
        if (title != null) {
            if (title.startsWith(QUEST_SEED)) {
                title = title.substring(QUEST_SEED.length()).trim();
            }
        }
    }
    _quest.setTitle(title);
    // Quest attributes
    // System.out.println("Title: "+title);
    List<Element> questFields = JerichoHtmlUtils.findElementsByTagNameAndAttributeValue(officialSection, HTMLElementName.DIV, "class", "questfield");
    for (Element questField : questFields) {
        parseQuestField(questField);
    }
    // Rewards
    // <table class="questrewards">
    Element rewardsTable = JerichoHtmlUtils.findElementByTagNameAndAttributeValue(officialSection, HTMLElementName.TABLE, "class", "questrewards");
    if (rewardsTable != null) {
        Rewards rewards = _quest.getQuestRewards();
        RewardsHTMLParser parser = new RewardsHTMLParser("Quest [" + _key + "]");
        parser.parseRewards(rewardsTable, rewards);
    }
}
Also used : Element(net.htmlparser.jericho.Element) Rewards(delta.games.lotro.common.Rewards) RewardsHTMLParser(delta.games.lotro.tools.lore.common.RewardsHTMLParser)

Aggregations

Rewards (delta.games.lotro.common.Rewards)1 RewardsHTMLParser (delta.games.lotro.tools.lore.common.RewardsHTMLParser)1 Element (net.htmlparser.jericho.Element)1