示例#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"));
            }
        }
示例#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");
            }
        }
示例#3
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));
        }
示例#4
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"));
            }
        }
示例#5
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");
            }
        }
示例#6
0
        public IdleAnimationSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Mood", Guid))
            {
                if (!row.TryGetEnum <MoodFlavor>("Mood", out mMood, MoodFlavor.Uncomfortable))
                {
                    BooterLogger.AddError(" Unknown Mood: " + row.GetString("Mood"));
                }
            }

            if (BooterLogger.Exists(row, "Priority", Guid))
            {
                if (!row.TryGetEnum <IdleAnimationPriority>("Priority", out mPriority, IdleAnimationPriority.NonDistress))
                {
                    BooterLogger.AddError(" Unknown Priority: " + row.GetString("Priority"));
                }
            }
        }
示例#7
0
        public IdleAnimationSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Mood", Guid))
            {
                if (!row.TryGetEnum<MoodFlavor>("Mood", out mMood, MoodFlavor.Uncomfortable))
                {
                    BooterLogger.AddError(" Unknown Mood: " + row.GetString("Mood"));
                }
            }

            if (BooterLogger.Exists(row, "Priority", Guid))
            {
                if (!row.TryGetEnum<IdleAnimationPriority>("Priority", out mPriority, IdleAnimationPriority.NonDistress))
                {
                    BooterLogger.AddError(" Unknown Priority: " + row.GetString("Priority"));
                }
            }
        }
示例#8
0
        public ReactionSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Type", Guid))
            {
                if (!row.TryGetEnum<ReactionTypes>("Type", out mType, ReactionTypes.None))
                {
                    BooterLogger.AddError(Guid + " Unknown Type: " + row.GetString("Type"));
                }
            }

            if (BooterLogger.Exists(row, "Speed", Guid))
            {
                if (!row.TryGetEnum<ReactionSpeed>("Speed", out mSpeed, ReactionSpeed.None))
                {
                    BooterLogger.AddError(Guid + " Unknown Speed: " + row.GetString("Speed"));
                }
            }
        }
示例#9
0
        public ReactionSymptom(XmlDbRow row)
            : base(row)
        {
            if (BooterLogger.Exists(row, "Type", Guid))
            {
                if (!row.TryGetEnum <ReactionTypes>("Type", out mType, ReactionTypes.None))
                {
                    BooterLogger.AddError(Guid + " Unknown Type: " + row.GetString("Type"));
                }
            }

            if (BooterLogger.Exists(row, "Speed", Guid))
            {
                if (!row.TryGetEnum <ReactionSpeed>("Speed", out mSpeed, ReactionSpeed.None))
                {
                    BooterLogger.AddError(Guid + " Unknown Speed: " + row.GetString("Speed"));
                }
            }
        }
示例#10
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");
            }
        }
示例#11
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");
            }
        }
示例#12
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);
            }
        }
示例#13
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);
            }
        }
示例#14
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

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

            if (!row.Exists("Locale"))
            {
                error = "Locale Missing";
                return(false);
            }

            if (!row.TryGetEnum <Locales>("Locale", out mLocale, Locales.Home))
            {
                error = "Unknown Locale";
                return(false);
            }

            return(base.Parse(row, ref error));
        }
示例#15
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));
        }
示例#16
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;
        }
示例#17
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");

            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError(file + ": Guid empty");
                return;
            }

            AfterschoolActivityType type = unchecked ((AfterschoolActivityType)ResourceUtils.HashString64(guid));

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

            List <string> skills = row.GetStringList("Skills", ',');

            if (skills != null)
            {
                foreach (string skillStr in skills)
                {
                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr);
                    if (skill == SkillNames.None)
                    {
                        BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr);
                        return;
                    }
                    else
                    {
                        data.mActivity.ActivitySkillNameList.Add(skill);
                    }
                }
            }

            if (data.mActivity.ActivitySkillNameList.Count == 0)
            {
                BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill");
                return;
            }

            DaysOfTheWeek days;

            if (!row.TryGetEnum <DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek"));
                return;
            }

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;

            if (!row.TryGetEnum <CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders"));
                return;
            }

            data.mGenders = genders;

            CASAgeGenderFlags ages;

            if (!row.TryGetEnum <CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages"));
                return;
            }

            data.mAges = ages;

            if (row.Exists("PreLoop"))
            {
                data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPreLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop"));
                    return;
                }
            }

            if (row.Exists("Loop"))
            {
                data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop"));
                    return;
                }
            }

            if (row.Exists("PostLoop"))
            {
                data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPostLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop"));
                    return;
                }
            }

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
示例#18
0
        public virtual void Set(XmlDbRow row)
        {
            try
            {
                mPerformanceModifier = row.GetFloat("PerformanceModifier", mPerformanceModifier);

                if (!string.IsNullOrEmpty(row.GetString("OnlySkill")))
                {
                    mOnlySkill = row.GetBool("OnlySkill");
                }

                if (!string.IsNullOrEmpty(row.GetString("MustHaveVisibleSkill")))
                {
                    mMustHaveVisibleSkill = row.GetBool("MustHaveVisibleSkill");
                }

                row.TryGetEnum <ProductVersion>("ProductVersoin", out mVersion, ProductVersion.BaseGame);

                mBranch = row.GetString("CareerBranch");

                mMinLevel = row.GetInt("CareerMinLevel", mMinLevel);

                mMaxLevel = row.GetInt("CareerMaxLevel", mMaxLevel);

                int count = row.GetInt("SkillCount");
                for (int i = 1; i <= count; i++)
                {
                    float rate = 1f;
                    if (row.Exists("SkillRate" + i))
                    {
                        rate = row.GetFloat("SkillRate" + i);
                    }

                    string skillName = row.GetString("Skill" + i);
                    if (skillName == null)
                    {
                        continue;
                    }

                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillName);
                    if (skill == SkillNames.None)
                    {
                        continue;
                    }

                    mSkills.Add(new SkillRate(skill, rate));
                }

                count = row.GetInt("MotiveCount");
                for (int i = 1; i <= count; i++)
                {
                    float rate = 1f;
                    if (row.Exists("MotiveRate" + i))
                    {
                        rate = row.GetFloat("MotiveRate" + i);
                    }

                    CommodityKind motive = CommodityKind.None;

                    string motiveName = row.GetString("Motive" + i);
                    if (motiveName == null)
                    {
                        continue;
                    }

                    ParserFunctions.TryParseEnum <CommodityKind>(motiveName, out motive, CommodityKind.None);

                    if (motive == CommodityKind.None)
                    {
                        continue;
                    }

                    mMotives.Add(new MotiveRate(motive, rate));
                }

                count = row.GetInt("MetricCount");
                for (int i = 1; i <= count; i++)
                {
                    int rate = row.GetInt("MetricRate" + i, 1);

                    MetricRate.MetricType metric = row.GetEnum <MetricRate.MetricType>("MetricType" + i, MetricRate.MetricType.None);

                    int hoursUntilChange = row.GetInt("MetricHoursUntilChange" + i, 1);

                    mMetrics.Add(new MetricRate(metric, rate, hoursUntilChange));
                }
            }
            catch (Exception exception)
            {
                Common.Exception(Name(), exception);
            }
        }
示例#19
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;
        }
示例#20
0
        public override bool Parse(XmlDbRow row, ref string error)
        {
            mName = new WeightOption.NameOption(row);

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

            if (!row.Exists("Locale"))
            {
                error = "Locale Missing";
                return false;
            }

            if (!row.TryGetEnum<Locales>("Locale", out mLocale, Locales.Home))
            {
                error = "Unknown Locale";
                return false;
            }

            return base.Parse(row, ref error);
        }
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");
            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError(file + ": Guid empty");
                return;
            }

            AfterschoolActivityType type = unchecked((AfterschoolActivityType)ResourceUtils.HashString64(guid));

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

            List<string> skills = row.GetStringList("Skills", ',');
            if (skills != null)
            {
                foreach (string skillStr in skills)
                {
                    SkillNames skill = SkillManager.sSkillEnumValues.ParseEnumValue(skillStr);
                    if (skill == SkillNames.None)
                    {
                        BooterLogger.AddError(file + ": " + guid + " Unknown skill " + skillStr);
                        return;
                    }
                    else
                    {
                        data.mActivity.ActivitySkillNameList.Add(skill);
                    }
                }
            }

            if (data.mActivity.ActivitySkillNameList.Count == 0)
            {
                BooterLogger.AddError(file + ": " + guid + " Activity Must Have a Skill");
                return;
            }

            DaysOfTheWeek days;
            if (!row.TryGetEnum<DaysOfTheWeek>("DaysOfTheWeek", out days, DaysOfTheWeek.All))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown DaysOfTheWeek " + row.GetString("DaysOfTheWeek"));
                return;
            }

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Genders", out genders, CASAgeGenderFlags.GenderMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Genders " + row.GetString("Genders"));
                return;
            }

            data.mGenders = genders;

            CASAgeGenderFlags ages;
            if (!row.TryGetEnum<CASAgeGenderFlags>("Ages", out ages, CASAgeGenderFlags.AgeMask))
            {
                BooterLogger.AddError(file + ": " + guid + " Unknown Ages " + row.GetString("Ages"));
                return;
            }

            data.mAges = ages;

            if (row.Exists("PreLoop"))
            {
                data.mPreLoop = new Common.MethodStore(row.GetString("PreLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPreLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PreLoop " + row.GetString("PreLoop"));
                    return;
                }
            }

            if (row.Exists("Loop"))
            {
                data.mLoop = new Common.MethodStore(row.GetString("Loop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing Loop " + row.GetString("Loop"));
                    return;
                }
            }

            if (row.Exists("PostLoop"))
            {
                data.mPostLoop = new Common.MethodStore(row.GetString("PostLoop"), new Type[] { typeof(GoToSchoolInRabbitHole), typeof(AfterschoolActivity) }).Method;
                if (data.mPostLoop == null)
                {
                    BooterLogger.AddError(file + ": " + guid + " Missing PostLoop " + row.GetString("PostLoop"));
                    return;
                }
            }

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
示例#22
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);
        }
示例#23
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 + ")");
                        }
                    }
                }
            }
        }
示例#24
0
            public Stage(XmlDbRow row)
            {
                if (BooterLogger.Exists(row, "Name", "Stage"))
                {
                    mName = row.GetString("Name");
                }

                if (!row.TryGetEnum <VectorControl.StageType>("Type", out mType, VectorControl.StageType.None))
                {
                    BooterLogger.AddError(Name + " Invalid Type: " + row.GetString("Type"));
                }

                float infectionRate = row.GetFloat("InfectionRate", 0);

                mOutdoorInfectionRate = row.GetFloat("OutdoorInfectionRate", infectionRate);
                if (mOutdoorInfectionRate > 1)
                {
                    mOutdoorInfectionRate = 1;
                }

                mRoomInfectionRate = row.GetFloat("RoomInfectionRate", mOutdoorInfectionRate * 1.5f);
                if (mRoomInfectionRate > 1)
                {
                    mRoomInfectionRate = 1;
                }

                mSocialInfectionRate = row.GetFloat("SocialInfectionRate", mRoomInfectionRate * 1.5f);
                if (mSocialInfectionRate > 1)
                {
                    mSocialInfectionRate = 1;
                }
                mFightInfectionRate = row.GetFloat("FightInfectionRate", mSocialInfectionRate);
                if (mFightInfectionRate > 1)
                {
                    mFightInfectionRate = 1;
                }

                mWoohooInfectionRate = row.GetFloat("WoohooInfectionRate", mSocialInfectionRate * 1.5f);
                if (mWoohooInfectionRate > 1)
                {
                    mWoohooInfectionRate = 1;
                }

                mMutationRate = row.GetFloat("MutationRate", 0);

                mGoodRelationshipDelta = row.GetInt("GoodRelationshipDelta", 0);
                mBadRelationshipDelta  = row.GetInt("BadRelationshipDelta", 0);

                mSymptomScoring        = row.GetString("SymptomScoring");
                mSymptomScoringMinimum = row.GetInt("SymptomScoringMinimum", 0);

                mStoryUnknown    = row.GetString("StoryUnknown");
                mStoryIdentified = row.GetString("StoryIdentified");

                if (row.Exists("CanInoculate")) // Default is True
                {
                    mCanInoculate = row.GetBool("CanInoculate");
                }
                else if (row.Exists("CanInnoculate"))
                {
                    mCanInoculate = row.GetBool("CanInnoculate");
                }

                int numSymptoms = row.GetInt("NumSymptoms", 0) + 1;

                for (int i = 1; i <= numSymptoms; i++)
                {
                    if (i == numSymptoms)
                    {
                        if (row.Exists("SymptomChance" + i))
                        {
                            BooterLogger.AddError(Name + " More Symptoms than NumSymptoms");
                        }
                        break;
                    }

                    mSymptoms.Add(new SymptomChance(row, i));
                }

                int numResistances = row.GetInt("NumResistances", 0) + 1;

                for (int i = 1; i <= numResistances; i++)
                {
                    if (i == numResistances)
                    {
                        if (row.Exists("Resistance" + i))
                        {
                            BooterLogger.AddError(Name + " More Resistance than NumResistances");
                        }
                        break;
                    }

                    ResistanceBooter.Data resistance = ResistanceBooter.GetResistance(row.GetString("Resistance" + i));
                    if (resistance == null)
                    {
                        BooterLogger.AddError(Name + " Unknown Resistance " + i + ": " + row.GetString("Resistance" + i));
                    }
                    else
                    {
                        mResistances.Add(resistance);
                    }
                }

                int numMutables = row.GetInt("NumMutables", 0) + 1;

                for (int i = 1; i <= numMutables; i++)
                {
                    if (i == numMutables)
                    {
                        if (row.Exists("Mutable" + i))
                        {
                            BooterLogger.AddError(Name + " More Mutable than NumMutables");
                        }
                        break;
                    }

                    List <string> mutable = row.GetStringList("Mutable" + i, ',');
                    if (mutable.Count != 3)
                    {
                        BooterLogger.AddError(Name + " Unknown Mutable " + i + ": " + row.GetString("Mutable" + i));
                        continue;
                    }

                    int minimum;
                    if (!int.TryParse(mutable[1], out minimum))
                    {
                        BooterLogger.AddError(Name + " Mutable " + i + " Invalid Minimum: " + mutable[1]);
                        continue;
                    }

                    int maximum;
                    if (!int.TryParse(mutable[2], out maximum))
                    {
                        BooterLogger.AddError(Name + " Mutable " + i + " Invalid Maximum: " + mutable[2]);
                        continue;
                    }

                    mMutables.Add(new Mutable(mutable[0], minimum, maximum));
                }
            }
示例#25
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 + ")");
                        }
                    }
                }
            }
        }
示例#26
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;
        }