Exemplo n.º 1
0
        /// <summary>
        /// Assigns player entity settings from a character sheet.
        /// </summary>
        public void AssignCharacter(CharacterSheet character, int level = 1, int maxHealth = 0)
        {
            if (character == null)
            {
                SetEntityDefaults();
                return;
            }

            this.level = level;
            this.gender = character.gender;
            this.race = character.race;
            this.career = character.career;
            this.name = character.name;
            this.faceIndex = character.faceIndex;
            this.stats = character.workingStats;
            this.skills = character.workingSkills;
            this.reflexes = character.reflexes;

            if (maxHealth <= 0)
                this.maxHealth = FormulaHelper.RollMaxHealth(level, stats.Endurance, career.HitPointsPerLevelOrMonsterLevel);
            else
                this.maxHealth = maxHealth;

            FillVitalSigns();

            DaggerfallUnity.LogMessage("Assigned character " + this.name, true);
        }
        public override void Update()
        {
            base.Update();

            if (Input.GetKeyDown(exitKey))
            {
                selectedRace = null;
                CloseWindow();
            }
        }
Exemplo n.º 3
0
 // Set some default values for testing during development
 void SetDefaultValues()
 {
     race = GetRaceTemplate(Races.Breton);
     gender = Genders.Male;
     career = DaggerfallEntity.GetClassCareerTemplate(ClassCareers.Mage);
     name = "Nameless";
     reflexes = PlayerReflexes.Average;
     workingSkills.SetDefaults();
     workingStats.SetFromCareer(career);
     faceIndex = 0;
 }
 /// <summary>
 /// Assigns default entity settings.
 /// </summary>
 public override void SetEntityDefaults()
 {
     // TODO: Add some bonus points to stats
     career = DaggerfallEntity.GetClassCareerTemplate(ClassCareers.Mage);
     if (career != null)
     {
         raceTemplate = CharacterDocument.GetRaceTemplate(Races.Breton);
         faceIndex = 0;
         reflexes = PlayerReflexes.Average;
         gender = Genders.Male;
         stats.SetFromCareer(career);
         level = testPlayerLevel;
         maxHealth = FormulaHelper.RollMaxHealth(level, stats.Endurance, career.HitPointsPerLevelOrMonsterLevel);
         name = testPlayerName;
         stats.SetDefaults();
         skills.SetDefaults();
         FillVitalSigns();
     }
 }
Exemplo n.º 5
0
 public void SetFaceTextures(RaceTemplate raceTemplate, Genders raceGender)
 {
     this.raceTemplate = raceTemplate;
     this.raceGender = raceGender;
     UpdateFaceTextures();
 }
 public void Reset()
 {
     selectedRace = null;
     if (promptLabel != null)
         promptLabel.Enabled = true;
 }
        void ClickHandler(BaseScreenComponent sender, Vector2 position)
        {
            int offset = (int)position.y * racePickerBitmap.Width + (int)position.x;
            if (offset < 0 || offset >= racePickerBitmap.Data.Length)
                return;

            int id = racePickerBitmap.Data[offset];
            if (raceDict.ContainsKey(id))
            {
                promptLabel.Enabled = false;
                selectedRace = raceDict[id];

                TextFile.Token[] textTokens = DaggerfallUnity.Instance.TextProvider.GetRSCTokens(selectedRace.DescriptionID);
                DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, this);
                messageBox.SetTextTokens(textTokens);
                messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.Yes);
                Button noButton = messageBox.AddButton(DaggerfallMessageBox.MessageBoxButtons.No);
                noButton.ClickSound = DaggerfallUI.Instance.GetAudioClip(SoundClips.ButtonClick);
                messageBox.OnButtonClick += ConfirmRacePopup_OnButtonClick;
                messageBox.OnCancel += ConfirmRacePopup_OnCancel;
                uiManager.PushWindow(messageBox);

                AudioClip clip = DaggerfallUnity.Instance.SoundReader.GetAudioClip((uint)selectedRace.ClipID);
                DaggerfallUI.Instance.AudioSource.PlayOneShot(clip);
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// Assigns player entity settings from a character document.
        /// </summary>
        public void AssignCharacter(CharacterDocument character, int level = 1, int maxHealth = 0, bool fillVitals = true)
        {
            if (character == null)
            {
                SetEntityDefaults();
                return;
            }

            this.level                            = level;
            this.gender                           = character.gender;
            this.raceTemplate                     = character.raceTemplate;
            this.career                           = character.career;
            this.name                             = character.name;
            this.faceIndex                        = character.faceIndex;
            this.stats                            = character.workingStats;
            this.skills                           = character.workingSkills;
            this.reflexes                         = character.reflexes;
            this.maxHealth                        = character.maxHealth;
            this.currentHealth                    = character.currentHealth;
            this.currentMagicka                   = character.currentSpellPoints;
            this.sGroupReputations[0]             = character.reputationCommoners;
            this.sGroupReputations[1]             = character.reputationMerchants;
            this.sGroupReputations[2]             = character.reputationNobility;
            this.sGroupReputations[3]             = character.reputationScholars;
            this.sGroupReputations[4]             = character.reputationUnderworld;
            this.currentFatigue                   = character.currentFatigue;
            this.skillUses                        = character.skillUses;
            this.skillsRaisedThisLevel1           = character.skillsRaisedThisLevel1;
            this.skillsRaisedThisLevel2           = character.skillsRaisedThisLevel2;
            this.startingLevelUpSkillSum          = character.startingLevelUpSkillSum;
            this.minMetalToHit                    = (WeaponMaterialTypes)character.minMetalToHit;
            this.armorValues                      = character.armorValues;
            this.lastTimePlayerAteOrDrankAtTavern = character.lastTimePlayerAteOrDrankAtTavern;
            this.timeOfLastSkillTraining          = character.lastTimePlayerBoughtTraining;
            this.timeForThievesGuildLetter        = character.timeForThievesGuildLetter;
            this.timeForDarkBrotherhoodLetter     = character.timeForDarkBrotherhoodLetter;
            this.darkBrotherhoodRequirementTally  = character.darkBrotherhoodRequirementTally;
            this.thievesGuildRequirementTally     = character.thievesGuildRequirementTally;

            SetCurrentLevelUpSkillSum();

            if (startingLevelUpSkillSum <= 0) // new character
            {
                startingLevelUpSkillSum = currentLevelUpSkillSum;
            }

            if (maxHealth <= 0)
            {
                this.maxHealth = FormulaHelper.RollMaxHealth(level, career.HitPointsPerLevel);
            }
            else
            {
                this.maxHealth = maxHealth;
            }

            if (fillVitals)
            {
                FillVitalSigns();
            }

            timeOfLastSkillIncreaseCheck = DaggerfallUnity.Instance.WorldTime.Now.ToClassicDaggerfallTime();

            DaggerfallUnity.LogMessage("Assigned character " + this.name, true);
        }
 public void SetFaceTextures(RaceTemplate raceTemplate, Genders raceGender)
 {
     facePicker.SetFaceTextures(raceTemplate, raceGender);
 }