/// <summary> /// Initialize static masteries. /// </summary> internal static void Load() { MasteriesDatafile datafile = Util.DeserializeDatafile <MasteriesDatafile>( DatafileConstants.MasteriesDatafile); foreach (SerializableMasteryShip srcShip in datafile.MasteryShips) { Ship ship = StaticItems.GetItemByID(srcShip.ID) as Ship; if (ship != null) { s_masteryShipsByID[ship.ID] = new MasteryShip(srcShip, ship); } } GlobalDatafileCollection.OnDatafileLoaded(); }
/// <summary> /// Generate the masteries datafile. /// </summary> internal static void GenerateDatafile() { Stopwatch stopwatch = Stopwatch.StartNew(); Util.ResetCounters(); Console.WriteLine(); Console.Write(@"Generating masteries datafile... "); // Export the mastery ships List <SerializableMasteryShip> listOfMasteryShips = new List <SerializableMasteryShip>(); foreach (IGrouping <int, DgmTypeMasteries> typeMastery in Database.DgmTypeMasteriesTable.GroupBy(x => x.ItemID)) { SerializableMasteryShip masteryShip = new SerializableMasteryShip { ID = typeMastery.Key, Name = Database.InvTypesTable[typeMastery.Key].Name }; // Add masteries to mastery ship masteryShip.Masteries.AddRange(ExportMasteries(typeMastery).OrderBy(x => x.Grade)); // Add mastery ship listOfMasteryShips.Add(masteryShip); } // Serialize MasteriesDatafile datafile = new MasteriesDatafile(); datafile.MasteryShips.AddRange(listOfMasteryShips); Util.DisplayEndTime(stopwatch); Util.SerializeXml(datafile, DatafileConstants.MasteriesDatafile); }