Example #1
0
        public virtual void Shutdown()
        {
            BooterLogger.AddTrace("Shutdown " + UnlocalizedName);

            foreach (Common.AlarmTask alarm in mAlarms.Keys)
            {
                alarm.Dispose();
            }
            mAlarms.Clear();

            foreach (EventListener listener in mListeners.Keys)
            {
                EventTracker.RemoveListener(listener);
            }
            mListeners.Clear();

            foreach (OptionItem option in mOptions)
            {
                IStoryProgressionUpdater updater = option as IStoryProgressionUpdater;
                if (updater == null)
                {
                    continue;
                }

                updater.Shutdown();
            }

            mOptions.Clear();
        }
Example #2
0
        public void OnObjectGroupCreated(IScriptObjectGroup group)
        {
            try
            {
                if (sObjectGroupCreated)
                {
                    return;
                }
                sObjectGroupCreated = true;

                if (sDelayedSkillBooks.Count > 0)
                {
                    BooterLogger.AddTrace("OnWorldLoadStarted: " + sDelayedSkillBooks.Count);

                    foreach (XmlDbData bookData in sDelayedSkillBooks)
                    {
                        LoadSkillBookData(bookData, "BookSkill");
                    }

                    sDelayedSkillBooks.Clear();

                    Bookstore.mItemDictionary.Clear();
                    Bookstore.LoadData();
                }
            }
            catch (Exception exception)
            {
                Common.Exception("OnWorldLoadStarted", exception);
            }
        }
Example #3
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 #4
0
        public void OnWorldLoadFinished()
        {
            kDebugging = Settings.Debugging;

            EventTracker.AddListener(EventTypeId.kEnterInWorldSubState, new ProcessEventDelegate(this.OnLiveMode));
            EventTracker.AddListener(EventTypeId.kSimInstantiated, new ProcessEventDelegate(this.OnSimInstantiated));

            if (Tagger.Settings.mAddresses != null)
            {
                List <ulong> invalidIds = new List <ulong>();
                foreach (ulong lotId in Tagger.Settings.mAddresses.Keys)
                {
                    Lot lot;
                    if (LotManager.sLots.TryGetValue(lotId, out lot))
                    {
                        lot.mAddressLocalizationKey = Tagger.Settings.mAddresses[lotId];
                    }
                    else
                    {
                        invalidIds.Add(lotId);
                    }
                }
                foreach (ulong id in invalidIds)
                {
                    Tagger.Settings.mAddresses.Remove(id);

                    BooterLogger.AddTrace("Removed: " + id);
                }
            }
        }
Example #5
0
        public Main()
            : base(null)
        {
            Main = this;

            BooterLogger.AddTrace("Main Constructed");
        }
Example #6
0
        public virtual void Startup(PersistentOptionBase options)
        {
            BooterLogger.AddTrace("Startup " + UnlocalizedName);

            mAlarms.Manager = this;

            foreach (OptionItem option in mOptions)
            {
                options.Restore(option);
            }

            Startup();
        }
Example #7
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            SkillNames skill;

            if (!ParserFunctions.TryParseEnum <SkillNames>(row.GetString("Skill"), out skill, SkillNames.None))
            {
                BooterLogger.AddError("Invalid Skill: " + row.GetString("Skill"));
                return;
            }

            sData.Add(skill, true);

            BooterLogger.AddTrace(" Child Skill: " + row.GetString("Skill"));
        }
Example #8
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            Type type = row.GetClassType("Type");

            if (type == null)
            {
                BooterLogger.AddError("Invalid Type: " + row.GetString("Type"));
                return;
            }

            sData.Add(type, true);

            BooterLogger.AddTrace(" Discount Type: " + row.GetString("Type"));
        }
Example #9
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BuffNames buff;

            if (!ParserFunctions.TryParseEnum <BuffNames>(row.GetString("Moodlet"), out buff, BuffNames.Undefined))
            {
                BooterLogger.AddError("Invalid Moodlet: " + row.GetString("Moodlet"));
                return;
            }

            sData.Add(buff, true);

            BooterLogger.AddTrace(" Bad Lot Moodlet: " + row.GetString("Moodlet"));
        }
Example #10
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);
        }
Example #11
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 #12
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            Homemaker.StipendValue key;
            if (!ParserFunctions.TryParseEnum <Homemaker.StipendValue>(row.GetString("Key"), out key, Homemaker.StipendValue.Undefined))
            {
                BooterLogger.AddError("Stipend Key Missing: " + row.GetString("Key"));
                return;
            }

            int maximum = row.GetInt("Maximum");

            int factor = row.GetInt("Factor");

            bool positive = row.GetBool("Positive");

            sData.Add(key, new Data(maximum, factor, positive));

            BooterLogger.AddTrace(" Stipend Loaded: " + row.GetString("Key"));
        }
Example #13
0
            public void OnPreLoad()
            {
                try
                {
                    Career music = CareerManager.GetStaticCareer(OccupationNames.Music);
                    if (music == null)
                    {
                        return;
                    }

                    BooterLogger.AddTrace("Replace Metric Music Skill");

                    foreach (Dictionary <int, CareerLevel> value in music.CareerLevels.Values)
                    {
                        foreach (CareerLevel level in value.Values)
                        {
                            List <PerfMetric> metrics = new List <PerfMetric>(level.Metrics);
                            foreach (PerfMetric metric in metrics)
                            {
                                MetricSkillX skillMetric = metric as MetricSkillX;
                                if (skillMetric == null)
                                {
                                    continue;
                                }

                                if (skillMetric.SkillGuid == SkillNames.Guitar)
                                {
                                    BooterLogger.AddTrace("Metric Replaced: " + level.BranchName + " " + level.Level);

                                    level.Metrics.Remove(metric);

                                    level.Metrics.Add(new MetricMusicSkill(skillMetric));
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    Common.Exception("OnPreLoad", e);
                }
            }
Example #14
0
        private static void AddIgnored(string type, string text, bool fullReset, bool debugging)
        {
            type = type.ToLower();
            text = text.ToLower();

            Dictionary <string, Ignore> ignored;

            if (!sIgnored.TryGetValue(type, out ignored))
            {
                ignored = new Dictionary <string, Ignore>();
                sIgnored.Add(type, ignored);
            }

            if (ignored.ContainsKey(text))
            {
                return;
            }

            BooterLogger.AddTrace("IgnoreList: Added Type: " + type + ", Stack: " + text);

            ignored.Add(text, new Ignore(fullReset, debugging));
        }
Example #15
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 #16
0
        public void OnPreLoad()
        {
            foreach (Dictionary <uint, InteractionTuning> list in AutonomyTuning.sTuning.Values)
            {
                foreach (InteractionTuning tuning in list.Values)
                {
                    if (sIgnore.ContainsKey(tuning.FullInteractionName))
                    {
                        continue;
                    }

                    if (tuning.Availability.OccultRestrictionType == OccultRestrictionType.Inclusive)
                    {
                        BooterLogger.AddTrace("Occult Altered: " + tuning.FullInteractionName + " - " + tuning.FullObjectName);
                        BooterLogger.AddTrace("  " + tuning.Availability.OccultRestrictionType);
                        BooterLogger.AddTrace("  " + tuning.Availability.OccultRestrictions);

                        tuning.Availability.OccultRestrictionType = OccultRestrictionType.Ignore;
                    }
                }
            }

            //BooterLogger.AddError("Error");
        }
Example #17
0
        // From AcademicDegreeManager:CreateAcademicDegreeTable
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            AcademicDegreeNames academicDegree = AcademicDegreeNames.Undefined;

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

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

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

            JobId academicDefaultCourseID;

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

            JobId academicDefaultLectureID;

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

            JobId academicDefaultLabID;

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

            List <OccupationNames> associatedOccupations = new List <OccupationNames>();
            List <string>          list2 = row.GetStringList("AssociatedOccupationNameEnum", ',', true);

            for (int i = 0x0; i < list2.Count; i++)
            {
                OccupationNames occupation;
                if (!ParserFunctions.TryParseEnum <OccupationNames>(list2[i], out occupation, OccupationNames.Undefined))
                {
                    occupation = unchecked ((OccupationNames)ResourceUtils.HashString64(row.GetString(list2[i])));
                }

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

            OccupationNames grantedOccupation;

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

            List <TraitNames> beneficialTraits;
            List <TraitNames> detrimentalTraits;
            List <TraitNames> suggestedTraits;

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

            AcademicDegreeStaticData staticData = null;

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

            string skillsThatGrantXP = row.GetString("SkillsThatGrantXP");

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

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

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

                    staticData.AddSkill(skillName, num4);
                }
            }

            AcademicDegreeManager.sDictionary[(ulong)academicDegree] = staticData;
        }
Example #18
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("Guid");

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

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

            AfterschoolActivityData data = new AfterschoolActivityData();

            data.mActivity = new AfterschoolActivity(type);

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

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

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

            DaysOfTheWeek days;

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

            data.mActivity.DaysForActivity = days;

            CASAgeGenderFlags genders;

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

            data.mGenders = genders;

            CASAgeGenderFlags ages;

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

            data.mAges = ages;

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

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

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

            Activities.Add(type, data);

            BooterLogger.AddTrace(file + ": " + guid + " Loaded");
        }
Example #19
0
        public void OnWorldLoadFinished()
        {
            Dictionary <BookWrittenData, bool> existing = new Dictionary <BookWrittenData, bool>();

            foreach (BookWritten book in Sims3.Gameplay.Queries.GetObjects <BookWritten>())
            {
                BookWrittenData bookData = book.Data as BookWrittenData;
                if (bookData == null)
                {
                    continue;
                }

                existing[bookData] = true;
            }

            List <string> remove = new List <string>();

            foreach (SimDescription sim in SimListing.GetResidents(true).Values)
            {
                if (sim.SkillManager == null)
                {
                    continue;
                }

                Writing skill = sim.SkillManager.GetSkill <Writing>(SkillNames.Writing);
                if (skill == null)
                {
                    continue;
                }

                if (skill.WrittenBookDataList == null)
                {
                    continue;
                }

                foreach (WrittenBookData book in skill.WrittenBookDataList.Values)
                {
                    book.Author = sim.FullName;

                    string id = book.Title + book.Author;

                    BookWrittenData bookData;
                    if (!BookData.BookWrittenDataList.TryGetValue(id, out bookData))
                    {
                        // Constructor auto-adds to dictionary
                        bookData = new BookWrittenData(book, true);
                    }

                    existing[bookData] = true;
                }
            }

            RemoveWrittenData("General");
            RemoveWrittenData("All");

            List <StoreItem> general = null, all = null;

            Bookstore.mItemDictionary.TryGetValue("General", out general);
            Bookstore.mItemDictionary.TryGetValue("All", out all);

            List <WorldType> worldTypes = new List <WorldType>();

            worldTypes.Add(GameUtils.GetCurrentWorldType());

            Writing stateSkill = new Writing();

            foreach (KeyValuePair <string, BookWrittenData> pair in BookData.BookWrittenDataList)
            {
                BookWrittenData data = pair.Value;

                if (!existing.ContainsKey(pair.Value))
                {
                    remove.Add(pair.Key);
                    continue;
                }
                else if ((string.IsNullOrEmpty(data.Title)) || (string.IsNullOrEmpty(data.Author)))
                {
                    remove.Add(pair.Key);
                    continue;
                }

                string geoState, materialState;
                stateSkill.GetGeoAndMaterialStates(data.Genre, out geoState, out materialState);

                if (string.IsNullOrEmpty(data.GeometryState))
                {
                    data.GeometryState = geoState;
                }

                if (string.IsNullOrEmpty(data.MaterialState))
                {
                    data.MaterialState = materialState;
                }

                ThumbnailKey thumb = new ThumbnailKey(new ResourceKey((ulong)ResourceUtils.XorFoldHashString32("book_standard"), 0x1661233, 0x1), ThumbnailSize.Medium, ResourceUtils.HashString32(data.GeometryState), ResourceUtils.HashString32(data.MaterialState));

                BookGeneralStoreItem item = new BookGeneralStoreItem(data.Title + " - " + data.Author, (float)data.Value, data, thumb, data.GenerateUIStoreItemID(), new CreateObjectCallback(CreateBookWrittenCallback), new ProcessObjectCallback(ProcessBookWrittenCallback), data.AllowedWorlds, worldTypes, data.Author, data.Title, data.Length, data.GenreString);

                general.Add(item);
                all.Add(item);
            }

            foreach (string id in remove)
            {
                BookData.BookWrittenDataList.Remove(id);

                BooterLogger.AddTrace("Removed: " + id);
            }
        }
Example #20
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 #21
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 #22
0
            public Data(string guid, BooterHelper.BootFile file, XmlDbRow row)
            {
                mGuid = guid;

                if (BooterLogger.Exists(row, "InitialStrength", guid))
                {
                    mInitialStrength = row.GetInt("InitialStrength", 0);
                }

                mInfectionScoring = row.GetString("InfectionScoring");
                if (string.IsNullOrEmpty(mInfectionScoring))
                {
                    BooterLogger.AddError(Guid + " Missing InfectionScoring: " + mInfectionScoring);
                }
                else if (ScoringLookup.GetScoring(mInfectionScoring) == null)
                {
                    BooterLogger.AddError(Guid + " Missing InfectionScoring: " + mInfectionScoring);
                }

                mInfectionMinimum = row.GetInt("InfectionMinimum", 0);

                VectorStageTable table = new VectorStageTable(file as BooterHelper.DataBootFile, guid);

                if (!table.IsValid)
                {
                    BooterLogger.AddError(Guid + " Missing Stages: " + guid);
                }
                else
                {
                    Dictionary <string, int> namesToStages = new Dictionary <string, int>();

                    for (int i = 0; i < table.Stages.Count; i++)
                    {
                        if (namesToStages.ContainsKey(table.Stages[i].Name))
                        {
                            BooterLogger.AddError(Guid + " Stage " + i + ": Duplicate Name " + table.Stages[i].Name);
                            continue;
                        }

                        namesToStages.Add(table.Stages[i].Name, i);
                    }

                    for (int i = 0; i < table.Stages.Count; i++)
                    {
                        BooterLogger.AddTrace("Stage " + i);

                        table.Stages[i].ValidateStages(namesToStages);
                    }
                }

                mStages = table.Stages;

                mInoculationRating = row.GetInt("InoculationRating", 10);
                mInoculationCost   = row.GetInt("InoculationCost", 0);
                mResistanceCost    = row.GetInt("ResistanceCost", 0);

                mCanOutbreak = row.GetBool("CanOutbreak");

                mHighProtectionCost = row.GetInt("HighProtectionCost", 0);
                mLowProtectionCost  = row.GetInt("LowProtectionCost", 0);

                mMinimumStrainDifference = row.GetInt("MinimumStrainDifference", 0);

                mStrainMutationRate = row.GetInt("StrainMutationRate", -1);

                int numInstigators = row.GetInt("NumInstigators", 0) + 1;

                for (int i = 1; i <= numInstigators; i++)
                {
                    if (i == numInstigators)
                    {
                        if (row.Exists("Instigator" + i))
                        {
                            BooterLogger.AddError(Guid + " More Instigator then NumInstigators");
                        }
                        break;
                    }

                    mInstigators.Add(InstigatorBooter.GetInstigator(row.GetString("Instigator" + i)));
                }
            }
Example #23
0
        public void OnPreLoad()
        {
            sDefaultBarTuned = false;

            foreach (BookComicData bookData in BookData.BookComicDataList.Values)
            {
                bookData.AllowedWorldTypes.Add(WorldType.Vacation);
            }

            foreach (Opportunity opp in OpportunityManager.sLocationBasedOpportunityList.Values)
            {
                if (opp.SharedData.mTargetWorldRequired == WorldName.SunsetValley)
                {
                    opp.SharedData.mTargetWorldRequired = WorldName.Undefined;
                }
            }

            if (ServiceNPCSpecifications.sServiceSpecifications != null)
            {
                foreach (ServiceType type in Enum.GetValues(typeof(ServiceType)))
                {
                    ServiceNPCSpecifications.ServiceSpecifications spec;
                    if (ServiceNPCSpecifications.sServiceSpecifications.TryGetValue(type.ToString(), out spec))
                    {
                        spec.InvalidWorlds.Clear();
                    }
                }
            }

            foreach (List <MotiveTuning> tempTuning in MotiveTuning.sTuning.Values)
            {
                foreach (MotiveTuning tuning in tempTuning)
                {
                    tuning.WorldRestrictionType = WorldRestrictionType.None;
                }
            }

            Bartending.BarData defaultData;
            if (Bartending.TryGetBarData(Lot.MetaAutonomyType.None, out defaultData))
            {
                sDefaultBarTuned = (defaultData.mFoods.Count > 0);
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.CommercialSubTypeData commData in Lot.sCommnunityTypeData)
            {
                commData.WorldAllowed     = null;
                commData.WorldTypeAllowed = null;
            }

            // Unlock all subTypes for all worlds
            foreach (Lot.ResidentialSubTypeData residentData in Lot.sResidentialTypeData)
            {
                residentData.WorldAllowed     = null;
                residentData.WorldTypeAllowed = null;
            }

            foreach (ActionData action in ActionData.sData.Values)
            {
                if (action.mAllowedWorldTypes != null)
                {
                    List <WorldType> types = new List <WorldType>(action.mAllowedWorldTypes);

                    if (types.Count > 0)
                    {
                        if ((!types.Contains(WorldType.Vacation)))
                        {
                            types.Add(WorldType.Vacation);
                        }

                        if ((!types.Contains(WorldType.Future)))
                        {
                            types.Add(WorldType.Future);
                        }

                        action.mAllowedWorldTypes = types.ToArray();
                    }
                }
            }

            STCData.SetNumSocialsDuringConversation(int.MaxValue);

            foreach (InsectData insect in InsectData.sData.Values)
            {
                if (insect.RequiredWorld != WorldName.Undefined)
                {
                    insect.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + insect.Name);
                }
            }

            foreach (RockGemMetalData rock in RockGemMetalBase.sData.Values)
            {
                if (rock.RequiredWorld != WorldName.Undefined)
                {
                    rock.mRequiredWorld = WorldName.Undefined;

                    BooterLogger.AddTrace("  Unlocked: " + rock.Name);
                }
            }

            List <KeyValuePair <WorldName, WorldNameData> > data = new List <KeyValuePair <WorldName, WorldNameData> >();

            if (GameUtils.IsInstalled(ProductVersion.EP1))
            {
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.China, new WorldNameData("China.world", "China_0x0859db4c", TravelUtil.DestinationInfoImage[0], TravelUtil.DestinationInfoName[0], TravelUtil.DestinationInfoDescription[0], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[0], 0x0)), TravelUtil.DestinationInfoComfirmDescription[0])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.Egypt, new WorldNameData("Egypt.world", "Egypt_0x0859db48", TravelUtil.DestinationInfoImage[1], TravelUtil.DestinationInfoName[1], TravelUtil.DestinationInfoDescription[1], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[1], 0x0)), TravelUtil.DestinationInfoComfirmDescription[1])));
                data.Add(new KeyValuePair <WorldName, WorldNameData>(WorldName.France, new WorldNameData("France.world", "France_0x0859db50", TravelUtil.DestinationInfoImage[2], TravelUtil.DestinationInfoName[2], TravelUtil.DestinationInfoDescription[2], UIManager.LoadUIImage(ResourceKey.CreatePNGKey(TravelUtil.DestinationInfoConfirmImage[2], 0x0)), TravelUtil.DestinationInfoComfirmDescription[2])));
            }

            List <WorldFileMetadata> worlds = new List <WorldFileMetadata>();

            WorldFileSearch search = new WorldFileSearch(0x0);

            foreach (string str in search)
            {
                WorldFileMetadata info = new WorldFileMetadata();

                info.mWorldFile = str;
                if (GetWorldFileDetails(ref info))
                {
                    worlds.Add(info);
                }
            }

            worlds.Sort(OnSort);

            foreach (WorldFileMetadata info in worlds)
            {
                string name = info.mWorldFile.Replace(".world", "");

                WorldName worldName = WorldName.Undefined;

                try
                {
                    worldName = unchecked ((WorldName)ResourceUtils.HashString32(name.Replace(" ", "")));
                }
                catch
                {
                    continue;
                }

                string saveFile = name;
                switch (name.ToLower())
                {
                case "islaparadiso":
                    if (!GameUtils.IsInstalled(ProductVersion.EP10))
                    {
                        continue;
                    }

                    worldName = WorldName.IslaParadiso;

                    saveFile += "_0x0c50c382";
                    break;

                case "sims university":
                    if (!GameUtils.IsInstalled(ProductVersion.EP9))
                    {
                        continue;
                    }

                    worldName = WorldName.University;

                    saveFile += "_0x0e41c954";
                    break;

                case "bridgeport":
                    if (!GameUtils.IsInstalled(ProductVersion.EP3))
                    {
                        continue;
                    }

                    worldName = WorldName.NewDowntownWorld;

                    saveFile += "_0x09ffe3d7";
                    break;

                case "twinbrook":
                    if (!GameUtils.IsInstalled(ProductVersion.EP2))
                    {
                        continue;
                    }

                    worldName = WorldName.TwinBrook;

                    saveFile += "_0x09b610fa";
                    break;

                case "appaloosaplains":
                    if (!GameUtils.IsInstalled(ProductVersion.EP5))
                    {
                        continue;
                    }

                    worldName = WorldName.AppaloosaPlains;

                    saveFile += "_0x0c50c56d";
                    break;

                case "riverview":
                    worldName = WorldName.RiverView;

                    saveFile += "_0x0859db43";
                    break;

                case "sunset valley":
                    worldName = WorldName.SunsetValley;

                    saveFile += "_0x0859db3c";
                    break;

                case "moonlight falls":
                    worldName = WorldName.MoonlightFalls;

                    saveFile += "_0x09b61110";
                    break;

                case "starlight shores":
                    if (!GameUtils.IsInstalled(ProductVersion.EP6))
                    {
                        continue;
                    }

                    worldName = WorldName.StarlightShores;

                    saveFile += "_0x09b610ff";
                    break;

                case "hidden springs":
                case "barnacle bay":
                case "lunar lakes":
                case "lucky palms":
                    saveFile += "_0x08866eb8";
                    break;

                case "roaring heights":
                    worldName = WorldName.DOT11;

                    saveFile += "_0x0de07e86";
                    break;

                case "midnight hollow":
                    worldName = WorldName.DOT10;

                    saveFile += "_0x0de07e7d";
                    break;

                case "dragon valley":
                    worldName = WorldName.DOT09;

                    saveFile += "_0x0de07c9c";
                    break;

                case "aurora skies":
                    worldName = WorldName.DOT08;

                    saveFile += "_0x0de07c8b";
                    break;

                case "monte vista":
                    worldName = WorldName.DOT07;

                    saveFile += "_0x0de07c83";
                    break;

                case "sunlit tides":
                    worldName = WorldName.DOT06;

                    saveFile += "_0x0de07c78";
                    break;

                case "oasis landing":
                    worldName = WorldName.FutureWorld;

                    saveFile += "_0x0f36012a";
                    break;

                case "egypt":
                case "china":
                case "france":
                    continue;

                default:
                    saveFile = FileNameBooter.GetFileName(saveFile);
                    break;
                }

                string infoIcon = "glb_i_suburb";
                switch (info.mWorldType)
                {
                case WorldType.Downtown:
                    infoIcon = "glb_i_downtown";
                    break;

                case WorldType.Vacation:
                    infoIcon = "glb_i_vacation";
                    break;

                default:
                    break;
                }

                if (!VisaManager.sDictionary.ContainsKey((ulong)worldName))
                {
                    Visa defaultVisa = new Visa();
                    defaultVisa.mWorldName          = worldName;
                    defaultVisa.mNonPersistableData = new NonPersistableVisaData();
                    defaultVisa.NonPersistableData.LevelUpStrings = new string[3] {
                        "", "", ""
                    };
                    defaultVisa.NonPersistableData.PointsForNextLevel = new int[3] {
                        0, 0, 0
                    };

                    Visa chinaVisa = VisaManager.GetStaticVisaData(WorldName.China);
                    if (chinaVisa != null)
                    {
                        defaultVisa.NonPersistableData.LevelUpStrings     = new List <string>(chinaVisa.NonPersistableData.LevelUpStrings).ToArray();
                        defaultVisa.NonPersistableData.PointsForNextLevel = new List <int>(chinaVisa.NonPersistableData.PointsForNextLevel).ToArray();
                    }

                    VisaManager.sDictionary.Add((ulong)worldName, defaultVisa);

                    data.Add(new KeyValuePair <WorldName, WorldNameData>(worldName, new WorldNameData(info.mWorldFile, saveFile, infoIcon, info.mCaption, info.mDescription, info.mWorldThumb, Common.Localize("Itinerary:Name", false, new object[] { info.mCaption }))));
                }
            }

            TravelUtil.kVacationWorldNames = new WorldName[data.Count];

            TravelUtil.DestinationInfoImage              = new string[data.Count];
            TravelUtil.DestinationInfoName               = new string[data.Count];
            TravelUtil.DestinationInfoDescription        = new string[data.Count];
            TravelUtil.DestinationInfoConfirmImage       = new string[data.Count];
            TravelUtil.DestinationInfoComfirmDescription = new string[data.Count];

            TravelUtil.DestinationInfoIndex = new int[data.Count];

            int index = 0;

            foreach (KeyValuePair <WorldName, WorldNameData> value in data)
            {
                TravelUtil.kVacationWorldNames[index] = value.Key;

                TravelUtil.DestinationInfoIndex[index] = index;

                TravelUtil.DestinationInfoImage[index]              = value.Value.mDestinationInfoImage;
                TravelUtil.DestinationInfoName[index]               = value.Value.mDestinationInfoName;
                TravelUtil.DestinationInfoDescription[index]        = value.Value.mDestinationInfoDescription;
                TravelUtil.DestinationInfoConfirmImage[index]       = "";
                TravelUtil.DestinationInfoComfirmDescription[index] = value.Value.mDestinationInfoConfirmDescription;

                sConfirmImages.Add(value.Value.mDestinationInfoConfirmImage);

                BooterLogger.AddTrace(value.Value.ToString());
                BooterLogger.AddTrace("  WorldName: " + (ulong)value.Key);

                index++;

                sData.Add(value.Key, value.Value);
            }

            //BooterLogger.AddError("WorldData");

            sOrigWorldNameToType = GameUtils.WorldNameToType;

            foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
            {
                switch (tuning.Availability.WorldRestrictionType)
                {
                case WorldRestrictionType.Allow:
                    if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Vacation);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }
                    else if (!tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Add(WorldType.Downtown);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (C) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;

                case WorldRestrictionType.Disallow:
                    if ((tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Vacation)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Downtown)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University)) ||
                        (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.Future)))
                    {
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Vacation);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Downtown);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.University);
                        tuning.Availability.WorldRestrictionWorldTypes.Remove(WorldType.Future);

                        BooterLogger.AddTrace("Tuning Altered: Allowed (B) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                    }

                    break;
                }
            }
        }
Example #24
0
        public void OnWorldLoadFinished()
        {
            kDebugging = Settings.Debugging;
            FilterHelper.kFilterCacheTime = Tagger.Settings.mFilterCacheTime;

            EventTracker.AddListener(EventTypeId.kEnterInWorldSubState, new ProcessEventDelegate(this.OnLiveMode));
            EventTracker.AddListener(EventTypeId.kSimInstantiated, new ProcessEventDelegate(this.OnSimInstantiated));

            List <ulong> invalidIds = new List <ulong>();

            foreach (ulong lotId in Tagger.Settings.mAddresses.Keys)
            {
                Lot lot;
                if (LotManager.sLots.TryGetValue(lotId, out lot))
                {
                    lot.mAddressLocalizationKey = Tagger.Settings.mAddresses[lotId];
                }
                else
                {
                    invalidIds.Add(lotId);
                }
            }
            foreach (ulong id in invalidIds)
            {
                Tagger.Settings.mAddresses.Remove(id);

                BooterLogger.AddTrace("Removed: " + id);
            }

            List <ulong> invalidSims = new List <ulong>();

            foreach (ulong descId in Tagger.Settings.mTaggedSims)
            {
                SimDescription     desc  = SimDescription.Find(descId);
                MiniSimDescription desc2 = MiniSimDescription.Find(descId);
                if (desc == null && desc2 == null)
                {
                    invalidSims.Add(descId);
                }
            }

            foreach (KeyValuePair <ulong, List <string> > pair in Tagger.Settings.mCustomSimTitles)
            {
                SimDescription     desc  = SimDescription.Find(pair.Key);
                MiniSimDescription desc2 = MiniSimDescription.Find(pair.Key);
                if (desc == null && desc2 == null)
                {
                    invalidSims.Add(pair.Key);
                }
            }

            // stop KeyNotFoundExceptions... in hindsight should have wrapped these in a get function...
            foreach (TagDataHelper.TagDataType flag in Enum.GetValues(typeof(TagDataHelper.TagDataType)))
            {
                if (!Tagger.Settings.mTagDataSettings.ContainsKey(flag))
                {
                    Tagger.Settings.mTagDataSettings.Add(flag, false);
                }
            }

            Tagger.Settings.ValidateActiveFilters(true);
        }
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 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 #27
0
        public void OnPreLoad()
        {
            if (GameUtils.IsInstalled(ProductVersion.EP9))
            {
                foreach (InteractionTuning tuning in InteractionTuning.sAllTunings.Values)
                {
                    switch (tuning.Availability.WorldRestrictionType)
                    {
                    case WorldRestrictionType.Allow:
                        if (tuning.Availability.WorldRestrictionWorldTypes.Contains(WorldType.University))
                        {
                            tuning.Availability.WorldRestrictionType = WorldRestrictionType.None;
                            tuning.Availability.Teens = true;

                            BooterLogger.AddTrace("Tuning Altered: Allowed (A) " + tuning.FullInteractionName + " : " + tuning.FullObjectName);
                        }

                        break;
                    }
                }

                InteractionTuning tuning2 = Tunings.GetTuning <AcademicTextBook, AcademicTextBook.StudyFromBookChooser.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.Teens = true;
                }

                tuning2 = Tunings.GetTuning <AcademicTextBook, AcademicTextBook.StudyFromBook.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.Teens = true;
                }

                tuning2 = Tunings.GetTuning <AcademicTextBook, AcademicTextBook.GetBookToStudyFrom.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.Teens = true;
                }

                tuning2 = Tunings.GetTuning <AcademicTextBook, AcademicTextBook.GetBookToMakeCheatSheet.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.Teens = true;
                }

                tuning2 = Tunings.GetTuning <AcademicTextBook, AcademicTextBook.MakeCheatSheet.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.Teens = true;
                }

                // Some Extra Ones that are locked in University

                tuning2 = Tunings.GetTuning <Homework, Homework.DoHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.DoHomeworkWith.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.HelpWithHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.GetHelpWithHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.GetHomeworkForDoWith.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.PickUpHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.PickUpHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.CopyHomework.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }

                tuning2 = Tunings.GetTuning <Homework, Homework.CopyHomeworkReaction.Definition>();
                if (tuning2 != null)
                {
                    tuning2.Availability.WorldRestrictionType = WorldRestrictionType.None;
                }
            }
        }
Example #28
0
        private static bool GetWorldFileDetails(ref WorldFileMetadata info)
        {
            string mWorldFile = info.mWorldFile;

            if (!mWorldFile.ToLower().EndsWith(".world"))
            {
                mWorldFile = mWorldFile + ".world";
            }

            info.mDescription = null;
            info.mWorldThumb  = null;
            info.mLotCount    = 0x0;

            WorldName worldName    = WorldName.Undefined;
            ulong     worldNameKey = 0x0L;

            string entryKey = UIManager.GetWorldMetadata(mWorldFile, ref info.mLotCount, ref info.mWorldThumb, ref worldNameKey, ref info.mWorldType, ref worldName);

            if (!GameUtils.WorldNameToType.ContainsKey(worldName))
            {
                GameUtils.WorldNameToType.Add(worldName, info.mWorldType);
            }

            ILocalizationModel localizationModel = Sims3.Gameplay.UI.Responder.Instance.LocalizationModel;

            if (entryKey != null)
            {
                if (localizationModel.HasLocalizationString(entryKey))
                {
                    info.mDescription = localizationModel.LocalizeString(entryKey, new object[0x0]);
                }
                else
                {
                    info.mDescription = entryKey;
                }
            }

            if ((worldNameKey != 0x0L) && localizationModel.HasLocalizationString(worldNameKey))
            {
                info.mCaption = localizationModel.LocalizeString(worldNameKey);
            }

            if (string.IsNullOrEmpty(info.mCaption))
            {
                BooterLogger.AddTrace("Untranslated " + mWorldFile + ": " + worldNameKey);

                if (mWorldFile.ToLower().EndsWith(".world"))
                {
                    int num2 = mWorldFile.LastIndexOfAny(new char[] { '\\', '/' });
                    info.mCaption = ((num2 >= 0x0) && (mWorldFile.Length > 0x0)) ? mWorldFile.Substring(num2 + 0x1) : mWorldFile.Substring(0x0, mWorldFile.Length - 0x6);
                }
                else
                {
                    info.mCaption = mWorldFile;
                }
            }

            if (info.mDescription == null)
            {
                info.mDescription = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Fusce pulvinar. Donec faucibus, dolor eu porta lobortis ante nibh vulputate justo, velvolutpat odio sapien venenatis justo. Quisque sit amet felis acelit imperdiet hendrerit. Nam ut mauris et nisi varius portitor. Fusce blandit, diam id varius portitor, sem elit bibendum dolor, congue molestie sapien lorem vel dolor. Fusce laoreet est non urna euismod commodo. Donec enim quam, blandit at, placerat in, eleifend vitae, justo. Suspendisse potenti. In blandit pede sit amet sem. Nam condimentum sapien sit amet erat.";
            }

            if (info.mWorldThumb == null)
            {
                info.mWorldThumb = UIManager.LoadUIImage(ResourceKey.CreatePNGKey("game_entry_town_placeholder", 0x0));
            }
            return(true);
        }
Example #29
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"));
                        }
                    }
                }
            }
        }