Beispiel #1
0
        public VanillaFactionsSettlers(ModContentPack mod)
        {
            var type = AccessTools.TypeByName("VFE_Settlers.Utilities.UtilityEvent");

            // Protection fee event
            NodeTreeDialogSync.EnableNodeTreeDialogSync();
            MpCompat.harmony.Patch(AccessTools.Method(type, "ProtectionFee"), prefix: NodeTreeDialogSync.HarmonyMethodMarkDialogAsOpen);
            // Caravan gizmo - turn in wanted criminal to settlement
            MP.RegisterSyncDelegate(type, "<>c__DisplayClass8_0", "<CommandTurnInWanted>b__0");
            // Dev mode set progress to 1
            MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("VFE_Settlers.Buildings.Building_ChemshineBarrel"), "<GetGizmos>", 0);
            // Toggle mode
            MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("VanillaFactionsExpandedSettlers.CompWarmUpReduction"), "<CompGetGizmosExtra>", 1);
            // Five fingers fillet table
            PatchingUtilities.PatchUnityRand("VFE_Settlers.JobGivers.JobDriver_PlayFiveFingerFillet:WatchTickAction", false);
        }
        public VanillaFactionsMedieval(ModContentPack mod)
        {
            // Wine gizmo
            {
                // Select wine quality
                var outerType = AccessTools.TypeByName("VFEMedieval.Command_SetTargetWineQuality");
                var innerType = AccessTools.Inner(outerType, "<>c__DisplayClass1_0");
                qualityField = AccessTools.Field(innerType, "quality");

                MpCompat.RegisterSyncMethodByIndex(innerType, "<ProcessInput>", 1);
                MP.RegisterSyncWorker <object>(SyncWineBarrel, innerType, shouldConstruct: true);
                // Debug age wine by 1 day
                MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("VFEMedieval.CompWineFermenter"), "<CompGetGizmosExtra>", 0).SetDebugOnly();
            }

            // Tournament dialog
            {
                NodeTreeDialogSync.EnableNodeTreeDialogSync();
                MpCompat.harmony.Patch(AccessTools.Method(AccessTools.TypeByName("VFEMedieval.MedievalTournament"), "Notify_CaravanArrived"),
                                       prefix: NodeTreeDialogSync.HarmonyMethodMarkDialogAsOpen);
            }
        }