Search in sources :

Example 1 with HandedFacade

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

the class CharacterFacadeImpl method refreshRaceRelatedFields.

private void refreshRaceRelatedFields() {
    race.set(charDisplay.getRace());
    if (charDisplay.getRace() != null) {
        for (HandedFacade handsFacade : availHands) {
            if (handsFacade.toString().equals(charDisplay.getHanded())) {
                handedness.set(handsFacade);
                break;
            }
        }
        for (GenderFacade pcGender : availGenders) {
            if (pcGender.equals(charDisplay.getGenderObject())) {
                gender.set(pcGender);
                break;
            }
        }
    }
    refreshClassLevelModel();
    refreshStatScores();
    age.set(charDisplay.getAge());
    updateAgeCategoryForAge();
    refreshHeightWeight();
    characterAbilities.rebuildAbilityLists();
    currentXP.set(charDisplay.getXP());
    xpForNextlevel.set(charDisplay.minXPForNextECL());
    xpTableName.set(charDisplay.getXPTableName());
    hpRef.set(theCharacter.hitPoints());
    alignment.set(charDisplay.getPCAlignment());
    refreshAvailableTempBonuses();
    companionSupportFacade.refreshCompanionData();
    updateLevelTodo();
    buildAvailableDomainsList();
    spellSupportFacade.refreshAvailableKnownSpells();
    updateScorePurchasePool(false);
    refreshEquipment();
    if (charDisplay.getRace() == null || Constants.NONESELECTED.equals(charDisplay.getRace().getKeyName())) {
        todoManager.addTodo(new TodoFacadeImpl(Tab.SUMMARY, "Race", "in_irTodoRace", 100));
    } else {
        todoManager.removeTodo("in_irTodoRace");
    }
}
Also used : GenderFacade(pcgen.facade.core.GenderFacade) HandedFacade(pcgen.facade.core.HandedFacade)

Example 2 with HandedFacade

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

the class CharacterFacadeImpl method initForCharacter.

/**
	 * 
	 */
private void initForCharacter() {
    // Calculate any active bonuses
    theCharacter.preparePCForOutput();
    todoManager = new TodoManager();
    infoFactory = new Gui2InfoFactory(theCharacter);
    characterAbilities = new CharacterAbilities(theCharacter, delegate, dataSet, todoManager);
    descriptionFacade = new DescriptionFacadeImpl(theCharacter);
    spellSupportFacade = new SpellSupportFacadeImpl(theCharacter, delegate, dataSet, todoManager, this);
    name = new DefaultReferenceFacade<>(charDisplay.getName());
    file = new DefaultReferenceFacade<>(new File(charDisplay.getFileName()));
    companionSupportFacade = new CompanionSupportFacadeImpl(theCharacter, todoManager, name, file, this);
    availTempBonuses = new DefaultListFacade<>();
    refreshAvailableTempBonuses();
    appliedTempBonuses = new DefaultListFacade<>();
    buildAppliedTempBonusList();
    kitList = new DefaultListFacade<>();
    refreshKitList();
    statScoreMap = new HashMap<>();
    for (StatFacade stat : dataSet.getStats()) {
        if (stat instanceof PCStat) {
            statScoreMap.put(stat, ChannelCompatibility.getStatScore(theCharacter.getCharID(), (PCStat) stat));
        } else {
            statScoreMap.put(stat, new DefaultReferenceFacade<>());
        }
    }
    File portraitFile = null;
    if (!StringUtils.isEmpty(charDisplay.getPortraitPath())) {
        portraitFile = new File(charDisplay.getPortraitPath());
    }
    portrait = new DefaultReferenceFacade<>(portraitFile);
    cropRect = new RectangleReference(charDisplay.getPortraitThumbnailRect());
    characterType = new DefaultReferenceFacade<>(charDisplay.getCharacterType());
    previewSheet = new DefaultReferenceFacade<>(charDisplay.getPreviewSheet());
    skillFilter = new DefaultReferenceFacade<>(charDisplay.getSkillFilter());
    tabName = new DefaultReferenceFacade<>(charDisplay.getTabName());
    playersName = new DefaultReferenceFacade<>(charDisplay.getPlayersName());
    race = new DefaultReferenceFacade<>(charDisplay.getRace());
    raceList = new DefaultListFacade<>();
    if (charDisplay.getRace() != null && charDisplay.getRace() != Globals.s_EMPTYRACE) {
        raceList.addElement(charDisplay.getRace());
    }
    handedness = new DefaultReferenceFacade<>();
    gender = new DefaultReferenceFacade<>();
    availHands = new DefaultListFacade<>();
    availGenders = new DefaultListFacade<>();
    for (Handed handed : Handed.values()) {
        availHands.addElement(handed);
    }
    for (Gender gender : Gender.values()) {
        availGenders.addElement(gender);
    }
    if (charDisplay.getRace() != null) {
        for (HandedFacade handsFacade : availHands) {
            if (handsFacade.equals(charDisplay.getHandedObject())) {
                handedness.set(handsFacade);
                break;
            }
        }
        for (GenderFacade pcGender : availGenders) {
            if (pcGender.equals(charDisplay.getGenderObject())) {
                gender.set(pcGender);
                break;
            }
        }
    }
    alignment = new DefaultReferenceFacade<>(charDisplay.getPCAlignment());
    age = new DefaultReferenceFacade<>(charDisplay.getAge());
    ageCategory = new DefaultReferenceFacade<>();
    updateAgeCategoryForAge();
    currentXP = new DefaultReferenceFacade<>(charDisplay.getXP());
    xpListener = new XPListener();
    FacetLibrary.getFacet(XPFacet.class).addDataFacetChangeListener(xpListener);
    xpForNextlevel = new DefaultReferenceFacade<>(charDisplay.minXPForNextECL());
    xpTableName = new DefaultReferenceFacade<>(charDisplay.getXPTableName());
    hpRef = new DefaultReferenceFacade<>(theCharacter.hitPoints());
    skinColor = new DefaultReferenceFacade<>(charDisplay.getSafeStringFor(PCStringKey.SKINCOLOR));
    hairColor = new DefaultReferenceFacade<>(charDisplay.getSafeStringFor(PCStringKey.HAIRCOLOR));
    eyeColor = new DefaultReferenceFacade<>(charDisplay.getSafeStringFor(PCStringKey.EYECOLOR));
    weightRef = new DefaultReferenceFacade<>();
    heightRef = new DefaultReferenceFacade<>();
    refreshHeightWeight();
    purchasedEquip = new EquipmentListFacadeImpl(theCharacter.getEquipmentMasterList());
    autoEquipListener = new AutoEquipListener();
    FacetLibrary.getFacet(AutoEquipmentFacet.class).addDataFacetChangeListener(autoEquipListener);
    carriedWeightRef = new DefaultReferenceFacade<>();
    loadRef = new DefaultReferenceFacade<>();
    weightLimitRef = new DefaultReferenceFacade<>();
    equipSet = new DefaultReferenceFacade<>();
    equipmentSets = new DefaultListFacade<>();
    initEquipSet();
    GameMode game = (GameMode) dataSet.getGameMode();
    rollMethodRef = new DefaultReferenceFacade<>(game.getRollMethod());
    charLevelsFacade = new CharacterLevelsFacadeImpl(theCharacter, delegate, todoManager, dataSet, this);
    pcClasses = new ArrayList<>();
    pcClassLevels = new DefaultListFacade<>();
    refreshClassLevelModel();
    charLevelsFacade.addHitPointListener(this);
    deity = new DefaultReferenceFacade<>(charDisplay.getDeity());
    domains = new DefaultListFacade<>();
    maxDomains = new DefaultReferenceFacade<>(theCharacter.getMaxCharacterDomains());
    remainingDomains = new DefaultReferenceFacade<>(theCharacter.getMaxCharacterDomains() - domains.getSize());
    availDomains = new DefaultListFacade<>();
    buildAvailableDomainsList();
    templates = new DefaultListFacade<>(charDisplay.getDisplayVisibleTemplateList());
    templateListener = new TemplateListener();
    FacetLibrary.getFacet(TemplateFacet.class).addDataFacetChangeListener(templateListener);
    initTodoList();
    statTotalLabelText = new DefaultReferenceFacade<>();
    statTotalText = new DefaultReferenceFacade<>();
    modTotalLabelText = new DefaultReferenceFacade<>();
    modTotalText = new DefaultReferenceFacade<>();
    updateScorePurchasePool(false);
    languages = new DefaultListFacade<>();
    numBonusLang = new DefaultReferenceFacade<>(0);
    numSkillLang = new DefaultReferenceFacade<>(0);
    refreshLanguageList();
    langListener = new LanguageListener();
    FacetLibrary.getFacet(LanguageFacet.class).addDataFacetChangeListener(langListener);
    purchasedEquip.addListListener(spellSupportFacade);
    purchasedEquip.addEquipmentListListener(spellSupportFacade);
    fundsRef = new DefaultReferenceFacade<>(theCharacter.getGold());
    wealthRef = new DefaultReferenceFacade<>(theCharacter.totalValue());
    gearBuySellSchemeRef = new DefaultReferenceFacade<>(findGearBuySellRate());
    allowDebt = false;
}
Also used : StatFacade(pcgen.facade.core.StatFacade) GenderFacade(pcgen.facade.core.GenderFacade) TemplateFacet(pcgen.cdom.facet.model.TemplateFacet) Handed(pcgen.cdom.enumeration.Handed) Gender(pcgen.cdom.enumeration.Gender) HandedFacade(pcgen.facade.core.HandedFacade) XPFacet(pcgen.cdom.facet.fact.XPFacet) GameMode(pcgen.core.GameMode) PCStat(pcgen.core.PCStat) File(java.io.File) LanguageFacet(pcgen.cdom.facet.model.LanguageFacet) AutoEquipmentFacet(pcgen.cdom.facet.AutoEquipmentFacet)

Aggregations

GenderFacade (pcgen.facade.core.GenderFacade)2 HandedFacade (pcgen.facade.core.HandedFacade)2 File (java.io.File)1 Gender (pcgen.cdom.enumeration.Gender)1 Handed (pcgen.cdom.enumeration.Handed)1 AutoEquipmentFacet (pcgen.cdom.facet.AutoEquipmentFacet)1 XPFacet (pcgen.cdom.facet.fact.XPFacet)1 LanguageFacet (pcgen.cdom.facet.model.LanguageFacet)1 TemplateFacet (pcgen.cdom.facet.model.TemplateFacet)1 GameMode (pcgen.core.GameMode)1 PCStat (pcgen.core.PCStat)1 StatFacade (pcgen.facade.core.StatFacade)1