private void InitCustomEvents()
 {
     DirectoryInfo[] modDirectories = (new DirectoryInfo(ModConstants.MODS_LOCATION)).GetDirectories();
     foreach (DirectoryInfo dir in modDirectories)
     {
         string modPath = dir.GetFiles("*.xml").FirstOrDefault().FullName;
         if (String.IsNullOrEmpty(modPath))
         {
             continue;
         }
         CustomEventMod customEvent = CustomEventMod.Load(modPath);
         AudioHelper.Instance.LoadAudio(dir);
         SpriteHelper.LoadSprites(dir);
         EventLoader.LoadNewEvents(dir, customEvent);
         ShopHelper.LoadItemsFromFile(dir, customEvent);
         ProgressTracker.SaveEventModStarted(customEvent);
         EventLoader.CustomEvents.Add(customEvent);
     }
 }
Exemple #2
0
 public static void LoadItemsFromFile(DirectoryInfo dir, CustomEventMod customEvent)
 {
     string[] files = Directory.GetFiles(dir.FullName + "/Items", "*.xml");
     foreach (string file in files)
     {
         GeneralManager.Instance.LogToFileOrConsole("[PromDate] Loading items from " + file);
         ItemContainer itemContainer = ItemContainer.Load(file);
         foreach (Item item in itemContainer.Items)
         {
             GeneralManager.Instance.LogToFileOrConsole("[PromDate] Loading item: " + item.Name);
             AddShopItem(item.Name, item.Price, item.DescriptionTitle, item.Description, item.ShopkeeperMood, SpriteHelper.LookupCustomSprite(item.SmallSprite), SpriteHelper.LookupCustomSprite(item.LargeSprite), item.EventItem);
             if (!string.IsNullOrEmpty(item.UnlockDescription))
             {
                 if (ProgressTracker.HasEventModBeenLoadedBefore(customEvent))
                 {
                     return;
                 }
                 GeneralManager.CUnlockableConditions cond = new GeneralManager.CUnlockableConditions(item.Name, NGameConstants.EUnlockableType.Item, "", new GeneralManager.CUnlockableRequirement[0], SpriteHelper.LookupCustomSprite(item.LargeSprite), item.UnlockDescription);
                 (typeof(GeneralManager).GetField("mUnlockedThisRun", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(GeneralManager.Instance) as List <GeneralManager.CUnlockableConditions>).Add(cond);
             }
         }
     }
     GeneralManager.Instance.CheckMoreUnlockablesThisRun();
 }