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); } } }
/// <summary> /// Sets the reader to object. /// </summary> /// <param name="objSizeSkillModifier">The object size skill modifier.</param> /// <param name="result">The result.</param> private void SetReaderToObject(ref SizeSkillModifier objSizeSkillModifier, ref SqlDataReader result) { if (result.HasRows) { objSizeSkillModifier.SizeID = (int)result.GetValue(result.GetOrdinal("SizeID")); objSizeSkillModifier.SkillID = (int)result.GetValue(result.GetOrdinal("SkillID")); objSizeSkillModifier.ModifierID = (int)result.GetValue(result.GetOrdinal("ModifierID")); Skill objSkill = new Skill(); Modifier objModifier = new Modifier(); objSizeSkillModifier.objSkill = objSkill.GetSkill(objSizeSkillModifier.SkillID); objSizeSkillModifier.objModifier = objModifier.GetModifier(objSizeSkillModifier.ModifierID); } }
/// <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); } }
//TODO: Unit Test static public bool DoesCharacterHaveSkillTrainingForSkill(int SkillID, Character objChar) { bool returnVal = false; Skill objSkill = new Skill(); objSkill.GetSkill(SkillID); foreach (Feat objFeat in objChar.lstFeats) { if (objFeat.FeatName == "Skill Training(" + objSkill.SkillName + ")") { returnVal = true; } } return(returnVal); }
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); }