Exemple #1
0
        public static bool DoTamingJobs_Prefix(object __instance, ref bool actionTaken)
        {
            var wrapper = new JobsWrapper(__instance);

            wrapper.DoTamingJobs(ref actionTaken);
            return(false);
        }
Exemple #2
0
        public static void Patch(Harmony h)
        {
            WasPatched = true;

            try
            {
                _Widgets_Section_Section = typeof(Widgets_Section).GetMethod("Section");
                h.Patch(_Widgets_Section_Section,
                        prefix: new HarmonyMethod(typeof(ColonyManager), nameof(WidgetsSectionPrefix)));

                _ManagerTab_Livestock_DrawTamingSection = typeof(ManagerTab_Livestock).GetMethod("DrawTamingSection", BindingFlags.Instance | BindingFlags.NonPublic);
                h.Patch(AccessTools.Method(typeof(ManagerTab_Livestock), "DoContent"),
                        prefix: new HarmonyMethod(typeof(ColonyManager), nameof(DoContent_Prefix)),
                        postfix: new HarmonyMethod(typeof(ColonyManager), nameof(DoContent_Postfix)));

                h.Patch(AccessTools.Method(typeof(ManagerJob_Livestock), "DoButcherJobs"),
                        prefix: new HarmonyMethod(typeof(ColonyManager), nameof(DoButcherJobs_Prefix)));
                h.Patch(AccessTools.Method(typeof(ManagerJob_Livestock), "DoTamingJobs"),
                        prefix: new HarmonyMethod(typeof(ColonyManager), nameof(DoTamingJobs_Prefix)));
                h.Patch(AccessTools.Method(typeof(ManagerJob_Livestock), "ExposeData"),
                        postfix: new HarmonyMethod(typeof(ColonyManager), nameof(ExposeDataPatch)));

                JobsWrapper.Init();
            }
            catch (NullReferenceException)
            {
                Log.Message("Problem patching Colony Manager");
            }
        }