Ejemplo n.º 1
0
        private void TomeChanged(object sender, EventArgs e)
        {
            CharacterSkillClass.Skills Skill;
            int Bonus;
            int Level;
            NumericUpDownWithBlank myControl;

            myControl = new NumericUpDownWithBlank();
            myControl = (NumericUpDownWithBlank)sender;
            string SkillName;

            SkillName = myControl.Name.Substring(0, myControl.Name.IndexOf("UpDwn")).Replace(" ", "_");
            if (myControl.Blank)
            {
                Level = 0;
            }
            else
            {
                Level = (int)myControl.Value;
            }

            Bonus = Convert.ToInt32(myControl.Name.Substring(myControl.Name.IndexOf("UpDwn") + "UpDwn".Length, myControl.Name.Length - myControl.Name.IndexOf("UpDwn") - "UpDwn".Length));
            Skill = (CharacterSkillClass.Skills)SkillNames.IndexOf(SkillName);
            CharacterManagerClass.CharacterManager.CharacterSkill.SetTomeBonus(Skill, Bonus, Level);
            UIManagerClass.UIManager.ScreenMessenger.NotifyChange(UIManagerClass.ChildScreen.SkillTomeEditScreen, ScreenMessengerClass.ChangeList.SkillChange);
        }
Ejemplo n.º 2
0
        private void PriorityChanged(object sender, EventArgs e)
        {
            NumericUpDownWithBlank control;

            control = new NumericUpDownWithBlank();
            control = (NumericUpDownWithBlank)sender;

            List <int> tempList;
            string     SkillName;

            SkillName = control.Name.ToString().Substring(0, control.Name.Length - ("Priority").Length);
            int SkillID;

            SkillID  = SkillNames.IndexOf(SkillName);
            tempList = new List <int>();
            for (int i = 0; i < NumSkills; ++i)
            {
                tempList = PriorityList[i];
                if (tempList.Contains(SkillID))
                {
                    tempList.Remove(SkillID);
                }
                PriorityList[i] = tempList;
            }
            if (control.Blank)
            {
                return;
            }
            tempList = PriorityList[(int)control.Value - 1];
            tempList.Add(SkillID);
            tempList.Sort();
            PriorityList[(int)control.Value - 1] = tempList;
            int y = 0;
        }
Ejemplo n.º 3
0
        private void SetToChanged(object sender, EventArgs e)
        {
            NumericUpDownWithBlank control;

            control = new NumericUpDownWithBlank();
            control = (NumericUpDownWithBlank)sender;
            string SkillName;

            SkillName = control.Name.ToString().Substring(0, control.Name.Length - ("SetTo").Length);
            int SkillID;

            SkillID = SkillNames.IndexOf(SkillName);
            if (!control.Blank)
            {
                MaxRank[SkillID] = (int)control.Value;
            }
            else
            {
                MaxRank[SkillID] = 0;
            }
        }
Ejemplo n.º 4
0
        public void SetClassUpDown(NumericUpDownWithBlank control)
        {
            string controlName;
            int    controlNum;

            if (AllowChange == true)
            {
                controlName = control.Name;
                //determine the Control changed
                controlNum = Convert.ToInt16(controlName.Substring((int)"ClassUpDown".Length, (int)controlName.Length - (int)"ClassUpDown".Length));
                //Send to PastLifeHeroic
                if (CharacterManagerClass.CharacterManager.CharacterPastLife.PastLifeHerioc[controlNum] != 0)
                {
                    control.Blank = false;
                    control.Value = CharacterManagerClass.CharacterManager.CharacterPastLife.PastLifeHerioc[controlNum];
                }
                else
                {
                    control.Blank = true;
                }
            }
        }
Ejemplo n.º 5
0
        public void SetSkillUpDown(NumericUpDownWithBlank control)
        {
            string        controlName;
            List <string> SkillNames;

            CharacterSkillClass.Skills Skill;
            SkillNames = Enum.GetNames(typeof(CharacterSkillClass.Skills)).ToList();

            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;
                }

                int MaxSkill = TomeModel.GetMaxBonus(SkillModel.GetIdFromName(Skill.ToString().Replace("_", " ")));
                control.Maximum = MaxSkill;

                int maxValue;
                int CurrentValue;
                int CurrentBonus;
                CurrentValue = 0;
                maxValue     = 0;
                CurrentBonus = 0;
                for (int i = 0; i < MaxSkill; ++i)
                {
                    CurrentValue = CharacterManagerClass.CharacterManager.CharacterSkill.PriorLifeTome[(int)Skill, i];
                    if (CurrentValue > maxValue)
                    {
                        maxValue = CurrentValue;

                        CurrentBonus = i + 1;
                    }
                }
                if (maxValue != 0)
                {
                    control.Blank = false;
                    control.Value = CurrentBonus;
                }
                else
                {
                    control.Blank = true;
                }
            }
        }
Ejemplo n.º 6
0
        public void SetAbilityUpDown(NumericUpDownWithBlank control)
        {
            string controlName;

            CharacterAbilityClass.Abilities ability;

            if (AllowChange == true)
            {
                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;
                }

                int MaxAbility = TomeModel.GetMaxBonus(AbilityModel.GetIdFromName(ability.ToString()));
                control.Maximum = MaxAbility;

                int maxValue;
                int CurrentValue;
                int CurrentBonus;
                CurrentValue = 0;
                maxValue     = 0;
                CurrentBonus = 0;
                for (int i = 0; i < MaxAbility; ++i)
                {
                    CurrentValue = CharacterManagerClass.CharacterManager.CharacterAbility.PriorLifeTome[(int)ability, i];
                    if (CurrentValue > maxValue)
                    {
                        maxValue = CurrentValue;

                        CurrentBonus = i + 1;
                    }
                }
                if (maxValue != 0)
                {
                    control.Blank = false;
                    control.Value = CurrentBonus;
                }
                else
                {
                    control.Blank = true;
                }
            }
        }