Beispiel #1
0
            static void Postfix(LibraryScriptableObject __instance)
            {
                var self = __instance;

                if (Main.library != null)
                {
                    return;
                }
                Main.library = self;
                try
                {
                    Main.logger.Log("Loading Kingmaker AI");

#if DEBUG
                    bool allow_guid_generation = true;
#else
                    bool allow_guid_generation = false; //no guids should be ever generated in release
#endif
                    CallOfTheWild.Helpers.GuidStorage.load(Properties.Resources.blueprints, allow_guid_generation);

                    UpdateAi.load();

#if DEBUG
                    string guid_file_name = @"C:\Repositories\KingmakerAI\KingmakerAI\blueprints.txt";
                    CallOfTheWild.Helpers.GuidStorage.dump(guid_file_name);
#endif
                    CallOfTheWild.Helpers.GuidStorage.dump(@"./Mods/KingmakerAI/loaded_blueprints.txt");
                }
                catch (Exception ex)
                {
                    Main.DebugError(ex);
                }
            }
Beispiel #2
0
            static void Postfix(LibraryScriptableObject __instance)
            {
                var self = __instance;

                if (Main.library != null)
                {
                    return;
                }
                Main.library = self;
                try
                {
                    Main.logger.Log("Loading Kingmaker AI");

#if DEBUG
                    bool allow_guid_generation = true;
#else
                    bool allow_guid_generation = false; //no guids should be ever generated in release
#endif
                    CallOfTheWild.Helpers.GuidStorage.load(Properties.Resources.blueprints, allow_guid_generation);

                    UpdateAi.load();
                    Core.load();
                    EndlessDungeon.load();

#if DEBUG
                    string guid_file_name = @"C:\Repositories\KingmakerAI\KingmakerAI\blueprints.txt";
                    CallOfTheWild.Helpers.GuidStorage.dump(guid_file_name);
#endif
                    CallOfTheWild.Helpers.GuidStorage.dump(@"./Mods/KingmakerAI/loaded_blueprints.txt");
                    Scripting.UI.initialize(Main.settings.scripts_working_folder, Main.settings.party_info_file);

                    Type TurnController       = Type.GetType("TurnBased.Controllers.TurnController, TurnBased");
                    Type TurnControllerOwlcat = Type.GetType("TurnBased.Controllers.TurnController, Assembly-CSharp");
                    if (TurnController != null)
                    {
                        logger.Log("Found TurnBased mod, patching...");
                        harmony.Patch(Harmony12.AccessTools.Method(TurnController, "ContinueActing"),
                                      postfix: new Harmony12.HarmonyMethod(typeof(TurnBasedPatches.TurnController_ContinueActing_Patch), "Postfix")
                                      );
                        harmony.Patch(Harmony12.AccessTools.Method(TurnController, "ContinueWaiting"),
                                      postfix: new Harmony12.HarmonyMethod(typeof(TurnBasedPatches.TurnController_ContinueWaiting_Patch), "Postfix")
                                      );
                    }
                    else if (TurnControllerOwlcat != null)
                    {
                        logger.Log("Found Official TurnBased, patching...");
                        harmony.Patch(Harmony12.AccessTools.Method(TurnControllerOwlcat, "ContinueActing"),
                                      postfix: new Harmony12.HarmonyMethod(typeof(TurnBasedOwlcatsPatches.TurnController_ContinueActing_Patch), "Postfix")
                                      );

                        harmony.Patch(Harmony12.AccessTools.Method(TurnControllerOwlcat, "ContinueWaiting"),
                                      prefix: new Harmony12.HarmonyMethod(typeof(TurnBasedOwlcatsPatches.TurnController_ContinueWaiting_Patch), "Prefix")
                                      );
                    }
                    else
                    {
                        logger.Log("TurnBased mod not found.");
                    }
                }
                catch (Exception ex)
                {
                    Main.DebugError(ex);
                }
            }