예제 #1
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            WeatherProfile profile = GetProfile(row);
            if (profile == null) return;

            profile.ParseTemperature(row);
        }
예제 #2
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;
                }
            }
        }
예제 #3
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null) return;

            ParseSkillData(dataFile.Data, row, true);
        }
예제 #4
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            TagStaticData data = new TagStaticData();

            string name = row.GetString("TypeName");
            string icon = row.GetString("Icon");
            string color = row.GetString("ColorHEX");
            bool business = row.GetBool("isBusinessType");            

            try
            {
                data.SetGUID(name);
            }
            catch (ArgumentException e)
            {
                Common.Exception("", e);
            }

            if (!data.Valid)
            {
                return;
            }

            data.name = name;
            data.icon = icon;
            data.isBusinessType = business;
            data.SetColorHex(color);

            if (!Tagger.staticData.ContainsKey(data.GUID))
            {                
                Tagger.staticData.Add(data.GUID, data);
                EnumInjection.InjectEnums<CommercialLotSubType>(new string[] { name }, new object[] { data.GUID }, false);
            }
        }
예제 #5
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DataBootFile careerFile = new BooterHelper.DataBootFile(file.ToString(), row.GetString("Careers"), false);
            if (!careerFile.IsValid)
            {
                BooterLogger.AddError(file.ToString() + ": Unknown Careers File " + row.GetString("Careers"));
                return;
            }

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

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

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

            table.Load(new CareerLoader(careerEventsFile).LoadCareer);
        }
예제 #6
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string toneName = row.GetString("ToneName");
            if (string.IsNullOrEmpty(toneName)) 
            {
                BooterLogger.AddError("Tone found with no name");
                return;
            }

            Type classType = row.GetClassType("FullClassName");
            if (classType == null) 
            {
                BooterLogger.AddError("Tone: " + toneName + " FullClassName no match");
                return;
            }

            string guid = row.GetString("CareerGuid");

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

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

            Career staticCareer = CareerManager.GetStaticCareer (careerGuid);
            if (staticCareer == null)
            {
                BooterLogger.AddError("Tone: " + toneName + " CareerGuid no match");
                return;
            }

            staticCareer.SharedData.ToneDefinitions.Add(new CareerBooterToneDefinition(row, classType));
        }
예제 #7
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");
                }
            }
        }
예제 #8
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"));
        }
        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"));
        }
        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(" Good Lot Moodlet: " + row.GetString("Moodlet"));
        }
예제 #11
0
        protected override bool Perform(BooterHelper.BootFile file)
        {
            if (base.Perform(file)) return true;

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

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

            Load(docfile, availability);
            return true;
        }
예제 #12
0
        protected static bool Load(BooterHelper.DocumentBootFile socialData, BooterHelper.DataBootFile actionAvailability)
        {
            bool result = true;

            if (!LoadSocialData(socialData))
            {
                result = false;
            }

            if (!LoadSocializingActionAvailability(actionAvailability))
            {
                result = false;
            }

            return result;
        }
예제 #13
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string worldName = row.GetString("WorldName");
            if (string.IsNullOrEmpty(worldName)) return;

            worldName = worldName.ToLower().Replace(".world", "").Replace(".World", "").Replace(".WORLD","");

            if (sLoadedNames.ContainsKey(worldName)) return;

            string fileName = row.GetString("FileName");
            if (string.IsNullOrEmpty(fileName)) return;

            fileName = fileName.Replace(".nhd", "").Replace(".Nhd", "").Replace(".NHD", "");

            sLoadedNames.Add(worldName, fileName);
        }
예제 #14
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            BooterHelper.DocumentBootFile socialData = new BooterHelper.DocumentBootFile(file.ToString(), row.GetString("SocialData"), false);
            if (!socialData.IsValid)
            {
                BooterLogger.AddTrace(file + ": No SocialData");
                return;
            }

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

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

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

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

                BooterLogger.AddError(file + ": ParseBuffData Error");
            }
        }
예제 #16
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"));
        }
예제 #17
0
        protected override void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            string guid = row.GetString("GUID");
            if (string.IsNullOrEmpty(guid))
            {
                BooterLogger.AddError("Invalid GUID: " + guid);
                return;
            }
            else if (sInstigators.ContainsKey(guid))
            {
                BooterLogger.AddError("Duplicate GUID: " + guid);
                return;
            }

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

            Data symptom = null;

            try
            {
                symptom = type.GetConstructor(new Type[] { typeof(XmlDbRow) }).Invoke(new object[] { row }) as Data;
            }
            catch (Exception e)
            {
                BooterLogger.AddError("Contructor Fail: " + row.GetString("FullClassName"));

                Common.Exception(guid + Common.NewLine + row.GetString("FullClassName") + " Fail", e);
            }

            if (symptom != null)
            {
                sInstigators.Add(guid, symptom);
            }
        }
예제 #18
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"));
                    }
                }
            }
예제 #19
0
 public CareerLoader(BooterHelper.DataBootFile careerEventsFile)
 {
     mCareerEventsFile = careerEventsFile;
 }
예제 #20
0
        private static void ParseOpportunityNames(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("Names");
            if (table == null) return;

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

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Names " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames names = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // new Code
                if (names == OpportunityNames.Undefined)
                {
                    names = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                bool sDoValidation = OpportunityManager.sDoValidation;
                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)names))
                {
                    Opportunity.OpportunitySharedData sharedData = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)names].SharedData;
                    sharedData.mName.Add("Gameplay/Excel/Opportunities/Names:" + row.GetString("OpportunityName"));
                    sharedData.mDescription.Add("Gameplay/Excel/Opportunities/Names:" + row.GetString("OpportunityDescription"));
                    string str3 = row.GetString("OpportunityHint");
                    sharedData.mHint.Add(string.IsNullOrEmpty(str3) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str3));
                    string str4 = row.GetString("CompletionText");
                    sharedData.mCompletionText.Add(string.IsNullOrEmpty(str4) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str4));
                    string str5 = row.GetString("SecondaryCompletionText");
                    sharedData.mSecondaryCompletionText.Add(string.IsNullOrEmpty(str5) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str5));
                    string str6 = row.GetString("FailureText");
                    sharedData.mFailureText.Add(string.IsNullOrEmpty(str6) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str6));
                    string str7 = row.GetString("ProgressText");
                    sharedData.mProgressText.Add(string.IsNullOrEmpty(str7) ? string.Empty : ("Gameplay/Excel/Opportunities/Names:" + str7));
                }
                else
                {
                    BooterLogger.AddError(file + ": Names Unknown Opp " + row["GUID"]);
                }
            }
        }
예제 #21
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();
        }
예제 #22
0
        public void Perform(BooterHelper.BootFile file, XmlDbRow row)
        {
            WorldName world;
            row.TryGetEnum<WorldName>("World", out world, WorldName.Undefined);

            List<DaysOfTheWeek> days = ParserFunctions.ParseDayList(row.GetString("Days"));
            if ((days == null) || (days.Count == 0))
            {
                days = ParserFunctions.ParseDayList("MTWRFSU");
            }

            int startHour = row.GetInt("StartHour");
            int endHour = row.GetInt("EndHour");

            if (startHour > endHour) return;

            int speed = row.GetInt("Speed");
            if (speed <= 0)
            {
                speed = Relativity.sOneMinute;
            }

            mIntervals.Add(new SpeedInterval(world, days, startHour, endHour, speed));
        }
예제 #23
0
        protected static bool LoadSocialData(BooterHelper.DocumentBootFile socialData)
        {
            if (!socialData.IsValid)
            {
                BooterLogger.AddError(socialData + ": Unknown SocialData File");
                return false;
            }

            XmlElementLookup lookup = new XmlElementLookup(socialData.Document);
            List<XmlElement> actions = lookup["Action"];
            if ((actions == null) || (actions.Count == 0))
            {
                BooterLogger.AddError(socialData + ": No Action");
                return false;
            }

            bool isEp5Installed = GameUtils.IsInstalled(ProductVersion.EP5);

            foreach (XmlElement element in actions)
            {
                XmlElementLookup table = new XmlElementLookup(element);

                CommodityTypes types;
                ParserFunctions.TryParseEnum<CommodityTypes>(element.GetAttribute("com"), out types, CommodityTypes.Undefined);

                ProductVersion version;
                ParserFunctions.TryParseEnum<ProductVersion>(element.GetAttribute("ver"), out version, ProductVersion.BaseGame);

                ActionData data = new ActionData(element.GetAttribute("key"), types, version, table, isEp5Installed);

                List<XmlElement> list = table["LHS"];
                if (list.Count > 0x0)
                {
                    SocialRuleLHS.sDictionary.Remove(data.Key);

                    foreach (XmlElement element3 in list)
                    {
                        SocialRuleLHS lhs = new SocialRuleLHS(data.Key, data.IntendedCommodityString, element3);
                        lhs.ProceduralPrecondition = FindMethod(element3.GetAttribute("ProcTest"));
                    }

                    SocialRuleLHS.Get(data.Key).Sort(new Comparison<SocialRuleLHS>(SocialRuleLHS.SortSocialRules));
                }

                ActionData.Add(data);

                BooterLogger.AddTrace(" " + data.Key + " Added");
            }

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

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

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

            foreach (XmlDbRow row in table.Rows)
            {
                Opportunity.OpportunitySharedData data = new Opportunity.OpportunitySharedData();
                ParserFunctions.TryParseEnum<ProductVersion>(row.GetString("ProductVersion"), out data.mProductVersion, ProductVersion.BaseGame);

                data.mGuid = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // New Code
                if (data.mGuid == OpportunityNames.Undefined)
                {
                    data.mGuid = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                if (GameUtils.IsInstalled(data.mProductVersion))
                {
                    string str2 = row.GetString("Icon");
                    if (!string.IsNullOrEmpty(str2))
                    {
                        data.mIconKey = ResourceKey.CreatePNGKey(str2, 0x0);
                    }
                    ParserFunctions.TryParseEnum<Repeatability>(row["RepeatLevel"], out data.mRepeatLevel, Repeatability.Undefined);
                    data.SetFlags(Opportunity.OpportunitySharedData.FlagField.Ordered, row.GetBool("IsOrdered"));
                    data.SetFlags(Opportunity.OpportunitySharedData.FlagField.Counted, row.GetBool("IsCounted"));
                    data.SetFlags(Opportunity.OpportunitySharedData.FlagField.Totaled, row.GetBool("IsTotaled"));
                    data.mCountOrTotal = row.GetFloat("CountOrTotal", 0f);
                    string str3 = row["Timeout"];
                    if (str3 != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<Opportunity.OpportunitySharedData.TimeoutCondition>(row["Timeout"], out data.mTimeout, Opportunity.OpportunitySharedData.TimeoutCondition.None);
                    }
                    if (data.mTimeout == Opportunity.OpportunitySharedData.TimeoutCondition.SimTime)
                    {
                        if (row.GetString("TimeoutData") != null)
                        {
                            data.mTimeoutData = ParserFunctions.ParseTime(row.GetString("TimeoutData"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": TimeoutData missing " + row["GUID"]);
                        }
                    }
                    else
                    {
                        data.mTimeoutData = row.GetFloat("TimeoutData");

                        if (row.GetString("TimeoutEnd") != null)
                        {
                            data.mTimeoutEnd = ParserFunctions.ParseTime(row.GetString("TimeoutEnd"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": TimeoutEnd missing " + row["GUID"]);
                        }
                    }
                    string name = row["Loss"];
                    if (name != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<Opportunity.OpportunitySharedData.TimeoutCondition>(name, out data.mLoss, Opportunity.OpportunitySharedData.TimeoutCondition.None);
                    }
                    if (data.mLoss == Opportunity.OpportunitySharedData.TimeoutCondition.SimTime)
                    {
                        if (row.GetString("LossData") != null)
                        {
                            data.mLossData = ParserFunctions.ParseTime(row.GetString("LossData"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": LossData missing " + row["GUID"]);
                        }
                    }
                    else
                    {
                        data.mLossData = row.GetFloat("LossData");
                    }

                    data.mChanceToGetOnPhone = row.GetFloat("ChanceToGetOnPhone");
                    row.TryGetEnum<OpportunityAvailability>("Availability", out data.mOpportunityAvailability, OpportunityAvailability.Undefined);
                    data.mOpportunityType = OpportunityType.Undefined;
                    row.TryGetEnum<OpportunityType>("OpportunityType", out data.mOpportunityType, OpportunityType.Undefined);
                    data.mEventList = OpportunityManager.ParseEvents(row, data.mGuid);
                    List<string> entry = row.GetStringList("CompletionEvent", ',', false);
                    if (entry.Count == 0x0)
                    {
                        data.mCompletionEvent = null;
                    }
                    else
                    {
                        data.mCompletionEvent = OpportunityManager.ParseOneEvent(entry, row, data.mGuid);
                        if (data.mOpportunityType == OpportunityType.Career)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateCareer);
                        }
                        else if (data.mOpportunityType == OpportunityType.Skill)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateSkill);
                        }
                        else if (data.mOpportunityType == OpportunityType.Location)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateSpecial);
                        }
                        else if (data.mOpportunityType == OpportunityType.AdventureChina)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateAdventureChina);
                        }
                        else if (data.mOpportunityType == OpportunityType.AdventureEgypt)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateAdventureEgypt);
                        }
                        else if (data.mOpportunityType == OpportunityType.AdventureFrance)
                        {
                            data.mCompletionEvent.mEventDelegate = new ProcessEventDelegate(Opportunity.ProcessCompletionEventDelegateAdventureFrance);
                        }
                    }
                    data.SetFlags(Opportunity.OpportunitySharedData.FlagField.AllowPhoneCompletion, row.GetBool("AllowPhoneCompletion"));
                    string str5 = row.GetString("CompletionProceduralTestFunction");
                    if (!string.IsNullOrEmpty(str5) && (OpportunityManager.sOpportunitiesTestClassType != null))
                    {
                        MethodInfo method = OpportunityManager.sOpportunitiesTestClassType.GetMethod(str5, BindingFlags.Public | BindingFlags.Static);
                        if (method != null)
                        {
                            data.mTargetProceduralTestDelegate = Delegate.CreateDelegate(typeof(OpportunityTargetProceduralTestDelegate), method) as OpportunityTargetProceduralTestDelegate;
                        }
                    }
                    Opportunity opportunity = null;
                    string typeName = row.GetString("CustomOpportunityClass");
                    if (typeName.Length > 0x0)
                    {
                        Type type = Type.GetType(typeName);
                        if (type != null)
                        {
                            Type[] types = new Type[] { typeof(Opportunity.OpportunitySharedData) };

                            try
                            {
                                opportunity = (Opportunity)type.GetConstructor(types).Invoke(new object[] { data });
                            }
                            catch
                            {
                                BooterLogger.AddError(file + ": Constructor Fail " + typeName);
                            }
                        }
                    }
                    else if (data.HasFlags(Opportunity.OpportunitySharedData.FlagField.Counted))
                    {
                        opportunity = new CountedOpportunity(data);
                    }
                    else if (data.HasFlags(Opportunity.OpportunitySharedData.FlagField.Totaled))
                    {
                        opportunity = new TotaledOpportunity(data);
                    }
                    else if (data.HasFlags(Opportunity.OpportunitySharedData.FlagField.Ordered))
                    {
                        opportunity = new OrderedOpportunity(data);
                    }
                    else
                    {
                        opportunity = new Opportunity(data);
                    }

                    if (opportunity != null)
                    {
                        // New code
                        GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)opportunity.Guid] = opportunity;

                        if (opportunity.IsLocationBased && (opportunity.Guid != OpportunityNames.Special_RestoreGhost))
                        {
                            // New code
                            OpportunityManager.sLocationBasedOpportunityList[opportunity.Guid] = opportunity;
                            continue;
                        }
                        if (opportunity.IsSkill || (opportunity.Guid == OpportunityNames.Special_RestoreGhost))
                        {
                            // New code
                            OpportunityManager.sSkillOpportunityList[opportunity.Guid] = opportunity;
                            continue;
                        }
                        if (opportunity.IsAdventureChina)
                        {
                            // New code
                            OpportunityManager.sAdventureChinaOpportunityList[opportunity.Guid] = opportunity;
                        }
                        else
                        {
                            if (opportunity.IsAdventureEgypt)
                            {
                                // New code
                                OpportunityManager.sAdventureEgyptOpportunityList[opportunity.Guid] = opportunity;
                                continue;
                            }
                            if (opportunity.IsAdventureFrance)
                            {
                                // New code
                                OpportunityManager.sAdventureFranceOpportunityList[opportunity.Guid] = opportunity;
                            }
                        }
                    }
                }
            }

            ParseOpportunityNames(dataFile, table.Rows.Count);
            ParseOpportunityRequirements(dataFile, table.Rows.Count);
            ParseOpportunitySetup(dataFile, table.Rows.Count);
            ParseOpportunityCompletion(dataFile, table.Rows.Count);
        }
예제 #25
0
        protected static bool LoadSocializingActionAvailability(BooterHelper.DataBootFile actionAvailability)
        {
            if (actionAvailability.GetTable("ActiveTopic") == null)
            {
                BooterLogger.AddError(actionAvailability + ": No ActiveTopic");
                return false;
            }

            SocialManager.ParseStcActionAvailability(actionAvailability.Data);
            SocialManager.ParseActiveTopic(actionAvailability.Data);

            return true;
        }
예제 #26
0
        private static void ParseOpportunitySetup(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("OpportunitiesSetup");
            if (table == null) return;

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

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Setup " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames names = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                #region NEWCODE
                if (names == OpportunityNames.Undefined)
                {
                    names = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }
                #endregion

                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)names))
                {
                    string[] strArray5;
                    string[] strArray6;
                    Opportunity opportunity = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong) names];
                    Opportunity.OpportunitySharedData sharedData = opportunity.SharedData;
                    string name = row.GetString("Object");
                    if (name != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityObjectTypes>(name, out sharedData.mSetupObjectType, OpportunityObjectTypes.Undefined);
                    }
                    sharedData.mSetupObjectData = row.GetString("ObjectData");
                    if (sharedData.mSetupObjectType == OpportunityObjectTypes.Keystone)
                    {
                        OpportunityManager.sKeystonesThatComeFromAdventures[sharedData.mSetupObjectData] = true;
                    }
                    sharedData.mSetupObjectTreasureSpawner = row.GetString("ObjectTreasureSpawner");
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.SetupObjectRequiredOnCompletion, row.GetBool("RequiredOnCompletion"));
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion, row.GetBool("DeleteOnCompletion"));
                    if (!string.IsNullOrEmpty(row.GetString("DeleteOnFailure")))
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure, row.GetBool("DeleteOnFailure"));
                    }
                    else
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure, sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion));
                    }
                    if (sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnCompletion))
                    {
                        sharedData.HasFlags(Opportunity.OpportunitySharedData.FlagField.DeleteSetupObjectOnFailure);
                    }
                    string str2 = row.GetString("ObjectStateForCompletion");
                    if (str2 != string.Empty)
                    {
                        string[] strArray = null;
                        if (ParserFunctions.ParseCommaSeparatedString(str2, out strArray))
                        {
                            ParserFunctions.TryParseEnum<OpportunityObjectState>(strArray[0x0], out sharedData.mSetupObjectCompletionState, OpportunityObjectState.Undefined);
                            if (strArray.Length == 0x2)
                            {
                                sharedData.mSetupObjectCompletionStateData = strArray[0x1];
                            }
                        }
                    }
                    row.TryGetEnum<OpportunityCompletionTNSType>("CompletionTNSType", out sharedData.mCompletionTNSType, OpportunityCompletionTNSType.Info);
                    Opportunity.OpportunitySharedData.DestinationInventoryType simInventory = Opportunity.OpportunitySharedData.DestinationInventoryType.SimInventory;
                    row.TryGetEnum<Opportunity.OpportunitySharedData.DestinationInventoryType>("DestinationInventory", out simInventory, Opportunity.OpportunitySharedData.DestinationInventoryType.SimInventory);
                    sharedData.mDestinationInventoryType = simInventory;
                    string str3 = row.GetString("Target");
                    if (str3 != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityTargetTypes>(str3, out sharedData.mTargetType, OpportunityTargetTypes.Undefined);
                    }
                    else if (name != string.Empty)
                    {
                        sharedData.mTargetType = OpportunityTargetTypes.SetupObject;
                    }
                    sharedData.mTargetData = row.GetString("TargetData");
                    string str4 = row.GetString("Source");
                    if (str4 != string.Empty)
                    {
                        ParserFunctions.TryParseEnum<OpportunityTargetTypes>(str4, out sharedData.mSourceType, OpportunityTargetTypes.Undefined);
                    }
                    sharedData.mSourceData = row.GetString("SourceData");
                    string str5 = row.GetString("TargetInteractionName");
                    if (str5 != string.Empty)
                    {
                        sharedData.mTargetInteractionName = "Gameplay/Excel/Opportunities/OpportunitiesSetup:" + str5;
                    }
                    sharedData.mSocialTextKeys = row.GetStringList("TargetSocialTextKeys", ',');
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.TargetInteractionIgnoreTarget, row.GetBool("TargetInteractionIgnoreTarget"));
                    sharedData.mTargetInteractionLikingToAccept = row.GetFloat("TargetInteractionLikingToAccept");
                    ParserFunctions.TryParseEnum<Role.RoleType>(row.GetString("TargetRoleRequired"), out sharedData.mTargetRoleRequired, Role.RoleType.None);
                    string str6 = row.GetString("TargetWorldRequired");
                    if ((str6 == "HomeWorld") || (sharedData.mProductVersion == ProductVersion.BaseGame))
                    {
                        sharedData.mTargetWorldRequired = WorldName.SunsetValley;
                    }
                    else
                    {
                        ParserFunctions.TryParseEnum<WorldName>(str6, out sharedData.mTargetWorldRequired, WorldName.Undefined);
                    }
                    sharedData.mTargetInteractionLength = row.GetFloat("TargetInteractionLength");
                    sharedData.mTargetInteractionDays = row.GetString("TargetInteractionDays");
                    sharedData.mTargetInteractionStartTime = ParserFunctions.ParseTime(row.GetString("TargetInteractionStartTime"));
                    sharedData.mTargetInteractionEndTime = ParserFunctions.ParseTime(row.GetString("TargetInteractionEndTime"));
                    string str7 = row.GetString("TargetInteractionCommodity");
                    if (!string.IsNullOrEmpty(str7))
                    {
                        string[] strArray2 = null;
                        if (ParserFunctions.ParseCommaSeparatedString(str7, out strArray2) && (strArray2.Length == 0x2))
                        {
                            ParserFunctions.TryParseEnum<CommodityKind>(strArray2[0x0], out sharedData.mTargetCommodity, CommodityKind.None);
                            float.TryParse(strArray2[0x1], out sharedData.mTargetCommodityDesiredValue);
                        }
                    }
                    string str8 = row.GetString("TargetInteractionItemRequired");
                    if (str8 != string.Empty)
                    {
                        string[] strArray3 = null;
                        if (ParserFunctions.ParseSemicolonSeparatedString(str8, out strArray3, false))
                        {
                            for (int i = 0x0; i < strArray3.Length; i++)
                            {
                                string[] strArray4 = null;
                                if (ParserFunctions.ParseCommaSeparatedString(strArray3[i].Trim(), out strArray4, false))
                                {
                                    for (int j = 0x0; j < strArray4.Length; j++)
                                    {
                                        strArray4[j] = strArray4[j].Trim();
                                    }
                                    if ((!OpportunityManager.ParseTargetInteractionItemInfo(strArray4, ref sharedData) && OpportunityManager.sDoValidation) && (sharedData.mRequiredItems != null))
                                    {
                                        int count = sharedData.mRequiredItems.Count;
                                    }
                                }
                            }
                        }
                    }
                    int num3 = (sharedData.mRequiredItems == null) ? 0x0 : sharedData.mRequiredItems.Count;
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.UseCollectibleProgressText, row.GetBool("TargetUseCollectibleProgressText"));
                    string str10 = row.GetString("TargetDeletionSortingFunction");
                    if ((!string.IsNullOrEmpty(str10) && (OpportunityManager.sOpportunitiesSortClassType != null)) && ParserFunctions.ParseSemicolonSeparatedString(str10, out strArray5))
                    {
                        int length = strArray5.Length;
                        for (int k = 0x0; k < strArray5.Length; k++)
                        {
                            MethodInfo method = OpportunityManager.sOpportunitiesSortClassType.GetMethod(strArray5[k], BindingFlags.Public | BindingFlags.Static);
                            if (method != null)
                            {
                                sharedData.mRequiredItems[k].mInventorySortFn = Delegate.CreateDelegate(typeof(InventoryItemSortDelegate), method) as InventoryItemSortDelegate;
                            }
                        }
                    }
                    if (ParserFunctions.ParseSemicolonSeparatedString(row.GetString("TargetInteractionNumberItemsRequired"), out strArray6))
                    {
                        int num10 = strArray6.Length;
                        for (int m = 0x0; m < strArray6.Length; m++)
                        {
                            List<int> list;
                            int num6 = 0x0;
                            int num7 = 0x0;
                            ParserFunctions.ParseCommaSeperatedInt(strArray6[m], out list);
                            if (list.Count == 0x1)
                            {
                                num6 = num7 = list[0x0];
                            }
                            else if (list.Count == 0x2)
                            {
                                num6 = Math.Min(list[0x0], list[0x1]);
                                num7 = Math.Max(list[0x0], list[0x1]);
                            }
                            sharedData.mRequiredItems[m].mTargetInteractionNumberItemsRequiredMin = num6;
                            sharedData.mRequiredItems[m].mTargetInteractionNumberItemsRequiredMax = num7;
                        }
                    }
                    if ((sharedData.mRequiredItems == null) || ((sharedData.mRequiredItems.Count == 0x1) && (sharedData.mRequiredItems[0x0].mTargetInteractionNumberItemsRequiredMin <= 0x0)))
                    {
                        sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.UseCollectibleProgressText, false);
                    }
                    sharedData.SetFlags(Opportunity.OpportunitySharedData.FlagField.TargetInteractionItemsDeleted, row.GetBool("TargetInteractionItemsDeleted"));
                    string str12 = row.GetString("TargetProceduralDeletionFunction");
                    if (!string.IsNullOrEmpty(str12) && (OpportunityManager.sOpportunitiesDeletionDelegateClassType != null))
                    {
                        MethodInfo info2 = OpportunityManager.sOpportunitiesDeletionDelegateClassType.GetMethod(str12, BindingFlags.Public | BindingFlags.Static);
                        if (info2 != null)
                        {
                            sharedData.mTargetProceduralDeletionDelegate = Delegate.CreateDelegate(typeof(OpportunityTargetProceduralDeletionDelegate), info2) as OpportunityTargetProceduralDeletionDelegate;
                        }
                    }
                    if ((OpportunityManager.sDoValidation && (sharedData.mRequiredItems != null)) && (sharedData.mRequiredItems.Count > 0x0))
                    {
                        for (int n = 0x0; n < sharedData.mRequiredItems.Count; n++)
                        {
                            if (((sharedData.TargetInteractionItemRequired(n) != null) && (sharedData.mTargetProceduralDeletionDelegate == null)) && ((sharedData.mRequiredItems[n].mTargetInteractionNumberItemsRequiredMin <= 0x0) && (sharedData.mGuid != OpportunityNames.EP1_Quest_Necteaux6)))
                            {
                                OpportunityNames mGuid = sharedData.mGuid;
                            }
                        }
                    }
                    string str13 = row.GetString("AdventureMapTagTarget");
                    if (!string.IsNullOrEmpty(str13))
                    {
                        string[] strArray7;
                        ParserFunctions.ParseCommaSeparatedString(str13, out strArray7);
                        if (strArray7.Length == 0x2)
                        {
                            ParserFunctions.TryParseEnum<AdventureMapTagTargetType>(strArray7[0x0], out sharedData.mAdventureMapTagTargetType, AdventureMapTagTargetType.None);
                            if (sharedData.mAdventureMapTagTargetType != AdventureMapTagTargetType.None)
                            {
                                sharedData.mAdventureMapTagTarget = strArray7[0x1];
                            }
                        }
                    }
                    string str14 = row.GetString("OppMapDagDisplayType");
                    if (!string.IsNullOrEmpty(str14))
                    {
                        ParserFunctions.TryParseEnum<Opportunity.OpportunitySharedData.MapTagOppDisplayType>(str14, out sharedData.MapTagDisplayType, Opportunity.OpportunitySharedData.MapTagOppDisplayType.Normal);
                    }
                    DaysOfTheWeek none = DaysOfTheWeek.None;
                    if (row.TryGetEnum<DaysOfTheWeek>("EventDay", out none, DaysOfTheWeek.None))
                    {
                        sharedData.mEventDay = none;

                        if (row.GetString("EventStartTime") != null)
                        {
                            sharedData.mEventStartTime = ParserFunctions.ParseTime(row.GetString("EventStartTime"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": EventStartTime missing " + row["GUID"]);
                        }

                        if (row.GetString("EventEndTime") != null)
                        {
                            sharedData.mEventEndTime = ParserFunctions.ParseTime(row.GetString("EventEndTime"));
                        }
                        else
                        {
                            BooterLogger.AddError(file + ": EventEndTime missing " + row["GUID"]);
                        }

                        sharedData.mEventSetup = row.GetString("EventSetup");
                    }
                    opportunity.SourceData = sharedData.mSourceData;
                    opportunity.SourceType = sharedData.mSourceType;
                    opportunity.TargetData = sharedData.mTargetData;
                    opportunity.TargetType = sharedData.mTargetType;
                }
            }
        }
예제 #27
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"));
                        }
                    }
                }
            }
        }
예제 #28
0
        private static void ParseOpportunityRequirements(BooterHelper.DataBootFile file, int total)
        {
            XmlDbTable table = file.GetTable("OpportunitiesRequirements");
            if (table == null) return;

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

            if (total != table.Rows.Count)
            {
                BooterLogger.AddError(file + ": Found Too few Req " + total + " < " + table.Rows.Count);
            }

            foreach (XmlDbRow row in table.Rows)
            {
                OpportunityNames opportunityKey = GenericManager<OpportunityNames, Opportunity, Opportunity>.ParseGuid(row["GUID"]);

                // New code
                if (opportunityKey == OpportunityNames.Undefined)
                {
                    opportunityKey = unchecked((OpportunityNames)ResourceUtils.HashString64(row["GUID"]));
                }

                bool sDoValidation = OpportunityManager.sDoValidation;
                if (GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary.ContainsKey((ulong)opportunityKey))
                {
                    Opportunity opp = GenericManager<OpportunityNames, Opportunity, Opportunity>.sDictionary[(ulong)opportunityKey];

                    Opportunity.OpportunitySharedData sharedData = opp.SharedData;
                    sharedData.mRequirementList = ParseRequirements(row, opportunityKey);
                    List<string> stringList = row.GetStringList("CustomRequirementFunction", ',');
                    if (stringList.Count > 0)
                    {
                        sharedData.mRequirementDelegate = (OpportunityRequirementDelegate)OpportunityManager.ParseDelegatePair(stringList[0], stringList[1], typeof(OpportunityRequirementDelegate));
                    }
                }
                else
                {
                    BooterLogger.AddError(file + ": Req Unknown Opp " + row["GUID"]);
                }
            }
        }
예제 #29
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");
        }
예제 #30
0
        protected override void PerformFile(BooterHelper.BootFile file)
        {
            BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile;
            if (dataFile == null) return;

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

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

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

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

            Dictionary<ulong, List<XmlDbRow>> dictionary = GenerateCareerToCareerLevelXmlDataMap(table2, "SkilledProfession", "SkillBasedCareers");
            foreach (XmlDbRow row in table.Rows)
            {
                string guid = row.GetString("SkilledProfession");

                OccupationNames names;

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

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

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

                SkillNames skillName = SkillNames.None;

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

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

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

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

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

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