/// <summary>A SMAPI GameLaunched event that enables EPU support if that mod is available.</summary>
        public void EnableEPU(object sender, GameLaunchedEventArgs e)
        {
            try
            {
                IConditionsChecker api = Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility"); //attempt to get an instance of EPU's API

                if (api == null)                                                                                                //if the API is NOT available
                {
                    Monitor.Log($"Optional API not found: Expanded Preconditions Utility (EPU).", LogLevel.Trace);
                    return;
                }
                else //if the API is available
                {
                    Monitor.Log($"Optional API found: Expanded Preconditions Utility (EPU).", LogLevel.Trace);
                }

                api.Initialize(Utility.MConfig.EnableEPUDebugMessages, this.ModManifest.UniqueID); //initialize the API

                Utility.EPUConditionsChecker = api;                                                //pass the API to this mod's static utility property
            }
            catch (Exception ex)
            {
                Utility.Monitor.Log($"An error happened while loading FTM's Expanded Preconditions Utility interface. Any spawn areas with \"EPUPreconditions\" settings will be disabled. The auto-generated error message has been added to the log.", LogLevel.Warn);
                Utility.Monitor.Log($"----------", LogLevel.Trace);
                Utility.Monitor.Log($"{ex.ToString()}", LogLevel.Trace);
            }
        }
 public DataLoader(IModHelper helper)
 {
     Helper = helper;
     DgaApi = MailFrameworkModEntry.ModHelper.ModRegistry.GetApi <IDynamicGameAssetsApi>("spacechase0.DynamicGameAssets");
     ConditionsCheckerApi = Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility");
     ConditionsCheckerApi?.Initialize(false, MailFrameworkModEntry.Manifest.UniqueID);
 }
Beispiel #3
0
 private void onGameLaunched(object _sender, EventArgs _e)
 {
     // Make Expanded Preconditions Utility available for checking.
     conditionsChecker = Helper.ModRegistry.GetApi <IConditionsChecker>
                             ("Cherry.ExpandedPreconditionsUtility");
     conditionsChecker.Initialize(false, ModManifest.UniqueID);
 }
Beispiel #4
0
        private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            ConditionsChecker = Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility");
            var verboseMode = false;

            ConditionsChecker.Initialize(verboseMode, ModManifest.UniqueID);
        }
Beispiel #5
0
        private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            ConditionsApi = Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility");
            if (ConditionsApi == null)
            {
                Monitor.Log("Expanded Preconditions Utility API not detected. Something went wrong, please check that your installation of Expanded Preconditions Utility is valid", LogLevel.Error);
                return;
            }


            ConditionsApi.Initialize(false, this.ModManifest.UniqueID);
        }
        private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
        {
            // Setup third party mod compatibility bridge
            Compat.Setup(this.Helper.ModRegistry, this.Monitor);
            IQuestApi          questApi = this.Helper.ModRegistry.GetApi <IQuestApi>("purrplingcat.questframework");
            IConditionsChecker epu      = this.Helper.ModRegistry.GetApi <IConditionsChecker>("Cherry.ExpandedPreconditionsUtility");
            var storyHelper             = new StoryHelper(this.ContentLoader, questApi.GetManagedApi(this.ModManifest));

            questApi.Events.GettingReady += (_, args) => storyHelper.LoadQuests(this.GameMaster);
            questApi.Events.Ready        += (_, args) => storyHelper.SanitizeOldAdventureQuestsInLog();
            epu.Initialize(this.Config.EnableDebug, this.ModManifest.UniqueID);

            // Mod's services and drivers
            this.QuestApi         = questApi;
            this.Epu              = epu;
            this.SpecialEvents    = new SpecialModEvents();
            this.DialogueDriver   = new DialogueDriver(this.Helper.Events);
            this.HintDriver       = new HintDriver(this.Helper.Events);
            this.StuffDriver      = new StuffDriver(this.Helper.Data, this.Monitor);
            this.MailDriver       = new MailDriver(this.ContentLoader, this.Monitor);
            this.GameMaster       = new GameMaster(this.Helper, storyHelper, this.Monitor);
            this.CompanionHud     = new CompanionDisplay(this.Config, this.ContentLoader);
            this.CompanionManager = new CompanionManager(
                gameMaster: this.GameMaster,
                dialogueDriver: this.DialogueDriver,
                hintDriver: this.HintDriver,
                hud: this.CompanionHud,
                config: this.Config,
                epu: this.Epu,
                monitor: this.Monitor
                );

            this.StuffDriver.RegisterEvents(this.Helper.Events);
            this.MailDriver.RegisterEvents(this.SpecialEvents);

            this.ApplyPatches(); // Apply harmony patches
            this.InitializeScenarios();
        }