Exemple #1
0
        /// <summary>
        /// Clones the specified LST CharacterSkill.
        /// </summary>
        /// <param name="lstCharacterSkill">The LST CharacterSkill.</param>
        /// <returns>List<CharacterSkill></returns>
        static public List <CharacterSkill> Clone(List <CharacterSkill> lstCharacterSkill)
        {
            List <CharacterSkill> lstCCharacterSkill = new List <CharacterSkill>();

            foreach (CharacterSkill objCharacterSkill in lstCharacterSkill)
            {
                lstCCharacterSkill.Add(CharacterSkill.Clone(objCharacterSkill));
            }

            return(lstCCharacterSkill);
        }
Exemple #2
0
        //TODO: Unit Test
        static public CharacterSkill GetCharacterSkillFromListBySkill(Skill objSkill, List <CharacterSkill> lstCharSkill)
        {
            CharacterSkill objReturnCharSkill = new CharacterSkill();

            foreach (CharacterSkill objCharSkill in lstCharSkill)
            {
                if (objSkill.SkillID == objCharSkill.objSkill.SkillID)
                {
                    objReturnCharSkill = objCharSkill;
                }
            }
            return(objReturnCharSkill);
        }
Exemple #3
0
        /// <summary>
        /// Sets the reader to object.
        /// </summary>
        /// <param name="objCharacterSkill">The object character skill.</param>
        /// <param name="result">The result.</param>
        private void SetReaderToObject(ref CharacterSkill objCharacterSkill, ref SqlDataReader result)
        {
            if (result.HasRows)
            {
                objCharacterSkill.CharacterID   = (int)result.GetValue(result.GetOrdinal("CharacterID"));
                objCharacterSkill.SkillID       = (int)result.GetValue(result.GetOrdinal("SkillID"));
                objCharacterSkill.HalfLevel     = (int)result.GetValue(result.GetOrdinal("HalfLevel"));
                objCharacterSkill.AbilityMod    = (int)result.GetValue(result.GetOrdinal("AbilityMod"));
                objCharacterSkill.Trained       = (int)result.GetValue(result.GetOrdinal("Trained"));
                objCharacterSkill.SkillFocus    = (int)result.GetValue(result.GetOrdinal("SkillFocus"));
                objCharacterSkill.Miscellaneous = (int)result.GetValue(result.GetOrdinal("Miscellaneous"));
                objCharacterSkill.FeatTalentMod = (int)result.GetValue(result.GetOrdinal("FeatTalentMod"));

                Skill objSkill = new Skill();
                objCharacterSkill.objSkill = objSkill.GetSkill(objCharacterSkill.SkillID);
            }
        }
Exemple #4
0
        /// <summary>
        /// Gets the character skill 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 CharacterSkill Objects</returns>
        private List <CharacterSkill> GetCharacterSkillList(string strSprocName, string strWhere, string strOrderBy)
        {
            List <CharacterSkill> characterSkills = new List <CharacterSkill>();

            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())
                {
                    CharacterSkill objCharacterSkill = new CharacterSkill();
                    SetReaderToObject(ref objCharacterSkill, ref result);
                    characterSkills.Add(objCharacterSkill);
                }
            }
            catch
            {
                Exception e = new Exception();
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(characterSkills);
        }
Exemple #5
0
        static public bool FeatOrConditionsMeet(Character objChar, Feat objFeat)
        {
            bool returnVal = false;
            List <FeatPrereqORCondition> lstFPORCond = new List <FeatPrereqORCondition>();
            FeatPrereqORCondition        objFPORCond = new FeatPrereqORCondition();


            List <Talent> lstORTalents = new List <Talent>();
            List <Feat>   lstORFeats   = new List <Feat>();
            List <Race>   lstORRaces   = new List <Race>();
            List <TalentTalentTreeRequirement> lstORTalentTrees = new List <TalentTalentTreeRequirement>();
            List <TalentAbilityRequirement>    lstORAbility     = new List <TalentAbilityRequirement>();
            List <Skill> lstORSkill = new List <Skill>();

            lstFPORCond = objFPORCond.GetFeatPrereqORConditions(objFeat.FeatID);

            if (lstFPORCond.Count == 0)
            {
                returnVal = true;
            }
            else
            {
                foreach (FeatPrereqORCondition objOrCond in lstFPORCond)
                {
                    if (objOrCond.FeatRequirementID != 0)
                    {
                        Feat objFR = new Feat();
                        objFR.GetFeat(objOrCond.FeatRequirementID);
                        lstORFeats.Add(objFR);
                    }
                    if (objOrCond.TalentID != 0)
                    {
                        Talent objTalent = new Talent();
                        objTalent.GetTalent(objOrCond.TalentID);
                        lstORTalents.Add(objTalent);
                    }
                    if (objOrCond.RaceID != 0)
                    {
                        Race objRace = new Race();
                        objRace.GetRace(objOrCond.RaceID);
                        lstORRaces.Add(objRace);
                    }
                    if (objOrCond.TalentTreeID != 0)
                    {
                        TalentTalentTreeRequirement objTTTR = new TalentTalentTreeRequirement();
                        objTTTR.TalentTreeID             = objOrCond.TalentTreeID;
                        objTTTR.TalentTreeTalentQuantity = objOrCond.TalentTreeTalentQuantity;
                        lstORTalentTrees.Add(objTTTR);
                    }
                    if (objOrCond.AbilityID != 0)
                    {
                        TalentAbilityRequirement objTAR = new TalentAbilityRequirement();
                        objTAR.AbilityID     = objOrCond.AbilityID;
                        objTAR.AbilityMinium = objOrCond.AbilityMinimum;
                        lstORAbility.Add(objTAR);
                    }
                    if (objOrCond.SkillID != 0)
                    {
                        Skill objSkill = new Skill();
                        objSkill.GetSkill(objOrCond.SkillID);
                        lstORSkill.Add(objSkill);
                    }
                }

                //Got all the lists full, have to check to see if the character has ANY of these, if they do then we jump out and are done
                //Talent
                bool blnTalentFound = false;
                foreach (Talent objSearchTalent in lstORTalents)
                {
                    if (Talent.IsTalentInList(objSearchTalent, objChar.lstTalents))
                    {
                        blnTalentFound = true;
                    }
                }

                if (blnTalentFound)
                {
                    return(blnTalentFound);
                }

                //Feat
                bool blnFeatFound = false;
                foreach (Feat objSearchFeat in lstORFeats)
                {
                    if (Feat.IsFeatInList(objSearchFeat, objChar.lstFeats))
                    {
                        blnFeatFound = true;
                    }
                }

                if (blnFeatFound)
                {
                    return(blnFeatFound);
                }

                //Race
                bool blnRaceFound = false;
                foreach (Race objSearchRace in lstORRaces)
                {
                    if (objSearchRace.RaceID == objChar.RaceID)
                    {
                        blnRaceFound = true;
                    }
                }

                if (blnRaceFound)
                {
                    return(blnRaceFound);
                }

                //TalentTree talents (Has x number of talents in a particular tree
                bool blnTalentTreeQuantityFound = false;
                foreach (Talent objSearchTalent in lstORTalents)
                {
                    if (Talent.IsTalentInList(objSearchTalent, objChar.lstTalents))
                    {
                        blnTalentTreeQuantityFound = true;
                    }
                }

                if (blnTalentTreeQuantityFound)
                {
                    return(blnTalentTreeQuantityFound);
                }


                //Ability
                bool blnAbilityFound = false;
                foreach (TalentAbilityRequirement objSearchAbility in lstORAbility)
                {
                    if (Ability.AblityRequirementMet(objSearchAbility.AbilityID, objSearchAbility.AbilityMinium, objChar))
                    {
                        blnAbilityFound = true;
                    }
                }

                if (blnTalentTreeQuantityFound)
                {
                    return(blnAbilityFound);
                }

                //public int SkillID { get; set; }
                //Race
                bool blnSkillFound = false;
                foreach (Skill objSearchSkill in lstORSkill)
                {
                    if (CharacterSkill.IsSkillInList(objSearchSkill, objChar.lstCharacterSkills))
                    {
                        blnSkillFound = true;
                    }
                }

                if (blnSkillFound)
                {
                    return(blnSkillFound);
                }
            }

            //went thru everything, nothing found return false;
            return(returnVal);
        }
Exemple #6
0
        /// <summary>
        /// Clones the specified object CharacterSkill.
        /// </summary>
        /// <param name="objCharacterSkill">The object CharacterSkill.</param>
        /// <returns>CharacterSkill</returns>
        static public CharacterSkill Clone(CharacterSkill objCharacterSkill)
        {
            CharacterSkill objCCharacterSkill = new CharacterSkill(objCharacterSkill.CharacterID, objCharacterSkill.SkillID);

            return(objCCharacterSkill);
        }