Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        public OccultSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Occult", Guid))
            {
                if (!row.TryGetEnum<OccultTypes>("Occult", out mOccult, OccultTypes.None))
                {
                    BooterLogger.AddError(" Unknown Occult: " + row.GetString("Occult"));
                }
            }

            if (BooterLogger.Exists(row, "Remove", Guid))
            {
                mRemove = row.GetBool("Remove");
            }

            if (BooterLogger.Exists(row, "DropOthers", Guid))
            {
                mDropOthers = row.GetBool("DropOthers");
            }

            if (BooterLogger.Exists(row, "AllowIfOthers", Guid))
            {
                mAllowIfOthers = row.GetBool("AllowIfOthers");
            }
        }
Esempio n. 3
0
        public OccultSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Occult", Guid))
            {
                if (!row.TryGetEnum <OccultTypes>("Occult", out mOccult, OccultTypes.None))
                {
                    BooterLogger.AddError(" Unknown Occult: " + row.GetString("Occult"));
                }
            }

            if (BooterLogger.Exists(row, "Remove", Guid))
            {
                mRemove = row.GetBool("Remove");
            }

            if (BooterLogger.Exists(row, "DropOthers", Guid))
            {
                mDropOthers = row.GetBool("DropOthers");
            }

            if (BooterLogger.Exists(row, "AllowIfOthers", Guid))
            {
                mAllowIfOthers = row.GetBool("AllowIfOthers");
            }
        }
Esempio n. 4
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = row.GetString("Name");

            if (!mMinimum.Parse(row, "Minimum", Manager, ref error))
            {
                return(false);
            }

            if (!mMaximum.Parse(row, "Maximum", Manager, ref error))
            {
                return(false);
            }

            mAllowGoToJail = row.GetBool("AllowGoToJail");

            mKeepObject = row.GetBool("KeepObject");

            mSneakinessScoring = row.GetString("SneakinessScoring");

            mSuccess = new WeightScenarioHelper(Origin.FromBurglar);
            if (!mSuccess.Parse(row, Manager, "Success", ref error))
            {
                return(false);
            }

            mFailure = new WeightScenarioHelper(Origin.FromBurglar);
            if (!mFailure.Parse(row, Manager, "Failure", ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 5
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mAffair = row.GetBool("Affair");

            mRelatedStay = row.GetBool("RelatedStay");

            return(base.Parse(row, ref error));
        }
Esempio n. 6
0
        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));
        }
Esempio n. 7
0
            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;
                    }
                }
            }
Esempio n. 8
0
        public CancelInteractionSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "All", Guid))
            {
                mAll = row.GetBool("All");
            }

            if (BooterLogger.Exists(row, "AffectSleep", Guid))
            {
                mAffectSleep = row.GetBool("AffectSleep");
            }
        }
        public CancelInteractionSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "All", Guid))
            {
                mAll = row.GetBool("All");
            }

            if (BooterLogger.Exists(row, "AffectSleep", Guid))
            {
                mAffectSleep = row.GetBool("AffectSleep");
            }
        }
Esempio n. 10
0
            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", ','));
                }
            }
Esempio n. 11
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mAllowSkill  = row.GetBool("AllowSkill");
            mAllowNormal = row.GetBool("AllowNormal");

            mSuccess = new WeightScenarioHelper(Origin.FromWorkingHard);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 12
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            TagStaticData data = new TagStaticData();

            string name     = row.GetString("TypeName");
            string icon     = row.GetString("Icon");
            string color    = row.GetString("ColorHEX");
            bool   business = row.GetBool("isBusinessType");

            try
            {
                data.SetGUID(name);
            }
            catch (ArgumentException e)
            {
                Common.Exception("", e);
            }

            if (!data.Valid)
            {
                return;
            }

            data.name           = name;
            data.icon           = icon;
            data.isBusinessType = business;
            data.SetColorHex(color);

            if (!Tagger.staticData.ContainsKey(data.GUID))
            {
                Tagger.staticData.Add(data.GUID, data);
                EnumInjection.InjectEnums <CommercialLotSubType>(new string[] { name }, new object[] { data.GUID }, false);
            }
        }
Esempio n. 13
0
        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;
        }
Esempio n. 14
0
        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);
        }
Esempio n. 15
0
        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);
        }
Esempio n. 16
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            TagStaticData data = new TagStaticData();

            string name = row.GetString("TypeName");
            string icon = row.GetString("Icon");
            string color = row.GetString("ColorHEX");
            bool business = row.GetBool("isBusinessType");            

            try
            {
                data.SetGUID(name);
            }
            catch (ArgumentException e)
            {
                Common.Exception("", e);
            }

            if (!data.Valid)
            {
                return;
            }

            data.name = name;
            data.icon = icon;
            data.isBusinessType = business;
            data.SetColorHex(color);

            if (!Tagger.staticData.ContainsKey(data.GUID))
            {                
                Tagger.staticData.Add(data.GUID, data);
                EnumInjection.InjectEnums<CommercialLotSubType>(new string[] { name }, new object[] { data.GUID }, false);
            }
        }
Esempio n. 17
0
        public SocialSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Social", Guid))
            {
                mSocial = row.GetString("Social");

                if (mSocial != "Braaaiiins")
                {
                    if (ActionData.Get(mSocial) == null)
                    {
                        BooterLogger.AddError(Guid + " Invalid Social: " + mSocial);
                    }
                }
            }

            if (BooterLogger.Exists(row, "RoomOnly", Guid))
            {
                mRoomOnly = row.GetBool("RoomOnly");
            }

            mScoring = row.GetString("Scoring");

            if (!string.IsNullOrEmpty(mScoring))
            {
                if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    BooterLogger.AddError(Guid + " Invalid Scoring: " + mScoring);
                }

                mMinimum = row.GetInt("Minimum", 0);
            }
        }
Esempio n. 18
0
        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);
        }
Esempio n. 19
0
        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);
        }
Esempio n. 20
0
        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");
            }
        }
Esempio n. 21
0
        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");
            }
        }
Esempio n. 22
0
        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));
        }
Esempio n. 23
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mDelta = new HitMissResult <SimDescription, SimScoringParameters>(row, "Delta", ref error);
            if (!string.IsNullOrEmpty(error))
            {
                return(false);
            }

            mRomantic = row.GetBool("Romantic");

            return(base.Parse(row, ref error));
        }
Esempio n. 24
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mResult = new HitMissResult <T, SP>(row, "", ref error);
            if (!string.IsNullOrEmpty(error))
            {
                return(false);
            }

            mInvert = row.GetBool("Invert");

            return(true);
        }
Esempio n. 25
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mDivisor = row.GetInt("Divisor", 1);

            mLowerBound = row.GetInt("LowerBound", int.MinValue);

            mUpperBound = row.GetInt("UpperBound", int.MaxValue);

            mPercentChance = row.GetBool("PercentChance");

            return(true);
        }
Esempio n. 26
0
        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));
        }
Esempio n. 27
0
        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);
        }
Esempio n. 28
0
        public SocialTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (BooterLogger.Exists(row, "Socials", name))
            {
                mSocials = row.GetStringList("SocialName", ',');

                for (int i = mSocials.Count - 1; i >= 0; i--)
                {
                    if (ActionData.Get(mSocials[i]) == null)
                    {
                        BooterLogger.AddError(name + " Invalid Social: " + mSocials[i]);

                        mSocials.RemoveAt(i);
                    }
                }
            }

            if (BooterLogger.Exists(row, "AllowAccept", name))
            {
                mAllowAccept = row.GetBool("AllowAccept");
            }

            if (BooterLogger.Exists(row, "AllowReject", name))
            {
                mAllowReject = row.GetBool("AllowReject");
            }

            if (BooterLogger.Exists(row, "AllowRecipient", name))
            {
                mAllowRecipient = row.GetBool("AllowRecipient");
            }

            if (BooterLogger.Exists(row, "AllowInitiator", name))
            {
                mAllowInitiator = row.GetBool("AllowInitiator");
            }
        }
Esempio n. 29
0
        public SocialTest(XmlDbRow row)
        {
            string name = row.GetString("GUID");

            if (BooterLogger.Exists(row, "Socials", name))
            {
                mSocials = row.GetStringList("SocialName", ',');

                for (int i = mSocials.Count - 1; i >= 0; i--)
                {
                    if (ActionData.Get(mSocials[i]) == null)
                    {
                        BooterLogger.AddError(name + " Invalid Social: " + mSocials[i]);

                        mSocials.RemoveAt(i);
                    }
                }
            }

            if (BooterLogger.Exists(row, "AllowAccept", name))
            {
                mAllowAccept = row.GetBool("AllowAccept");
            }

            if (BooterLogger.Exists(row, "AllowReject", name))
            {
                mAllowReject = row.GetBool("AllowReject");
            }

            if (BooterLogger.Exists(row, "AllowRecipient", name))
            {
                mAllowRecipient = row.GetBool("AllowRecipient");
            }

            if (BooterLogger.Exists(row, "AllowInitiator", name))
            {
                mAllowInitiator = row.GetBool("AllowInitiator");
            }
        }
Esempio n. 30
0
        public ResistanceSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "AffectSelf", Guid))
            {
                mAffectSelf = row.GetBool("AffectSelf");
            }

            if (BooterLogger.Exists(row, "AffectOther", Guid))
            {
                mAffectOther = row.GetBool("AffectOther");
            }

            if (BooterLogger.Exists(row, "Minimum", Guid))
            {
                mMinimum = row.GetInt("Minimum", 0);
            }

            if (BooterLogger.Exists(row, "Maximum", Guid))
            {
                mMaximum = row.GetInt("Maximum", 0);
            }
        }
Esempio n. 31
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mSeperateAdultStory = row.GetBool("SeperateAdultStory");

            mSuccess = new WeightScenarioHelper(Origin.FromSocialization);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 32
0
        public virtual bool Parse(XmlDbRow row, ref string error)
        {
            mPushChance = row.GetInt("PushChance", mPushChance);

            if (row.Exists("ShouldPush"))
            {
                mShouldPush = row.GetBool("ShouldPush");
            }

            mInitialReportChance  = row.GetInt("InitialReportChance", row.GetInt("ReportChance", mInitialReportChance));
            mContinueReportChance = row.GetInt("ContinueReportChance", row.GetInt("ReportChance", mContinueReportChance));

            return(true);
        }
Esempio n. 33
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mbShouldFire = row.GetBool("ShouldFire");

            mSuccess = new WeightScenarioHelper(Origin.FromWatchingSimSuffer);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 34
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = row.GetString("Name");

            mAllowGoToJail = row.GetBool("AllowGoToJail");

            mAllowInjury = row.GetBool("AllowInjury");

            mSneakinessScoring = row.GetString("SneakinessScoring");

            mSuccess = new WeightScenarioHelper(Origin.FromBadGuest);
            if (!mSuccess.Parse(row, Manager, "Success", ref error))
            {
                return false;
            }

            mFailure = new WeightScenarioHelper(Origin.FromBadGuest);
            if (!mFailure.Parse(row, Manager, "Failure", ref error))
            {
                return false;
            } 
            
            return base.Parse(row, ref error);
        }
Esempio n. 35
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = row.GetString("Name");

            mAllowGoToJail = row.GetBool("AllowGoToJail");

            mAllowInjury = row.GetBool("AllowInjury");

            mSneakinessScoring = row.GetString("SneakinessScoring");

            mSuccess = new WeightScenarioHelper(Origin.FromFire);
            if (!mSuccess.Parse(row, Manager, "Success", ref error))
            {
                return(false);
            }

            mFailure = new WeightScenarioHelper(Origin.FromFire);
            if (!mFailure.Parse(row, Manager, "Failure", ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 36
0
        public DeathSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Type", Guid))
            {
                if (!row.TryGetEnum <SimDescription.DeathType>("Type", out mType, SimDescription.DeathType.None))
                {
                    BooterLogger.AddError(" Unknown Type: " + row.GetString("Type"));
                }
            }

            if (BooterLogger.Exists(row, "AllowActive", Guid))
            {
                mAllowActive = row.GetBool("AllowActive");
            }
        }
Esempio n. 37
0
        public DeathSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Type", Guid))
            {
                if (!row.TryGetEnum<SimDescription.DeathType>("Type", out mType, SimDescription.DeathType.None))
                {
                    BooterLogger.AddError(" Unknown Type: " + row.GetString("Type"));
                }
            }

            if (BooterLogger.Exists(row, "AllowActive", Guid))
            {
                mAllowActive = row.GetBool("AllowActive");
            }
        }
Esempio n. 38
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            if (row.Exists("ChildStory"))
            {
                mChildStory = row.GetBool("ChildStory");
            }

            mFight = new FightScenarioHelper(Origin.FromWatchingSimSuffer, DeathType);
            if (!mFight.Parse(row, Manager, this, ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Esempio n. 39
0
        public FindSimSymptom(XmlDbRow row)
            : base(row)
        {
            mScoring = row.GetString("Scoring");

            if (!string.IsNullOrEmpty(mScoring))
            {
                if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    BooterLogger.AddError(Guid + " Invalid Scoring: " + mScoring);
                }

                mMinimum = row.GetInt("Minimum", 0);
            }

            mAllowActive = row.GetBool("AllowActive");
        }
Esempio n. 40
0
        public FindSimSymptom(XmlDbRow row)
            : base(row)
        {
            mScoring = row.GetString("Scoring");

            if (!string.IsNullOrEmpty(mScoring))
            {
                if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    BooterLogger.AddError(Guid + " Invalid Scoring: " + mScoring);
                }

                mMinimum = row.GetInt("Minimum", 0);
            }

            mAllowActive = row.GetBool("AllowActive");
        }
Esempio n. 41
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            Homemaker.StipendValue key;
            if (!ParserFunctions.TryParseEnum<Homemaker.StipendValue>(row.GetString("Key"), out key, Homemaker.StipendValue.Undefined))
            {
                BooterLogger.AddError("Stipend Key Missing: " + row.GetString("Key"));
                return;
            }

            int maximum = row.GetInt("Maximum");

            int factor = row.GetInt("Factor");

            bool positive = row.GetBool("Positive");

            sData.Add(key, new Data (maximum, factor, positive));

            BooterLogger.AddTrace(" Stipend Loaded: " + row.GetString("Key"));
        }
Esempio n. 42
0
        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;
        }
Esempio n. 43
0
            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");
                }
            }
Esempio n. 44
0
        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);
        }
Esempio n. 45
0
        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;
        }
Esempio n. 46
0
        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;
        }
Esempio n. 47
0
        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;
                }
            }
        }
Esempio n. 48
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mAllowSteal = row.GetBool("AllowSteal");

            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);
        }
Esempio n. 49
0
        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);
        }
Esempio n. 50
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mAllowSkill = row.GetBool("AllowSkill");
            mAllowNormal = row.GetBool("AllowNormal");

            mSuccess = new WeightScenarioHelper(Origin.FromWorkingHard);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return false;
            }

            return base.Parse(row, ref error);
        }
Esempio n. 51
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mSeperateAdultStory = row.GetBool("SeperateAdultStory");

            mSuccess = new WeightScenarioHelper(Origin.FromSocialization);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return false;
            }

            return base.Parse(row, ref error);
        }
Esempio n. 52
0
            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", ','));
                }
            }
Esempio n. 53
0
        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;
        }
Esempio n. 54
0
            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);
                            }
                        }
                    }
                }
            }
Esempio n. 55
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mbShouldFire = row.GetBool("ShouldFire");

            mSuccess = new WeightScenarioHelper(Origin.FromWatchingSimSuffer);
            if (!mSuccess.Parse(row, Manager, this, "Success", ref error))
            {
                return false;
            } 

            return base.Parse(row, ref error);
        }
Esempio n. 56
0
            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;
                    }
                }
            }
Esempio n. 57
0
        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);
        }
Esempio n. 58
0
        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);
        }
Esempio n. 59
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = row.GetString("Name");

            if (!mMinimum.Parse(row, "Minimum", Manager, ref error))
            {
                return false;
            }

            if (!mMaximum.Parse(row, "Maximum", Manager, ref error))
            {
                return false;
            }

            mAllowGoToJail = row.GetBool("AllowGoToJail");

            mKeepObject = row.GetBool("KeepObject");

            mSneakinessScoring = row.GetString("SneakinessScoring");

            mSuccess = new WeightScenarioHelper(Origin.FromBurglar);
            if (!mSuccess.Parse(row, Manager, "Success", ref error))
            {
                return false;
            }

            mFailure = new WeightScenarioHelper(Origin.FromBurglar);
            if (!mFailure.Parse(row, Manager, "Failure", ref error))
            {
                return false;
            }

            return base.Parse(row, ref error);
        }
Esempio n. 60
0
        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 + ")");
                        }
                    }
                }
            }
        }