private void SetReaderToObject(ref FeatPrereqORCondition objFeatPrereqORCondition, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objFeatPrereqORCondition.FeatPrereqORConditionID = (int)result.GetValue(result.GetOrdinal("FeatPrereqORConditionID"));
                objFeatPrereqORCondition.FeatID                   = (int)result.GetValue(result.GetOrdinal("FeatID"));
                objFeatPrereqORCondition.TalentID                 = (int)result.GetValue(result.GetOrdinal("TalentID"));
                objFeatPrereqORCondition.FeatRequirementID        = (int)result.GetValue(result.GetOrdinal("FeatRequirementID"));
                objFeatPrereqORCondition.RaceID                   = (int)result.GetValue(result.GetOrdinal("RaceID"));
                objFeatPrereqORCondition.TalentTreeID             = (int)result.GetValue(result.GetOrdinal("TalentTreeID"));
                objFeatPrereqORCondition.TalentTreeTalentQuantity = (int)result.GetValue(result.GetOrdinal("TalentTreeTalentQuantity"));
                objFeatPrereqORCondition.AbilityID                = (int)result.GetValue(result.GetOrdinal("AbilityID"));
                objFeatPrereqORCondition.AbilityMinimum           = (int)result.GetValue(result.GetOrdinal("AbilityMinimum"));
                objFeatPrereqORCondition.SkillID                  = (int)result.GetValue(result.GetOrdinal("SkillID"));

                Talent objT = new Talent(objFeatPrereqORCondition.TalentID);
                objFeatPrereqORCondition.objTalent = objT;

                Feat objF = new Feat(objFeatPrereqORCondition.FeatRequirementID);
                objFeatPrereqORCondition.objFeatRequirement = objF;

                Race objR = new Race(objFeatPrereqORCondition.RaceID);
                objFeatPrereqORCondition.objRace = objR;

                TalentTree objTT = new TalentTree(objFeatPrereqORCondition.TalentTreeID);
                objFeatPrereqORCondition.objTalentTree = objTT;

                Ability objA = new Ability(objFeatPrereqORCondition.AbilityID);
                objFeatPrereqORCondition.objAbility = objA;

                Skill objS = new Skill(objFeatPrereqORCondition.SkillID);
                objFeatPrereqORCondition.objSkill = objS;
            }
        }
Пример #2
0
        private void SetReaderToObject(ref TalentPrereqORCondition objTalentPrereqORCondition, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objTalentPrereqORCondition.TalentPrereqORConditionID = (int)result.GetValue(result.GetOrdinal("TalentPrereqORConditionID"));
                objTalentPrereqORCondition.TalentID            = (int)result.GetValue(result.GetOrdinal("TalentID"));
                objTalentPrereqORCondition.TalentRequirementID = (int)result.GetValue(result.GetOrdinal("TalentRequirementID"));
                objTalentPrereqORCondition.FeatID                   = (int)result.GetValue(result.GetOrdinal("FeatID"));
                objTalentPrereqORCondition.RaceID                   = (int)result.GetValue(result.GetOrdinal("RaceID"));
                objTalentPrereqORCondition.TalentTreeID             = (int)result.GetValue(result.GetOrdinal("TalentTreeID"));
                objTalentPrereqORCondition.TalentTreeTalentQuantity = (int)result.GetValue(result.GetOrdinal("TalentTreeTalentQuantity"));
                objTalentPrereqORCondition.AbilityID                = (int)result.GetValue(result.GetOrdinal("AbilityID"));
                objTalentPrereqORCondition.AbilityMinimum           = (int)result.GetValue(result.GetOrdinal("AbilityMinimum"));
                objTalentPrereqORCondition.SkillID                  = (int)result.GetValue(result.GetOrdinal("SkillID"));

                if (objTalentPrereqORCondition.TalentID != 0)
                {
                    Talent objTalent = new Talent();
                    objTalentPrereqORCondition.objTalent = objTalent.GetTalent(objTalentPrereqORCondition.TalentID);
                }

                if (objTalentPrereqORCondition.TalentRequirementID != 0)
                {
                    Talent objTalentRequirement = new Talent();
                    objTalentPrereqORCondition.objTalentRequirement = objTalent.GetTalent(objTalentPrereqORCondition.TalentID);
                }

                if (objTalentPrereqORCondition.FeatID != 0)
                {
                    Feat objFeat = new Feat();
                    objTalentPrereqORCondition.objFeat = objFeat.GetFeat(objTalentPrereqORCondition.FeatID);
                }

                if (objTalentPrereqORCondition.RaceID != 0)
                {
                    Race objRace = new Race();
                    objTalentPrereqORCondition.objRace = objRace.GetRace(objTalentPrereqORCondition.FeatID);
                }

                if (objTalentPrereqORCondition.TalentTreeID != 0)
                {
                    TalentTree objTalentTree = new TalentTree();
                    objTalentPrereqORCondition.objTalentTree = objTalentTree.GetTalentTree(objTalentPrereqORCondition.TalentTreeID);
                }

                if (objTalentPrereqORCondition.AbilityID != 0)
                {
                    TalentPrerequisteAbility objTalentPrerequisteAbility = new TalentPrerequisteAbility();
                    objTalentPrereqORCondition.objTalentPrerequisteAbility = objTalentPrerequisteAbility.GetTalentPrerequisteAbility(this.TalentID, this.AbilityID);
                }

                if (objTalentPrereqORCondition.SkillID != 0)
                {
                    Skill objSkill = new Skill();
                    objTalentPrereqORCondition.objSkill = objSkill.GetSkill(objTalentPrereqORCondition.SkillID);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Clones the specified LST TalentTree.
        /// </summary>
        /// <param name="lstTalentTree">The LST TalentTree.</param>
        /// <returns>List<TalentTree></returns>
        static public List <TalentTree> Clone(List <TalentTree> lstTalentTree)
        {
            List <TalentTree> lstCTalentTree = new List <TalentTree>();

            foreach (TalentTree objTalentTree in lstTalentTree)
            {
                lstCTalentTree.Add(TalentTree.Clone(objTalentTree));
            }

            return(lstCTalentTree);
        }
Пример #4
0
        /// <summary>
        /// Determines whether [is talent tree in list] [the specified object talent tree].
        /// </summary>
        /// <param name="objTalentTree">The object talent tree.</param>
        /// <param name="lstTalentTree">The LST talent tree.</param>
        /// <returns>Boolean</returns>
        static public bool IsTalentTreeInList(TalentTree objTalentTree, List <TalentTree> lstTalentTree)
        {
            bool blnTalentTreeFound = false;

            foreach (TalentTree lstObjTalentTree in lstTalentTree)
            {
                if (objTalentTree.TalentTreeID == lstObjTalentTree.TalentTreeID)
                {
                    blnTalentTreeFound = true;
                }
            }

            return(blnTalentTreeFound);
        }
Пример #5
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objTalentTree">The object talent tree.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref TalentTree objTalentTree, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objTalentTree.TalentTreeID   = (int)result.GetValue(result.GetOrdinal("TalentTreeID"));
                objTalentTree.ForceTalent    = (bool)result.GetValue(result.GetOrdinal("ForceTalent"));
                objTalentTree.TalentTreeName = result.GetValue(result.GetOrdinal("TalentTreeName")).ToString();

                Talent objTalent = new Talent();
                Race   objRace   = new Race();
                TalentTreeRequirement objTalentTreeRequirement = new TalentTreeRequirement();

                objTalentTree.objTalentTreeTalents = objTalent.GetTreeTalents("otmTalentTreeTalent.TalentTreeID=" + objTalentTree.TalentTreeID.ToString(), "");

                objTalentTree.objTalentTreeRaceRequirement = objRace.GetRaceRequirementForTalentTree("TalentTreeID=" + objTalentTree.TalentTreeID.ToString(), " RaceName");

                objTalentTree.objTalentTreeRequirement = objTalentTreeRequirement.GetTalentTreeTalentTreeRequirements("TalentTreeID=" + objTalentTree.TalentTreeID.ToString(), " TalentTreeRequirementDescription ");

                objTalentTree._objComboBoxData.Add(objTalentTree.TalentTreeID, objTalentTree.TalentTreeName);
            }
        }
Пример #6
0
        /// <summary>
        /// Gets the talent tree list.
        /// </summary>
        /// <param name="strSprocName">Name of the string sproc.</param>
        /// <param name="strWhere">The string where.</param>
        /// <param name="strOrderBy">The string order by.</param>
        /// <returns>List of TalentTree objects</returns>
        private List <TalentTree> GetTalentTreeList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <TalentTree> talentTrees = new List <TalentTree>();

            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = strSprocName;
                command.Parameters.Add(dbconn.GenerateParameterObj("@strWhere", SqlDbType.VarChar, strWhere, 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@strOrderBy", SqlDbType.VarChar, strOrderBy, 1000));
                result = command.ExecuteReader();

                while (result.Read())
                {
                    TalentTree objTalentTree = new TalentTree();
                    SetReaderToObject(ref objTalentTree, ref result);
                    talentTrees.Add(objTalentTree);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(talentTrees);
        }
Пример #7
0
        //TODO Unit Test
        public List <TalentTree> GetForceTalentTreesByCharacterTradtion(Character objChar)
        {
            List <TalentTree> talentTrees = new List <TalentTree>();

            SqlDataReader      result;
            DatabaseConnection dbconn     = new DatabaseConnection();
            SqlCommand         command    = new SqlCommand();
            SqlConnection      connection = new SqlConnection(dbconn.SQLSEVERConnString);

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "Select_CharacterTalentTreeForceTradtions";
                command.Parameters.Add(dbconn.GenerateParameterObj("@CharacterID", SqlDbType.Int, objChar.CharacterID.ToString()));
                result = command.ExecuteReader();

                while (result.Read())
                {
                    TalentTree objTalentTree = new TalentTree();
                    SetReaderToObject(ref objTalentTree, ref result);
                    talentTrees.Add(objTalentTree);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(talentTrees);
        }
Пример #8
0
        /// <summary>
        /// Clones the specified object TalentTree.
        /// </summary>
        /// <param name="objTalentTree">The object TalentTree.</param>
        /// <returns>TalentTree</returns>
        static public TalentTree Clone(TalentTree objTalentTree)
        {
            TalentTree objCTalentTree = new TalentTree(objTalentTree.TalentTreeID);

            return(objCTalentTree);
        }
Пример #9
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objClass">The object class.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref Class objClass, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objClass.ClassID             = (int)result.GetValue(result.GetOrdinal("ClassID"));
                objClass.IsPrestige          = (bool)result.GetValue(result.GetOrdinal("IsPrestige"));
                objClass.ClassName           = result.GetValue(result.GetOrdinal("ClassName")).ToString();
                objClass.HitDieType          = (int)result.GetValue(result.GetOrdinal("HitDieType"));
                objClass.StartingSkillNumber = (int)result.GetValue(result.GetOrdinal("StartingSkillNumber"));

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartingSkills")).ToString()))
                {
                    objClass.StartingSkills = (int)result.GetValue(result.GetOrdinal("StartingSkills"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDie")).ToString()))
                {
                    objClass.StartCreditDie = (int)result.GetValue(result.GetOrdinal("StartCreditDie"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDieNumber")).ToString()))
                {
                    objClass.StartCreditDieNumber = (int)result.GetValue(result.GetOrdinal("StartCreditDieNumber"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("StartCreditDieModifier")).ToString()))
                {
                    objClass.StartCreditDieModifier = (int)result.GetValue(result.GetOrdinal("StartCreditDieModifier"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredTalents")).ToString()))
                {
                    objClass.PrestigeRequiredTalents = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredTalents"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredForceTech")).ToString()))
                {
                    objClass.PrestigeRequiredForceTech = (bool)result.GetValue(result.GetOrdinal("PrestigeRequiredForceTech"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredDarkside")).ToString()))
                {
                    objClass.PrestigeRequiredDarkside = (bool)result.GetValue(result.GetOrdinal("PrestigeRequiredDarkside"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredFeats")).ToString()))
                {
                    objClass.PrestigeRequiredFeats = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredFeats"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredBaseAttack")).ToString()))
                {
                    objClass.PrestigeRequiredBaseAttack = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredBaseAttack"));
                }

                if (!string.IsNullOrEmpty(result.GetValue(result.GetOrdinal("PrestigeRequiredLevel")).ToString()))
                {
                    objClass.PrestigeRequiredLevel = (int)result.GetValue(result.GetOrdinal("PrestigeRequiredLevel"));
                }
                objClass._objComboBoxData.Clear();
                objClass._objComboBoxData.Add(objClass.ClassID, objClass.ClassName);
            }
            if (objClass.IsPrestige)
            {
                Feat                objFeat = new Feat();;
                ClassDefenseType    objClassDefenseTypes   = new ClassDefenseType();
                PrestigeRequirement objPrestigeRequirement = new PrestigeRequirement();
                TalentTree          objTalentTree          = new TalentTree();
                Talent              objTalent     = new Talent();
                ForcePower          objForcePower = new ForcePower();
                Skill               objSkill      = new Skill();
                Race                objRace       = new Race();

                objClass.StartingFeats = objFeat.GetStartingFeats(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objClassDefenseTypes = objClassDefenseTypes.GetClassDefenseTypes(" ClassID=" + objClass.ClassID.ToString(), "");

                objClass.objPrestigeRequirement = objPrestigeRequirement.GetPrestigeRequirementPrestigeClass(" ClassID=" + objClass.ClassID.ToString(), "PrestigeRequirementDescription");

                objClass.objPrestigeRequiredTalentTree = objTalentTree.GetTalentTreesPrestigeClass("ClassID=" + objClass.ClassID.ToString(), "TalentTreeName");

                objClass.objPrestigeRequiredTalents = objTalent.GetPrestigeRequiredTalents("ClassID=" + objClass.ClassID.ToString(), "TalentName");

                objClass.objPrestigeRequiredFeats = objFeat.GetPrestigeRequiredFeats(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objPrestigeRequiredFeatGroup = objFeat.GetPrestigeRequiredFeatGroups(" ClassID=" + objClass.ClassID.ToString(), "FeatName");

                objClass.objPrestigeRequiredForcePowers = objForcePower.GetPrestigeRequiredForcePowers(" ClassID=" + objClass.ClassID.ToString(), "ForcePowerName");

                objClass.objPrestigeRequiredSkills = objSkill.GetPrestigeRequiredSkills(" ClassID=" + objClass.ClassID.ToString(), "SkillName");

                objClass.objPrestigeRequiredRaces = objRace.GetRaceRequirementForClass(" mtmPrestigeRequirementClassRace.ClassID=" + objClass.ClassID.ToString(), "RaceName");
            }
        }