예제 #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);
        }
예제 #2
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DocumentBootFile socialData = new BooterHelper.DocumentBootFile(file.ToString(), row.GetString("SocialData"), false);
            if (!socialData.IsValid)
            {
                BooterLogger.AddTrace(file + ": No SocialData");
                return;
            }

            BooterHelper.DataBootFile availability = new BooterHelper.DataBootFile(file.ToString(), row.GetString("SocializingActionAvailability"), false);
            if (!availability.IsValid)
            {
                BooterLogger.AddTrace(file + ": No SocializingActionAvailability");
                return;
            }

            Load(socialData, availability);
        }
예제 #3
0
        protected override bool Perform(BooterHelper.BootFile file)
        {
            if (base.Perform(file)) return true;

            BooterHelper.DocumentBootFile docfile = file as BooterHelper.DocumentBootFile;
            if (docfile == null) return false;

            BooterHelper.DataBootFile availability = new BooterHelper.DataBootFile(file.ToString(), VersionStamp.sNamespace + ".SocializingActionAvailability", false);
            if (!availability.IsValid)
            {
                return false;
            }

            Load(docfile, availability);
            return true;
        }
예제 #4
0
        protected override void PerformFile(BooterHelper.BootFile file)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null) return;

            if ((dataFile.GetTable("BuffList") == null) && (dataFile.GetTable("Buffs") == null)) return;

            try
            {
                BuffManager.ParseBuffData(dataFile.Data, true);
            }
            catch (Exception e)
            {
                Common.Exception(file.ToString(), e);

                BooterLogger.AddError(file + ": ParseBuffData Error");
            }
        }
예제 #5
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"));
                    }
                }
            }
예제 #6
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();
        }
예제 #7
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);
                }
            }
        }