Пример #1
0
        /// <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);
            }
        }
Пример #2
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);
 }
Пример #3
0
 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);
 }
Пример #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);
        }
Пример #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);
        }
Пример #6
0
        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();
        }
        public CompanionManager(IGameMaster gameMaster, DialogueDriver dialogueDriver, HintDriver hintDriver, CompanionDisplay hud, Config config, IConditionsChecker epu, IMonitor monitor)
        {
            this.GameMaster         = gameMaster ?? throw new ArgumentNullException(nameof(gameMaster));
            this.dialogueDriver     = dialogueDriver ?? throw new ArgumentNullException(nameof(dialogueDriver));
            this.hintDriver         = hintDriver ?? throw new ArgumentNullException(nameof(hintDriver));
            this.Hud                = hud ?? throw new ArgumentNullException(nameof(hud));
            this.monitor            = monitor ?? throw new ArgumentNullException(nameof(monitor));
            this.PossibleCompanions = new Dictionary <string, CompanionStateMachine>();
            this.Config             = config ?? throw new ArgumentNullException(nameof(config));
            this.EPU                = epu ?? throw new ArgumentNullException(nameof(epu));

            this.dialogueDriver.DialogueChanged += this.DialogueDriver_DialogueChanged;
            this.hintDriver.CheckHint           += this.HintDriver_CheckHint;
        }
 public CompanionCutscenes(IContentLoader contentLoader, CompanionManager companionManager, IConditionsChecker epu)
 {
     this.contentLoader    = contentLoader;
     this.companionManager = companionManager;
     this.epu = epu;
 }