/// <summary>
        /// Converts a CharacterRecord to a prototypical CharacterDocument for character import.
        /// </summary>
        /// <returns>CharacterDocument derived from CharacterRecord data.</returns>
        public CharacterDocument ToCharacterDocument()
        {
            CharacterDocument doc = new CharacterDocument();
            Dictionary <int, RaceTemplate> raceDict = RaceTemplate.GetRaceDictionary();

            doc.raceTemplate                    = raceDict[(int)parsedData.race + 1];
            doc.gender                          = parsedData.gender;
            doc.career                          = parsedData.career;
            doc.name                            = parsedData.characterName;
            doc.faceIndex                       = parsedData.faceIndex;
            doc.workingStats                    = parsedData.currentStats;
            doc.workingSkills                   = parsedData.skills;
            doc.reflexes                        = parsedData.reflexes;
            doc.currentHealth                   = parsedData.currentHealth;
            doc.maxHealth                       = parsedData.maxHealth;
            doc.currentSpellPoints              = parsedData.currentSpellPoints;
            doc.reputationCommoners             = parsedData.reputationCommoners;
            doc.reputationMerchants             = parsedData.reputationMerchants;
            doc.reputationNobility              = parsedData.reputationNobility;
            doc.reputationScholars              = parsedData.reputationScholars;
            doc.reputationUnderworld            = parsedData.reputationUnderworld;
            doc.currentFatigue                  = parsedData.currentFatigue;
            doc.skillUses                       = parsedData.skillUses;
            doc.startingLevelUpSkillSum         = parsedData.startingLevelUpSkillSum;
            doc.minMetalToHit                   = parsedData.minMetalToHit;
            doc.armorValues                     = parsedData.armorValues;
            doc.lastTimePlayerBoughtTraining    = parsedData.lastTimePlayerBoughtTraining;
            doc.timeForThievesGuildLetter       = parsedData.timeForThievesGuildLetter;
            doc.timeForDarkBrotherhoodLetter    = parsedData.timeForDarkBrotherhoodLetter;
            doc.darkBrotherhoodRequirementTally = parsedData.darkBrotherhoodRequirementTally;
            doc.thievesGuildRequirementTally    = parsedData.thievesGuildRequirementTally;
            doc.biographyReactionMod            = parsedData.biographyReactionMod;

            return(doc);
        }
Esempio n. 2
0
        string GetFlatDetailsString()
        {
            // Get billboard texture data
            FactionFile.FlatData flatData;
            if (IsIndividualNPC)
            {
                // Individuals are always flat1 no matter gender
                flatData = FactionFile.GetFlatData(FactionData.flat1);
            }
            if (Gender == Genders.Male)
            {
                // Male has flat1
                flatData = FactionFile.GetFlatData(FactionData.flat1);
            }
            else
            {
                // Female has flat2
                flatData = FactionFile.GetFlatData(FactionData.flat2);
            }

            // Get flat ID for this person
            int flatID = FlatsFile.GetFlatID(flatData.archive, flatData.record);

            // Get flat caption for this ID, e.g. "young lady in green", or fallback to race
            FlatsFile.FlatData flatCFG;
            if (DaggerfallUnity.Instance.ContentReader.FlatsFileReader.GetFlatData(flatID, out flatCFG))
            {
                return(TextManager.Instance.GetLocalizedText(flatID.ToString(), TextCollections.TextFlats));
            }
            else
            {
                return(RaceTemplate.GetRaceDictionary()[(int)race].Name);
            }
        }
        public override bool ExpandMacro(MacroTypes macro, out string textOut)
        {
            // TODO:
            //  * Support for home town/building (believe this is just random unless NPC moved from a Place)
            //  * Support for %god (TEXT.RSC 4077-4084)
            //  * Support for pronoun (%g1, %g2, %g2, %g2self, %g3)
            //  * Support for class (not sure what NPCs have a class, need to see this used in a quest)
            //  * Support for faction (believe this is just the name of faction they belong to, e.g. The Merchants)

            // Store this person in quest as last Person encountered
            // This will be used for subsequent pronoun macros, etc.
            ParentQuest.LastResourceReferenced = this;

            textOut = string.Empty;
            bool result = true;

            switch (macro)
            {
            case MacroTypes.NameMacro1:                 // Display name
                textOut = displayName;
                break;

            case MacroTypes.NameMacro2:                 // Home building name
                textOut = GetHomeBuildingName();
                break;

            case MacroTypes.NameMacro3:                 // Home town name
                textOut = GetHomePlaceLocationName();
                break;

            case MacroTypes.NameMacro4:                 // Home region name
                textOut = GetHomePlaceRegionName();
                break;

            case MacroTypes.DetailsMacro:               // Race
                textOut = RaceTemplate.GetRaceDictionary()[(int)race].Name;
                break;

            case MacroTypes.FactionMacro:               // Faction macro
                // Want name of guild, not the person
                FactionFile.FactionData guildData;
                if (GameManager.Instance.PlayerEntity.FactionData.GetFactionData(ParentQuest.FactionId, out guildData))
                {
                    textOut = guildData.name;
                }
                else
                {
                    result = false;
                }
                break;

            default:                                    // Macro not supported
                result = false;
                break;
            }

            return(result);
        }
        /// <summary>
        /// Converts a CharacterRecord to a prototypical CharacterDocument for character import.
        /// </summary>
        /// <param name="stripLycanthropyType">Lycanthropy type to remove, if previously read.</param>
        /// <returns>CharacterDocument derived from CharacterRecord data.</returns>
        public CharacterDocument ToCharacterDocument(LycanthropyTypes stripLycanthropyType = LycanthropyTypes.None)
        {
            CharacterDocument doc = new CharacterDocument();
            Dictionary <int, RaceTemplate> raceDict = RaceTemplate.GetRaceDictionary();

            // Strip back classic changes for vampire or lycanthrope as this is handled by effect system in DFU
            // If player is not transformed then this will simply return parsedData.race + 1
            Races classicTransformedRace;
            Races liveRace = StripTransformedRace(out classicTransformedRace, stripLycanthropyType);

            doc.raceTemplate                      = raceDict[(int)liveRace];
            doc.gender                            = parsedData.gender;
            doc.career                            = parsedData.career;
            doc.name                              = parsedData.characterName;
            doc.faceIndex                         = parsedData.faceIndex;
            doc.workingStats                      = parsedData.currentStats;
            doc.workingSkills                     = parsedData.skills;
            doc.reflexes                          = parsedData.reflexes;
            doc.currentHealth                     = parsedData.currentHealth;
            doc.maxHealth                         = parsedData.baseHealth;
            doc.currentSpellPoints                = parsedData.currentSpellPoints;
            doc.reputationCommoners               = parsedData.reputationCommoners;
            doc.reputationMerchants               = parsedData.reputationMerchants;
            doc.reputationNobility                = parsedData.reputationNobility;
            doc.reputationScholars                = parsedData.reputationScholars;
            doc.reputationUnderworld              = parsedData.reputationUnderworld;
            doc.currentFatigue                    = parsedData.currentFatigue;
            doc.skillUses                         = parsedData.skillUses;
            doc.skillsRaisedThisLevel1            = parsedData.skillsRaisedThisLevel1;
            doc.skillsRaisedThisLevel2            = parsedData.skillsRaisedThisLevel2;
            doc.startingLevelUpSkillSum           = parsedData.startingLevelUpSkillSum;
            doc.minMetalToHit                     = parsedData.minMetalToHit;
            doc.armorValues                       = parsedData.armorValues;
            doc.timeToBecomeVampireOrWerebeast    = parsedData.timeToBecomeVampireOrWerebeast;
            doc.hasStartedInitialVampireQuest     = parsedData.hasStartedInitialVampireQuest;
            doc.lastTimeVampireNeedToKillSatiated = parsedData.lastTimeVampireNeedToKillSatiated;
            doc.lastTimePlayerAteOrDrankAtTavern  = parsedData.lastTimePlayerAteOrDrankAtTavern;
            doc.lastTimePlayerBoughtTraining      = parsedData.lastTimePlayerBoughtTraining;
            doc.timeForThievesGuildLetter         = parsedData.timeForThievesGuildLetter;
            doc.timeForDarkBrotherhoodLetter      = parsedData.timeForDarkBrotherhoodLetter;
            doc.vampireClan                       = parsedData.vampireClan;
            doc.darkBrotherhoodRequirementTally   = parsedData.darkBrotherhoodRequirementTally;
            doc.thievesGuildRequirementTally      = parsedData.thievesGuildRequirementTally;
            doc.biographyReactionMod              = parsedData.biographyReactionMod;
            doc.classicTransformedRace            = classicTransformedRace;

            return(doc);
        }
        /// <summary>
        /// Converts a CharacterRecord to a prototypical CharacterSheet for character import.
        /// </summary>
        /// <returns>CharacterSheet derived from CharacterRecord data.</returns>
        public CharacterSheet ToCharacterSheet()
        {
            CharacterSheet sheet = new CharacterSheet();
            Dictionary <int, RaceTemplate> raceDict = RaceTemplate.GetRaceDictionary();

            sheet.race          = raceDict[(int)parsedData.race + 1];
            sheet.gender        = parsedData.gender;
            sheet.career        = parsedData.career;
            sheet.name          = parsedData.characterName;
            sheet.faceIndex     = parsedData.faceIndex;
            sheet.workingStats  = parsedData.currentStats;
            sheet.workingSkills = parsedData.skills;
            sheet.reflexes      = parsedData.reflexes;

            return(sheet);
        }
Esempio n. 6
0
        /// <summary>
        /// Converts a CharacterRecord to a prototypical CharacterDocument for character import.
        /// </summary>
        /// <returns>CharacterDocument derived from CharacterRecord data.</returns>
        public CharacterDocument ToCharacterDocument()
        {
            CharacterDocument doc = new CharacterDocument();
            Dictionary <int, RaceTemplate> raceDict = RaceTemplate.GetRaceDictionary();

            doc.raceTemplate  = raceDict[(int)parsedData.race + 1];
            doc.gender        = parsedData.gender;
            doc.career        = parsedData.career;
            doc.name          = parsedData.characterName;
            doc.faceIndex     = parsedData.faceIndex;
            doc.workingStats  = parsedData.currentStats;
            doc.workingSkills = parsedData.skills;
            doc.reflexes      = parsedData.reflexes;

            return(doc);
        }
        /// <summary>
        /// Converts a CharacterRecord to a prototypical CharacterDocument for character import.
        /// </summary>
        /// <returns>CharacterDocument derived from CharacterRecord data.</returns>
        public CharacterDocument ToCharacterDocument()
        {
            CharacterDocument doc = new CharacterDocument();
            Dictionary <int, RaceTemplate> raceDict = RaceTemplate.GetRaceDictionary();

            doc.raceTemplate            = raceDict[(int)parsedData.race + 1];
            doc.gender                  = parsedData.gender;
            doc.career                  = parsedData.career;
            doc.name                    = parsedData.characterName;
            doc.faceIndex               = parsedData.faceIndex;
            doc.workingStats            = parsedData.currentStats;
            doc.workingSkills           = parsedData.skills;
            doc.reflexes                = parsedData.reflexes;
            doc.currentHealth           = parsedData.currentHealth;
            doc.maxHealth               = parsedData.maxHealth;
            doc.currentSpellPoints      = parsedData.currentSpellPoints;
            doc.currentFatigue          = parsedData.currentFatigue;
            doc.skillUses               = parsedData.skillUses;
            doc.startingLevelUpSkillSum = parsedData.startingLevelUpSkillSum;

            return(doc);
        }