示例#1
0
        public OmniJournalData(XmlDbRow row, int rowIndex)
            : base(row, "OmniJournal", rowIndex)
        {
            mCareerName     = row.GetString("CareerName");
            mCareerLevel    = ParserFunctions.ParseInt(row.GetString("CareerLevel"), 0);
            mCurrentEdition = ParserFunctions.ParseInt(row.GetString("StartingEdition"), 1);

            mMaxEdition = ParserFunctions.ParseInt(row.GetString("MaxEdition"), 1);

            base.MyType = BookData.BookType.MedicalJournal;

            Dictionary <int, OmniJournalData> levels;

            if (!sJournalDataList.TryGetValue(mCareerName, out levels))
            {
                levels = new Dictionary <int, OmniJournalData>();

                sJournalDataList.Add(mCareerName, levels);
            }

            if (!levels.ContainsKey(mCareerLevel))
            {
                levels.Add(mCareerLevel, this);
            }
        }
示例#2
0
        // From ActiveCareer::GenerateOccupationToJobStaticDataMap
        private static Dictionary <ulong, Dictionary <uint, JobStaticData> > GenerateOccupationToJobStaticDataMap(XmlDbTable jobsTable)
        {
            Dictionary <ulong, Dictionary <uint, JobStaticData> > careerToJobStaticDataMap = new Dictionary <ulong, Dictionary <uint, JobStaticData> >();

            bool          flag                      = true;
            bool          hasActiveCareer           = false;
            string        jobTitle                  = string.Empty;
            int           hoursAvailable            = 0x0;
            DaysOfTheWeek daysAvailable             = ~DaysOfTheWeek.None;
            float         jobStartTime              = -1f;
            int           budget                    = 0x0;
            int           cash                      = 0x0;
            float         experience                = 0f;
            List <JobId>  parents                   = null;
            List <TaskCreationStaticData> tasks     = null;
            string             mapTagText           = null;
            string             mapTagIcon           = null;
            bool               mapTagShowInOffHours = false;
            JobId              jobId                = JobId.Invalid;
            JobDestinaitonType destinationType      = JobDestinaitonType.Invalid;

            CommercialLotSubType[] commercialLotSubTypes = null;
            RabbitHoleType         none = RabbitHoleType.None;

            RabbitHoleType[] rabbitholeTypes = null;
            int[]            durationMinMax  = null;
            OccupationNames  activeCareer    = OccupationNames.Undefined;

            JobCooldownDefinition[] jobCooldownDefinitions = null;
            string        jobInteractionName        = null;
            string        jobIntroductionKey        = null;
            string        jobIntroductionWithSimKey = null;
            TNSNames      tnsID              = TNSNames.Invalid;
            string        musicClipName      = null;
            List <string> list3              = new List <string>();
            List <CooldownSpecificity> list4 = new List <CooldownSpecificity>();

            foreach (string str8 in jobsTable.DefaultRow.ColumnNames)
            {
                if (str8.StartsWith("Cooldown_"))
                {
                    CooldownSpecificity specificity;
                    if (!ParserFunctions.TryParseEnum <CooldownSpecificity>(str8.Substring(0x9).Replace('_', ','), out specificity, CooldownSpecificity.None))
                    {
                        return(careerToJobStaticDataMap);
                    }
                    list3.Add(str8);
                    list4.Add(specificity);
                }
            }

            int count = list3.Count;

            foreach (XmlDbRow row in jobsTable.Rows)
            {
                List <string> stringList;

                OccupationNames undefined = OccupationNames.Undefined;
                if (!row.TryGetEnum <OccupationNames>("ActiveCareer", out undefined, OccupationNames.Undefined))
                {
                    undefined = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString("ActiveCareer")));
                }

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

                if (undefined != OccupationNames.Undefined)
                {
                    hasActiveCareer = true;
                    OccupationNames names4 = undefined;
                    if (undefined != activeCareer)
                    {
                        names4 = activeCareer;
                    }
                    activeCareer = undefined;
                    if (flag)
                    {
                        flag = false;
                    }
                    else
                    {
                        ActiveCareer.AddNewJob(careerToJobStaticDataMap, ref hoursAvailable, ref daysAvailable, ref jobStartTime, ref budget, ref cash, ref experience, ref parents, ref tasks, ref mapTagText, ref mapTagIcon, ref mapTagShowInOffHours, jobId, names4, ref destinationType, ref commercialLotSubTypes, ref none, ref durationMinMax, ref rabbitholeTypes, ref jobTitle, jobCooldownDefinitions, ref jobInteractionName, ref jobIntroductionKey, ref jobIntroductionWithSimKey, ref tnsID, ref musicClipName);
                    }
                }
                else if (hasActiveCareer)
                {
                    hasActiveCareer = false;
                }
                else if (!string.IsNullOrEmpty(row.GetString("ActiveCareer")))
                {
                    return(careerToJobStaticDataMap);
                }

                if (hasActiveCareer)
                {
                    if (!row.TryGetEnum <JobId>("Job_Id", out jobId, JobId.Invalid))
                    {
                        jobId = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("Job_Id")));

                        sIdToJobs[jobId] = row.GetString("Job_Id");
                    }

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

                    if (!row.IsInstalled("SKU_Installed") || !row.IsRegistered("SKU_Registered"))
                    {
                        if (Occupation.sValidJobsNotInstalled == null)
                        {
                            Occupation.sValidJobsNotInstalled = new List <KeyValuePair <OccupationNames, JobId> >();
                        }
                        Occupation.sValidJobsNotInstalled.Add(new KeyValuePair <OccupationNames, JobId>(undefined, jobId));
                        continue;
                    }

                    jobTitle                  = row.GetString("Job_Title");
                    hoursAvailable            = row.GetInt("Hours_Available", 0x0);
                    daysAvailable             = ParserFunctions.ParseDayListToEnum(row.GetString("Days_Available"));
                    jobStartTime              = row.GetFloat("Start_Time", -1f);
                    budget                    = row.GetInt("Budget", 0x0);
                    cash                      = row.GetInt("Payout_Cash", 0x0);
                    experience                = row.GetInt("Payout_XP", 0x0);
                    mapTagText                = row.GetString("Map_Tag_Text");
                    mapTagIcon                = row.GetString("Map_Tag_Icon");
                    mapTagShowInOffHours      = row.GetString("Show_Map_Tag_In_Off_Hours") == "x";
                    jobInteractionName        = row.GetString("Job_InteractionName");
                    jobIntroductionKey        = row.GetString("Job_IntroductionKey");
                    jobIntroductionWithSimKey = row.GetString("Job_IntroductionWithSimKey");
                    row.TryGetEnum <TNSNames>("Job_CompletionTNS", out tnsID, TNSNames.Invalid);
                    musicClipName = row.GetString("Music");
                    string str11 = row.GetString("Valid_Destination");
                    bool   flag4 = false;
                    if (!string.IsNullOrEmpty(str11))
                    {
                        if (!row.TryGetEnum <JobDestinaitonType>("Valid_Destination", out destinationType, JobDestinaitonType.Invalid))
                        {
                            flag4 = true;
                        }

                        switch (destinationType)
                        {
                        case JobDestinaitonType.Commercial:
                        case JobDestinaitonType.ResidentialAndCommercial:
                            string str12 = row.GetString("Destination_Arguments");
                            if (!string.IsNullOrEmpty(str12))
                            {
                                List <CommercialLotSubType> list5;
                                if (!ParserFunctions.TryParseCommaSeparatedList <CommercialLotSubType>(str12, out list5, CommercialLotSubType.kCommercialUndefined))
                                {
                                    flag4 = true;
                                }
                                else
                                {
                                    commercialLotSubTypes = list5.ToArray();
                                }
                            }
                            break;

                        case JobDestinaitonType.RabbitHole:
                            stringList = row.GetStringList("Destination_Arguments", ',');
                            if ((stringList != null) && (stringList.Count == 0x3))
                            {
                                if (ParserFunctions.TryParseEnum <RabbitHoleType>(stringList[0x0], out none, RabbitHoleType.None))
                                {
                                    int num7 = ParserFunctions.ParseInt(stringList[0x1], -1);
                                    int num8 = ParserFunctions.ParseInt(stringList[0x2], -1);
                                    durationMinMax = new int[] { num7, num8 };
                                }
                                else
                                {
                                    flag4 = true;
                                }
                            }
                            else
                            {
                                flag4 = true;
                            }
                            break;

                        case JobDestinaitonType.RabbitHoleLot:
                            string str13 = row.GetString("Destination_Arguments");
                            if (!string.IsNullOrEmpty(str13))
                            {
                                List <RabbitHoleType> list7;
                                if (!ParserFunctions.TryParseCommaSeparatedList <RabbitHoleType>(str13, out list7, RabbitHoleType.None))
                                {
                                    flag4 = true;
                                }
                                else
                                {
                                    rabbitholeTypes = list7.ToArray();
                                }
                            }
                            break;
                        }
                    }

                    jobCooldownDefinitions = null;
                    List <JobCooldownDefinition> list8 = new List <JobCooldownDefinition>(count);
                    for (int i = 0x0; i < count; i++)
                    {
                        int @int = row.GetInt(list3[i]);
                        if (@int != 0x0)
                        {
                            list8.Add(new JobCooldownDefinition(list4[i], (float)@int));
                        }
                    }

                    if (list8.Count > 0x0)
                    {
                        jobCooldownDefinitions = list8.ToArray();
                    }

                    if (flag4)
                    {
                        continue;
                    }
                }

                if (!string.IsNullOrEmpty(row.GetString("Parent_Job_Ids")))
                {
                    JobId id2;
                    if (!row.TryGetEnum <JobId>("Parent_Job_Ids", out id2, JobId.Invalid))
                    {
                        id2 = unchecked ((JobId)ResourceUtils.HashString64(row.GetString("Parent_Job_Ids")));

                        sIdToJobs[id2] = row.GetString("Parent_Job_Ids");
                    }

                    if (parents == null)
                    {
                        parents = new List <JobId>();
                    }
                    parents.Add(id2);
                }

                if (!string.IsNullOrEmpty(row.GetString("Task_Id")))
                {
                    TaskId id3;
                    if (!row.TryGetEnum <TaskId>("Task_Id", out id3, TaskId.Invalid))
                    {
                        id3 = unchecked ((TaskId)ResourceUtils.HashString64(row.GetString("Task_Id")));
                    }

                    if (tasks == null)
                    {
                        tasks = new List <TaskCreationStaticData>();
                    }
                    int lowerBound = row.GetInt("Task_Lower_Bound");
                    int upperBound = row.GetInt("Task_Upper_Bound");
                    TaskCreationStaticData item = new TaskCreationStaticData(id3, lowerBound, upperBound);
                    tasks.Add(item);
                }
            }

            ActiveCareer.AddNewJob(careerToJobStaticDataMap, ref hoursAvailable, ref daysAvailable, ref jobStartTime, ref budget, ref cash, ref experience, ref parents, ref tasks, ref mapTagText, ref mapTagIcon, ref mapTagShowInOffHours, jobId, activeCareer, ref destinationType, ref commercialLotSubTypes, ref none, ref durationMinMax, ref rabbitholeTypes, ref jobTitle, jobCooldownDefinitions, ref jobInteractionName, ref jobIntroductionKey, ref jobIntroductionWithSimKey, ref tnsID, ref musicClipName);

            return(careerToJobStaticDataMap);
        }
示例#3
0
        // Sims3.Gameplay.ActorSystems.BuffManager
        public static void ParseBuffData(XmlDbData data, bool bStore)
        {
            try
            {
                XmlDbTable xmlDbTable = null;
                data.Tables.TryGetValue("BuffList", out xmlDbTable);
                if (xmlDbTable == null)
                {
                    xmlDbTable = data.Tables["Buffs"];
                }

                foreach (XmlDbRow current in xmlDbTable.Rows)
                {
                    bool   flag = false;
                    string text = current["BuffName"];
                    //  if (!bStore || Localization.HasLocalizationString("Gameplay/Excel/buffs/BuffList:" + text))
                    {
                        string    mDescription = current["BuffDescription"];
                        string    mHelpText    = current["BuffHelpText"];
                        BuffNames guid         = (BuffNames)BuffManager.GetGuid(current["Hex"], bStore);
                        double    mVersion     = 0.0;
                        if (guid == BuffNames.Undefined)
                        {
                            flag = true;
                        }
                        Buff buff = null;

                        if (!flag)
                        {
                            BuffCategory mBuffCategory;
                            ParserFunctions.TryParseEnum <BuffCategory>(current["Category"], out mBuffCategory, BuffCategory.None, true);
                            CommodityKind mSolveCommodity = CommodityKind.None;
                            ParserFunctions.TryParseEnum <CommodityKind>(current["SolveCommodity"], out mSolveCommodity, CommodityKind.None, true);
                            string names  = current["IncreasedEffectiveness"];
                            string names2 = current["ReducedEffectiveness"];
                            List <SocialManager.SocialEffectiveness> mIncreasedEffectivenessList;
                            ParserFunctions.TryParseCommaSeparatedList <SocialManager.SocialEffectiveness>(names, out mIncreasedEffectivenessList, SocialManager.SocialEffectiveness.None);
                            List <SocialManager.SocialEffectiveness> mReducedEffectivenessList;
                            ParserFunctions.TryParseCommaSeparatedList <SocialManager.SocialEffectiveness>(names2, out mReducedEffectivenessList, SocialManager.SocialEffectiveness.None);
                            string   mTopic = current["Topic"];
                            MoodAxis mAxisEffected;
                            if (ParserFunctions.TryParseEnum <MoodAxis>(current["AxisEffected"], out mAxisEffected, MoodAxis.None, true))
                            {
                                Polarity mPolarityOverride;
                                ParserFunctions.TryParseEnum <Polarity>(current["PolarityOverride"], out mPolarityOverride, Polarity.NoOverride, true);
                                Buff.BuffData buffData = new Buff.BuffData();
                                ParserFunctions.TryParseEnum <ProductVersion>(current["SKU"], out buffData.mProductVersion, (ProductVersion)1);
                                ResourceKey resourceKey = ResourceKey.kInvalidResourceKey;
                                string      text2       = null;
                                if (AppDomain.CurrentDomain.GetData("UIManager") != null)
                                {
                                    text2       = current["ThumbFilename"];
                                    resourceKey = ResourceKey.CreatePNGKey(text2, ResourceUtils.ProductVersionToGroupId(buffData.mProductVersion));
                                    if (!World.ResourceExists(resourceKey))
                                    {
                                        resourceKey = ResourceKey.CreatePNGKey(text2, 0u);
                                    }
                                }
                                if (bStore)
                                {
                                    mVersion = Convert.ToDouble(current["Version"]);
                                }
                                buffData.mBuffGuid     = guid;
                                buffData.mBuffName     = text;
                                buffData.mDescription  = mDescription;
                                buffData.mHelpText     = mHelpText;
                                buffData.mBuffCategory = mBuffCategory;
                                buffData.mVersion      = mVersion;
                                buffData.SetFlags(Buff.BuffData.FlagField.PermaMoodlet, ParserFunctions.ParseBool(current["PermaMoodlet"]));
                                string @string = current.GetString("PermaMoodletColor");
                                ParserFunctions.TryParseEnum <MoodColor>(@string, out buffData.mMoodletColor, MoodColor.Invalid);
                                buffData.mAxisEffected      = mAxisEffected;
                                buffData.mPolarityOverride  = mPolarityOverride;
                                buffData.mEffectValue       = ParserFunctions.ParseInt(current["EffectValue"], 0);
                                buffData.mDelayTimer        = (float)ParserFunctions.ParseInt(current["DelayTimer"], 0);
                                buffData.mTimeoutSimMinutes = ParserFunctions.ParseFloat(current["TimeoutLength"], -1f);
                                buffData.mSolveCommodity    = mSolveCommodity;
                                buffData.mSolveTime         = ParserFunctions.ParseFloat(current["SolveTime"], -3.40282347E+38f);
                                buffData.SetFlags(Buff.BuffData.FlagField.AttemptAutoSolve, ParserFunctions.ParseBool(current["AttemptAutoSolve"]));
                                ParserFunctions.ParseCommaSeparatedString(current["FacialIdle"], out buffData.mFacialIdles);
                                buffData.SetFlags(Buff.BuffData.FlagField.IsExtreme, ParserFunctions.ParseBool(current["IsExtreme"]));
                                buffData.mIncreasedEffectivenessList = mIncreasedEffectivenessList;
                                buffData.mReducedEffectivenessList   = mReducedEffectivenessList;
                                buffData.mThumbKey    = resourceKey;
                                buffData.mThumbString = text2;
                                buffData.mTopic       = mTopic;
                                buffData.SetFlags(Buff.BuffData.FlagField.ShowBalloon, current.GetBool("ShowBallon"));
                                buffData.SetFlags(Buff.BuffData.FlagField.Travel, current.GetBool("Travel"));
                                ParserFunctions.TryParseCommaSeparatedList <OccultTypes>(current["DisallowedOccults"], out buffData.mDisallowedOccults, OccultTypes.None);
                                if (buffData.mDisallowedOccults.Count == 0)
                                {
                                    buffData.mDisallowedOccults = null;
                                }
                                string text3 = current.GetString("JazzStateSuffix");
                                if (string.IsNullOrEmpty(text3))
                                {
                                    text3 = text;
                                }
                                buffData.mJazzStateSuffix = text3;
                                string string2 = current.GetString("SpeciesAvailability");
                                if (string.IsNullOrEmpty(string2))
                                {
                                    buffData.mAvailabilityFlags = (CASAGSAvailabilityFlags)127L;
                                }
                                else
                                {
                                    buffData.mAvailabilityFlags = ParserFunctions.ParseAllowableAgeSpecies(string2);
                                }
                                string text4 = current["CustomClassName"];
                                if (text4.Length > 0)
                                {
                                    text4 = text4.Replace(" ", "");
                                    int num = text4.IndexOf(',');
                                    if (num < 0)
                                    {
                                        flag = true;
                                    }
                                    else
                                    {
                                        string str = text4.Substring(0, num);
                                        text4.Substring(num + 1);
                                        Type type = null;
                                        if (bStore)
                                        {
                                            type = Type.GetType(str + ",Sims3StoreObjects");
                                        }
                                        if (type == null)
                                        {
                                            type = Type.GetType(text4);
                                        }
                                        if (type == null)
                                        {
                                            flag = true;
                                        }
                                        else
                                        {
                                            Type[] types = new Type[]
                                            {
                                                typeof(Buff.BuffData)
                                            };
                                            ConstructorInfo constructor = type.GetConstructor(types);
                                            object          obj         = constructor.Invoke(new object[]
                                            {
                                                buffData
                                            });
                                            buff = (Buff)obj;
                                        }
                                    }
                                }
                                else
                                {
                                    buff = new Buff(buffData);
                                }
                            }
                            if (!flag && buff != null)
                            {
                                BuffInstance value = buff.CreateBuffInstance();
                                if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.ContainsKey((ulong)guid))
                                {
                                    if (GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid].mBuff.BuffVersion < buff.BuffVersion)
                                    {
                                        GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary[(ulong)guid] = value;
                                    }
                                }
                                else
                                {
                                    GenericManager <BuffNames, BuffInstance, BuffInstance> .sDictionary.Add((ulong)guid, value);

                                    BuffManager.sBuffEnumValues.AddNewEnumValue(text, guid);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                StyledNotification.Show(new StyledNotification.Format(ex.ToString(), StyledNotification.NotificationStyle.kGameMessageNegative));
            }
        }