public DataLoader(IModHelper helper, IManifest manifest) { Helper = helper; I18N = helper.Translation; ModConfig = helper.ReadConfig <ModConfig>(); Dictionary <object, int> CrystalariumData = DataLoader.Helper.Data.ReadJsonFile <Dictionary <object, int> >(CrystalariumDataJson) ?? DefaultCystalariumData; DataLoader.Helper.Data.WriteJsonFile(CrystalariumDataJson, CrystalariumData); Dictionary <int, string> objects = DataLoader.Helper.Content.Load <Dictionary <int, string> >("Data\\ObjectInformation", ContentSource.GameContent); CrystalariumData.ToList().ForEach(d => { int?id = GetId(d.Key, objects); if (id.HasValue && !CrystalariumDataId.ContainsKey(id.Value)) { CrystalariumDataId[id.Value] = d.Value; } }); DataLoader.LoadContentPacksCommand(); if (!ModConfig.DisableLetter) { MailDao.SaveLetter ( new Letter ( "CustomCrystalarium" , I18N.Get("CustomCrystalarium.Letter") , (l) => !Game1.player.mailReceived.Contains(l.Id) , (l) => Game1.player.mailReceived.Add(l.Id) ) { Title = I18N.Get("CustomCrystalarium.Letter.Title") } ); } CreateConfigMenu(manifest); }
/// <summary>Raised after the player loads a save slot and the world is initialized.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private static void OnSaveLoaded(object sender, SaveLoadedEventArgs e) { DataLoader.LoadContentPacksCommand(); }