Exemple #1
0
        /*********
        ** Public methods
        *********/
        /// <summary>The mod entry point, called after the mod is first loaded.</summary>
        /// <param name="helper">Provides simplified APIs for writing mods.</param>
        public override void Entry(IModHelper helper)
        {
            // Read in config file and create if needed
            try
            {
                this.Config = this.Helper.ReadConfig <ModConfig>();
            }
            catch (Exception)
            {
                this.Config = new ModConfig();
                this.Monitor.Log(this.Helper.Translation.Get("IllFormattedConfig"), LogLevel.Warn);
            }

            // Initialize the error logger and config in all the other files via a helper function
            MCTHelperFunctions.Initialize(this.Monitor, this.Config, helper);

            // Do the Harmony things
            var harmony = new Harmony(this.ModManifest.UniqueID);

            RepeatPatcher.Apply(harmony);
            WeddingPatcher.Apply(harmony);
            BirthPatcher.Apply(harmony);
            DivorcePatcher.Apply(harmony);
            LuauPatcher.Apply(harmony);
            WorldChangePatcher.Apply(harmony);
            NightEventPatcher.Apply(harmony);
            IslandPatcher.Apply(harmony);

            // Adds a command to check current active conversation topics
            helper.ConsoleCommands.Add("vl.mct.current_CTs", "Returns a list of the current active dialogue events.", MCTHelperFunctions.console_GetCurrentCTs);

            // Adds a command to see if player has a given mail flag
            helper.ConsoleCommands.Add("vl.mct.has_flag", "Checks if the player has a mail flag.\n\nUsage: vl.mct_hasflag <flagName>\n- flagName: the possible mail flag name.", MCTHelperFunctions.console_HasMailFlag);

            // Adds a command to add a conversation topic
            helper.ConsoleCommands.Add("vl.mct.add_CT", "Adds the specified conversation topic with duration of 1 day.\n\nUsage: vl.mct_add_CT <topicName> <duration>\n- topicName: the conversation topic to add.\n- duration: duration of conversation topic to add.", MCTHelperFunctions.console_AddConversationTopic);

            // Adds a command to remove a conversation topic
            helper.ConsoleCommands.Add("vl.mct.remove_CT", "Removes the specified conversation topic.\n\nUsage: vl.mct_remove_CT <topicName>\n- topicName: the conversation topic to remove.", MCTHelperFunctions.console_RemoveConversationTopic);

            // Adds a command to check if a conversation topic is repeatable
            helper.ConsoleCommands.Add("vl.mct.is_repeatable_CT", "Checks whether the specified conversation topic is repeatable.\n\nUsage: vl.mct_remove_CT <topicName>\n- topicName: the conversation topic to check.", MCTHelperFunctions.console_IsRepeatableCT);

            // Adds a command to print all repeatable conversation topics
            helper.ConsoleCommands.Add("vl.mct.repeatable_CTs", "Returns a list of all repeatable conversation topics.", MCTHelperFunctions.console_AllRepeatableCTs);

            // Add GMCM
            helper.Events.GameLoop.GameLaunched += this.RegisterGMCM;

            // Add asset editor
            helper.Events.Content.AssetRequested += this.OnAssetRequested;
        }
        // Initialize Monitor and Config for this class and all other classes
        public static void Initialize(IMonitor monitor, ModConfig config, IModHelper helper)
        {
            Monitor = monitor;
            Config  = config;
            Helper  = helper;

            RepeatPatcher.Initialize(Monitor, Config);
            WeddingPatcher.Initialize(Monitor, Config);
            BirthPatcher.Initialize(Monitor, Config);
            DivorcePatcher.Initialize(Monitor, Config);
            LuauPatcher.Initialize(Monitor, Config);
            WorldChangePatcher.Initialize(Monitor, Config);
            NightEventPatcher.Initialize(Monitor, Config);
            JojaEventAssetEditor.Initialize(Monitor, Config);
            IslandPatcher.Initialize(Monitor, Config);
        }