public override void Parse(XmlDbRow row) { base.Parse(row); mMinIntensityDuration = row.GetFloat("MinIntensityDuration", 0); mTransitionTime.First = row.GetFloat("MinTransitionTime", 0); mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0); mIntensityWeights = new List<int>(); mIntensityWeights.Add(row.GetInt("LightWeight", 0)); mIntensityWeights.Add(row.GetInt("ModerateWeight", 0)); mIntensityWeights.Add(row.GetInt("HeavyWeight", 0)); mIntensityChangeWeights = new List<int>(); foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ',')) { float value; if (float.TryParse(strValue, out value)) { mIntensityChangeWeights.Add((int)value); } else { mIntensityChangeWeights.Add(0); } } }
public override void Parse(XmlDbRow row) { base.Parse(row); mMinIntensityDuration = row.GetFloat("MinIntensityDuration", 0); mTransitionTime.First = row.GetFloat("MinTransitionTime", 0); mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0); mIntensityWeights = new List <int>(); mIntensityWeights.Add(row.GetInt("LightWeight", 0)); mIntensityWeights.Add(row.GetInt("ModerateWeight", 0)); mIntensityWeights.Add(row.GetInt("HeavyWeight", 0)); mIntensityChangeWeights = new List <int>(); foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ',')) { float value; if (float.TryParse(strValue, out value)) { mIntensityChangeWeights.Add((int)value); } else { mIntensityChangeWeights.Add(0); } } }
public virtual void Parse(XmlDbRow row) { mWeight = row.GetInt("Weight", 0); mLength.First = row.GetFloat("MinLength", 0); mLength.Second = row.GetFloat("MaxLength", 0); mTemp.First = row.GetFloat("MinTemp", 0); mTemp.Second = row.GetFloat("MaxTemp", 0); }
public WeightBaseSymptom(XmlDbRow row) : base(row) { if (BooterLogger.Exists(row, "Minimum", Guid)) { mMinimum = row.GetFloat("Minimum"); } if (BooterLogger.Exists(row, "Maximum", Guid)) { mMaximum = row.GetFloat("Maximum"); } }
public FitnessSymptom(XmlDbRow row) : base(row) { if (BooterLogger.Exists(row, "Minimum", Guid)) { mMinimum = row.GetFloat("Minimum"); } if (BooterLogger.Exists(row, "Maximum", Guid)) { mMaximum = row.GetFloat("Maximum"); } }
protected static SettingsKey ParseKey(XmlDbRow row) { Season season = row.GetEnum <Season>("Season", SettingsKey.sAllSeasons); Vector2 hours = new Vector2(); hours.x = row.GetFloat("StartHour", -1); hours.y = row.GetFloat("EndHour", 25); if (season == SettingsKey.sAllSeasons) { return(new GeneralKey(hours)); } else { return(new SeasonKey(season, hours)); } }
public void ParseTemperature(XmlDbRow row) { mStart = row.GetInt("StartDay", 1); mEnd = row.GetInt("EndDay", -1); if (row.Exists("Enabled")) { mEnabled = row.GetBool("Enabled"); } for (int i = 0x0; i < SeasonsManager.TemperatureManager.kTimeNames.Length; i++) { string column = SeasonsManager.TemperatureManager.kTimeNames[i] + "Min"; float min = row.GetFloat(column, -1f); column = SeasonsManager.TemperatureManager.kTimeNames[i] + "Max"; float max = row.GetFloat(column, -1f); switch (i) { case 0: mMorningTemp = new Pair <float, float>(min, max); break; case 1: mNoonTemp = new Pair <float, float>(min, max); break; case 2: mEveningTemp = new Pair <float, float>(min, max); break; case 3: mNightTemp = new Pair <float, float>(min, max); break; } } }
public SymptomChance(XmlDbRow row, int index) { mChance = row.GetFloat("SymptomChance" + index); List <string> symptoms = row.GetStringList("Symptoms" + index, ','); foreach (string symptomName in symptoms) { SymptomBooter.Data symptom = SymptomBooter.GetSymptom(symptomName); if (symptom == null) { BooterLogger.AddError("Unknown Symptom: " + symptomName); } else { mSymptoms.Add(symptom); } } }
// From AcademicDegreeManager:CreateAcademicDegreeTable protected override void Perform(BooterHelper.BootFile file, XmlDbRow row) { AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined; if (!row.TryGetEnum <AcademicDegreeNames>("AcademicDegreeEnum", out academicDegree, AcademicDegreeNames.Undefined)) { academicDegree = unchecked ((AcademicDegreeNames)ResourceUtils.HashString64(row.GetString("AcademicDegreeEnum"))); } BooterLogger.AddTrace("AcademicDegreeEnum: " + row.GetString("AcademicDegreeEnum")); string degreeNameKey = row.GetString("AcademicDegreeName"); string degreeDescKey = row.GetString("AcademicDegreeDesc"); string degreeIcon = row.GetString("AcademicDegreeIcon"); int degreeCreditHours = row.GetInt("AcademicDegreeRequiredCreditHours"); float degreeCostPerCredit = row.GetFloat("AcademicDegreeCostPerCredit"); string degreeResponsibilitiesKey = row.GetString("ResponsibilityTooltipKey"); JobId academicDefaultCourseID; if (!row.TryGetEnum <JobId>("AcademicDefaultCourseID", out academicDefaultCourseID, JobId.AcademicsGenericRabbitHoleCourse)) { // Custom academicDefaultCourseID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultCourseID"))); } JobId academicDefaultLectureID; if (!row.TryGetEnum <JobId>("AcademicDefaultLectureID", out academicDefaultLectureID, JobId.Invalid)) { // Custom academicDefaultLectureID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLectureID"))); } JobId academicDefaultLabID; if (!row.TryGetEnum <JobId>("AcademicDefaultLabID", out academicDefaultLabID, JobId.Invalid)) { // Custom academicDefaultLabID = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLabID"))); } List <OccupationNames> associatedOccupations = new List <OccupationNames>(); List <string> list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true); for (int i = 0x0; i < list2.Count; i++) { OccupationNames occupation; if (!ParserFunctions.TryParseEnum <OccupationNames>(list2[i], out occupation, OccupationNames.Undefined)) { occupation = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i]))); } if (occupation != OccupationNames.Undefined) { associatedOccupations.Add(occupation); } } OccupationNames grantedOccupation; if (!ParserFunctions.TryParseEnum <OccupationNames>("GrantedOccupationNameEnum", out grantedOccupation, OccupationNames.Undefined)) { // Custom grantedOccupation = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString("GrantedOccupationNameEnum"))); } List <TraitNames> beneficialTraits; List <TraitNames> detrimentalTraits; List <TraitNames> suggestedTraits; ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["BeneficialTraits"], out beneficialTraits, TraitNames.Unknown); ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["DetrimentalTraits"], out detrimentalTraits, TraitNames.Unknown); ParserFunctions.TryParseCommaSeparatedList <TraitNames>(row["SuggestedTraits"], out suggestedTraits, TraitNames.Unknown); AcademicDegreeStaticData staticData = null; if (!AcademicDegreeManager.sDictionary.TryGetValue((ulong)academicDegree, out staticData)) { staticData = new AcademicDegreeStaticData(academicDegree, degreeNameKey, degreeDescKey, degreeResponsibilitiesKey, degreeIcon, degreeCreditHours, degreeCostPerCredit, academicDefaultCourseID, academicDefaultLectureID, academicDefaultLabID, associatedOccupations, grantedOccupation, beneficialTraits, detrimentalTraits, suggestedTraits); } else { staticData.BeneficialTraits.AddRange(beneficialTraits); staticData.DetrimentalTraits.AddRange(detrimentalTraits); staticData.SuggestedTraits.AddRange(suggestedTraits); staticData.AssociatedOccupations.AddRange(associatedOccupations); } string skillsThatGrantXP = row.GetString("SkillsThatGrantXP"); if (!string.IsNullOrEmpty(skillsThatGrantXP)) { foreach (string str6 in skillsThatGrantXP.Split(new char[] { ';' })) { string[] strArray2 = str6.Split(new char[] { ',' }); if (strArray2.Length != 0x2) { continue; } float num4 = ParserFunctions.ParseFloat(strArray2[0x1], -1234123f); if (num4 == -1234123f) { continue; } // Custom SkillNames skillName = SkillManager.sSkillEnumValues.ParseEnumValue(strArray2[0x0]); if (skillName == SkillNames.None) { continue; } staticData.AddSkill(skillName, num4); } } AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData; }
public void ParseTemperature(XmlDbRow row) { mStart = row.GetInt("StartDay", 1); mEnd = row.GetInt("EndDay", -1); if (row.Exists("Enabled")) { mEnabled = row.GetBool("Enabled"); } for (int i = 0x0; i < SeasonsManager.TemperatureManager.kTimeNames.Length; i++) { string column = SeasonsManager.TemperatureManager.kTimeNames[i] + "Min"; float min = row.GetFloat(column, -1f); column = SeasonsManager.TemperatureManager.kTimeNames[i] + "Max"; float max = row.GetFloat(column, -1f); switch (i) { case 0: mMorningTemp = new Pair<float, float>(min, max); break; case 1: mNoonTemp = new Pair<float, float>(min, max); break; case 2: mEveningTemp = new Pair<float, float>(min, max); break; case 3: mNightTemp = new Pair<float, float>(min, max); break; } } }
public override void SetField(FieldInfo field, XmlDbRow row) { field.SetValue(null, row.GetFloat("Value")); }
// From AcademicDegreeManager:CreateAcademicDegreeTable protected override void Perform(BooterHelper.BootFile file, XmlDbRow row) { AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined; if (!row.TryGetEnum<AcademicDegreeNames>("AcademicDegreeEnum", out academicDegree, AcademicDegreeNames.Undefined)) { academicDegree = unchecked((AcademicDegreeNames)ResourceUtils.HashString64(row.GetString("AcademicDegreeEnum"))); } BooterLogger.AddTrace("AcademicDegreeEnum: " + row.GetString("AcademicDegreeEnum")); string degreeNameKey = row.GetString("AcademicDegreeName"); string degreeDescKey = row.GetString("AcademicDegreeDesc"); string degreeIcon = row.GetString("AcademicDegreeIcon"); int degreeCreditHours = row.GetInt("AcademicDegreeRequiredCreditHours"); float degreeCostPerCredit = row.GetFloat("AcademicDegreeCostPerCredit"); string degreeResponsibilitiesKey = row.GetString("ResponsibilityTooltipKey"); JobId academicDefaultCourseID; if (!row.TryGetEnum<JobId>("AcademicDefaultCourseID", out academicDefaultCourseID, JobId.AcademicsGenericRabbitHoleCourse)) { // Custom academicDefaultCourseID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultCourseID"))); } JobId academicDefaultLectureID; if (!row.TryGetEnum<JobId>("AcademicDefaultLectureID", out academicDefaultLectureID, JobId.Invalid)) { // Custom academicDefaultLectureID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLectureID"))); } JobId academicDefaultLabID; if (!row.TryGetEnum<JobId>("AcademicDefaultLabID", out academicDefaultLabID, JobId.Invalid)) { // Custom academicDefaultLabID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLabID"))); } List<OccupationNames> associatedOccupations = new List<OccupationNames>(); List<string> list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true); for (int i = 0x0; i < list2.Count; i++) { OccupationNames occupation; if (!ParserFunctions.TryParseEnum<OccupationNames>(list2[i], out occupation, OccupationNames.Undefined)) { occupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i]))); } if (occupation != OccupationNames.Undefined) { associatedOccupations.Add(occupation); } } OccupationNames grantedOccupation; if (!ParserFunctions.TryParseEnum<OccupationNames>("GrantedOccupationNameEnum", out grantedOccupation, OccupationNames.Undefined)) { // Custom grantedOccupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString("GrantedOccupationNameEnum"))); } List<TraitNames> beneficialTraits; List<TraitNames> detrimentalTraits; List<TraitNames> suggestedTraits; ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["BeneficialTraits"], out beneficialTraits, TraitNames.Unknown); ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["DetrimentalTraits"], out detrimentalTraits, TraitNames.Unknown); ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["SuggestedTraits"], out suggestedTraits, TraitNames.Unknown); AcademicDegreeStaticData staticData = null; if (!AcademicDegreeManager.sDictionary.TryGetValue((ulong)academicDegree, out staticData)) { staticData = new AcademicDegreeStaticData(academicDegree, degreeNameKey, degreeDescKey, degreeResponsibilitiesKey, degreeIcon, degreeCreditHours, degreeCostPerCredit, academicDefaultCourseID, academicDefaultLectureID, academicDefaultLabID, associatedOccupations, grantedOccupation, beneficialTraits, detrimentalTraits, suggestedTraits); } else { staticData.BeneficialTraits.AddRange(beneficialTraits); staticData.DetrimentalTraits.AddRange(detrimentalTraits); staticData.SuggestedTraits.AddRange(suggestedTraits); staticData.AssociatedOccupations.AddRange(associatedOccupations); } string skillsThatGrantXP = row.GetString("SkillsThatGrantXP"); if (!string.IsNullOrEmpty(skillsThatGrantXP)) { foreach (string str6 in skillsThatGrantXP.Split(new char[] { ';' })) { string[] strArray2 = str6.Split(new char[] { ',' }); if (strArray2.Length != 0x2) continue; float num4 = ParserFunctions.ParseFloat(strArray2[0x1], -1234123f); if (num4 == -1234123f) continue; // Custom SkillNames skillName = SkillManager.sSkillEnumValues.ParseEnumValue(strArray2[0x0]); if (skillName == SkillNames.None) continue; staticData.AddSkill(skillName, num4); } } AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData; }
public virtual void Set(XmlDbRow row) { try { mPerformanceModifier = row.GetFloat("PerformanceModifier", mPerformanceModifier); if (!string.IsNullOrEmpty(row.GetString("OnlySkill"))) { mOnlySkill = row.GetBool("OnlySkill"); } if (!string.IsNullOrEmpty(row.GetString("MustHaveVisibleSkill"))) { mMustHaveVisibleSkill = row.GetBool("MustHaveVisibleSkill"); } row.TryGetEnum <ProductVersion>("ProductVersoin", out mVersion, ProductVersion.BaseGame); mBranch = row.GetString("CareerBranch"); mMinLevel = row.GetInt("CareerMinLevel", mMinLevel); mMaxLevel = row.GetInt("CareerMaxLevel", mMaxLevel); int count = row.GetInt("SkillCount"); for (int i = 1; i <= count; i++) { float rate = 1f; if (row.Exists("SkillRate" + i)) { rate = row.GetFloat("SkillRate" + i); } string skillName = row.GetString("Skill" + i); if (skillName == null) { continue; } SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillName); if (skill == SkillNames.None) { continue; } mSkills.Add(new SkillRate(skill, rate)); } count = row.GetInt("MotiveCount"); for (int i = 1; i <= count; i++) { float rate = 1f; if (row.Exists("MotiveRate" + i)) { rate = row.GetFloat("MotiveRate" + i); } CommodityKind motive = CommodityKind.None; string motiveName = row.GetString("Motive" + i); if (motiveName == null) { continue; } ParserFunctions.TryParseEnum <CommodityKind>(motiveName, out motive, CommodityKind.None); if (motive == CommodityKind.None) { continue; } mMotives.Add(new MotiveRate(motive, rate)); } count = row.GetInt("MetricCount"); for (int i = 1; i <= count; i++) { int rate = row.GetInt("MetricRate" + i, 1); MetricRate.MetricType metric = row.GetEnum <MetricRate.MetricType>("MetricType" + i, MetricRate.MetricType.None); int hoursUntilChange = row.GetInt("MetricHoursUntilChange" + i, 1); mMetrics.Add(new MetricRate(metric, rate, hoursUntilChange)); } } catch (Exception exception) { Common.Exception(Name(), exception); } }
public Stage(XmlDbRow row) { if (BooterLogger.Exists(row, "Name", "Stage")) { mName = row.GetString("Name"); } if (!row.TryGetEnum <VectorControl.StageType>("Type", out mType, VectorControl.StageType.None)) { BooterLogger.AddError(Name + " Invalid Type: " + row.GetString("Type")); } float infectionRate = row.GetFloat("InfectionRate", 0); mOutdoorInfectionRate = row.GetFloat("OutdoorInfectionRate", infectionRate); if (mOutdoorInfectionRate > 1) { mOutdoorInfectionRate = 1; } mRoomInfectionRate = row.GetFloat("RoomInfectionRate", mOutdoorInfectionRate * 1.5f); if (mRoomInfectionRate > 1) { mRoomInfectionRate = 1; } mSocialInfectionRate = row.GetFloat("SocialInfectionRate", mRoomInfectionRate * 1.5f); if (mSocialInfectionRate > 1) { mSocialInfectionRate = 1; } mFightInfectionRate = row.GetFloat("FightInfectionRate", mSocialInfectionRate); if (mFightInfectionRate > 1) { mFightInfectionRate = 1; } mWoohooInfectionRate = row.GetFloat("WoohooInfectionRate", mSocialInfectionRate * 1.5f); if (mWoohooInfectionRate > 1) { mWoohooInfectionRate = 1; } mMutationRate = row.GetFloat("MutationRate", 0); mGoodRelationshipDelta = row.GetInt("GoodRelationshipDelta", 0); mBadRelationshipDelta = row.GetInt("BadRelationshipDelta", 0); mSymptomScoring = row.GetString("SymptomScoring"); mSymptomScoringMinimum = row.GetInt("SymptomScoringMinimum", 0); mStoryUnknown = row.GetString("StoryUnknown"); mStoryIdentified = row.GetString("StoryIdentified"); if (row.Exists("CanInoculate")) // Default is True { mCanInoculate = row.GetBool("CanInoculate"); } else if (row.Exists("CanInnoculate")) { mCanInoculate = row.GetBool("CanInnoculate"); } int numSymptoms = row.GetInt("NumSymptoms", 0) + 1; for (int i = 1; i <= numSymptoms; i++) { if (i == numSymptoms) { if (row.Exists("SymptomChance" + i)) { BooterLogger.AddError(Name + " More Symptoms than NumSymptoms"); } break; } mSymptoms.Add(new SymptomChance(row, i)); } int numResistances = row.GetInt("NumResistances", 0) + 1; for (int i = 1; i <= numResistances; i++) { if (i == numResistances) { if (row.Exists("Resistance" + i)) { BooterLogger.AddError(Name + " More Resistance than NumResistances"); } break; } ResistanceBooter.Data resistance = ResistanceBooter.GetResistance(row.GetString("Resistance" + i)); if (resistance == null) { BooterLogger.AddError(Name + " Unknown Resistance " + i + ": " + row.GetString("Resistance" + i)); } else { mResistances.Add(resistance); } } int numMutables = row.GetInt("NumMutables", 0) + 1; for (int i = 1; i <= numMutables; i++) { if (i == numMutables) { if (row.Exists("Mutable" + i)) { BooterLogger.AddError(Name + " More Mutable than NumMutables"); } break; } List <string> mutable = row.GetStringList("Mutable" + i, ','); if (mutable.Count != 3) { BooterLogger.AddError(Name + " Unknown Mutable " + i + ": " + row.GetString("Mutable" + i)); continue; } int minimum; if (!int.TryParse(mutable[1], out minimum)) { BooterLogger.AddError(Name + " Mutable " + i + " Invalid Minimum: " + mutable[1]); continue; } int maximum; if (!int.TryParse(mutable[2], out maximum)) { BooterLogger.AddError(Name + " Mutable " + i + " Invalid Maximum: " + mutable[2]); continue; } mMutables.Add(new Mutable(mutable[0], minimum, maximum)); } }