/// <summary> /// Generate the skills datafile. /// </summary> internal static void GenerateDatafile() { Stopwatch stopwatch = Stopwatch.StartNew(); Util.ResetCounters(); Console.WriteLine(); Console.Write(@"Generating blueprints datafile... "); // Configure blueprints with Null market group ConfigureNullMarketBlueprint(); Dictionary <int, SerializableBlueprintMarketGroup> groups = new Dictionary <int, SerializableBlueprintMarketGroup>(); // Export blueprint groups CreateMarketGroups(groups); // Create the parent-children groups relations foreach (SerializableBlueprintMarketGroup group in groups.Values) { IEnumerable <SerializableBlueprintMarketGroup> children = Database.InvMarketGroupsTable.Concat( s_injectedMarketGroups).Where(x => x.ParentID == group.ID).Select( x => groups[x.ID]).OrderBy(x => x.Name); group.SubGroups.AddRange(children); } // Sort groups IEnumerable <SerializableBlueprintMarketGroup> blueprintGroups = Database.InvMarketGroupsTable.Concat( s_injectedMarketGroups).Where(x => x.ParentID == DBConstants.BlueprintsMarketGroupID).Select( x => groups[x.ID]).OrderBy(x => x.Name); // Reset the custom market groups s_nullMarketBlueprints.ForEach(srcItem => srcItem.MarketGroupID = null); Database.InvTypesTable .Where(item => Database.InvGroupsTable[item.GroupID].CategoryID == DBConstants.AncientRelicsCategoryID) .ToList() .ForEach(x => x.MarketGroupID = DBConstants.AncientRelicsMarketGroupID); // Serialize BlueprintsDatafile datafile = new BlueprintsDatafile(); datafile.MarketGroups.AddRange(blueprintGroups); Util.DisplayEndTime(stopwatch); // DEBUG: Find which blueprints have not been generated if (Debugger.IsAttached) { var blueprintIds = groups.Values.SelectMany(x => x.Blueprints).Select(y => y.ID).ToList(); var diff = Database.InvBlueprintTypesTable.Where(blueprint => !blueprintIds.Contains(blueprint.ID)).ToList(); if (diff.Any()) { Console.WriteLine("{0} blueprints were not generated.", diff.Count); } } Util.SerializeXml(datafile, DatafileConstants.BlueprintsDatafile); }
/// <summary> /// Initialize static blueprints. /// </summary> internal static void Load() { if (s_blueprintMarketGroups != null) { return; } BlueprintsDatafile datafile = Util.DeserializeDatafile <BlueprintsDatafile>(DatafileConstants.BlueprintsDatafile); s_blueprintMarketGroups = new BlueprintMarketGroupCollection(null, datafile.Groups); foreach (var srcGroup in s_blueprintMarketGroups) { InitializeDictionaries(srcGroup); } }
/// <summary> /// Initialize static blueprints. /// </summary> internal static void Load() { if (BlueprintMarketGroups != null) { return; } BlueprintsDatafile datafile = Util.DeserializeDatafile <BlueprintsDatafile>(DatafileConstants.BlueprintsDatafile, Util.LoadXslt(Properties.Resources.DatafilesXSLT)); BlueprintMarketGroups = new BlueprintMarketGroupCollection(null, datafile.MarketGroups); foreach (BlueprintMarketGroup srcGroup in BlueprintMarketGroups) { InitializeDictionaries(srcGroup); } GlobalDatafileCollection.OnDatafileLoaded(); }