/// <summary> /// Copy contents of another DaggerfallSkills into this one. /// Does not copy active effect mods. /// </summary> /// <param name="other">Skilla collection to copy from.</param> public void Copy(DaggerfallSkills other) { for (int i = 0; i < Count; i++) { SetPermanentSkillValue(i, other.GetPermanentSkillValue(i)); } }
/// <summary> /// Raise skills if conditions are met. /// </summary> public void RaiseSkills() { DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; if ((now.ToClassicDaggerfallTime() - timeOfLastSkillIncreaseCheck) <= 360) { return; } timeOfLastSkillIncreaseCheck = now.ToClassicDaggerfallTime(); for (short i = 0; i < skillUses.Length; i++) { int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier((DFCareer.Skills)i); float careerAdvancementMultiplier = Career.AdvancementMultiplier; int usesNeededForAdvancement = FormulaHelper.CalculateSkillUsesForAdvancement(skills.GetSkillValue(i), skillAdvancementMultiplier, careerAdvancementMultiplier, level); if (skillUses[i] >= usesNeededForAdvancement) { skillUses[i] = 0; skills.SetSkillValue(i, (short)(skills.GetSkillValue(i) + 1)); SetCurrentLevelUpSkillSum(); DaggerfallUI.Instance.PopupMessage(HardStrings.skillImprove.Replace("%s", DaggerfallUnity.Instance.TextProvider.GetSkillName((DaggerfallConnect.DFCareer.Skills)i))); } } if (CheckForLevelUp()) { DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenCharacterSheetWindow); } }
/// <summary> /// Create a new copy of this stat collection. /// Does not copy active effect mods. /// </summary> /// <returns>New DaggerfallStats which is a copy of this DaggerfallStats.</returns> public DaggerfallSkills Clone() { DaggerfallSkills newSkills = new DaggerfallSkills(); newSkills.Copy(this); return(newSkills); }
/// <summary> /// Raise skills if conditions are met. /// </summary> public void RaiseSkills() { const int youAreNowAMasterOfTextID = 4020; DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; if ((now.ToClassicDaggerfallTime() - timeOfLastSkillIncreaseCheck) <= 360) { return; } timeOfLastSkillIncreaseCheck = now.ToClassicDaggerfallTime(); for (short i = 0; i < skillUses.Length; i++) { int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier((DFCareer.Skills)i); float careerAdvancementMultiplier = Career.AdvancementMultiplier; int usesNeededForAdvancement = FormulaHelper.CalculateSkillUsesForAdvancement(skills.GetPermanentSkillValue(i), skillAdvancementMultiplier, careerAdvancementMultiplier, level); if (skillUses[i] >= usesNeededForAdvancement) { skillUses[i] = 0; if (skills.GetPermanentSkillValue(i) < 100 && (skills.GetPermanentSkillValue(i) < 95 || !AlreadyMasteredASkill())) { skills.SetPermanentSkillValue(i, (short)(skills.GetPermanentSkillValue(i) + 1)); SetCurrentLevelUpSkillSum(); DaggerfallUI.Instance.PopupMessage(HardStrings.skillImprove.Replace("%s", DaggerfallUnity.Instance.TextProvider.GetSkillName((DFCareer.Skills)i))); if (skills.GetPermanentSkillValue(i) == 100) { List <DFCareer.Skills> primarySkills = GetPrimarySkills(); if (primarySkills.Contains((DFCareer.Skills)i)) { ITextProvider textProvider = DaggerfallUnity.Instance.TextProvider; TextFile.Token[] tokens; tokens = textProvider.GetRSCTokens(youAreNowAMasterOfTextID); if (tokens != null && tokens.Length > 0) { DaggerfallMessageBox messageBox = new DaggerfallMessageBox(DaggerfallUI.UIManager); messageBox.SetTextTokens(tokens); messageBox.ClickAnywhereToClose = true; messageBox.ParentPanel.BackgroundColor = Color.clear; messageBox.Show(); } DaggerfallUI.Instance.PlayOneShot(SoundClips.ArenaFanfareLevelUp); } } } } } if (CheckForLevelUp()) { DaggerfallUI.PostMessage(DaggerfallUIMessages.dfuiOpenCharacterSheetWindow); } }
public void Copy(DaggerfallSkills other) { for (int i = 0; i < Count; i++) { SetSkillValue(i, other.GetSkillValue(i)); } }
DaggerfallSkills ReadSkills(BinaryReader reader) { DaggerfallSkills skills = new DaggerfallSkills(); for (int i = 0; i < DaggerfallSkills.Count; i++) { Int16 shortValue = reader.ReadInt16(); reader.ReadInt32(); // Skip unknown Int32 skills.SetSkillValue(i, shortValue); } return skills; }
void SetSkills(DaggerfallSkills startingSkills, DaggerfallSkills workingSkills) { this.startingSkills.Copy(startingSkills); this.workingSkills.Copy(workingSkills); UpdateSkillValueLabels(); }