protected override void Perform(BooterHelper.BootFile file, XmlDbRow row) { TunableStore store = null; if (row.Exists("SubFieldName")) { store = new NestedStore(); } else if (row.Exists("Index")) { store = new ArrayValueStore(); } else { store = new ValueStore(); } if (!store.Parse(row)) { return; } SettingsKey key = ParseKey(row); if (key is GeneralKey) { store.Apply(key); } Add(key, store); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (row.Exists("ChildStory")) { mChildStory = row.GetBool("ChildStory"); } if (row.Exists("AllowDoorPranks")) { mAllowDoorPranks = row.GetBool("AllowDoorPranks"); } mSneakinessScoring = row.GetString("SneakinessScoring"); mSuccess = new WeightScenarioHelper(Origin.FromSocialization); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } mFailure = new WeightScenarioHelper(Origin.FromSocialization); if (!mFailure.Parse(row, Manager, this, "Failure", ref error)) { return(false); } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, ref string error) { if (!base.Parse(row, ref error)) { return(false); } if (!row.Exists("Type")) { error = "Type missing"; return(false); } else if (!ParserFunctions.TryParseEnum <SimType>(row.GetString("Type"), out mType, SimType.None)) { error = "Unknown Type " + row.GetString("Type"); return(false); } if (!row.Exists("OtherType")) { error = "OtherType missing"; return(false); } else if (!ParserFunctions.TryParseEnum <SimType>(row.GetString("OtherType"), out mOtherType, SimType.None)) { error = "Unknown OtherType " + row.GetString("OtherType"); return(false); } return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("Score")) { error = "Score missing"; return(false); } mScore = row.GetInt("Score", 0); if (row.Exists("CustomSkill")) { mSkill = SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("CustomSkill")); if (mSkill == SkillNames.None) { //error = "CustomSkill unknown: " + row.GetString("CustomSkill"); return(false); } } else { mSkill = SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill")); if (mSkill == SkillNames.None) { error = "Skill Unknown: " + row.GetString("Skill"); return(false); } } return(true); }
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error) { if (!base.Parse(row, personality, ref error)) { return(false); } if (!row.Exists("Name")) { error = "Name missing"; return(false); } else if (!row.Exists("Default")) { error = "Default missing"; return(false); } mName = row.GetString("Name"); SetValue(row.GetInt("Default")); mResetOnLeaderChange = row.GetBool("ResetOnLeaderChange"); return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("Method")) { error = "Method missing"; return(false); } else if (!row.Exists("Gate")) { error = "Gate missing"; return(false); } mMethod = row.GetString("Method"); if (ScoringLookup.GetScoring(mMethod) == null) { error = mMethod + " not found"; return(false); } mGate = new HitMissResult <T, SP>(row, "Gate", ref error); if (!string.IsNullOrEmpty(error)) { return(false); } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("Score")) { error = "Score missing"; return(false); } else if (!row.Exists("Scale")) { error = "Scale missing"; return(false); } else if (!row.Exists("FriendBound")) { error = "FriendBound missing"; return(false); } else if (!row.Exists("EnemyBound")) { error = "EnemyBound missing"; return(false); } mScore = row.GetInt("Score"); mScale = row.GetInt("Scale"); mFriendBound = row.GetInt("FriendBound"); mEnemyBound = row.GetInt("EnemyBound"); return(true); }
public HitMissResult(XmlDbRow row, string prefix, ref string error) { if (!row.Exists(prefix + "Scoring")) { if (!row.Exists(prefix)) { if (!row.Exists(prefix + "Minimum")) { error = prefix + "Minimum missing"; return; } else if (!row.Exists(prefix + "Maximum")) { error = prefix + "Maximum missing"; return; } } mMinimum = row.GetInt(prefix + "Minimum", row.GetInt(prefix, 0)); mMaximum = row.GetInt(prefix + "Maximum", row.GetInt(prefix, 0)); if (mMinimum > mMaximum) { int temp = mMaximum; mMaximum = mMinimum; mMinimum = temp; } } else { mScoringName = row.GetString(prefix + "Scoring"); mScoring = null; } }
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error) { if (!base.Parse(row, personality, ref error)) { return(false); } if (!row.Exists("Name")) { error = "Name missing"; return(false); } else if (!row.Exists("Default")) { error = "Default missing"; return(false); } else { CASAgeGenderFlags ageGender; if (!ParserFunctions.TryParseEnum <CASAgeGenderFlags>(row.GetString("AgeGender"), out ageGender, CASAgeGenderFlags.None)) { error = "Unknown AgeGender " + row.GetString("AgeGender"); return(false); } mAge = ageGender & CASAgeGenderFlags.AgeMask; if (mAge == CASAgeGenderFlags.None) { mAge = CASAgeGenderFlags.AgeMask; } mGender = ageGender & CASAgeGenderFlags.GenderMask; if (mGender == CASAgeGenderFlags.None) { mGender = CASAgeGenderFlags.GenderMask; } StringToSpeciesList converter = new StringToSpeciesList(); mSpecies = converter.Convert(row.GetString("Species")); if (mSpecies == null) { error = converter.mError; return(false); } if (mSpecies.Count == 0) { mSpecies.Add(CASAgeGenderFlags.Human); } } mName = row.GetString("Name"); SetValue(row.GetBool("Default")); return(true); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (!row.Exists("AllowGoToJail")) { error = "AllowGoToJail missing"; return(false); } mAllowGoToJail = row.GetBool("AllowGoToJail"); mBail = new IntegerOption.OptionValue(-1); if (row.Exists("Bail")) { if (!mBail.Parse(row, "Bail", Manager, this, ref error)) { return(false); } } mInvestigate = new InvestigationHelper(); if (!mInvestigate.Parse(row, Manager, this, ref error)) { return(false); } mMinimum = new IntegerOption.OptionValue(); if (!mMinimum.Parse(row, "Minimum", Manager, this, ref error)) { return(false); } mMaximum = new IntegerOption.OptionValue(); if (!mMaximum.Parse(row, "Maximum", Manager, this, ref error)) { return(false); } mKeepObject = row.GetBool("KeepObject"); mSneakinessScoring = row.GetString("SneakinessScoring"); mSuccess = new WeightScenarioHelper(Origin.FromBurglar); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } mFailure = new WeightScenarioHelper(Origin.FromBurglar); if (!mFailure.Parse(row, Manager, this, "Failure", ref error)) { return(false); } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error) { if (!base.Parse(row, personality, ref error)) return false; if (!row.Exists("Name")) { error = "Name missing"; return false; } else if (!row.Exists("Default")) { error = "Default missing"; return false; } else { CASAgeGenderFlags ageGender; if (!ParserFunctions.TryParseEnum<CASAgeGenderFlags>(row.GetString("AgeGender"), out ageGender, CASAgeGenderFlags.None)) { error = "Unknown AgeGender " + row.GetString("AgeGender"); return false; } mAge = ageGender & CASAgeGenderFlags.AgeMask; if (mAge == CASAgeGenderFlags.None) { mAge = CASAgeGenderFlags.AgeMask; } mGender = ageGender & CASAgeGenderFlags.GenderMask; if (mGender == CASAgeGenderFlags.None) { mGender = CASAgeGenderFlags.GenderMask; } StringToSpeciesList converter = new StringToSpeciesList(); mSpecies = converter.Convert(row.GetString("Species")); if (mSpecies == null) { error = converter.mError; return false; } if (mSpecies.Count == 0) { mSpecies.Add(CASAgeGenderFlags.Human); } } mName = row.GetString("Name"); SetValue (row.GetBool("Default")); return true; }
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; } } }
protected bool ParseBuffs(XmlDbRow row, string prefix1, string prefix2, Dictionary <BuffNames, Origin> buffs, ref string error) { if ((!string.IsNullOrEmpty(prefix2)) && (!ParseBuffs(row, prefix1, null, buffs, ref error))) { return(false); } string prefix = prefix1 + prefix2; int index = 0; while (true) { if (!row.Exists(prefix + "Buff" + index)) { break; } BuffNames buff; if (!ParserFunctions.TryParseEnum <BuffNames>(row.GetString(prefix + "Buff" + index), out buff, BuffNames.Undefined)) { error = prefix + "Buff" + index + " unknown"; return(false); } if (buffs.ContainsKey(buff)) { error = prefix + "Buff " + buff + " already found"; return(false); } if (!row.Exists(prefix + "Origin" + index)) { error = prefix + "Origin" + index + " missing"; return(false); } Origin origin; if (!ParserFunctions.TryParseEnum <Origin>(row.GetString(prefix + "Origin" + index), out origin, Origin.None)) { error = prefix + "Origin" + index + " unknown"; return(false); } buffs.Add(buff, origin); index++; } return(true); }
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 CareerTransfer(XmlDbRow row, Dictionary <string, Dictionary <int, CareerLevel> > careerLevels, string careerName) : base(row, careerLevels, null) { mStringKey = "NRaas.CareerTransfer:" + row.GetString("EventType"); if (row.Exists("TransferCareer")) { string guid = row.GetString("TransferCareer"); ParserFunctions.TryParseEnum <OccupationNames>(guid, out mTransferCareer, OccupationNames.Undefined); if (mTransferCareer == OccupationNames.Undefined) { mTransferCareer = unchecked ((OccupationNames)ResourceUtils.HashString64(guid)); } } if (row.Exists("TransferBranch")) { mTransferBranch = row.GetString("TransferBranch"); } if (row.Exists("TransferLevelAbsolute")) { mAbsoluteLevel = row.GetInt("TransferLevelAbsolute"); } if (row.Exists("TransferLevelRelative")) { string relativeLevel = row.GetString("TransferLevelRelative"); List <string> relativeLevels = new List <string>(relativeLevel.Split(new char[] { ':' })); mRelativeLevelMin = int.Parse(relativeLevels[0]); if (relativeLevels.Count > 1) { mRelativeLevelMax = int.Parse(relativeLevels[1]); } else { if (mRelativeLevelMin > 0) { mRelativeLevelMax = mRelativeLevelMin; mRelativeLevelMin = 0; } } } }
public CareerTransfer(XmlDbRow row, Dictionary<string, Dictionary<int, CareerLevel>> careerLevels, string careerName) : base(row, careerLevels, null) { mStringKey = "NRaas.CareerTransfer:" + row.GetString("EventType"); if (row.Exists("TransferCareer")) { string guid = row.GetString("TransferCareer"); ParserFunctions.TryParseEnum<OccupationNames>(guid, out mTransferCareer, OccupationNames.Undefined); if (mTransferCareer == OccupationNames.Undefined) { mTransferCareer = unchecked((OccupationNames)ResourceUtils.HashString64(guid)); } } if (row.Exists("TransferBranch")) { mTransferBranch = row.GetString("TransferBranch"); } if (row.Exists("TransferLevelAbsolute")) { mAbsoluteLevel = row.GetInt("TransferLevelAbsolute"); } if (row.Exists("TransferLevelRelative")) { string relativeLevel = row.GetString("TransferLevelRelative"); List<string> relativeLevels = new List<string>(relativeLevel.Split(new char[] { ':' })); mRelativeLevelMin = int.Parse(relativeLevels[0]); if (relativeLevels.Count > 1) { mRelativeLevelMax = int.Parse(relativeLevels[1]); } else { if (mRelativeLevelMin > 0) { mRelativeLevelMax = mRelativeLevelMin; mRelativeLevelMin = 0; } } } }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mBail = new IntegerOption.OptionValue(-1); if (row.Exists("Bail")) { if (!mBail.Parse(row, "Bail", Manager, this, ref error)) { return(false); } } mChance = new IntegerOption.OptionValue(); if (!mChance.Parse(row, "Chance", Manager, this, ref error)) { return(false); } mSuccess = new WeightScenarioHelper(Origin.FromBurglar); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return(false); } return(base.Parse(row, ref error)); }
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, ref string error) { if ((!string.IsNullOrEmpty(prefix)) && (!Parse(row, manager, updater, null, ref error))) { return false; } if (row.Exists(prefix + "RecruitAllowSteal")) { mAllowSteal = row.GetBool(prefix + "RecruitAllowSteal"); } if (mActorRecruit == null) { mActorRecruit = new SimScenarioFilter(); } if (!mActorRecruit.Parse(row, manager, updater, prefix + "RecruitActor", false, ref error)) { return false; } if (mTargetRecruit == null) { mTargetRecruit = new SimScenarioFilter(); } if (!mTargetRecruit.Parse(row, manager, updater, prefix + "RecruitTarget", false, ref error)) { return false; } return true; }
public override bool Parse(XmlDbRow row, ref string error) { mHit = new HitMissResult <T, HitMissSP>(row, "Hit", ref error); if (!string.IsNullOrEmpty(error)) { return(false); } mMiss = new HitMissResult <T, HitMissSP>(row, "Miss", ref error); if (!string.IsNullOrEmpty(error)) { return(false); } if (row.Exists("OnExpansionFail")) { if (!ParserFunctions.TryParseEnum <HitMissExpansionFail>(row.GetString("OnExpansionFail"), out mOnExpansionFail, HitMissExpansionFail.None)) { error = "OnExpansionFail unknown"; return(false); } } return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("AgeGender")) { error = "AgeGender Missing"; } else { if (!ParserFunctions.TryParseEnum <CASAgeGenderFlags>(row.GetString("AgeGender"), out mAgeGender, CASAgeGenderFlags.None)) { error = "Unknown AgeGender " + row.GetString("AgeGender"); return(false); } } StringToSpeciesList converter = new StringToSpeciesList(); mSpecies = converter.Convert(row.GetString("Species")); if (mSpecies == null) { error = converter.mError; return(false); } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, ref string error) { if (!base.Parse(row, ref error)) { return(false); } if (!row.Exists("Trait")) { error = "Trait missing"; return(false); } else { ToTraitName converter = new ToTraitName(); List <TraitNames> traits = converter.Convert(row.GetString("Trait")); if ((traits == null) || (traits.Count == 0)) { error = converter.mError; return(false); } if (!sPlumbotAntiEquivalents.TryGetValue(traits[0], out mAntiTrait)) { mAntiTrait = TraitNames.Unknown; } mTraits = traits.ToArray(); } return(true); }
public override bool Parse(XmlDbRow row, string prefix, bool firstPass, ref string error) { mDelta = row.GetInt(prefix + "PropagateDelta", -25); if (row.Exists(prefix + "PropagateEnemy")) { if (!ParserFunctions.TryParseEnum <WhichSim>(row.GetString(prefix + "PropagateEnemy"), out mEnemySim, WhichSim.Actor)) { error = prefix + "PropagateEnemy unknown"; return(false); } } SimScenarioFilter.RelationshipLevel relationLevel; if (ParserFunctions.TryParseEnum <SimScenarioFilter.RelationshipLevel>(row.GetString(prefix + "PropagateRelationshipGate"), out relationLevel, SimScenarioFilter.RelationshipLevel.Neutral)) { mRelationshipGate = (int)relationLevel; } else { mRelationshipGate = row.GetInt(prefix + "PropagateRelationshipGate", mRelationshipGate); } return(base.Parse(row, prefix, firstPass, ref error)); }
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, ref string error) { if ((!string.IsNullOrEmpty(prefix)) && (!Parse(row, manager, updater, null, ref error))) { return(false); } if (row.Exists(prefix + "RecruitAllowSteal")) { mAllowSteal = row.GetBool(prefix + "RecruitAllowSteal"); } if (mActorRecruit == null) { mActorRecruit = new SimScenarioFilter(); } if (!mActorRecruit.Parse(row, manager, updater, prefix + "RecruitActor", false, ref error)) { return(false); } if (mTargetRecruit == null) { mTargetRecruit = new SimScenarioFilter(); } if (!mTargetRecruit.Parse(row, manager, updater, prefix + "RecruitTarget", false, ref error)) { return(false); } return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (!base.Parse(row, ref error)) { return(false); } if (row.Exists("CustomSkill")) { mSkill = SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("CustomSkill")); if (mSkill == SkillNames.None) { //error = "CustomSkill unknown: " + row.GetString("CustomSkill"); return(false); } } else { mSkill = SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill")); if (mSkill == SkillNames.None) { error = "Skill unknown: " + row.GetString("Skill"); return(false); } } return(true); }
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, ref string error) { mFightScoring = row.GetString("FightScoring"); if (!row.Exists("AllowGoToJail")) { error = "AllowGoToJail missing"; return(false); } mAllowGoToJail = row.GetBool("AllowGoToJail"); mActorAllowInjury = row.GetBool("AllowInjury") || row.GetBool("ActorAllowInjury"); mTargetAllowInjury = row.GetBool("AllowInjury") || row.GetBool("TargetAllowInjury"); mChanceOfDeath = new IntegerOption.OptionValue(-1); if (row.Exists("ChanceOfDeath")) { if (!mChanceOfDeath.Parse(row, "ChanceOfDeath", manager, updater, ref error)) { return(false); } } mBail = row.GetInt("Bail"); mSuccess = new WeightScenarioHelper(mOrigin); if (!mSuccess.Parse(row, manager, updater, "Success", ref error)) { return(false); } mFailure = new WeightScenarioHelper(mOrigin); if (!mFailure.Parse(row, manager, updater, "Failure", ref error)) { return(false); } mExtremeFailure = new WeightScenarioHelper(mOrigin); if (!mExtremeFailure.Parse(row, manager, updater, "ExtremeFailure", ref error)) { return(false); } return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (row.Exists("ChanceOfPregnancy")) { mPregnancyChance = row.GetInt("ChanceOfPregnancy"); } if (row.Exists("AffairStory")) { if (!ParserFunctions.TryParseEnum <ManagerRomance.AffairStory>(row.GetString("AffairStory"), out mAffairStory, ManagerRomance.AffairStory.None)) { error = "AffairStory unknown"; return(false); } } return(base.Parse(row, ref error)); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("Score")) { error = "Score missing"; return(false); } else if (!row.Exists("Scale")) { error = "Scale missing"; return(false); } mScore = row.GetInt("Score", 0); mScale = row.GetInt("Scale", 25); return(true); }
public override bool Parse(XmlDbRow row, ref string error) { if (!row.Exists("Vector")) { error = "Vector missing"; return(false); } else if (!row.Exists("Counter")) { error = "Counter missing"; return(false); } mVector = row.GetString("Vector"); mCounter = row.GetString("Counter"); return(true); }
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 static bool Exists(XmlDbRow row, string key, string name) { if (row.Exists(key)) { return(true); } AddError(name + " " + key + " Missing"); return(false); }
public MoodletTest(XmlDbRow row) { string name = row.GetString("GUID"); if (!row.Exists("BuffName")) { BooterLogger.AddError(name + " BuffName Missing"); } else { foreach (string buffStr in row.GetStringList("BuffName", ',')) { BuffNames buff; if (ParserFunctionsEx.Parse(buffStr, out buff)) { mBuffs.Add(buff); } else { BooterLogger.AddError(name + " Unknown BuffName: " + buffStr); } } } if (row.Exists("Origin")) { foreach (string originStr in row.GetStringList("Origin", ',')) { Origin origin; if (ParserFunctionsEx.Parse(originStr, out origin)) { mOrigins.Add(origin); } else { BooterLogger.AddError(name + " Unknown Origin: " + origin); } mOrigins.Add(origin); } } }
public MoodletTest(XmlDbRow row) { string name = row.GetString("GUID"); if (!row.Exists("BuffName")) { BooterLogger.AddError(name + " BuffName Missing"); } else { foreach (string buffStr in row.GetStringList("BuffName", ',')) { BuffNames buff; if (ParserFunctionsEx.Parse(buffStr, out buff)) { mBuffs.Add(buff); } else { BooterLogger.AddError(name + " Unknown BuffName: " + buffStr); } } } if (row.Exists("Origin")) { foreach (string originStr in row.GetStringList("Origin", ',')) { Origin origin; if (ParserFunctionsEx.Parse(originStr, out origin)) { mOrigins.Add(origin); } else { BooterLogger.AddError(name + " Unknown Origin: " + origin); } mOrigins.Add(origin); } } }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mMaximum = new IntegerOption.OptionValue(); if (row.Exists("AlterKey")) { mAlterKey = row.GetString("AlterKey"); } else { if (row.Exists("AccountingKey")) { mAccountingKey = row.GetString("AccountingKey"); } else { error = "AccountingKey missing"; return(false); } if (!mMaximum.Parse(row, "Maximum", Manager, this, ref error)) { return(false); } } mMinimum = new IntegerOption.OptionValue(); if (!mMinimum.Parse(row, "Minimum", Manager, this, ref error)) { return(false); } mSuccess = new WeightScenarioHelper(Origin.FromGettingGifts); 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) { if (!row.Exists("Hit")) { error = "Hit missing"; return(false); } mHitScore = row.GetInt("Hit", 0); if (!row.Exists("Miss")) { error = "Miss missing"; return(false); } mMissScore = row.GetInt("Miss", 0); return(true); }
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error) { if (!base.Parse(row, personality, ref error)) return false; if (!row.Exists("Name")) { error = "Name missing"; return false; } else if (!row.Exists("Default")) { error = "Default missing"; return false; } mName = row.GetString("Name"); SetValue (row.GetBool("Default")); return true; }
public ImpregnateSymptom(XmlDbRow row) : base(row) { if (BooterLogger.Exists(row, "Clone", Guid)) { mClone = row.GetBool("Clone"); } if (BooterLogger.Exists(row, "AllowCloseRelations", Guid)) { mAllowCloseRelations = row.GetBool("AllowCloseRelations"); } if (row.Exists("HandlePlantSim")) { mHandlePlantSim = row.GetBool("HandlePlantSim"); } }
public override bool Parse(XmlDbRow row, string prefix, bool firstPass, ref string error) { mDelta = row.GetInt(prefix + "PropagateDelta", -25); if (row.Exists(prefix + "PropagateEnemy")) { if (!ParserFunctions.TryParseEnum<WhichSim>(row.GetString(prefix + "PropagateEnemy"), out mEnemySim, WhichSim.Actor)) { error = prefix + "PropagateEnemy unknown"; return false; } } SimScenarioFilter.RelationshipLevel relationLevel; if (ParserFunctions.TryParseEnum<SimScenarioFilter.RelationshipLevel>(row.GetString(prefix + "PropagateRelationshipGate"), out relationLevel, SimScenarioFilter.RelationshipLevel.Neutral)) { mRelationshipGate = (int)relationLevel; } else { mRelationshipGate = row.GetInt(prefix + "PropagateRelationshipGate", mRelationshipGate); } return base.Parse(row, prefix, firstPass, ref error); }
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, bool errorIfNone, ref string error) { mDisallowRelated = row.GetBool(prefix + "DisallowRelated"); if (row.Exists(prefix + "StandardFilter")) { mEnabled = true; if (!ParserFunctions.TryParseEnum<StandardFilter>(row.GetString(prefix + "StandardFilter"), out mStandardFilter, StandardFilter.None)) { error = prefix + "StandardFilter invalid"; return false; } } string customTest = row.GetString(prefix + "CustomTest"); mCustomTest = new Common.MethodStore(customTest, new Type[] { typeof(Parameters), typeof(SimDescription), typeof(SimDescription) }); if ((mCustomTest == null) && (!string.IsNullOrEmpty(customTest))) { error = prefix + "CustomTest Invalid"; return false; } switch (mStandardFilter) { case StandardFilter.ExistingFriend: case StandardFilter.ExistingEnemy: case StandardFilter.Nemesis: if (!row.Exists(prefix + "StandardIgnoreBusy")) { error = prefix + "StandardIgnoreBusy missing"; return false; } mStandardIgnoreBusy = row.GetBool(prefix + "StandardIgnoreBusy"); break; } switch (mStandardFilter) { case StandardFilter.ExistingFriend: case StandardFilter.ExistingEnemy: RelationshipLevel standardLevel; if (ParserFunctions.TryParseEnum<RelationshipLevel>(row.GetString(prefix + "StandardGate"), out standardLevel, RelationshipLevel.Neutral)) { mStandardGate = (int)standardLevel; } else { RelationshipLevel defGate = RelationshipLevel.Neutral; if (mStandardFilter == StandardFilter.ExistingFriend) { defGate = RelationshipLevel.Friend; } else { defGate = RelationshipLevel.Enemy; } mStandardGate = row.GetInt(prefix + "StandardGate", (int)defGate); } break; case StandardFilter.ExistingFlirt: case StandardFilter.ExistingOrAnyFlirt: if (!row.Exists(prefix + "StandardDisallowPartner")) { error = prefix + "StandardDisallowPartner missing"; return false; } break; } // The default for DisallowPartner can be altered by the calling system, don't overwrite it if (row.Exists(prefix + "StandardDisallowPartner")) { mStandardDisallowPartner = row.GetBool(prefix + "StandardDisallowPartner"); } switch (mStandardFilter) { case StandardFilter.AnyFlirt: case StandardFilter.ExistingOrAnyFlirt: if (!row.Exists(prefix + "AllowAffair")) { error = prefix + "AllowAffair missing"; return false; } break; } if (row.Exists(prefix + "AllowOpposing")) { mAllowOpposing = row.GetBool(prefix + "AllowOpposing"); } else { mAllowOpposing = true; } if (row.Exists("AllowAffair")) { error = prefix + "AllowAffair misdefined"; return false; } else if (row.Exists(prefix + "AllowAffair")) { mAllowAffair = row.GetBool(prefix + "AllowAffair"); } else { mAllowAffair = false; } if (row.Exists(prefix + "ThirdPartyFilter")) { mEnabled = true; if (!ParserFunctions.TryParseEnum<ThirdPartyFilter>(row.GetString(prefix + "ThirdPartyFilter"), out mThirdPartyFilter, ThirdPartyFilter.None)) { error = prefix + "ThirdPartyFilter invalid"; return false; } } mScoring = row.GetString(prefix + "Scoring"); if (!string.IsNullOrEmpty(mScoring)) { mEnabled = true; if (ScoringLookup.GetScoring(mScoring) == null) { error = mScoring + " missing"; return false; } if ((!row.Exists(prefix + "ScoringMinimum")) && (!row.Exists(prefix + "ScoringMaximum"))) { error = prefix + "ScoringMinimum missing"; return false; } } mScoringMaximum = row.GetInt(prefix + "ScoringMaximum", int.MaxValue); mScoringMinimum = row.GetInt(prefix + "ScoringMinimum", int.MinValue); if (mScoringMinimum > mScoringMaximum) { int scoring = mScoringMinimum; mScoringMinimum = mScoringMaximum; mScoringMaximum = scoring; } if ((row.Exists(prefix + "RelationshipMinimum")) || (row.Exists(prefix + "RelationshipMaximum"))) { mEnabled = true; } RelationshipLevel relationLevel; if (ParserFunctions.TryParseEnum<RelationshipLevel>(row.GetString(prefix + "RelationshipMaximum"), out relationLevel, RelationshipLevel.Neutral)) { mRelationshipMaximum = (int)relationLevel; } else { mRelationshipMaximum = row.GetInt(prefix + "RelationshipMaximum", 101); } if (ParserFunctions.TryParseEnum<RelationshipLevel>(row.GetString(prefix + "RelationshipMinimum"), out relationLevel, RelationshipLevel.Neutral)) { mRelationshipMinimum = (int)relationLevel; } else { mRelationshipMinimum = row.GetInt(prefix + "RelationshipMinimum", -101); } if (mRelationshipMinimum > mRelationshipMaximum) { int scoring = mRelationshipMinimum; mRelationshipMinimum = mRelationshipMaximum; mRelationshipMaximum = scoring; } mClan = row.GetString(prefix + "Clan"); if (!string.IsNullOrEmpty(mClan)) { mEnabled = true; } if (row.Exists(prefix + "ClanLeader")) { mEnabled = true; } mClanLeader = row.GetBool(prefix + "ClanLeader"); if (row.Exists(prefix + "ClanMembers")) { mEnabled = true; } mClanMembers = row.GetBool(prefix + "ClanMembers"); string ageGender = row.GetString(prefix + "AgeGender"); if (!string.IsNullOrEmpty(ageGender)) { mEnabled = true; if (!ParserFunctions.TryParseEnum<CASAgeGenderFlags>(ageGender, out mAgeGender, CASAgeGenderFlags.None)) { error = "Unknown AgeGender " + ageGender; return false; } } StringToSpeciesList converter = new StringToSpeciesList(); mSpecies = converter.Convert(row.GetString(prefix + "Species")); if (mSpecies == null) { error = converter.mError; return false; } if (mSpecies.Count == 0) { mSpecies.Add(CASAgeGenderFlags.Human); } for (int i = 0; i < 10; i++) { string key = prefix + "UserAgeGender" + i; if (!row.Exists(key)) break; mEnabled = true; string name = row.GetString(key); AgeGenderOption option = manager.GetOption<AgeGenderOption>(name); if (option == null) { error = prefix + "UserAgeGender" + i + " " + name + " missing"; return false; } mUserAgeGenders.Add(name); } for (int i = 0; i < 10; i++) { string key = prefix + "ValueTest" + i; if (!row.Exists(key)) break; mEnabled = true; string name = row.GetString(key); int min = row.GetInt(key + "Minimum", int.MinValue); int max = row.GetInt(key + "Maximum", int.MaxValue); bool match = true; if (row.Exists(key + "Match")) { match = row.GetBool(key + "Match"); } mValueTestLoads.Add(new ValueTestLoadStore(name, min, max, match)); } if ((!mEnabled) && (errorIfNone)) { error = prefix + " Filter missing"; return false; } updater.AddUpdater(this); return true; }
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 void Parse(XmlDbRow myRow, XmlDbTable levelTable) { if ((levelTable != null) && (levelTable.Rows.Count > 0)) { mOutfits = new OmniCareer.OutfitData(levelTable.Rows[0]); } else { mOutfits = new OmniCareer.OutfitData(); } mCoworkerPool = myRow.GetString("CoworkerPool"); if (myRow.Exists("PaySims")) { mPaySims = myRow.GetBool("PaySims"); } if (myRow.Exists("LotDesignator")) { mLotDesignator = myRow.GetString("LotDesignator"); } }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (row.Exists("AllowMultiple")) { mAllowMultiple = row.GetBool("AllowMultiple"); } mMinimumWealth = new IntegerOption.OptionValue(); if (!mMinimumWealth.Parse(row, "MinimumWealth", Manager, this, ref error)) { return false; } mSuccess = new WeightScenarioHelper(Origin.FromStore); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } return base.Parse(row, ref error); }
protected bool ParseBuffs(XmlDbRow row, string prefix1, string prefix2, Dictionary<BuffNames,Origin> buffs, ref string error) { if ((!string.IsNullOrEmpty(prefix2)) && (!ParseBuffs(row, prefix1, null, buffs, ref error))) { return false; } string prefix = prefix1 + prefix2; int index = 0; while (true) { if (!row.Exists(prefix + "Buff" + index)) break; BuffNames buff; if (!ParserFunctions.TryParseEnum<BuffNames>(row.GetString(prefix + "Buff" + index), out buff, BuffNames.Undefined)) { error = prefix + "Buff" + index + " unknown"; return false; } if (buffs.ContainsKey(buff)) { error = prefix + "Buff " + buff + " already found"; return false; } if (!row.Exists(prefix + "Origin" + index)) { error = prefix + "Origin" + index + " missing"; return false; } Origin origin; if (!ParserFunctions.TryParseEnum<Origin>(row.GetString(prefix + "Origin" + index), out origin, Origin.None)) { error = prefix + "Origin" + index + " unknown"; return false; } buffs.Add(buff, origin); index++; } return true; }
protected bool ParseAccumulator(XmlDbRow row, string prefix, List<AccumulatorLoadValue> accumulators, ref string error) { for (int i = 0; i < 10; i++) { string key = prefix + i; if (!row.Exists(key)) break; string value = row.GetString(key); if (string.IsNullOrEmpty(value)) { error = prefix + i + " empty"; return false; } string[] values = value.Split(','); if (values.Length != 2) { error = prefix + i + " not properly formatted"; return false; } string name = values[0].Trim(); bool reset = false; int accumulator = 0; if (values[1].Trim().ToLower() == "reset") { reset = true; } else { if (!int.TryParse(values[1].Trim(), out accumulator)) { error = prefix + i + " second parameter not integer"; return false; } } mAccumulators.Add(new AccumulatorLoadValue(name, accumulator, reset)); } return true; }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (!row.Exists("AllowGoToJail")) { error = "AllowGoToJail missing"; return false; } mAllowGoToJail = row.GetBool("AllowGoToJail"); mBail = new IntegerOption.OptionValue(-1); if (row.Exists("Bail")) { if (!mBail.Parse(row, "Bail", Manager, this, ref error)) { return false; } } if (!row.Exists("AllowInjury")) { error = "AllowInjury missing"; return false; } mAllowInjury = row.GetBool("AllowInjury"); mSneakinessScoring = row.GetString("SneakinessScoring"); mInvestigate = new InvestigationHelper(); if (!mInvestigate.Parse(row, Manager, this, ref error)) { return false; } mSuccess = new WeightScenarioHelper(Origin.FromFire); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } mFailure = new WeightScenarioHelper(Origin.FromFire); if (!mFailure.Parse(row, Manager, this, "Failure", ref error)) { return false; } return base.Parse(row, ref error); }
protected override void Perform(BooterHelper.BootFile file, XmlDbRow row) { string guid = row.GetString("Guid"); if (string.IsNullOrEmpty(guid)) { BooterLogger.AddError(file + ": Guid empty"); return; } AfterschoolActivityType type = unchecked((AfterschoolActivityType)ResourceUtils.HashString64(guid)); AfterschoolActivityData data = new AfterschoolActivityData(); data.mActivity = new AfterschoolActivity(type); List<string> skills = row.GetStringList("Skills", ','); if (skills != null) { foreach (string skillStr in skills) { SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr); if (skill == SkillNames.None) { BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr); return; } else { data.mActivity.ActivitySkillNameList.Add(skill); } } } if (data.mActivity.ActivitySkillNameList.Count == 0) { BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill"); return; } DaysOfTheWeek days; if (!row.TryGetEnum<DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All)) { BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek")); return; } data.mActivity.DaysForActivity = days; CASAgeGenderFlags genders; if (!row.TryGetEnum<CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask)) { BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders")); return; } data.mGenders = genders; CASAgeGenderFlags ages; if (!row.TryGetEnum<CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask)) { BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages")); return; } data.mAges = ages; if (row.Exists("PreLoop")) { data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method; if (data.mPreLoop == null) { BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop")); return; } } if (row.Exists("Loop")) { data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method; if (data.mLoop == null) { BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop")); return; } } if (row.Exists("PostLoop")) { data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method; if (data.mPostLoop == null) { BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop")); return; } } Activities.Add(type, data); BooterLogger.AddTrace(file + ": " + guid + " Loaded"); }
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 bool ParseValue(XmlDbRow row) { if (!row.Exists("Value")) { BooterLogger.AddError("Value missing for " + mParentType + "." + mFieldName); return false; } FieldInfo field = GetFieldInfo(); if (field == null) { BooterLogger.AddError("Unknown Field for " + mParentType + "." + mFieldName); return false; } ITunableConvertOption fieldOption = TunableTypeOption.GetFieldOption(GetParsingType(field)); if (fieldOption != null) { try { mValue = fieldOption.Clone(GetTunableFieldInfo()).Convert(row.GetString("Value"), true); return true; } catch (Exception e) { Common.Exception(mParentType + "." + mFieldName + Common.NewLine + row.GetString("Value"), e); return false; } } else { BooterLogger.AddError("Unhandled Field type : " + field.FieldType + " (" + mParentType + "." + mFieldName + ")"); return false; } }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (row.Exists("AccountingKey")) { mAccountingKey = row.GetString("AccountingKey"); } else { error = "AccountingKey missing"; return false; } mMinimum = new IntegerOption.OptionValue(); if (!mMinimum.Parse(row, "Minimum", Manager, this, ref error)) { return false; } mMaximum = new IntegerOption.OptionValue(); if (!mMaximum.Parse(row, "Maximum", Manager, this, ref error)) { return false; } mSuccess = new WeightScenarioHelper(Origin.FromCharity); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } mFailure = new WeightScenarioHelper(Origin.FromCharity); if (!mFailure.Parse(row, Manager, this, "Failure", ref error)) { return false; } mAcceptanceScoring = row.GetString("AcceptanceScoring"); return base.Parse(row, ref error); }
public bool Parse(XmlDbRow row, StoryProgressionObject manager, IUpdateManager updater, string prefix, ref string error) { if (!string.IsNullOrEmpty(prefix)) { if (!Parse(row, manager, updater, null, ref error)) { return false; } mTestBeforehand = row.GetBool(prefix + "TestBeforehand"); mDelta = new HitMissResult<SimDescription, SimScoringParameters>(row, prefix + "Delta", ref error); bool deltaSet = string.IsNullOrEmpty(error); if (!deltaSet) { error = null; } string scenario = row.GetString(prefix + "Scenario"); if (!string.IsNullOrEmpty(scenario)) { WeightOption scenarioWeight = manager.GetOption<WeightOption>(scenario); if (scenarioWeight == null) { error = prefix + "Scenario weight " + scenario + " missing"; return false; } mScenario = scenarioWeight.GetScenario(); if (mScenario == null) { error = prefix + "Scenario " + scenario + " invalid"; return false; } if (deltaSet) { IDeltaScenario deltaScenario = mScenario as IDeltaScenario; if (deltaScenario != null) { deltaScenario.IDelta = mDelta; } } } mRecruit = new SimRecruitFilter(); if (!mRecruit.Parse(row, manager, updater, prefix, ref error)) { return false; } mPropagate = new PropagationScenarioHelper(); if (!mPropagate.Parse(row, mOrigin, prefix, ref error)) { return false; } mActorBuffs = new Dictionary<BuffNames, Origin>(); if (!ParseBuffs(row, prefix, "Actor", mActorBuffs, ref error)) { return false; } mTargetBuffs = new Dictionary<BuffNames, Origin>(); if (!ParseBuffs(row, prefix, "Target", mTargetBuffs, ref error)) { return false; } } if (row.Exists(prefix + "ScenarioActor")) { if (!row.TryGetEnum<PropagateBuffScenario.WhichSim>(prefix + "ScenarioActor", out mScenarioActor, PropagateBuffScenario.WhichSim.Unset)) { error = prefix + "ScenarioActor Unknown " + row.GetString(prefix + "ScenarioActor"); return false; } } if (row.Exists(prefix + "ScenarioTarget")) { if (!row.TryGetEnum<PropagateBuffScenario.WhichSim>(prefix + "ScenarioTarget", out mScenarioTarget, PropagateBuffScenario.WhichSim.Unset)) { error = prefix + "ScenarioTarget Unknown " + row.GetString(prefix + "ScenarioTarget"); return false; } } mActorCelebrity = row.GetInt(prefix + "ActorCelebrity", mActorCelebrity); mTargetCelebrity = row.GetInt(prefix + "TargetCelebrity", mTargetCelebrity); if (!ParseAccumulator(row, prefix + "AccumulateValue", mAccumulators, ref error)) { return false; } if (!ParseAccumulator(row, prefix + "GatheringFailureValue", mGatheringFailAccumulators, ref error)) { return false; } updater.AddUpdater(this); return true; }
public override bool Parse(XmlDbRow row) { if (!base.Parse(row)) return false; List<string> subFieldNames = new List<string>(); int count = 1; while (true) { string suffix = null; if (count > 1) { suffix = count.ToString(); } string subFieldName = row.GetString("SubFieldName" + suffix); if (string.IsNullOrEmpty(subFieldName)) { break; } subFieldNames.Add(subFieldName); count++; } if (subFieldNames.Count == 0) { BooterLogger.AddError("SubFieldName missing for " + mParentType + "." + mFieldName); return false; } FieldInfo subField = GetFieldInfo(); if (subField == null) { BooterLogger.AddError("Unknown Field for " + mParentType.ToString() + "." + mFieldName); return false; } NestedStore parentStore = this; for (int i = 0; i < subFieldNames.Count - 1; i++) { FieldInfo newField = subField.FieldType.GetField(subFieldNames[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); if (newField == null) { BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + subFieldNames[i]); return false; } NestedStore newStore = new NestedStore(newField, null); parentStore.mChild = newStore; subField = newField; parentStore = newStore; } string finalFieldName = subFieldNames[subFieldNames.Count - 1]; FieldInfo finalField = subField.FieldType.GetField(finalFieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance); if (finalField == null) { BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + finalFieldName); return false; } ValueStore child = null; if (row.Exists("Index")) { int index = row.GetInt("Index", -1); if (index < 0) { BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName); return false; } child = new ArrayValueStore(finalField, index, null); } else { child = new ValueStore(finalField, null); } parentStore.mChild = child; return child.ParseValue(row); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mAllowDebt = row.GetBool("AllowDebt"); if (row.Exists("AccountingKey")) { mAccountingKey = row.GetString("AccountingKey"); } else { error = "AccountingKey missing"; return false; } mFight = new FightScenarioHelper(Origin.FromTheft, SimDescription.DeathType.OldAge); if (!mFight.Parse(row, Manager, this, ref error)) { return false; } mInvestigate = new InvestigationHelper(); if (!mInvestigate.Parse(row, Manager, this, ref error)) { return false; } mMinimum = new IntegerOption.OptionValue(); if (!mMinimum.Parse(row, "Minimum", Manager, this, ref error)) { return false; } mMaximum = new IntegerOption.OptionValue(); if (!mMaximum.Parse(row, "Maximum", Manager, this, ref error)) { return false; } return base.Parse(row, ref error); }
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 override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mSuccess = new WeightScenarioHelper(Origin.FromBurglar); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } if (!row.Exists("Locale")) { error = "Locale Missing"; return false; } if (!row.TryGetEnum<Locales>("Locale", out mLocale, Locales.Home)) { error = "Unknown Locale"; return false; } return base.Parse(row, ref error); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (row.Exists("AccountingKey")) { mAccountingKey = row.GetString("AccountingKey"); } else { error = "AccountingKey missing"; return false; } mAllowDebt = new BooleanOption.OptionValue(); if (!mAllowDebt.Parse(row, "AllowDebt", Manager, this, ref error)) { return false; } mMinimum = new IntegerOption.OptionValue(); if (!mMinimum.Parse(row, "Minimum", Manager, this, ref error)) { return false; } mMaximum = new IntegerOption.OptionValue(); if (!mMaximum.Parse(row, "Maximum", Manager, this, ref error)) { return false; } mSuccess = new WeightScenarioHelper(Origin.FromGettingGifts); 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); mFight = new FightScenarioHelper(Origin.FromWatchingSimSuffer, DeathType); if (!mFight.Parse(row, Manager, this, ref error)) { return false; } if (!row.Exists("ReaddOldLeader")) { error = "ReaddOldLeader Missing"; return false; } mReaddOldLeader = row.GetBool("ReaddOldLeader"); return base.Parse(row, ref error); }
public override bool Parse(XmlDbRow row, SimPersonality personality, ref string error) { ProductVersion productVersion; if (!ParserFunctions.TryParseEnum<ProductVersion>(row.GetString("ProductVersion"), out productVersion, ProductVersion.BaseGame)) { error = "ProductVersion missing"; return false; } if (!GameUtils.IsInstalled(productVersion)) { return true; } string module = row.GetString("Module"); if ((!string.IsNullOrEmpty(module)) && (!Common.AssemblyCheck.IsInstalled(module))) { return true; } // Must be after the product version checks, but before everything else if (!base.Parse(row, personality, ref error)) return false; if (!row.Exists("Scenario")) { error = "Scenario missing"; return false; } else if (!row.Exists("Weight")) { error = "Weight missing"; return false; } else if (!row.Exists("Name")) { error = "Name missing"; return false; } mName = new NameOption(row); Type classType = row.GetClassType("Scenario"); if (classType == null) { error = "Scenario class not found"; return false; } int weight = row.GetInt("Weight"); if (weight > 0) { mVisible = true; } else { weight = 1; if (!row.Exists("ShouldPush")) { error = "ShouldPush missing"; return false; } } SetValue (weight); try { mScenario = classType.GetConstructor(new Type[0]).Invoke(new object[0]) as Scenario; } catch {} if (mScenario == null) { error = "Scenario constructor fail"; return false; } mScenario.Manager = personality; if (!mScenario.Parse(row, ref error)) { return false; } if (!mScenario.PostParse(ref error)) { return false; } IViolentScenario violentScenario = mScenario as IViolentScenario; if ((violentScenario != null) && (violentScenario.IsViolent)) { PushDeathChanceOption.Installed = true; } return true; }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); mBail = new IntegerOption.OptionValue(-1); if (row.Exists("Bail")) { if (!mBail.Parse(row, "Bail", Manager, this, ref error)) { return false; } } mChance = new IntegerOption.OptionValue(); if (!mChance.Parse(row, "Chance", Manager, this, ref error)) { return false; } mSuccess = new WeightScenarioHelper(Origin.FromBurglar); 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); mFight = new FightScenarioHelper(Origin.FromWatchingSimSuffer, SimDescription.DeathType.OldAge); if (!mFight.Parse(row, Manager, this, ref error)) { return false; } mTraitReasons = new Dictionary<TraitNames, string>(); int index = 0; while (true) { if (!row.Exists("ReasonTrait" + index)) break; TraitNames trait; if (!ParserFunctions.TryParseEnum<TraitNames>(row.GetString("ReasonTrait" + index), out trait, TraitNames.Unknown)) { error = "ReasonTrait" + index + " unknown"; return false; } if (mTraitReasons.ContainsKey(trait)) { error = "ReasonTrait " + trait + " already found"; return false; } if (!row.Exists("ReasonTraitName" + index)) { error = "ReasonTraitName" + index + " missing"; return false; } string text = row.GetString("ReasonTraitName" + index); mTraitReasons.Add(trait, text); index++; } mAgeGenderReasons = new Dictionary<CASAgeGenderFlags, string>(); index = 0; while (true) { if (!row.Exists("ReasonAgeGender" + index)) break; CASAgeGenderFlags ageGender; if (!ParserFunctions.TryParseEnum<CASAgeGenderFlags>(row.GetString("ReasonAgeGender" + index), out ageGender, CASAgeGenderFlags.None)) { error = "ReasonAgeGender" + index + " unknown"; return false; } if (mAgeGenderReasons.ContainsKey(ageGender)) { error = "ReasonAgeGender " + ageGender + " already found"; return false; } if (!row.Exists("ReasonAgeGenderName" + index)) { error = "ReasonAgeGenderName" + index + " missing"; return false; } string text = row.GetString("ReasonAgeGenderName" + index); mAgeGenderReasons.Add(ageGender, text); index++; } if ((mTraitReasons.Count == 0) && (mAgeGenderReasons.Count == 0)) { error = "No Reasons found"; return false; } return base.Parse(row, ref error); }
public override bool Parse(XmlDbRow row, ref string error) { mName = new WeightOption.NameOption(row); if (row.Exists("Skill")) { mSkill = SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill")); if (mSkill == SkillNames.None) { error = "Skill unknown"; return false; } } mSuccess = new WeightScenarioHelper(Origin.FromCharity); if (!mSuccess.Parse(row, Manager, this, "Success", ref error)) { return false; } return base.Parse(row, ref error); }
private static void ParseSkillData(XmlDbData data, XmlDbRow row, bool bStore) { ProductVersion version; bool flag = false; SkillNames guid = SkillNames.None; string skillHex = row.GetString("Hex"); try { guid = (SkillNames)SkillManager.GetGuid(ref skillHex, bStore); } catch { } if (guid == SkillNames.None) { flag = true; BooterLogger.AddError("GUID Fail " + skillHex); } if (!row.TryGetEnum<ProductVersion>("CodeVersion", out version, ProductVersion.BaseGame)) { flag = true; BooterLogger.AddError("CodeVersion Fail " + version); } else if (!GameUtils.IsInstalled(version)) { flag = true; BooterLogger.AddError("Install Fail " + version); } if (!flag) { Skill skill = null; string typeName = row.GetString("CustomClassName"); bool flag2 = typeName.Length > 0x0; if (flag2) { Type type = null; /* if (bStore) { string[] strArray = typeName.Split(new char[] { ',' }); if (strArray.Length < 0x2) { flag = true; } else { type = Type.GetType(strArray[0x0] + ",Sims3StoreObjects"); } } */ if (type == null) { type = Type.GetType(typeName); } if (type == null) { flag = true; BooterLogger.AddError("CustomClassName Not Found " + typeName); } else { object[] args = new object[] { guid }; ConstructorInfo constructor = type.GetConstructor(Type.GetTypeArray(args)); if (constructor == null) { flag = true; BooterLogger.AddError("Constructor Missing " + typeName); } else { try { skill = constructor.Invoke(args) as Skill; } catch (Exception e) { Common.Exception(skillHex, e); } if (skill == null) { flag = true; BooterLogger.AddError("Constructor Fail " + typeName); } } } } else { skill = new Skill(guid); BooterLogger.AddTrace("Generic Skill Used " + skillHex); } if (!flag) { Skill.NonPersistableSkillData data2 = new Skill.NonPersistableSkillData(); skill.NonPersistableData = data2; uint group = ResourceUtils.ProductVersionToGroupId(version); data2.SkillProductVersion = version; data2.Name = "Gameplay/Excel/Skills/SkillList:" + row.GetString("SkillName"); if (!bStore || Localization.HasLocalizationString(data2.Name)) { data2.Description = "Gameplay/Excel/Skills/SkillList:" + row.GetString("SkillDescription"); data2.MaxSkillLevel = row.GetInt("MaxSkillLevel", 0x0); //skill.Guid = (SkillNames)(uint)guid; // Performed by the constructor, don't do it again here data2.ThoughtBalloonTopicString = row.GetString("ThoughtBalloonTopic"); data2.IconKey = ResourceKey.CreatePNGKey(row.GetString("IconKey"), group); data2.SkillUIIconKey = ResourceKey.CreatePNGKey(row.GetString("SkillUIIcon"), group); string str3 = row.GetString("Commodity"); CommodityKind commodity = CommodityKind.None; try { commodity = (CommodityKind)Enum.Parse(typeof(CommodityKind), str3); } catch { } if (commodity == CommodityKind.None) { commodity = unchecked((CommodityKind)ResourceUtils.HashString64(str3)); } data2.Commodity = commodity; SkillManager.SkillCommodityMap.Add(commodity, guid); double num = 0; if (bStore) { string versionStr = row.GetString("Version"); if (!string.IsNullOrEmpty(versionStr)) { num = Convert.ToDouble(versionStr); } } data2.SkillVersion = num; if (row.GetBool("Physical")) { skill.AddCategoryToSkill(SkillCategory.Physical); } if (row.GetBool("Mental")) { skill.AddCategoryToSkill(SkillCategory.Mental); } if (row.GetBool("Musical")) { skill.AddCategoryToSkill(SkillCategory.Musical); } if (row.GetBool("Creative")) { skill.AddCategoryToSkill(SkillCategory.Creative); } if (row.GetBool("Artistic")) { skill.AddCategoryToSkill(SkillCategory.Artistic); } if (row.GetBool("Hidden")) { skill.AddCategoryToSkill(SkillCategory.Hidden); } if (row.GetBool("Certificate")) { skill.AddCategoryToSkill(SkillCategory.Certificate); } if ((row.Exists("HiddenWithSkillProgress") && row.GetBool("HiddenWithSkillProgress")) && skill.HasCategory(SkillCategory.Hidden)) { skill.AddCategoryToSkill(SkillCategory.HiddenWithSkillProgress); } int[] numArray = new int[skill.MaxSkillLevel]; int num3 = 0x0; for (int i = 0x1; i <= skill.MaxSkillLevel; i++) { string column = "Level_" + i.ToString(); num3 += row.GetInt(column, 0x0); numArray[i - 0x1] = num3; } data2.PointsForNextLevel = numArray; data2.AlwaysDisplayLevelUpTns = row.GetBool("AlwaysDisplayTNS"); string[] strArray2 = new string[skill.MaxSkillLevel + 0x1]; for (int j = 0x2; j <= skill.MaxSkillLevel; j++) { string str6 = "Level_" + j.ToString() + "_Text"; strArray2[j - 0x1] = row.GetString(str6); if (strArray2[j - 0x1] != string.Empty) { strArray2[j - 0x1] = "Gameplay/Excel/Skills/SkillList:" + strArray2[j - 0x1]; } } strArray2[skill.MaxSkillLevel] = row.GetString("Level_10_Text_Alternate"); if (strArray2[skill.MaxSkillLevel] != string.Empty) { strArray2[skill.MaxSkillLevel] = "Gameplay/Excel/Skills/SkillList:" + strArray2[skill.MaxSkillLevel]; } data2.LevelUpStrings = strArray2; if (flag2) { XmlDbTable table2 = null; string key = row.GetString("CustomDataSheet"); data.Tables.TryGetValue(key, out table2); if ((table2 == null) && (key.Length > 0x0)) { flag = true; skill = null; } else if (!skill.ParseSkillData(table2)) { flag = true; skill = null; } } data2.AvailableAgeSpecies = ParserFunctions.ParseAllowableAgeSpecies(row, "AvailableAgeSpecies"); data2.DreamsAndPromisesIcon = row.GetString("DreamsAndPromisesIcon"); data2.DreamsAndPromisesIconKey = ResourceKey.CreatePNGKey(data2.DreamsAndPromisesIcon, group); data2.LogicSkillBoost = row.GetBool("LogicSkillBoost"); if (!flag) { GenericManager<SkillNames, Skill, Skill>.sDictionary.Add((uint)guid, skill); SkillManager.sSkillEnumValues.AddNewEnumValue(skillHex, skill.Guid); BooterLogger.AddTrace("Loaded " + skill.Name + " (" + skill.Guid + ")"); } } } } }