Search in sources :

Example 1 with Skill

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

the class RewardsHTMLParser method parseTraitReward.

private void parseTraitReward(Element rewardDiv, Rewards rewards) {
    List<Element> as = rewardDiv.getAllElements(HTMLElementName.A);
    int size = (as != null) ? as.size() : 0;
    if (size == 2) {
        Element secondA = as.get(1);
        String name = CharacterReference.decodeCollapseWhiteSpace(secondA.getContent());
        // String iconURL=null;
        Element firstA = as.get(0);
        String url = firstA.getAttributeValue("href");
        if ((url != null) && (url.startsWith(URL_SEED))) {
            String qualifiedIdentifier = url.substring(URL_SEED.length()).trim();
            if (qualifiedIdentifier.startsWith(TRAIT_URL_SEED)) {
                String identifier = qualifiedIdentifier.substring(TRAIT_URL_SEED.length()).trim();
                if ((identifier.startsWith(EMOTE_SEED)) && (name.startsWith(EMOTE_SEED))) {
                    // identifier=identifier.substring(EMOTE_SEED.length()).trim();
                    name = name.substring(EMOTE_SEED.length()).trim();
                    Emote emote = new Emote(/*identifier,*/
                    name);
                    rewards.addEmote(emote);
                // System.out.println(emote.dump());
                } else {
                    Trait trait = new Trait(/*identifier,*/
                    name);
                    rewards.addTrait(trait);
                // System.out.println(trait.dump());
                }
            } else if (qualifiedIdentifier.startsWith(PASSIVE_SKILL_URL_SEED)) {
                // String identifier=qualifiedIdentifier.substring(PASSIVE_SKILL_URL_SEED.length()).trim();
                Skill skill = new Skill(/*SkillType.PASSIVE,identifier,*/
                name);
                rewards.addSkill(skill);
            // System.out.println(skill.dump());
            } else {
                _logger.warn(_objectId + ": unmanaged trait/skill identifier [" + qualifiedIdentifier + "]");
            }
        /*
        List<Element> imgs=firstA.getAllElements(HTMLElementName.IMG);
        if ((imgs!=null) && (imgs.size()>=1))
        {
          Element img=imgs.get(0);
          iconURL=img.getAttributeValue("src");
        }
        */
        } else {
            _logger.warn(_objectId + ": malformed URL [" + url + "]");
        }
    } else {
        _logger.warn(_objectId + ": trait reward with " + size + " anchor tags!");
    }
/*
    <div class="questReward">
    <div>
    <strong>Traits:</strong>
    </div>
    <div>
    <a href="/wiki/Trait:Expert_Woodworker_Proficiency">
    <img class="icon" src="http://content.turbine.com/sites/lorebook.lotro.com/images/icons/trait/trait_c_craft_woodworker_complete_proficiency_3.png">
    </a>
    <a href="/wiki/Trait:Expert_Woodworker_Proficiency">Expert Woodworker Proficiency</a>
    </div>
    </div>
     */
}
Also used : Skill(delta.games.lotro.common.Skill) Element(net.htmlparser.jericho.Element) Emote(delta.games.lotro.common.Emote) Trait(delta.games.lotro.common.Trait)

Example 2 with Skill

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

the class LotroWikiDeedPageParser method handleSkillReward.

private void handleSkillReward(Rewards rewards, String skillStr) {
    Skill skill = new Skill(skillStr);
    rewards.addSkill(skill);
}
Also used : Skill(delta.games.lotro.common.Skill)

Aggregations

Skill (delta.games.lotro.common.Skill)2 Emote (delta.games.lotro.common.Emote)1 Trait (delta.games.lotro.common.Trait)1 Element (net.htmlparser.jericho.Element)1