protected static bool LoadSkillBookData(XmlDbData spreadsheet, string bookSheet) { if (spreadsheet.Tables.ContainsKey(bookSheet)) { XmlDbTable table = spreadsheet.Tables[bookSheet]; int rowIndex = 0x0; foreach (XmlDbRow row in table.Rows) { try { XmlDbData.XmlDbRowFast data = row as XmlDbData.XmlDbRowFast; if (data != null) { if (row.Exists("AltSkill")) { data.mData.Remove("Skill"); data.mData.Add("Skill", row.GetString("AltSkill")); } } BooterLogger.AddTrace("Skill Book Found: " + row.GetString("Skill")); if (SkillManager.GetStaticSkill(SkillManager.sSkillEnumValues.ParseEnumValue(row.GetString("Skill"))) == null) { return(false); } BookSkillData book = new BookSkillData(row, rowIndex); string msg = book.ID; msg += Common.NewLine + " AllowedWorldTypes " + new ListToString <WorldType>().Convert(book.AllowedWorldTypes); msg += Common.NewLine + " AllowedWorlds " + new ListToString <WorldName>().Convert(book.AllowedWorlds); BooterLogger.AddTrace("Book Loaded: " + msg); } catch (Exception e) { Common.Exception("Title: " + row["Title"], e); } rowIndex++; } } return(true); }
public 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")); } } }