예제 #1
0
        public ClassBO GetClassByClassName(string _className)
        {
            ClassDO retval = dataContext.GetClassDOByClassName(_className);

            if (retval == null)
            {
                return(null);
            }
            return(new ClassBO(retval));
        }
예제 #2
0
        public ClassBO GetClass(int _classID)
        {
            ClassDO retval = dataContext.GetClassDOByID(_classID);

            if (retval == null)
            {
                return(null);
            }
            return(new ClassBO(retval));
        }
예제 #3
0
        public int NewUserCharacter(CharacterTransition character, int userID)
        {
            // Get data from the class of the character to use in calculations
            ClassDO _class = dataContext.GetClassDOByClassName(character.Class);

            // Calculate hit points for the new personal character
            int hp = (character.ClassLevel * _class.ClassDiceValue);

            // Adjust the stats for the new personal character based on character level
            int StatMod(int stat)
            {
                if (character.ClassLevel >= 15)
                {
                    stat = stat + 2;
                    if (stat <= 25)
                    {
                        return(stat);
                    }
                    return(25);
                }
                else if (character.ClassLevel >= 10)
                {
                    stat = stat + 1;
                    if (stat <= 25)
                    {
                        return(stat);
                    }
                    return(25);
                }
                return(stat);
            }

            // Add the new personal character to the database and retrieve the id in order to display the new character
            var rv = dataContext.AddUserCharacter(character.Name, character.Class, character.ClassLevel, hp, character.AC, StatMod(character.Strength), StatMod(character.Dexterity), StatMod(character.Constitution), StatMod(character.Intelligence), StatMod(character.Wisdom), StatMod(character.Charisma), character.Description, character.SeriesID_FK, userID);

            return(rv);
        }
예제 #4
0
 // Constructor to map a DataAccessLayer object to a BusinessLogicLayer object
 public ClassBO(ClassDO _classDO)
 {
     ClassID        = _classDO.ClassID;
     ClassName      = _classDO.ClassName;
     ClassDiceValue = _classDO.ClassDiceValue;
 }