Пример #1
0
        private void SkillUpDownValueChanged(object sender, EventArgs e)
        {
            NumericUpDownWithBlank control;
            string        controlName;
            List <string> SkillNames;

            CharacterSkillClass.Skills Skill;
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();
            control    = (NumericUpDownWithBlank)sender;
            int tomeBonus;
            int minLevel = 0;

            if (AllowChange == true)
            {
                bool SkillFound = false;
                controlName = control.Name;
                //determine the ability changed
                Skill = CharacterSkillClass.Skills.Balance;
                for (int i = 0; i < SkillNames.Count; ++i)
                {
                    if (controlName.Contains(SkillNames[i]))
                    {
                        Skill      = (CharacterSkillClass.Skills)i;
                        SkillFound = true;
                        if (SkillFound)
                        {
                            break;
                        }
                    }
                }
                if (!SkillFound)
                {
                    return;
                }
                //determine the level of the tome
                tomeBonus = (int)control.Value;
                Guid SkillID  = SkillModel.GetIdFromName(Skill.ToString().Replace("_", " "));
                int  SkillMax = TomeModel.GetMaxBonus(SkillID);
                if (tomeBonus != 0)
                {
                    minLevel = TomeModel.GetMinLevel(SkillID, tomeBonus);
                }
                if (control.Blank == true)
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, tomeBonus, 0);
                }
                else
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, tomeBonus, minLevel);
                }
                for (int i = tomeBonus + 1; i < SkillMax + 1; ++i)
                {
                    CharacterManagerClass.CharacterManager.CharacterSkill.SetPriorLifeTomeBonus(Skill, i, 0);
                }
                //inform other screens
                UIManagerClass.UIManager.ScreenMessenger.NotifyChange(UIManagerClass.ChildScreen.PastLifeEditScreen, ScreenMessengerClass.ChangeList.SkillChange);
            }
        }
Пример #2
0
        private void TomeUpDownValueChanged(object sender, EventArgs e)
        {
            NumericUpDownWithBlank control;
            string controlName;

            CharacterAbilityClass.Abilities ability;
            int tomeBonus;
            int minLevel = 0;

            if (AllowChange == true)
            {
                control     = (NumericUpDownWithBlank)sender;
                controlName = control.Name;
                //determine the ability changed
                ability = CharacterAbilityClass.Abilities.Strength;
                if (controlName.Contains("Str"))
                {
                    ability = CharacterAbilityClass.Abilities.Strength;
                }
                if (controlName.Contains("Dex"))
                {
                    ability = CharacterAbilityClass.Abilities.Dexterity;
                }
                if (controlName.Contains("Con"))
                {
                    ability = CharacterAbilityClass.Abilities.Constitution;
                }
                if (controlName.Contains("Int"))
                {
                    ability = CharacterAbilityClass.Abilities.Intelligence;
                }
                if (controlName.Contains("Wis"))
                {
                    ability = CharacterAbilityClass.Abilities.Wisdom;
                }
                if (controlName.Contains("Cha"))
                {
                    ability = CharacterAbilityClass.Abilities.Charisma;
                }

                //determine the level of the tome
                tomeBonus = (int)control.Value;
                Guid AbilityID  = AbilityModel.GetIdFromName(ability.ToString());
                int  AbilityMax = TomeModel.GetMaxBonus(AbilityID);
                if (tomeBonus != 0)
                {
                    minLevel = TomeModel.GetMinLevel(AbilityID, tomeBonus);
                }
                if (control.Blank == true)
                {
                    CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, tomeBonus, 0);
                }
                else
                {
                    CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, tomeBonus, minLevel);
                }
                for (int i = tomeBonus + 1; i < AbilityMax + 1; ++i)
                {
                    CharacterManagerClass.CharacterManager.CharacterAbility.SetPriorLifeTomeBonus(ability, i, 0);
                }
                //inform other screens
                UIManagerClass.UIManager.ScreenMessenger.NotifyChange(UIManagerClass.ChildScreen.PastLifeEditScreen, ScreenMessengerClass.ChangeList.AbilityChange);
            }
        }