Search in sources :

Example 1 with SpellFacade

use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.

the class SpellSupportFacadeImpl method buildAvailableNodes.

/**
	 * Construct the list of available spells for the character. 
	 */
private void buildAvailableNodes() {
    availableSpellNodes.clearContents();
    // Scan character classes for spell classes
    List<PCClass> classList = getCharactersSpellcastingClasses();
    // Look at each spell on each spellcasting class
    for (PCClass pcClass : classList) {
        DoubleKeyMapToList<SpellFacade, String, SpellNode> existingSpells = buildExistingSpellMap(availableSpellNodes, pcClass);
        for (Spell spell : pc.getAllSpellsInLists(charDisplay.getSpellLists(pcClass))) {
            // Create SpellNodeImpl for each spell
            CharacterSpell charSpell = new CharacterSpell(pcClass, spell);
            SpellFacadeImplem spellImplem = new SpellFacadeImplem(pc, spell, charSpell, null);
            HashMapToList<CDOMList<Spell>, Integer> levelInfo = pc.getSpellLevelInfo(spell);
            for (CDOMList<Spell> spellList : charDisplay.getSpellLists(pcClass)) {
                List<Integer> levels = levelInfo.getListFor(spellList);
                if (levels != null) {
                    for (Integer level : levels) {
                        SpellNodeImpl node = new SpellNodeImpl(spellImplem, pcClass, String.valueOf(level), null);
                        if (!existingSpells.containsInList(spellImplem, node.getSpellLevel(), node)) {
                            // Add to list
                            availableSpellNodes.addElement(node);
                        }
                    }
                }
            }
        }
    }
}
Also used : PCClass(pcgen.core.PCClass) SpellSupportForPCClass(pcgen.core.SpellSupportForPCClass) Spell(pcgen.core.spell.Spell) CharacterSpell(pcgen.core.character.CharacterSpell) CharacterSpell(pcgen.core.character.CharacterSpell) CDOMList(pcgen.cdom.base.CDOMList) SpellFacade(pcgen.facade.core.SpellFacade)

Example 2 with SpellFacade

use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.

the class QualifiedSpellTreeCellRenderer method getTreeCellRendererComponent.

@Override
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean focus) {
    Object obj = ((DefaultMutableTreeNode) value).getUserObject();
    if (//$NON-NLS-1$
    "".equals(obj)) {
        //$NON-NLS-1$
        obj = LanguageBundle.getString("in_none");
    }
    super.getTreeCellRendererComponent(tree, obj, sel, expanded, leaf, row, focus);
    if (obj instanceof SpellNode) {
        SpellNode spellNode = (SpellNode) obj;
        SpellFacade spell = spellNode.getSpell();
        ClassFacade pcClass = spellNode.getSpellcastingClass();
        if (!character.isQualifiedFor(spell, pcClass)) {
            setForeground(UIPropertyContext.getNotQualifiedColor());
        }
    }
    if (obj instanceof InfoFacade && ((InfoFacade) obj).isNamePI()) {
        setFont(FontManipulation.bold_italic(getFont()));
    } else {
        setFont(FontManipulation.plain(getFont()));
    }
    return this;
}
Also used : SpellNode(pcgen.facade.core.SpellSupportFacade.SpellNode) ClassFacade(pcgen.facade.core.ClassFacade) DefaultMutableTreeNode(javax.swing.tree.DefaultMutableTreeNode) InfoFacade(pcgen.facade.core.InfoFacade) SpellFacade(pcgen.facade.core.SpellFacade)

Example 3 with SpellFacade

use of pcgen.facade.core.SpellFacade in project pcgen by PCGen.

the class Gui2InfoFactory method getHTMLInfo.

@Override
public String getHTMLInfo(InfoFacade facade) {
    if (facade == null) {
        return EMPTY_STRING;
    }
    // Use a more detailed info if we can
    if (facade instanceof AbilityFacade) {
        return getHTMLInfo((AbilityFacade) facade);
    }
    if (facade instanceof ClassFacade) {
        return getHTMLInfo((ClassFacade) facade, null);
    }
    if (facade instanceof DeityFacade) {
        return getHTMLInfo((DeityFacade) facade);
    }
    if (facade instanceof DomainFacade) {
        return getHTMLInfo((DomainFacade) facade);
    }
    if (facade instanceof EquipmentFacade) {
        return getHTMLInfo((EquipmentFacade) facade);
    }
    if (facade instanceof KitFacade) {
        return getHTMLInfo((KitFacade) facade);
    }
    if (facade instanceof RaceFacade) {
        return getHTMLInfo((RaceFacade) facade);
    }
    if (facade instanceof SkillFacade) {
        return getHTMLInfo((SkillFacade) facade);
    }
    if (facade instanceof SpellFacade) {
        return getHTMLInfo((SpellFacade) facade);
    }
    if (facade instanceof TempBonusFacade) {
        return getHTMLInfo((TempBonusFacade) facade);
    }
    if (facade instanceof TemplateFacade) {
        return getHTMLInfo((TemplateFacade) facade);
    }
    final HtmlInfoBuilder infoText = new HtmlInfoBuilder();
    infoText.appendTitleElement(facade.toString());
    infoText.appendLineBreak();
    if (!facade.getType().isEmpty()) {
        //$NON-NLS-1$
        infoText.appendI18nElement("in_irInfoType", facade.getType());
        infoText.appendLineBreak();
    }
    infoText.appendI18nElement(//$NON-NLS-1$
    "in_itmInfoLabelTextSource", facade.getSource());
    return infoText.toString();
}
Also used : DomainFacade(pcgen.facade.core.DomainFacade) EquipmentFacade(pcgen.facade.core.EquipmentFacade) ClassFacade(pcgen.facade.core.ClassFacade) KitFacade(pcgen.facade.core.KitFacade) TempBonusFacade(pcgen.facade.core.TempBonusFacade) AbilityFacade(pcgen.facade.core.AbilityFacade) SkillFacade(pcgen.facade.core.SkillFacade) DeityFacade(pcgen.facade.core.DeityFacade) HtmlInfoBuilder(pcgen.gui2.util.HtmlInfoBuilder) RaceFacade(pcgen.facade.core.RaceFacade) SpellFacade(pcgen.facade.core.SpellFacade) TemplateFacade(pcgen.facade.core.TemplateFacade)

Aggregations

SpellFacade (pcgen.facade.core.SpellFacade)3 ClassFacade (pcgen.facade.core.ClassFacade)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)1 CDOMList (pcgen.cdom.base.CDOMList)1 PCClass (pcgen.core.PCClass)1 SpellSupportForPCClass (pcgen.core.SpellSupportForPCClass)1 CharacterSpell (pcgen.core.character.CharacterSpell)1 Spell (pcgen.core.spell.Spell)1 AbilityFacade (pcgen.facade.core.AbilityFacade)1 DeityFacade (pcgen.facade.core.DeityFacade)1 DomainFacade (pcgen.facade.core.DomainFacade)1 EquipmentFacade (pcgen.facade.core.EquipmentFacade)1 InfoFacade (pcgen.facade.core.InfoFacade)1 KitFacade (pcgen.facade.core.KitFacade)1 RaceFacade (pcgen.facade.core.RaceFacade)1 SkillFacade (pcgen.facade.core.SkillFacade)1 SpellNode (pcgen.facade.core.SpellSupportFacade.SpellNode)1 TempBonusFacade (pcgen.facade.core.TempBonusFacade)1 TemplateFacade (pcgen.facade.core.TemplateFacade)1 HtmlInfoBuilder (pcgen.gui2.util.HtmlInfoBuilder)1