public ActionDataSetting(string name, XmlDbRow row) : this(name) { mFlags = Flags.None; if (row.Exists("Autonomous")) { mAutonomous = row.GetBool("Autonomous"); mFlags |= Flags.Autonomous; } if (row.Exists("UserDirected")) { mUserDirected = row.GetBool("UserDirected"); mFlags |= Flags.UserDirected; } if (row.Exists("AllowPregnant")) { mAllowPregnant = row.GetBool("AllowPregnant"); mFlags |= Flags.AllowPregnant; } if (row.Exists("ActorAgeSpecies")) { mActorAgeSpecies = row.GetEnum <CASAGSAvailabilityFlags>("ActorAgeSpecies", CASAGSAvailabilityFlags.All); if (mActorAgeSpecies == CASAGSAvailabilityFlags.All) { BooterLogger.AddError("Unknown ActorAgeSpecies: " + row.GetString("ActorAgeSpecies")); } else { mFlags |= Flags.ActorAgeSpecies; mActorAgeSpeciesList = null; } } if (row.Exists("TargetAgeSpecies")) { mTargetAgeSpecies = row.GetEnum <CASAGSAvailabilityFlags>("TargetAgeSpecies", CASAGSAvailabilityFlags.All); if (mTargetAgeSpecies == CASAGSAvailabilityFlags.All) { BooterLogger.AddError("Unknown TargetAgeSpecies: " + row.GetString("TargetAgeSpecies")); } else { mFlags |= Flags.TargetAgeSpecies; mTargetAgeSpeciesList = null; } } }
public ITUNSettings(string name, XmlDbRow row) : this(name) { mFlags = Flags.None; if (row.Exists("Autonomous")) { mAutonomous = row.GetBool("Autonomous"); mFlags |= Flags.Autonomous; } if (row.Exists("UserDirected")) { mUserDirected = row.GetBool("UserDirected"); mFlags |= Flags.UserDirected; } if (row.Exists("AgeSpecies")) { mAgeSpecies = row.GetEnum <CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None); if (mAgeSpecies == CASAGSAvailabilityFlags.None) { BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies")); } else { mFlags |= Flags.AgeSpecies; mAgeSpeciesList = null; } } if (row.Exists("Availability")) { mAvailability = row.GetEnum <Availability.FlagField>("Availability", Availability.FlagField.None); if (mAvailability == Availability.FlagField.None) { BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability")); } else { mFlags |= Flags.Availability; } } if (row.Exists("Advertised")) { ParseAdvertised(row.GetStringList("Advertised", ',')); } }
protected WeatherSettings GetSeason(XmlDbRow row) { Season season = row.GetEnum<Season>("Season", Season.Spring | Season.Summer | Season.Fall | Season.Winter); if (season == (Season.Spring | Season.Summer | Season.Fall | Season.Winter)) { BooterLogger.AddError("Unknown Season: " + row.GetString("Season")); return null; } return Tempest.Settings.GetWeather(season, false); }
protected WeatherSettings GetSeason(XmlDbRow row) { Season season = row.GetEnum <Season>("Season", Season.Spring | Season.Summer | Season.Fall | Season.Winter); if (season == (Season.Spring | Season.Summer | Season.Fall | Season.Winter)) { BooterLogger.AddError("Unknown Season: " + row.GetString("Season")); return(null); } return(Tempest.Settings.GetWeather(season, false)); }
public override bool Parse(XmlDbRow row, ref string error) { mOccult = row.GetEnum<OccultTypes>("Occult", OccultTypes.None); if (mOccult == OccultTypes.None) { error = "Occult Fail: " + row.GetString("Occult"); return false; } mAllowHybrid = row.GetBool("AllowHybrid"); return base.Parse(row, ref error); }
public override bool Parse(XmlDbRow row, ref string error) { mOccult = row.GetEnum <OccultTypes>("Occult", OccultTypes.None); if (mOccult == OccultTypes.None) { error = "Occult Fail: " + row.GetString("Occult"); return(false); } mAllowHybrid = row.GetBool("AllowHybrid"); return(base.Parse(row, ref error)); }
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 override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mCheckAny = row.GetBool("CheckAny"); mDelta = row.GetInt("Delta", mDelta); if (row.Exists("Ages")) { mAges = row.GetEnum <CASAgeGenderFlags>("Ages", CASAgeGenderFlags.None); if (mAges == CASAgeGenderFlags.None) { error = "Invalid Ages: " + row.GetString("Ages"); return(false); } } if (row.Exists("CheckExisting")) { mCheckExisting = row.GetBool("CheckExisting"); } if (row.Exists("Species")) { ToCASAgeGenderFlags converter = new ToCASAgeGenderFlags(); mSpecies = converter.Convert(row.GetString("Species")); if (mSpecies == null) { error = converter.mError; return(false); } } mSuccess = new WeightScenarioHelper(Origin.FromNewLitter); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mChanceOfHomeLot = row.GetInt("ChanceOfHome", mChanceOfHomeLot); mPartyAttire = row.GetEnum <OutfitCategories>("Attire", OutfitCategories.None); if (mPartyAttire == OutfitCategories.None) { error = "Unknown Attire: " + row.GetString("Attire"); return(false); } mSuccess = new WeightScenarioHelper(Origin.FromSocialization); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } return(base.Parse(row, ref error)); }
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 ITUNSettings(string name, XmlDbRow row) : this(name) { mFlags = Flags.None; if (row.Exists("Autonomous")) { mAutonomous = row.GetBool("Autonomous"); mFlags |= Flags.Autonomous; } if (row.Exists("UserDirected")) { mUserDirected = row.GetBool("UserDirected"); mFlags |= Flags.UserDirected; } if (row.Exists("AgeSpecies")) { mAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("AgeSpecies", CASAGSAvailabilityFlags.None); if (mAgeSpecies == CASAGSAvailabilityFlags.None) { BooterLogger.AddError("Unknown AgeSpecies: " + row.GetString("AgeSpecies")); } else { mFlags |= Flags.AgeSpecies; mAgeSpeciesList = null; } } if (row.Exists("Availability")) { mAvailability = row.GetEnum<Availability.FlagField>("Availability", Availability.FlagField.None); if (mAvailability == Availability.FlagField.None) { BooterLogger.AddError("Unknown Availability: " + row.GetString("Availability")); } else { mFlags |= Flags.Availability; } } if (row.Exists("Advertised")) { ParseAdvertised(row.GetStringList("Advertised", ',')); } }
public ActionDataSetting(string name, XmlDbRow row) : this(name) { mFlags = Flags.None; if (row.Exists("Autonomous")) { mAutonomous = row.GetBool("Autonomous"); mFlags |= Flags.Autonomous; } if (row.Exists("UserDirected")) { mUserDirected = row.GetBool("UserDirected"); mFlags |= Flags.UserDirected; } if (row.Exists("AllowPregnant")) { mAllowPregnant = row.GetBool("AllowPregnant"); mFlags |= Flags.AllowPregnant; } if (row.Exists("ActorAgeSpecies")) { mActorAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("ActorAgeSpecies", CASAGSAvailabilityFlags.All); if (mActorAgeSpecies == CASAGSAvailabilityFlags.All) { BooterLogger.AddError("Unknown ActorAgeSpecies: " + row.GetString("ActorAgeSpecies")); } else { mFlags |= Flags.ActorAgeSpecies; mActorAgeSpeciesList = null; } } if (row.Exists("TargetAgeSpecies")) { mTargetAgeSpecies = row.GetEnum<CASAGSAvailabilityFlags>("TargetAgeSpecies", CASAGSAvailabilityFlags.All); if (mTargetAgeSpecies == CASAGSAvailabilityFlags.All) { BooterLogger.AddError("Unknown TargetAgeSpecies: " + row.GetString("TargetAgeSpecies")); } else { mFlags |= Flags.TargetAgeSpecies; mTargetAgeSpeciesList = null; } } }
public void Load(XmlDbRow row) { sCustomNames = true; CASAGSAvailabilityFlags specieFlags = ParserFunctions.ParseAllowableAgeSpecies(row, "Species"); string totalName = row.GetString("Name"); if (string.IsNullOrEmpty(totalName)) { return; } //BooterLogger.AddError("Names Found: " + totalName); string[] names = totalName.Split(','); bool exclusion = row.GetBool("Exclude"); bool isMale = false; bool isFemale = false; { CASAgeGenderFlags gender = row.GetEnum <CASAgeGenderFlags>("Gender", CASAgeGenderFlags.Male | CASAgeGenderFlags.Female); if ((gender & CASAgeGenderFlags.Male) == CASAgeGenderFlags.Male) { isMale = true; } if ((gender & CASAgeGenderFlags.Female) == CASAgeGenderFlags.Female) { isFemale = true; } } List <CASAgeGenderFlags> species = new List <CASAgeGenderFlags>(); if ((specieFlags & CASAGSAvailabilityFlags.AllCatsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Cat); } if ((specieFlags & CASAGSAvailabilityFlags.AllDogsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Dog); } if ((specieFlags & CASAGSAvailabilityFlags.AllLittleDogsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.LittleDog); } if ((specieFlags & CASAGSAvailabilityFlags.AllHorsesMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Horse); } if ((specieFlags & CASAGSAvailabilityFlags.HumanAgeMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Human); } foreach (CASAgeGenderFlags specie in species) { Genders genderList; if (!mLoadedNames.TryGetValue(specie, out genderList)) { genderList = new Genders(); mLoadedNames.Add(specie, genderList); } for (int i = 0; i < names.Length; i++) { string name = names[i].Trim(); if (isMale) { if (exclusion) { genderList.GetExclusions(false).Add(name, true); } else { genderList.GetNames(false).Add(name); } } if (isFemale) { if (exclusion) { genderList.GetExclusions(true).Add(name, true); } else { genderList.GetNames(true).Add(name); } } } } }
public override void SetField(FieldInfo field, XmlDbRow row) { field.SetValue(null, row.GetEnum <T>("Value", default(T))); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mChanceOfHomeLot = row.GetInt("ChanceOfHome", mChanceOfHomeLot); mPartyAttire = row.GetEnum<OutfitCategories>("Attire", OutfitCategories.None); if (mPartyAttire == OutfitCategories.None) { error = "Unknown Attire: " + row.GetString("Attire"); return false; } mSuccess = new WeightScenarioHelper(Origin.FromSocialization); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } return base.Parse(row, ref error); }
public void Load(XmlDbRow row) { sCustomNames = true; CASAGSAvailabilityFlags specieFlags = ParserFunctions.ParseAllowableAgeSpecies(row, "Species"); string totalName = row.GetString("Name"); if (string.IsNullOrEmpty(totalName)) return; //BooterLogger.AddError("Names Found: " + totalName); string[] names = totalName.Split(','); bool exclusion = row.GetBool("Exclude"); bool isMale = false; bool isFemale = false; { CASAgeGenderFlags gender = row.GetEnum<CASAgeGenderFlags>("Gender", CASAgeGenderFlags.Male | CASAgeGenderFlags.Female); if ((gender & CASAgeGenderFlags.Male) == CASAgeGenderFlags.Male) { isMale = true; } if ((gender & CASAgeGenderFlags.Female) == CASAgeGenderFlags.Female) { isFemale = true; } } List<CASAgeGenderFlags> species = new List<CASAgeGenderFlags>(); if ((specieFlags & CASAGSAvailabilityFlags.AllCatsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Cat); } if ((specieFlags & CASAGSAvailabilityFlags.AllDogsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Dog); } if ((specieFlags & CASAGSAvailabilityFlags.AllLittleDogsMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.LittleDog); } if ((specieFlags & CASAGSAvailabilityFlags.AllHorsesMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Horse); } if ((specieFlags & CASAGSAvailabilityFlags.HumanAgeMask) != CASAGSAvailabilityFlags.None) { species.Add(CASAgeGenderFlags.Human); } foreach (CASAgeGenderFlags specie in species) { Genders genderList; if (!mLoadedNames.TryGetValue(specie, out genderList)) { genderList = new Genders(); mLoadedNames.Add(specie, genderList); } for (int i = 0; i < names.Length; i++) { string name = names[i].Trim(); if (isMale) { if (exclusion) { genderList.GetExclusions(false).Add(name, true); } else { genderList.GetNames(false).Add(name); } } if (isFemale) { if (exclusion) { genderList.GetExclusions(true).Add(name, true); } else { genderList.GetNames(true).Add(name); } } } } }