Example #1
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DataBootFile careerFile = new BooterHelper.DataBootFile(file.ToString(), row.GetString("Careers"), false);
            if (!careerFile.IsValid)
            {
                BooterLogger.AddError(file.ToString() + ": Unknown Careers File " + row.GetString("Careers"));
                return;
            }

            BooterHelper.DataBootFile careerEventsFile = new BooterHelper.DataBootFile(careerFile.ToString(), row.GetString("CareerEvents"), false);

            if (careerEventsFile.IsValid)
            {
                foreach (Career career in CareerManager.CareerList)
                {
                    XmlDbTable table3 = careerEventsFile.GetTable(career.Guid.ToString());
                    if (table3 != null)
                    {
                        LoadCareerEvents(career, careerEventsFile, table3);
                    }
                }
            }

            BooterHelper.DataBootTable table = new BooterHelper.DataBootTable(careerFile, "CareerList");
            if (!table.IsValid)
            {
                BooterLogger.AddError(file.ToString() + ": No CareerList " + careerFile.ToString());
                return;
            }

            table.Load(new CareerLoader(careerEventsFile).LoadCareer);
        }
Example #2
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null)
            {
                return;
            }

            mIndex++;

            string personalityName = row.GetString("Name");

            if (string.IsNullOrEmpty(personalityName))
            {
                BooterLogger.AddError(file + " : Method " + mIndex + " Unnamed");
                return;
            }

            BooterLogger.AddTrace("Found " + personalityName);

            if (GetPersonality(personalityName) != null)
            {
                BooterLogger.AddError(personalityName + " Name already in use");
                return;
            }

            Type classType = row.GetClassType("FullClassName");

            if (classType == null)
            {
                BooterLogger.AddError(personalityName + " No Class");
                return;
            }

            SimPersonality personality = null;

            try
            {
                personality = classType.GetConstructor(new Type[0]).Invoke(new object[0]) as SimPersonality;
            }
            catch
            { }

            if (personality == null)
            {
                BooterLogger.AddError(personalityName + ": Constructor Fail " + row.GetString("FullClassName"));
            }
            else
            {
                XmlDbTable optionTable = dataFile.GetTable(personalityName);
                if (personality.Parse(row, optionTable))
                {
                    sLookup.Add(personalityName.ToLower(), personality);
                }
                else
                {
                    BooterLogger.AddError(personalityName + ": Parsing Fail");
                }
            }
        }
Example #3
0
        protected void ParseTemperatures(Season currentSeason)
        {
            XmlDbData xmlData = XmlDbData.ReadData("Seasons");

            if ((xmlData == null) || (xmlData.Tables == null))
            {
                return;
            }

            XmlDbTable xmlDbTable = SeasonsManager.GetXmlDbTable(xmlData, "Temperature");

            if (xmlDbTable != null)
            {
                foreach (XmlDbRow row in xmlDbTable.Rows)
                {
                    Season season;
                    if (!row.TryGetEnum <Season>("Season", out season, Season.Summer))
                    {
                        continue;
                    }

                    if (season != currentSeason)
                    {
                        continue;
                    }

                    ParseTemperature(row);
                }
            }
        }
Example #4
0
            public void Load(string listing, string field, List <BootFile> files)
            {
                XmlDbTable table = GetTable(listing);

                if (table != null)
                {
                    if ((table.Rows == null) || (table.Rows.Count == 0))
                    {
                        BooterLogger.AddError(mName + ": " + table + " table empty");
                    }
                    else
                    {
                        BooterLogger.AddTrace(mName + ": Found " + listing + " = " + table.Rows.Count);

                        foreach (XmlDbRow row in table.Rows)
                        {
                            BootFile file = new DataBootFile(mName, row.GetString(field), false);
                            if (file.IsValid)
                            {
                                files.Add(file);
                            }
                        }
                    }
                }
                else
                {
                    BooterLogger.AddTrace(mName + ": No " + listing + " Table");
                }
            }
Example #5
0
        // From InsectSpawner.ParseData
        protected static void ParseSpawnerData(XmlDbData data, bool bStore)
        {
            XmlDbTable table = null;

            data.Tables.TryGetValue("Spawners", out table);
            if (table != null)
            {
                foreach (XmlDbRow row in table.Rows)
                {
                    List <InsectType> list;
                    if (Insect.sInsectsTypes.TryParseSuperSetEnumCommaSeparatedList(row["Spawns"], out list, InsectType.Undefined))
                    {
                        string typeName = row["SpawnerClassName"];

                        // Custom, unsure why it is needed since EA Standard does not have it
                        if (!typeName.Contains(","))
                        {
                            typeName += ",Sims3GameplayObjects";
                        }

                        Type type = null;
                        if (bStore)
                        {
                            string[] strArray = typeName.Split(new char[] { '|' });
                            if (strArray.Length > 0x1)
                            {
                                typeName = strArray[0x0] + ",Sims3StoreObjects";
                                type     = Type.GetType(typeName, false, true);
                                if (type == null)
                                {
                                    typeName = strArray[0x0] + ',' + strArray[0x1];
                                }
                            }
                        }

                        if (type == null)
                        {
                            type = Type.GetType(typeName, false, true);
                        }

                        if (type != null)
                        {
                            FieldInfo field = type.GetField("kSpawnerData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
                            if (field != null)
                            {
                                InsectSpawner.InsectSpawnerData spawnerData = field.GetValue(null) as InsectSpawner.InsectSpawnerData;
                                if ((spawnerData != null) && (spawnerData.SpawnerTuning != null))
                                {
                                    sOriginalSpawnChance[spawnerData.SpawnerTuning] = spawnerData.SpawnerTuning.SpawnChance;
                                }
                            }
                        }
                    }
                }
            }
        }
Example #6
0
            public DataBootTable(DataBootFile file, string table)
            {
                mName = table;

                if (file != null)
                {
                    mFile  = file;
                    mTable = file.GetTable(table);
                }
            }
Example #7
0
            public void Parse(string key, OnPopulate populate)
            {
                XmlDbData careerFile = XmlDbData.ReadData(key);

                if ((careerFile != null) && (careerFile.Tables != null) && (careerFile.Tables.ContainsKey("CareerData")))
                {
                    XmlDbTable table = careerFile.Tables["CareerData"];

                    foreach (XmlDbRow row in table.Rows)
                    {
                        string guid = row.GetString("Career");

                        string branch = row.GetString("Branch");
                        if (string.IsNullOrEmpty(branch))
                        {
                            branch = "Base";
                        }

                        int level = row.GetInt("Level");
                        if (level == 1)
                        {
                            continue;
                        }

                        OccupationNames careerGuid = OccupationNames.Undefined;
                        ParserFunctions.TryParseEnum <OccupationNames>(guid, out careerGuid, OccupationNames.Undefined);

                        if (careerGuid == OccupationNames.Undefined)
                        {
                            careerGuid = unchecked ((OccupationNames)ResourceUtils.HashString64(guid));
                        }

                        Dictionary <int, Dictionary <string, TData> > levels;
                        if (!mLevels.TryGetValue(careerGuid, out levels))
                        {
                            levels = new Dictionary <int, Dictionary <string, TData> >();
                            mLevels.Add(careerGuid, levels);
                        }

                        Dictionary <string, TData> branches;
                        if (!levels.TryGetValue(level, out branches))
                        {
                            branches = new Dictionary <string, TData>();
                            levels.Add(level, branches);
                        }

                        if (branches.ContainsKey(branch))
                        {
                            continue;
                        }

                        branches.Add(branch, populate(row));
                    }
                }
            }
Example #8
0
 public SchoolElementaryEx(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
     try
     {
         mOther.Parse(myRow, levelTable);
     }
     catch (Exception e)
     {
         Common.Exception(Name, e);
     }
 }
Example #9
0
 public SchoolElementaryEx(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
     try
     {
         mOther.Parse(myRow, levelTable);
     }
     catch (Exception e)
     {
         Common.Exception(Name, e);
     }
 }
Example #10
0
        public void OnPreLoad()
        {
            try
            {
                XmlDbData careerData = XmlDbData.ReadData("NRaas.StoryProgression.Retired");

                XmlDbData careerEventData = XmlDbData.ReadData("CareerEvents");

                if ((careerData != null) &&
                    (careerData.Tables != null) &&
                    (careerEventData != null) &&
                    (careerEventData.Tables != null) &&
                    (careerData.Tables.ContainsKey("CareerList")))
                {
                    XmlDbTable table = careerData.Tables["CareerList"];
                    foreach (XmlDbRow row in table.Rows)
                    {
                        string key = row.GetString("TableName");
                        if (key != "Retired")
                        {
                            continue;
                        }

                        if (careerData.Tables.ContainsKey(key))
                        {
                            XmlDbTable table2 = careerData.Tables[key];
                            if (table2 != null)
                            {
                                XmlDbTable table3 = null;
                                careerEventData.Tables.TryGetValue(key, out table3);

                                Career career = new Retired(row, table2, table3);

                                if ((career != null) && (career.Guid != OccupationNames.Undefined))
                                {
                                    if (!GenericManager <OccupationNames, Occupation, Occupation> .sDictionary.ContainsKey((ulong)career.Guid))
                                    {
                                        GenericManager <OccupationNames, Occupation, Occupation> .sDictionary.Add((ulong)career.Guid, career);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                Common.Exception("Retired PreLoad", exception);
            }
        }
Example #11
0
 public static void ParseSkillData(XmlDbData data, bool bStore)
 {
     if ((data != null) && (data.Tables != null))
     {
         XmlDbTable table = null;
         data.Tables.TryGetValue("SkillList", out table);
         if (table != null)
         {
             foreach (XmlDbRow row in table.Rows)
             {
                 ParseSkillData(data, row, bStore);
             }
         }
     }
 }
Example #12
0
        protected static bool LoadSkillBookData(XmlDbData spreadsheet, string bookSheet)
        {
            if (spreadsheet.Tables.ContainsKey(bookSheet))
            {
                XmlDbTable table    = spreadsheet.Tables[bookSheet];
                int        rowIndex = 0x0;
                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        XmlDbData.XmlDbRowFast data = row as XmlDbData.XmlDbRowFast;
                        if (data != null)
                        {
                            if (row.Exists("AltSkill"))
                            {
                                data.mData.Remove("Skill");
                                data.mData.Add("Skill", row.GetString("AltSkill"));
                            }
                        }

                        BooterLogger.AddTrace("Skill Book Found: " + row.GetString("Skill"));

                        if (SkillManager.GetStaticSkill(SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill"))) == null)
                        {
                            return(false);
                        }

                        BookSkillData book = new BookSkillData(row, rowIndex);

                        string msg = book.ID;

                        msg += Common.NewLine + "  AllowedWorldTypes " + new ListToString <WorldType>().Convert(book.AllowedWorldTypes);

                        msg += Common.NewLine + "  AllowedWorlds " + new ListToString <WorldName>().Convert(book.AllowedWorlds);

                        BooterLogger.AddTrace("Book Loaded: " + msg);
                    }
                    catch (Exception e)
                    {
                        Common.Exception("Title: " + row["Title"], e);
                    }

                    rowIndex++;
                }
            }
            return(true);
        }
        public static void ParseLessons(XmlDbData data)
        {
            bool       flag       = DeviceConfig.IsMac();
            XmlDbTable xmlDbTable = null;

            data.Tables.TryGetValue("Tutorialettes", out xmlDbTable);
            //Tutorialette.Tutorialettes = new List<TutorialetteDialog.TutorialetteData>();
            //Tutorialette.sIgnoreGlobalCooldown = new Dictionary<Lessons, bool>();
            List <TutorialetteDialog.TutorialettePage> list = null;

            //Tutorialette.sLessonTnsKeys = new Dictionary<Lessons, LessonTNSData>();
            foreach (XmlDbRow row in xmlDbTable.Rows)
            {
                ProductVersion productVersion;
                row.TryGetEnum("EPValid", out productVersion, ProductVersion.BaseGame);
                if (GameUtils.IsInstalled(productVersion))
                {
                    if (!string.IsNullOrEmpty(row["LessonKey"]))
                    {
                        //print("Lesson defaulted into: " + lessons.ToString());
                        string        lessonTnsKey = "Gameplay/Excel/Tutorial/Tutorialettes:" + row["TnsKey"];
                        LessonTNSData value        = new LessonTNSData(lessonTnsKey, productVersion);
                        Tutorialette.sLessonTnsKeys.Add((Lessons)207, value);
                        list = new List <TutorialetteDialog.TutorialettePage>();
                        Tutorialette.Tutorialettes.Add(new TutorialetteDialog.TutorialetteData("Gameplay/Excel/Tutorial/Tutorialettes:" + row["LessonName"], list, (int)207, (ulong)productVersion));
                        Tutorialette.sIgnoreGlobalCooldown.Add((Lessons)207, ParserFunctions.ParseBool(row["IgnoreGlobalCooldown"]));
                    }
                    if (list != null)
                    {
                        string text;
                        if (flag)
                        {
                            text = row["PageTextMac"];
                            if (string.IsNullOrEmpty(text))
                            {
                                text = row["PageText"];
                            }
                        }
                        else
                        {
                            text = row["PageText"];
                        }
                        list.Add(new TutorialetteDialog.TutorialettePage("Gameplay/Excel/Tutorial/Tutorialettes:" + text, row["PageImage"]));
                    }
                }
            }
        }
Example #14
0
 public Unemployed(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
     try
     {
         if (mOriginalLevelData == null)
         {
             if ((levelTable != null) && (levelTable.Rows.Count > 0))
             {
                 mOriginalLevelData = levelTable.Rows[0];
             }
         }
     }
     catch (Exception e)
     {
         Common.Exception(Name, e);
     }
 }
Example #15
0
        protected override void PerformFile(BooterHelper.BootFile file)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null)
            {
                return;
            }

            sDelayedSkillBooks.Add(dataFile.Data);

            BookData.LoadBookData(dataFile.Data, "BookGeneral", BookData.BookType.General);
            BookData.LoadBookData(dataFile.Data, "BookRecipe", BookData.BookType.Recipe);
            BookData.LoadBookData(dataFile.Data, "MedicalJournal", BookData.BookType.MedicalJournal);
            BookData.LoadBookData(dataFile.Data, "SheetMusic", BookData.BookType.SheetMusic);
            BookData.LoadBookData(dataFile.Data, "BookToddler", BookData.BookType.Toddler);
            BookData.LoadBookData(dataFile.Data, "BookAlchemyRecipe", BookData.BookType.AlchemyRecipe);

            LoadWrittenBookTitles(dataFile.Data);

            LoadWrittenBookMaterials(dataFile.Data);

            BookData.LoadBookData(dataFile.Data, "BookFish", BookData.BookType.FishBook);

            XmlDbTable table = dataFile.GetTable("OmniJournal");

            if (table != null)
            {
                BooterLogger.AddTrace(file.ToString() + ": Found OmniJournal = " + table.Rows.Count.ToString());

                int rowIndex = 0;
                foreach (XmlDbRow row in table.Rows)
                {
                    new OmniJournalData(row, rowIndex);
                    rowIndex++;
                }
            }
            else
            {
                BooterLogger.AddTrace(file.ToString() + ": No OmniJournal");
            }

            Bookstore.mItemDictionary.Clear();
            Bookstore.LoadData();
        }
Example #16
0
        protected override void PerformFile(BooterHelper.BootFile paramFile)
        {
            BooterHelper.DataBootFile file = paramFile as BooterHelper.DataBootFile;

            XmlDbTable jobsTable = file.GetTable("Jobs");

            if (jobsTable == null)
            {
                if (file.mPrimary)
                {
                    BooterLogger.AddTrace(file + ": No Jobs Table");
                }
                else
                {
                    BooterLogger.AddError(file + ": No Jobs Table");
                }

                return;
            }

            Dictionary <ulong, Dictionary <uint, JobStaticData> > careerToJobStaticDataMap = GenerateOccupationToJobStaticDataMap(jobsTable);

            BooterLogger.AddTrace("Jobs: " + careerToJobStaticDataMap.Count);

            foreach (KeyValuePair <ulong, Dictionary <uint, JobStaticData> > occupationPair in careerToJobStaticDataMap)
            {
                OccupationStaticData data;
                if (!Occupation.sOccupationStaticDataMap.TryGetValue(occupationPair.Key, out data))
                {
                    continue;
                }

                foreach (KeyValuePair <uint, JobStaticData> jobPair in occupationPair.Value)
                {
                    data.JobStaticDataMap[jobPair.Key] = jobPair.Value;
                }
            }
        }
Example #17
0
            public void Parse(XmlDbRow myRow, XmlDbTable levelTable)
            {
                if ((levelTable != null) && (levelTable.Rows.Count > 0))
                {
                    mOutfits = new OmniCareer.OutfitData(levelTable.Rows[0]);
                }
                else
                {
                    mOutfits = new OmniCareer.OutfitData();
                }

                mCoworkerPool = myRow.GetString("CoworkerPool");

                if (myRow.Exists("PaySims"))
                {
                    mPaySims = myRow.GetBool("PaySims");
                }

                if (myRow.Exists("LotDesignator"))
                {
                    mLotDesignator = myRow.GetString("LotDesignator");
                }
            }
Example #18
0
        protected static void LoadCareerEvents(Career career, BooterHelper.BootFile eventsFile, XmlDbTable eventDataTable)
        {
            if (eventDataTable == null)
            {
                return;
            }

            BooterLogger.AddTrace(eventsFile + ": Found " + career.Name + " Events = " + eventDataTable.Rows.Count);

            foreach (XmlDbRow row in eventDataTable.Rows)
            {
                ProductVersion version;
                row.TryGetEnum <ProductVersion>("ProductVersion", out version, ProductVersion.BaseGame);

                if (GameUtils.IsInstalled(version))
                {
                    string str3 = row.GetString("EventName");
                    string str4 = row.GetString("OpportunityName");
                    bool   flag = row.GetInt("SureShotEvent") == 1;

                    Type classType;
                    if ((str4 != string.Empty) && (str3 == string.Empty))
                    {
                        classType = typeof(Career.EventOpportunity);
                    }
                    else
                    {
                        classType = row.GetClassType("EventName");
                    }

                    Type[] types = new Type[] { typeof(XmlDbRow), typeof(Dictionary <string, Dictionary <int, CareerLevel> >), typeof(string) };
                    object obj   = null;

                    try
                    {
                        obj = classType.GetConstructor(types).Invoke(new object[] { row, career.SharedData.CareerLevels, eventDataTable.Name });
                    }
                    catch (Exception e)
                    {
                        BooterLogger.AddError(eventsFile + ": Constructor Fail " + row.GetString("EventName"));

                        Common.Exception(eventsFile + ": Constructor Fail " + row.GetString("EventName"), e);
                    }

                    if (obj == null)
                    {
                        BooterLogger.AddError(eventsFile + ": Bad Class " + row.GetString("EventName"));
                    }
                    else
                    {
                        Career.EventOpportunity opportunityEvent = obj as Career.EventOpportunity;

                        // new Code
                        if ((opportunityEvent != null) && (opportunityEvent.mOpportunity == OpportunityNames.Undefined))
                        {
                            opportunityEvent.mOpportunity = unchecked ((OpportunityNames)ResourceUtils.HashString64(str4));
                        }

                        Career.EventDaily dailyEvent = obj as Career.EventDaily;
                        if (dailyEvent != null)
                        {
                            if (dailyEvent.AvailableLevels(career).Count == 0)
                            {
                                BooterLogger.AddError(eventsFile + ": No AvailableLevels " + row.GetString("EventType"));
                            }
                            else
                            {
                                // new Code
                                if (dailyEvent.mEventType == Career.CareerEventType.None)
                                {
                                    dailyEvent.mEventType = unchecked ((Career.CareerEventType)ResourceUtils.HashString64(row.GetString("EventType")));
                                }

                                if (career.SharedData == null)
                                {
                                    BooterLogger.AddError(eventsFile + ": Career SharedData missing " + career.mCareerGuid);
                                }
                                else
                                {
                                    if (flag)
                                    {
                                        career.SharedData.SureShotEvent = dailyEvent;
                                    }
                                    else
                                    {
                                        career.SharedData.CareerEventList.Add(dailyEvent);

                                        try
                                        {
                                            CareerEventManager.sAllEvents.Add(dailyEvent.EventType, dailyEvent);
                                        }
                                        catch
                                        {
                                            BooterLogger.AddError(eventsFile + ": Duplicate Event " + row.GetString("EventType"));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            BooterLogger.AddError(eventsFile + ": Not EventDaily " + row.GetString("EventType"));
                        }
                    }
                }
            }
        }
Example #19
0
 public Retired(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base (myRow, levelTable, eventDataTable)
 {
     mCareerGuid = CareerGuid;
 } 
Example #20
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null)
            {
                return;
            }

            bool success = false;

            mIndex++;

            try
            {
                string methodName = row.GetString("Name");
                if (string.IsNullOrEmpty(methodName))
                {
                    BooterLogger.AddError(file + " : Method " + mIndex + " Unnamed");
                }
                else if (ScoringLookup.GetScoring(methodName, false) != null)
                {
                    BooterLogger.AddError(methodName + " Name already in use");
                    return;
                }
                else
                {
                    Type classType = row.GetClassType("FullClassName");
                    if (classType == null)
                    {
                        BooterLogger.AddError(methodName + " Unknown FullClassName: " + row.GetString("FullClassName"));
                    }
                    else
                    {
                        IListedScoringMethod scoring = null;
                        try
                        {
                            scoring = classType.GetConstructor(new Type[0]).Invoke(new object[0]) as IListedScoringMethod;
                        }
                        catch
                        { }

                        if (scoring == null)
                        {
                            BooterLogger.AddError(methodName + ": Constructor Fail " + row.GetString("FullClassName"));
                        }
                        else
                        {
                            XmlDbTable scoringTable = dataFile.GetTable(methodName);
                            if (scoringTable == null)
                            {
                                BooterLogger.AddError(methodName + ": Table Missing");
                            }
                            else
                            {
                                if (scoring.Parse(row, scoringTable))
                                {
                                    BooterLogger.AddTrace("Added Scoring : " + methodName);

                                    ScoringLookup.AddScoring(methodName, scoring);

                                    success = true;
                                }
                                else
                                {
                                    BooterLogger.AddError(methodName + ": Parsing Fail");
                                }
                            }
                        }
                    }
                }
            }
            finally
            {
                if (!success)
                {
                    foreach (string column in row.ColumnNames)
                    {
                        BooterLogger.AddError(column + "= " + row[column]);
                    }
                }
            }
        }
        public override bool Parse(XmlDbRow row, XmlDbTable table)
        {
            mCycleRetention = row.GetInt("CycleRetention", mCycleRetention);

            return(base.Parse(row, table));
        }
Example #22
0
 public PartTimeJob(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 { }
Example #23
0
 public Retired(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
     mCareerGuid = CareerGuid;
 }
        private static Dictionary<ulong, List<XmlDbRow>> GenerateCareerToCareerLevelXmlDataMap(XmlDbTable careerLevelTable, string columnName, string spreadsheetName)
        {
            Dictionary<ulong, List<XmlDbRow>> dictionary = new Dictionary<ulong, List<XmlDbRow>>();
            foreach (XmlDbRow row in careerLevelTable.Rows)
            {
                OccupationNames names;
                if (!row.TryGetEnum<OccupationNames>(columnName, out names, OccupationNames.Undefined))
                {
                    names = unchecked((OccupationNames)ResourceUtils.HashString64(row.GetString(columnName)));
                }


                List<XmlDbRow> list;
                if (dictionary.TryGetValue((ulong)names, out list))
                {
                    list.Add(row);
                }
                else
                {
                    List<XmlDbRow> list2 = new List<XmlDbRow>();
                    list2.Add(row);
                    dictionary.Add((ulong)names, list2);
                }
            }
            return dictionary;
        }
Example #25
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);
        }
Example #26
0
        public virtual bool Parse(XmlDbRow myRow, XmlDbTable table)
        {
            mName = myRow.GetString("Name");

            string error = null;

            if (!Parse(myRow, ref error))
            {
                BooterLogger.AddError(Name + " : " + error);
                return(false);
            }

            if ((table == null) || (table.Rows == null) || (table.Rows.Count == 0))
            {
                BooterLogger.AddError(Name + ": Missing Table");
                return(false);
            }
            else
            {
                List <IScoring <T, SubSP> > rawScoring = new List <IScoring <T, SubSP> >();

                int index = 1;
                foreach (XmlDbRow row in table.Rows)
                {
                    Type classType = row.GetClassType("FullClassName");
                    if (classType == null)
                    {
                        BooterLogger.AddError(Name + ": Unknown FullClassName " + row.GetString("FullClassName"));
                        continue;
                    }

                    IScoring <T, SubSP> scoring = null;
                    try
                    {
                        scoring = classType.GetConstructor(new Type[0]).Invoke(new object[0]) as IScoring <T, SubSP>;
                    }
                    catch
                    { }

                    if (scoring == null)
                    {
                        BooterLogger.AddError(Name + " (" + index + "): Constructor Fail " + row.GetString("FullClassName") + " as " + typeof(IScoring <T, SubSP>));
                    }
                    else
                    {
                        error = null;
                        if (scoring.Parse(row, ref error))
                        {
                            rawScoring.Add(scoring);
                        }
                        else
                        {
                            if (!string.IsNullOrEmpty(error))
                            {
                                BooterLogger.AddError(Name + " index " + index + " : " + error);
                            }
                            else
                            {
                                BooterLogger.AddTrace(Name + " index " + index + " : <Warning>");
                            }
                        }
                    }

                    index++;
                }

                List <ICombinedScoring <T, SubSP> > combinedList = Common.DerivativeSearch.Find <ICombinedScoring <T, SubSP> >(Common.DerivativeSearch.Caching.NoCache);

                foreach (ICombinedScoring <T, SubSP> combined in combinedList)
                {
                    IScoring <T, SubSP> scoring = combined as IScoring <T, SubSP>;
                    if (scoring == null)
                    {
                        continue;
                    }

                    if (combined.Combine(rawScoring))
                    {
                        rawScoring.Add(scoring);
                    }
                }

                List <IScoring <T, SubSP> > scoringList = new List <IScoring <T, SubSP> >(rawScoring);
                rawScoring.Clear();

                foreach (IScoring <T, SubSP> scoring in scoringList)
                {
                    if (scoring.IsConsumed)
                    {
                        continue;
                    }

                    rawScoring.Add(scoring);
                }

                if (rawScoring.Count > 0)
                {
                    mHelper.SetRawScoring(rawScoring);
                    return(true);
                }
                else
                {
                    BooterLogger.AddError(Name + ": No valid scoring");
                    return(false);
                }
            }
        }
Example #27
0
 public PartTimeJob(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
 }
Example #28
0
        protected static void ParseParts <TYPE>(string suffix, Dictionary <ResourceKey, List <InvalidPartBase> > partsByKey, Dictionary <BodyTypes, List <InvalidPartBase> > partsByType)
            where TYPE : InvalidPartBase, new()
        {
            partsByKey.Clear();
            partsByType.Clear();

            BooterLogger.AddTrace(suffix + ":OnPreLoad");

            string name = VersionStamp.sNamespace + "." + suffix;

            XmlDbData data = null;

            try
            {
                data = XmlDbData.ReadData(name);
                if ((data == null) || (data.Tables == null))
                {
                    BooterLogger.AddTrace(name + " Missing");
                    return;
                }
            }
            catch (Exception e)
            {
                BooterLogger.AddTrace(name + " Formatting Error");

                Common.Exception(name, e);
                return;
            }

            XmlDbTable table = data.Tables[suffix];

            if ((table != null) && (table.Rows != null))
            {
                Dictionary <ResourceKey, bool> allParts = new Dictionary <ResourceKey, bool>();

                BooterLogger.AddTrace(name + " PartSearch");

                PartSearch search = new PartSearch();

                foreach (CASPart part in search)
                {
                    if (allParts.ContainsKey(part.Key))
                    {
                        continue;
                    }

                    allParts.Add(part.Key, true);
                }

                search.Reset();

                BooterLogger.AddTrace(name + " Rows");

                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        OutfitCategories categories;
                        if (!row.TryGetEnum <OutfitCategories>("Categories", out categories, OutfitCategories.All))
                        {
                            BooterLogger.AddError(suffix + " Unknown Categories: " + row.GetString("Categories"));
                            continue;
                        }

                        /*
                         * ProductVersion productVersion = ProductVersion.Undefined;
                         * if (row.Exists("ProductVersion"))
                         * {
                         *  if (!row.TryGetEnum<ProductVersion>(row["ProductVersion"], out productVersion, ProductVersion.Undefined))
                         *  {
                         *      BooterLogger.AddError(suffix + " Unknown WorldTypes: " + row.GetString("WorldTypes"));
                         *      continue;
                         *  }
                         * }
                         */
                        List <WorldType> worldTypes = new List <WorldType>();
                        if (row.Exists("WorldTypes"))
                        {
                            if (!ParserFunctions.TryParseCommaSeparatedList <WorldType>(row["WorldTypes"], out worldTypes, WorldType.Undefined))
                            {
                                BooterLogger.AddError(suffix + " Unknown WorldTypes: " + row.GetString("WorldTypes"));
                                continue;
                            }
                        }

                        OutfitCategoriesExtended extended = OutfitCategoriesExtended.ValidForRandom;
                        if (row.Exists("Extended"))
                        {
                            if (!row.TryGetEnum <OutfitCategoriesExtended>("Extended", out extended, OutfitCategoriesExtended.ValidForRandom))
                            {
                                BooterLogger.AddError(suffix + " Unknown Extended: " + row.GetString("Extended"));
                                continue;
                            }
                        }

                        CASAgeGenderFlags age;
                        if (!row.TryGetEnum <CASAgeGenderFlags>("Age", out age, CASAgeGenderFlags.AgeMask))
                        {
                            BooterLogger.AddError(suffix + " Unknown Age: " + row.GetString("Age"));
                            continue;
                        }

                        CASAgeGenderFlags gender;
                        if (!row.TryGetEnum <CASAgeGenderFlags>("Gender", out gender, CASAgeGenderFlags.GenderMask))
                        {
                            BooterLogger.AddError(suffix + " Unknown Gender: " + row.GetString("Gender"));
                            continue;
                        }

                        CASAgeGenderFlags species = CASAgeGenderFlags.Human;

                        if (row.Exists("Species"))
                        {
                            if (!row.TryGetEnum <CASAgeGenderFlags>("Species", out species, CASAgeGenderFlags.Human))
                            {
                                BooterLogger.AddError(suffix + " Unknown Species: " + row.GetString("Species"));
                                continue;
                            }
                        }

                        BodyTypes type = BodyTypes.None;

                        if (!string.IsNullOrEmpty(row.GetString("BodyType")))
                        {
                            if (!row.TryGetEnum <BodyTypes>("BodyType", out type, BodyTypes.None))
                            {
                                BooterLogger.AddError(suffix + " Unknown BodyTypes: " + row.GetString("BodyType"));
                                continue;
                            }
                        }

                        ResourceKey key = ResourceKey.kInvalidResourceKey;

                        List <InvalidPartBase> tests = null;

                        if (type == BodyTypes.None)
                        {
                            ulong instance = row.GetUlong("Instance");
                            if (instance == 0)
                            {
                                BooterLogger.AddError(suffix + " Invalid Instance " + row.GetString("Key"));
                                continue;
                            }

                            uint group = row.GetUInt("Group");

                            key = new ResourceKey(instance, 0x034aeecb, group);

                            if (!allParts.ContainsKey(key))
                            {
                                BooterLogger.AddError(suffix + " Key not found: " + key);
                                continue;
                            }

                            if (!partsByKey.TryGetValue(key, out tests))
                            {
                                tests = new List <InvalidPartBase>();
                                partsByKey.Add(key, tests);
                            }
                        }
                        else
                        {
                            if (!partsByType.TryGetValue(type, out tests))
                            {
                                tests = new List <InvalidPartBase>();
                                partsByType.Add(type, tests);
                            }
                        }

                        TYPE newPart = new TYPE();
                        newPart.Set(categories, worldTypes, extended, age, gender, species);

                        tests.Add(newPart);
                    }
                    catch (Exception e)
                    {
                        string setDump = suffix;
                        foreach (string column in row.ColumnNames)
                        {
                            setDump += Common.NewLine + column + " = " + row.GetString(column);
                        }

                        Common.Exception(setDump, e);
                    }
                }

                BooterLogger.AddTrace(suffix + " Parts By Key Added: " + partsByKey.Count);
                BooterLogger.AddTrace(suffix + " Parts By Type Added: " + partsByType.Count);
            }
        }
Example #29
0
        protected static void LoadWrittenBookMaterials(XmlDbData spreadsheet)
        {
            if (spreadsheet.Tables.ContainsKey("WrittenBookMaterials"))
            {
                XmlDbTable table = spreadsheet.Tables["WrittenBookMaterials"];

                int count = 0;

                foreach (XmlDbRow row in table.Rows)
                {
                    try
                    {
                        string item = row.GetString("Trashy");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Trashy].Add(item);
                        }
                        item = row.GetString("Drama");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Drama].Add(item);
                        }
                        item = row.GetString("SciFi");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.SciFi].Add(item);
                        }
                        item = row.GetString("Fantasy");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Fantasy].Add(item);
                        }
                        item = row.GetString("Humor");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Humor].Add(item);
                        }
                        item = row.GetString("Satire");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Satire].Add(item);
                        }
                        item = row.GetString("Mystery");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Mystery].Add(item);
                        }
                        item = row.GetString("Romance");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Romance].Add(item);
                        }
                        item = row.GetString("Historical");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Historical].Add(item);
                        }
                        item = row.GetString("Childrens");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Childrens].Add(item);
                        }
                        item = row.GetString("Vaudeville");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Vaudeville].Add(item);
                        }
                        item = row.GetString("Biography");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Biography].Add(item);
                        }
                        item = row.GetString("Article");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Article].Add(item);
                        }
                        item = row.GetString("Autobiography");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Autobiography].Add(item);
                        }
                        item = row.GetString("Masterpiece");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Masterpiece].Add(item);
                        }
                        item = row.GetString("PoliticalMemoir");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.PoliticalMemoir].Add(item);
                        }
                        item = row.GetString("LifeStory");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.LifeStory].Add(item);
                        }
                        item = row.GetString("Fiction");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.Fiction].Add(item);
                        }
                        item = row.GetString("NonFiction");
                        if (item != "")
                        {
                            BookData.WrittenBookMaterials[BookData.BookGenres.NonFiction].Add(item);
                        }

                        if (GameUtils.IsInstalled(ProductVersion.EP3))
                        {
                            item = row.GetString("ActionScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.ActionScreenplay].Add(item);
                            }
                            item = row.GetString("RomanticComedyScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.RomanticComedyScreenplay].Add(item);
                            }
                            item = row.GetString("DramaScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.DramaScreenplay].Add(item);
                            }
                            item = row.GetString("SciFiScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.SciFiScreenplay].Add(item);
                            }
                            item = row.GetString("IndieScreenplay");
                            if (item != "")
                            {
                                BookData.WrittenBookMaterials[BookData.BookGenres.IndieScreenplay].Add(item);
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Common.Exception("Entry: " + count, e);
                    }

                    count++;
                }
            }
        }
Example #30
0
        protected override void PerformFile(BooterHelper.BootFile file)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null)
            {
                return;
            }

            XmlDbTable table = dataFile.GetTable("SkillBasedCareers");

            if (table == null)
            {
                if (file.mPrimary)
                {
                    BooterLogger.AddTrace(file + ": No SkillBasedCareers table");
                }
                else
                {
                    BooterLogger.AddError(file + ": No SkillBasedCareers table");
                }
                return;
            }

            XmlDbTable table2 = dataFile.GetTable("CareerLevels");

            if (table2 == null)
            {
                BooterLogger.AddError(file + ": No CareerLevels table");
                return;
            }

            BooterLogger.AddTrace(file + ": Found Setup = " + table.Rows.Count.ToString());

            if (Occupation.sOccupationStaticDataMap == null)
            {
                Occupation.sOccupationStaticDataMap = new Dictionary <ulong, OccupationStaticData>();
            }

            Dictionary <ulong, List <XmlDbRow> > dictionary = GenerateCareerToCareerLevelXmlDataMap(table2, "SkilledProfession", "SkillBasedCareers");

            foreach (XmlDbRow row in table.Rows)
            {
                string guid = row.GetString("SkilledProfession");

                OccupationNames names;

                if (!row.TryGetEnum <OccupationNames>("SkilledProfession", out names, OccupationNames.Undefined))
                {
                    names = unchecked ((OccupationNames)ResourceUtils.HashString64(guid));
                }

                if (Occupation.sOccupationStaticDataMap.ContainsKey((ulong)names))
                {
                    BooterLogger.AddError(file + ": Exists " + guid);
                    continue;
                }

                string str = row.GetString("Skill_Name");

                SkillNames skillName = SkillNames.None;

                try
                {
                    skillName = GenericManager <SkillNames, Skill, Skill> .ParseGuid(str);
                }
                catch
                { }

                if (skillName == SkillNames.None)
                {
                    skillName = unchecked ((SkillNames)ResourceUtils.HashString64(str));
                }

                int           minimumLevel                         = row.GetInt("Minimum_Skill_Level", -1);
                float         gainMultiplier                       = row.GetFloat("XP_Gain_Multiplier", 0f);
                int           highestLevel                         = row.GetInt("Highest_Level", 0x0);
                string        speechBalloonIcon                    = row.GetString("Speech_Balloon_Image");
                string        hudIcon                              = row.GetString("HUD_Icon");
                string        dreamsAndPromisesIcon                = row.GetString("Wishes_Icon");
                string        careerDescriptionLocalizationKey     = "Gameplay/Excel/SkillBasedCareers/SkillBasedCareers:" + row.GetString("Description_Text");
                string        careerOfferLocalizationKey           = "Gameplay/Excel/SkillBasedCareers/SkillBasedCareers:" + row.GetString("Offer_Text");
                List <string> careerResponsibilityLocalizationKeys = new List <string>();
                for (int i = 0x1; i <= 0x3; i++)
                {
                    string str7 = row.GetString("Career_Responsibility_" + i);
                    if (string.IsNullOrEmpty(str7))
                    {
                        break;
                    }
                    careerResponsibilityLocalizationKeys.Add("Gameplay/Excel/SkillBasedCareers/SkillBasedCareers:" + str7);
                }
                List <string> careerResponsibilityShortLocalizationKeys = new List <string>();
                for (int i = 0x1; i <= 0x3; i++)
                {
                    string str10 = row.GetString("Career_Responsibility_Short_" + i);
                    if (string.IsNullOrEmpty(str10))
                    {
                        break;
                    }
                    careerResponsibilityShortLocalizationKeys.Add("Gameplay/Excel/SkillBasedCareers/SkillBasedCareers:" + str10);
                }
                List <string> careerResponsibilityIcons = new List <string>();
                for (int j = 0x1; j <= 0x3; j++)
                {
                    string str11 = row.GetString("Career_Responsibility_Icon_" + j);
                    if (string.IsNullOrEmpty(str11))
                    {
                        break;
                    }
                    careerResponsibilityIcons.Add(str11);
                }

                List <XmlDbRow> list3;
                if (dictionary.TryGetValue((ulong)names, out list3))
                {
                    Dictionary <int, OccupationLevelStaticData> levelStaticDataMap = SkillBasedCareer.GenerateCareerLevelToStaticLevelDataMap(names, list3);

                    Type type = row.GetClassType("FullClassName");
                    if (type == null)
                    {
                        type = Type.GetType("Sims3.Gameplay.Careers.SkillBasedCareer, Sims3GameplaySystems");
                    }

                    Type[]           types  = new Type[] { typeof(OccupationNames) };
                    SkillBasedCareer career = (SkillBasedCareer)type.GetConstructor(types).Invoke(new object[] { names });
                    if (career == null)
                    {
                        BooterLogger.AddError(file.ToString() + ": Constructor Fail " + guid);
                        continue;
                    }
                    Dictionary <uint, JobStaticData>         jobStaticDataMap  = new Dictionary <uint, JobStaticData>();
                    Dictionary <uint, TaskStaticData>        taskStaticDataMap = new Dictionary <uint, TaskStaticData>();
                    Dictionary <string, TrackedAsStaticData> trackedAsMappingsStaticDataMap = new Dictionary <string, TrackedAsStaticData>();
                    SkillBasedCareerStaticData data2 = new SkillBasedCareerStaticData(skillName, minimumLevel, gainMultiplier, highestLevel, speechBalloonIcon, hudIcon, dreamsAndPromisesIcon, careerDescriptionLocalizationKey, careerOfferLocalizationKey, careerResponsibilityLocalizationKeys, careerResponsibilityShortLocalizationKeys, careerResponsibilityIcons, levelStaticDataMap, jobStaticDataMap, taskStaticDataMap, trackedAsMappingsStaticDataMap);
                    if (Occupation.sOccupationStaticDataMap == null)
                    {
                        Occupation.sOccupationStaticDataMap = new Dictionary <ulong, OccupationStaticData>();
                    }
                    Occupation.sOccupationStaticDataMap.Add((ulong)names, data2);
                    CareerManager.AddStaticOccupation(career);
                }
                else
                {
                    BooterLogger.AddError(file.ToString() + ": No Levels " + guid);
                }
            }
        }
Example #31
0
            public DataBootTable(DataBootFile file, string table)
            {
                mName = table;

                if (file != null)
                {
                    mFile = file;
                    mTable = file.GetTable(table);
                }
            }
Example #32
0
        private static Dictionary <ulong, List <XmlDbRow> > GenerateCareerToCareerLevelXmlDataMap(XmlDbTable careerLevelTable, string columnName, string spreadsheetName)
        {
            Dictionary <ulong, List <XmlDbRow> > dictionary = new Dictionary <ulong, List <XmlDbRow> >();

            foreach (XmlDbRow row in careerLevelTable.Rows)
            {
                OccupationNames names;
                if (!row.TryGetEnum <OccupationNames>(columnName, out names, OccupationNames.Undefined))
                {
                    names = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString(columnName)));
                }


                List <XmlDbRow> list;
                if (dictionary.TryGetValue((ulong)names, out list))
                {
                    list.Add(row);
                }
                else
                {
                    List <XmlDbRow> list2 = new List <XmlDbRow>();
                    list2.Add(row);
                    dictionary.Add((ulong)names, list2);
                }
            }
            return(dictionary);
        }
Example #33
0
            public void Parse(XmlDbRow myRow, XmlDbTable levelTable)
            {
                if ((levelTable != null) && (levelTable.Rows.Count > 0))
                {
                    mOutfits = new OmniCareer.OutfitData(levelTable.Rows[0]);
                }
                else
                {
                    mOutfits = new OmniCareer.OutfitData();
                }

                mCoworkerPool = myRow.GetString("CoworkerPool");

                if (myRow.Exists("PaySims"))
                {
                    mPaySims = myRow.GetBool("PaySims");
                }

                if (myRow.Exists("LotDesignator"))
                {
                    mLotDesignator = myRow.GetString("LotDesignator");
                }
            }
Example #34
0
            public void LoadCareer(BooterHelper.BootFile file, XmlDbRow row)
            {
                BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
                if (dataFile == null)
                {
                    return;
                }

                string careerName = row.GetString("CareerName");

                if (careerName == null)
                {
                    BooterLogger.AddError(file.ToString() + ": No CareerName");
                }
                else
                {
                    Type classType = row.GetClassType("FullClassName");
                    if (classType != null)
                    {
                        string key = row.GetString("TableName");

                        XmlDbTable levelTable = dataFile.GetTable(key);
                        if (levelTable != null)
                        {
                            foreach (XmlDbRow levelRow in levelTable.Rows)
                            {
                                XmlDbData.XmlDbRowFast level = levelRow as XmlDbData.XmlDbRowFast;
                                if (level == null)
                                {
                                    continue;
                                }

                                if (!level.Exists("DowntownWakeupTime"))
                                {
                                    level.mData.Add("DowntownWakeupTime", level.GetString("WakeupTime"));
                                }

                                if (!level.Exists("DowntownStartTime"))
                                {
                                    level.mData.Add("DowntownStartTime", level.GetString("StartTime"));
                                }

                                if (!level.Exists("DowntownDayLength"))
                                {
                                    level.mData.Add("DowntownDayLength", level.GetString("DayLength"));
                                }
                            }

                            Type[] types  = new Type[] { typeof(XmlDbRow), typeof(XmlDbTable), typeof(XmlDbTable) };
                            Career career = null;

                            try
                            {
                                career = classType.GetConstructor(types).Invoke(new object[] { row, levelTable, null }) as Career;
                            }
                            catch (Exception e)
                            {
                                BooterLogger.AddError(careerName + ": Constructor Fail " + row.GetString("FullClassName"));

                                Common.Exception(careerName + ": Constructor Fail " + row.GetString("FullClassName"), e);
                                return;
                            }

                            if (career != null)
                            {
                                if (mCareerEventsFile.IsValid)
                                {
                                    XmlDbTable table3 = mCareerEventsFile.GetTable(key);
                                    if (table3 != null)
                                    {
                                        LoadCareerEvents(career, mCareerEventsFile, table3);
                                    }
                                }

                                career.mCareerGuid = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString("AltGuid")));

                                if (career.Guid == OccupationNames.Undefined)
                                {
                                    BooterLogger.AddError(careerName + ": No AltGuid");
                                }
                                else if (CareerManager.GetStaticCareer(career.mCareerGuid) != null)
                                {
                                    BooterLogger.AddError(careerName + ": Duplicate GUID");
                                }
                                else
                                {
                                    RabbitHoleType type = RabbitHoleType.None;
                                    ParserFunctions.TryParseEnum <RabbitHoleType>(row.GetString("RabbitholeType"), out type, RabbitHoleType.None);
                                    if (type != RabbitHoleType.None)
                                    {
                                        sCareers.Add(new CareerBooterElement(career.Guid, type));

                                        CareerManager.AddStaticOccupation(career);

                                        BooterLogger.AddTrace(careerName + ": Added to Rabbithole " + type);
                                    }
                                    else
                                    {
                                        BooterLogger.AddError(careerName + ": Unknown Rabbithole");
                                    }
                                }
                            }
                            else
                            {
                                BooterLogger.AddError(careerName + ": Constructor Fail " + row.GetString("FullClassName"));
                            }
                        }
                        else
                        {
                            BooterLogger.AddError(careerName + ": No TableName");
                        }
                    }
                    else
                    {
                        BooterLogger.AddError(careerName + ": Invalid FullClassName " + row.GetString("FullClassName"));
                    }
                }
            }
Example #35
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 + ")");
                        }
                    }
                }
            }
        }
Example #36
0
 public HomeSchooling(XmlDbRow myRow, XmlDbTable levelTable, XmlDbTable eventDataTable)
     : base(myRow, levelTable, eventDataTable)
 {
 }
Example #37
0
        protected static void LoadCareerEvents(Career career, BooterHelper.BootFile eventsFile, XmlDbTable eventDataTable)
        {
            if (eventDataTable == null) return;

            BooterLogger.AddTrace(eventsFile + ": Found " + career.Name + " Events = " + eventDataTable.Rows.Count);

            foreach (XmlDbRow row in eventDataTable.Rows)
            {
                ProductVersion version;
                row.TryGetEnum<ProductVersion>("ProductVersion", out version, ProductVersion.BaseGame);

                if (GameUtils.IsInstalled(version))
                {
                    string str3 = row.GetString("EventName");
                    string str4 = row.GetString("OpportunityName");
                    bool flag = row.GetInt("SureShotEvent") == 1;

                    Type classType;
                    if ((str4 != string.Empty) && (str3 == string.Empty))
                    {
                        classType = typeof(Career.EventOpportunity);
                    }
                    else
                    {
                        classType = row.GetClassType("EventName");
                    }

                    Type[] types = new Type[] { typeof(XmlDbRow), typeof(Dictionary<string, Dictionary<int, CareerLevel>>), typeof(string) };
                    object obj = null;

                    try
                    {
                        obj = classType.GetConstructor(types).Invoke(new object[] { row, career.SharedData.CareerLevels, eventDataTable.Name });
                    }
                    catch(Exception e)
                    {
                        BooterLogger.AddError(eventsFile + ": Constructor Fail " + row.GetString("EventName"));

                        Common.Exception(eventsFile + ": Constructor Fail " + row.GetString("EventName"), e);
                    }

                    if (obj == null)
                    {
                        BooterLogger.AddError(eventsFile + ": Bad Class " + row.GetString("EventName"));
                    }
                    else
                    {
                        Career.EventOpportunity opportunityEvent = obj as Career.EventOpportunity;

                        // new Code
                        if ((opportunityEvent != null) && (opportunityEvent.mOpportunity == OpportunityNames.Undefined))
                        {
                            opportunityEvent.mOpportunity = unchecked((OpportunityNames)ResourceUtils.HashString64(str4));
                        }

                        Career.EventDaily dailyEvent = obj as Career.EventDaily;
                        if (dailyEvent != null)
                        {
                            if (dailyEvent.AvailableLevels(career).Count == 0)
                            {
                                BooterLogger.AddError(eventsFile + ": No AvailableLevels " + row.GetString("EventType"));
                            }
                            else
                            {
                                // new Code
                                if (dailyEvent.mEventType == Career.CareerEventType.None)
                                {
                                    dailyEvent.mEventType = unchecked((Career.CareerEventType)ResourceUtils.HashString64(row.GetString("EventType")));
                                }

                                if (career.SharedData == null)
                                {
                                    BooterLogger.AddError(eventsFile + ": Career SharedData missing " + career.mCareerGuid);
                                }
                                else
                                {
                                    if (flag)
                                    {
                                        career.SharedData.SureShotEvent = dailyEvent;
                                    }
                                    else
                                    {
                                        career.SharedData.CareerEventList.Add(dailyEvent);

                                        try
                                        {
                                            CareerEventManager.sAllEvents.Add(dailyEvent.EventType, dailyEvent);
                                        }
                                        catch
                                        {
                                            BooterLogger.AddError(eventsFile + ": Duplicate Event " + row.GetString("EventType"));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            BooterLogger.AddError(eventsFile + ": Not EventDaily " + row.GetString("EventType"));
                        }
                    }
                }
            }
        }
Example #38
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;
        }