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"); } } }
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); }
public VectorStageTable(BooterHelper.DataBootFile file, string name) : base(file, name) { if (IsValid) { Load(LoadStage); } }
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(); }
public void ParseIntervals() { mIntervals = new List <SpeedInterval>(); BooterHelper.DataBootFile speedFile = new BooterHelper.DataBootFile("NRaas.RelativityTuning", "NRaas.RelativityTuning", false); if (!speedFile.IsValid) { return; } BooterHelper.DataBootTable table = new BooterHelper.DataBootTable(speedFile, "Speeds"); if (!table.IsValid) { return; } table.Load(Perform); mIntervals.Sort(new Comparison <SpeedInterval>(SpeedInterval.OnSort)); }
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; } } }
protected override void PerformFile(BooterHelper.BootFile file) { BooterHelper.DataBootFile dataFile = file as BooterHelper.DataBootFile; if (dataFile == null) { return; } if (dataFile.GetTable("TraitList") == null && dataFile.GetTable("Traits") == null) { return; } try { TraitManager.ParseTraitData(dataFile.Data, true); } catch (Exception e) { Common.Exception(file.ToString(), e); BooterLogger.AddError(file + ": ParseTraitData Error"); } }
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")); } } }
public CareerLoader(BooterHelper.DataBootFile careerEventsFile) { mCareerEventsFile = careerEventsFile; }
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); } } }