Ejemplo n.º 1
0
        public MoodletSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "BuffName", Guid))
            {
                if (!row.TryGetEnum <BuffNames>("BuffName", out mBuff, BuffNames.Undefined))
                {
                    mBuff = (BuffNames)row.GetUlong("BuffName", 0);
                    if (mBuff == 0)
                    {
                        mBuff = (BuffNames)ResourceUtils.HashString64(row.GetString("BuffName"));
                    }

                    if (!BuffManager.BuffDictionary.ContainsKey((ulong)mBuff))
                    {
                        BooterLogger.AddError(Guid + " Unknown BuffName: " + row.GetString("BuffName"));
                    }
                }
            }

            mMoodValue = row.GetInt("MoodValue", 0);

            mDuration = row.GetInt("Duration", 30);
            if (mDuration <= 0)
            {
                mDuration = -1;
            }

            mOrigin = (Origin)row.GetUlong("Origin", 0);
            if (mOrigin == Origin.None)
            {
                mOrigin = (Origin)ResourceUtils.HashString64(row.GetString("Origin"));
            }
        }
Ejemplo n.º 2
0
        public MoodletSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "BuffName", Guid))
            {
                if (!row.TryGetEnum<BuffNames>("BuffName", out mBuff, BuffNames.Undefined))
                {
                    mBuff = (BuffNames)row.GetUlong("BuffName", 0);
                    if (mBuff == 0)
                    {
                        mBuff = (BuffNames)ResourceUtils.HashString64(row.GetString("BuffName"));
                    }

                    if (!BuffManager.BuffDictionary.ContainsKey((ulong)mBuff))
                    {
                        BooterLogger.AddError(Guid + " Unknown BuffName: " + row.GetString("BuffName"));
                    }
                }
            }

            mMoodValue = row.GetInt("MoodValue", 0);

            mDuration = row.GetInt("Duration", 30);
            if (mDuration <= 0)
            {
                mDuration = -1;
            }

            mOrigin = (Origin)row.GetUlong("Origin", 0);
            if (mOrigin == Origin.None)
            {
                mOrigin = (Origin)ResourceUtils.HashString64(row.GetString("Origin"));
            }
        }
Ejemplo n.º 3
0
        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 override bool Parse(XmlDbRow row, ref string error)
        {
            mPosMultiple = row.GetInt("PosMultiple", 1);
            mNegMultiple = row.GetInt("NegMultiple", 1);

            return(base.Parse(row, ref error));
        }
Ejemplo n.º 5
0
        public void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            WorldName world;

            row.TryGetEnum <WorldName>("World", out world, WorldName.Undefined);

            List <DaysOfTheWeek> days = ParserFunctions.ParseDayList(row.GetString("Days"));

            if ((days == null) || (days.Count == 0))
            {
                days = ParserFunctions.ParseDayList("MTWRFSU");
            }

            int startHour = row.GetInt("StartHour");
            int endHour   = row.GetInt("EndHour");

            if (startHour > endHour)
            {
                return;
            }

            int speed = row.GetInt("Speed");

            if (speed <= 0)
            {
                speed = Relativity.sOneMinute;
            }

            mIntervals.Add(new SpeedInterval(world, days, startHour, endHour, speed));
        }
Ejemplo n.º 6
0
        public override void Parse(XmlDbRow row)
        {
            base.Parse(row);

            mMinIntensityDuration = row.GetFloat("MinIntensityDuration", 0);
            mTransitionTime.First = row.GetFloat("MinTransitionTime", 0);
            mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0);
            mIntensityWeights = new List<int>();
            mIntensityWeights.Add(row.GetInt("LightWeight", 0));
            mIntensityWeights.Add(row.GetInt("ModerateWeight", 0));
            mIntensityWeights.Add(row.GetInt("HeavyWeight", 0));
            mIntensityChangeWeights = new List<int>();

            foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ','))
            {
                float value;
                if (float.TryParse(strValue, out value))
                {
                    mIntensityChangeWeights.Add((int)value);
                }
                else
                {
                    mIntensityChangeWeights.Add(0);
                }
            }
        }
Ejemplo n.º 7
0
        public override void Parse(XmlDbRow row)
        {
            base.Parse(row);

            mMinIntensityDuration  = row.GetFloat("MinIntensityDuration", 0);
            mTransitionTime.First  = row.GetFloat("MinTransitionTime", 0);
            mTransitionTime.Second = row.GetFloat("MaxTransitionTime", 0);
            mIntensityWeights      = new List <int>();
            mIntensityWeights.Add(row.GetInt("LightWeight", 0));
            mIntensityWeights.Add(row.GetInt("ModerateWeight", 0));
            mIntensityWeights.Add(row.GetInt("HeavyWeight", 0));
            mIntensityChangeWeights = new List <int>();

            foreach (string strValue in row.GetStringList("NumIntensityChangeWeights", ','))
            {
                float value;
                if (float.TryParse(strValue, out value))
                {
                    mIntensityChangeWeights.Add((int)value);
                }
                else
                {
                    mIntensityChangeWeights.Add(0);
                }
            }
        }
Ejemplo n.º 8
0
        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);
        }
Ejemplo n.º 9
0
        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;
            }
        }
Ejemplo n.º 10
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);
        }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
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);
            }
        }
Ejemplo n.º 13
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);
        }
Ejemplo n.º 14
0
        public ScoringStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Scoring", Name))
            {
                mScoring = row.GetString("Scoring");
                if (string.IsNullOrEmpty(mScoring))
                {
                    BooterLogger.AddError(Name + " Empty Scoring");
                }
                else if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    BooterLogger.AddError(Name + " Invalid Scoring: " + mScoring);
                }
            }

            if (row.GetString("Minimum") == "Strength")
            {
                mMinimum = int.MinValue;
            }
            else
            {
                mMinimum = row.GetInt("Minimum", int.MinValue);
            }

            mMinMutation = row.GetString("MinMutation");
        }
Ejemplo n.º 15
0
        public ScoringStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Scoring", Name))
            {
                mScoring = row.GetString("Scoring");
                if (string.IsNullOrEmpty(mScoring))
                {
                    BooterLogger.AddError(Name + " Empty Scoring");
                }
                else if (ScoringLookup.GetScoring(mScoring) == null)
                {
                    BooterLogger.AddError(Name + " Invalid Scoring: " + mScoring);
                }
            }

            if (row.GetString("Minimum") == "Strength")
            {
                mMinimum = int.MinValue;
            }
            else
            {
                mMinimum = row.GetInt("Minimum", int.MinValue);
            }

            mMinMutation = row.GetString("MinMutation");
        }
Ejemplo n.º 16
0
        public override bool Parse(XmlDbRow row, string prefix, bool firstPass, ref string error)
        {
            mDelta = row.GetInt(prefix + "PropagateDelta", mDelta);

            if (row.Exists(prefix + "PropagateFriend"))
            {
                if (!ParserFunctions.TryParseEnum<WhichSim>(row.GetString(prefix + "PropagateFriend"), out mFriendSim, WhichSim.Actor))
                {
                    error = prefix + "PropagateFriend 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);
        }
Ejemplo n.º 17
0
        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);
        }
Ejemplo n.º 18
0
        public TimedStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "MinDuration", Name))
            {
                mMinDuration = row.GetInt("MinDuration", 0);
            }

            mMinMutation = row.GetString("MinMutation");

            if (BooterLogger.Exists(row, "MaxDuration", Name))
            {
                mMaxDuration = row.GetInt("MaxDuration", 0);
            }

            mMaxMutation = row.GetString("MaxMutation");
        }
Ejemplo n.º 19
0
 public FirestarterSymptom(XmlDbRow row)
     : base(row)
 {
     if (BooterLogger.Exists(row, "Maximum", Guid))
     {
         mMaximum = row.GetInt("Maximum");
     }
 }
Ejemplo n.º 20
0
 public FirestarterSymptom(XmlDbRow row)
     : base(row)
 {
     if (BooterLogger.Exists(row, "Maximum", Guid))
     {
         mMaximum = row.GetInt("Maximum");
     }
 }
Ejemplo n.º 21
0
        public TestCounterStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Minimum", Name))
            {
                mMinimum = row.GetInt("Minimum", 0);
            }

            mMinMutation = row.GetString("MinMutation");

            if (BooterLogger.Exists(row, "Maximum", Name))
            {
                mMaximum = row.GetInt("Maximum", 0);
            }

            mMaxMutation = row.GetString("MaxMutation");
        }
Ejemplo n.º 22
0
 public virtual void Parse(XmlDbRow row)
 {
     mWeight = row.GetInt("Weight", 0);
     mLength.First = row.GetFloat("MinLength", 0);
     mLength.Second = row.GetFloat("MaxLength", 0);
     mTemp.First = row.GetFloat("MinTemp", 0);
     mTemp.Second = row.GetFloat("MaxTemp", 0);
 }
Ejemplo n.º 23
0
 public virtual void Parse(XmlDbRow row)
 {
     mWeight        = row.GetInt("Weight", 0);
     mLength.First  = row.GetFloat("MinLength", 0);
     mLength.Second = row.GetFloat("MaxLength", 0);
     mTemp.First    = row.GetFloat("MinTemp", 0);
     mTemp.Second   = row.GetFloat("MaxTemp", 0);
 }
Ejemplo n.º 24
0
        public TimedStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "MinDuration", Name))
            {
                mMinDuration = row.GetInt("MinDuration", 0);
            }

            mMinMutation = row.GetString("MinMutation");

            if (BooterLogger.Exists(row, "MaxDuration", Name))
            {
                mMaxDuration = row.GetInt("MaxDuration", 0);
            }

            mMaxMutation = row.GetString("MaxMutation");
        }
Ejemplo n.º 25
0
        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);
        }
Ejemplo n.º 26
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"));
        }
Ejemplo n.º 27
0
        protected static int Populate(XmlDbRow row)
        {
            int totalAllowed = row.GetInt("TotalAllowed");
            if (totalAllowed <= 0)
            {
                totalAllowed = 1;
            }

            return totalAllowed;
        }
Ejemplo n.º 28
0
        public IncrementalStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Maximum", Name))
            {
                mMaximum = row.GetInt("Maximum", 0);
            }

            mMaxMutation = row.GetString("MaxMutation");
        }
Ejemplo n.º 29
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"));
        }
Ejemplo n.º 30
0
        public IncrementalStage(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Maximum", Name))
            {
                mMaximum = row.GetInt("Maximum", 0);
            }

            mMaxMutation = row.GetString("MaxMutation");
        }
Ejemplo n.º 31
0
        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);
        }
Ejemplo n.º 32
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mTargetContinueChance = row.GetInt("TargetContinueChance", mTargetContinueChance);

            mTargetMaximumCount = row.GetInt("TargetMaximumCount", mTargetMaximumCount);

            mMutualFilter = new SimScenarioFilter();
            if (!mMutualFilter.Parse(row, Manager, this, "Mutual", false, ref error))
            {
                return(false);
            }

            mTargetFilter = new SimScenarioFilter();
            if (!mTargetFilter.Parse(row, Manager, this, "Target", true, ref error))
            {
                return(false);
            }

            return(base.Parse(row, ref error));
        }
Ejemplo n.º 33
0
        public override bool Parse(XmlDbRow row)
        {
            mIndex = row.GetInt("Index", -1);
            if (mIndex < 0)
            {
                BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName);
                return(false);
            }

            return(base.Parse(row));
        }
Ejemplo n.º 34
0
        public MotiveSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Motive", Guid))
            {
                if (!row.TryGetEnum<CommodityKind>("Motive", out mMotive, CommodityKind.None))
                {
                    BooterLogger.AddError(" Unknown Motive: " + row.GetString("Motive"));
                }
            }

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

            if (BooterLogger.Exists(row, "LowerBound", Guid))
            {
                mLowerBound = row.GetInt("LowerBound", 0);
            }
        }
Ejemplo n.º 35
0
        public MotiveSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Motive", Guid))
            {
                if (!row.TryGetEnum <CommodityKind>("Motive", out mMotive, CommodityKind.None))
                {
                    BooterLogger.AddError(" Unknown Motive: " + row.GetString("Motive"));
                }
            }

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

            if (BooterLogger.Exists(row, "LowerBound", Guid))
            {
                mLowerBound = row.GetInt("LowerBound", 0);
            }
        }
Ejemplo n.º 36
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            if (!row.Exists("Gate"))
            {
                error = "Gate missing";
                return(false);
            }

            mGate = row.GetInt("Gate", 0);

            return(base.Parse(row, ref error));
        }
Ejemplo n.º 37
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");
            int    openHour  = row.GetInt("OpenHour");
            int    closeHour = row.GetInt("CloseHour");

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

            if (!data.Valid)
            {
                return;
            }

            data.name           = name;
            data.icon           = icon;
            data.isBusinessType = business;
            data.openHour       = openHour;
            data.closeHour      = closeHour;
            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);
                EnumInjection.InjectEnums <Lot.MetaAutonomyType>(new string[] { name }, new object[] { data.GUID }, false);
                EnumInjection.InjectEnums <MetaAutonomyVenueType>(new string[] { name }, new object[] { data.GUID }, false);
            }
        }
Ejemplo n.º 38
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");
            int openHour = row.GetInt("OpenHour");
            int closeHour = row.GetInt("CloseHour");

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

            if (!data.Valid)
            {
                return;
            }

            data.name = name;
            data.icon = icon;
            data.isBusinessType = business;
            data.openHour = openHour;
            data.closeHour = closeHour;
            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);
                EnumInjection.InjectEnums<Lot.MetaAutonomyType>(new string[] { name }, new object[] { data.GUID }, false);
                EnumInjection.InjectEnums<MetaAutonomyVenueType>(new string[] { name }, new object[] { data.GUID }, false); 
            }
        }
Ejemplo n.º 39
0
            public Data(XmlDbRow row, VectorBooter.Test test)
            {
                mGuid = row.GetString("GUID");

                mDelta = row.GetInt("Delta", 0);

                if (mDelta == 0)
                {
                    BooterLogger.AddError(mGuid + " Missing Delta");
                }

                mTest = test;
            }
Ejemplo n.º 40
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;
                }
            }
        }
Ejemplo n.º 41
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);
            }
        }
Ejemplo n.º 42
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;
                    }
                }
            }
        }
Ejemplo n.º 43
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");
        }
Ejemplo n.º 44
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;
                }
            }
        }
Ejemplo n.º 45
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

            mChance = row.GetInt("Chance", mChance);

            mAcceptanceScoring = row.GetString("AcceptanceScoring");

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

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

            return base.Parse(row, ref error);
        }
Ejemplo n.º 46
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;
        }
Ejemplo n.º 47
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;
        }
Ejemplo n.º 48
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 + ")");
                        }
                    }
                }
            }
        }
Ejemplo n.º 49
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mTargetContinueChance = row.GetInt("TargetContinueChance", mTargetContinueChance);

            mTargetMaximumCount = row.GetInt("TargetMaximumCount", mTargetMaximumCount);

            mMutualFilter = new SimScenarioFilter();
            if (!mMutualFilter.Parse(row, Manager, this, "Mutual", false, ref error))
            {
                return false;
            }

            mTargetFilter = new SimScenarioFilter();
            if (!mTargetFilter.Parse(row, Manager, this, "Target", true, ref error))
            {
                return false;
            }

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

            mChanceOfHomeLot = row.GetInt("ChanceOfHome", mChanceOfHomeLot);

            mPartyAttire = row.GetEnum<OutfitCategories>("Attire", OutfitCategories.None);
            if (mPartyAttire == OutfitCategories.None)
            {
                error = "Unknown Attire: " + row.GetString("Attire");
                return false;
            }

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

            return base.Parse(row, ref error);
        }
Ejemplo n.º 51
0
        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;
        }
Ejemplo n.º 52
0
        public void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            WorldName world;
            row.TryGetEnum<WorldName>("World", out world, WorldName.Undefined);

            List<DaysOfTheWeek> days = ParserFunctions.ParseDayList(row.GetString("Days"));
            if ((days == null) || (days.Count == 0))
            {
                days = ParserFunctions.ParseDayList("MTWRFSU");
            }

            int startHour = row.GetInt("StartHour");
            int endHour = row.GetInt("EndHour");

            if (startHour > endHour) return;

            int speed = row.GetInt("Speed");
            if (speed <= 0)
            {
                speed = Relativity.sOneMinute;
            }

            mIntervals.Add(new SpeedInterval(world, days, startHour, endHour, speed));
        }
Ejemplo n.º 53
0
            public Data(XmlDbRow row, VectorBooter.Test test)
            {
                mGuid = row.GetString("GUID");

                mDelta = row.GetInt("Delta", 0);

                if (mDelta == 0)
                {
                    BooterLogger.AddError(mGuid + " Missing Delta");
                }

                mTest = test;
            }
Ejemplo n.º 54
0
        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);
        }
Ejemplo n.º 55
0
        public override bool Parse(XmlDbRow row)
        {
            mIndex = row.GetInt("Index", -1);
            if (mIndex < 0)
            {
                BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName);
                return false;
            }

            return base.Parse(row);
        }
Ejemplo n.º 56
0
        // From AcademicDegreeManager:CreateAcademicDegreeTable
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined;

            if (!row.TryGetEnum<AcademicDegreeNames>("AcademicDegreeEnum", out academicDegree, AcademicDegreeNames.Undefined))
            {
                academicDegree = unchecked((AcademicDegreeNames)ResourceUtils.HashString64(row.GetString("AcademicDegreeEnum")));
            }

            BooterLogger.AddTrace("AcademicDegreeEnum: " + row.GetString("AcademicDegreeEnum"));

            string degreeNameKey = row.GetString("AcademicDegreeName");
            string degreeDescKey = row.GetString("AcademicDegreeDesc");
            string degreeIcon = row.GetString("AcademicDegreeIcon");
            int degreeCreditHours = row.GetInt("AcademicDegreeRequiredCreditHours");
            float degreeCostPerCredit = row.GetFloat("AcademicDegreeCostPerCredit");
            string degreeResponsibilitiesKey = row.GetString("ResponsibilityTooltipKey");

            JobId academicDefaultCourseID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultCourseID", out academicDefaultCourseID, JobId.AcademicsGenericRabbitHoleCourse))
            {
                // Custom
                academicDefaultCourseID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultCourseID")));
            }

            JobId academicDefaultLectureID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultLectureID", out academicDefaultLectureID, JobId.Invalid))
            {
                // Custom
                academicDefaultLectureID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLectureID")));                
            }

            JobId academicDefaultLabID;
            if (!row.TryGetEnum<JobId>("AcademicDefaultLabID", out academicDefaultLabID, JobId.Invalid))
            {
                // Custom
                academicDefaultLabID = unchecked((JobId)ResourceUtils.HashString64(row.GetString("AcademicDefaultLabID")));
            }

            List<OccupationNames> associatedOccupations = new List<OccupationNames>();
            List<string> list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true);
            for (int i = 0x0; i < list2.Count; i++)
            {
                OccupationNames occupation;
                if (!ParserFunctions.TryParseEnum<OccupationNames>(list2[i], out occupation, OccupationNames.Undefined))
                {
                    occupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i])));
                }

                if (occupation != OccupationNames.Undefined)
                {
                    associatedOccupations.Add(occupation);
                }
            }

            OccupationNames grantedOccupation;
            if (!ParserFunctions.TryParseEnum<OccupationNames>("GrantedOccupationNameEnum", out grantedOccupation, OccupationNames.Undefined))
            {
                // Custom
                grantedOccupation = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString("GrantedOccupationNameEnum")));
            }

            List<TraitNames> beneficialTraits;
            List<TraitNames> detrimentalTraits;
            List<TraitNames> suggestedTraits;
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["BeneficialTraits"], out beneficialTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["DetrimentalTraits"], out detrimentalTraits, TraitNames.Unknown);
            ParserFunctions.TryParseCommaSeparatedList<TraitNames>(row["SuggestedTraits"], out suggestedTraits, TraitNames.Unknown);

            AcademicDegreeStaticData staticData = null;
            if (!AcademicDegreeManager.sDictionary.TryGetValue((ulong)academicDegree, out staticData))
            {
                staticData = new AcademicDegreeStaticData(academicDegree, degreeNameKey, degreeDescKey, degreeResponsibilitiesKey, degreeIcon, degreeCreditHours, degreeCostPerCredit, academicDefaultCourseID, academicDefaultLectureID, academicDefaultLabID, associatedOccupations, grantedOccupation, beneficialTraits, detrimentalTraits, suggestedTraits);
            }
            else
            {
                staticData.BeneficialTraits.AddRange(beneficialTraits);
                staticData.DetrimentalTraits.AddRange(detrimentalTraits);
                staticData.SuggestedTraits.AddRange(suggestedTraits);
                staticData.AssociatedOccupations.AddRange(associatedOccupations);
            }

            string skillsThatGrantXP = row.GetString("SkillsThatGrantXP");
            if (!string.IsNullOrEmpty(skillsThatGrantXP))
            {
                foreach (string str6 in skillsThatGrantXP.Split(new char[] { ';' }))
                {
                    string[] strArray2 = str6.Split(new char[] { ',' });
                    if (strArray2.Length != 0x2) continue;

                    float num4 = ParserFunctions.ParseFloat(strArray2[0x1], -1234123f);
                    if (num4 == -1234123f) continue;

                    // Custom
                    SkillNames skillName = SkillManager.sSkillEnumValues.ParseEnumValue(strArray2[0x0]);
                    if (skillName == SkillNames.None) continue;

                    staticData.AddSkill(skillName, num4);
                }
            }

            AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData;
        }