public MoreFactionInteraction(ModContentPack mod) { var type = AccessTools.TypeByName("Multiplayer.Client.Patches.CloseDialogsForExpiredLetters"); // We should probably add this to the API the next time we update it var rejectMethods = (Dictionary <Type, MethodInfo>)AccessTools.Field(type, "rejectMethods").GetValue(null); type = AccessTools.TypeByName("MoreFactionInteraction.ChoiceLetter_ReverseTradeRequest"); var methods = MpMethodUtil.GetLambda(type, "Choices", MethodType.Getter, null, 0, 3).ToArray(); MP.RegisterSyncDelegate(type, methods[0].DeclaringType.Name, methods[0].Name); MP.RegisterSyncMethod(methods[1]); rejectMethods[type] = methods[1]; var typeNames = new[] { "MoreFactionInteraction.ChoiceLetter_DiplomaticMarriage", "MoreFactionInteraction.ChoiceLetter_ExtortionDemand", "MoreFactionInteraction.ChoiceLetter_MysticalShaman", }; foreach (var typeName in typeNames) { type = AccessTools.TypeByName(typeName); methods = MpMethodUtil.GetLambda(type, "Choices", MethodType.Getter, null, 0, 1).ToArray(); MP.RegisterSyncMethod(methods[0]); MP.RegisterSyncMethod(methods[1]); rejectMethods[type] = methods[1]; } typeNames = new[] { "MoreFactionInteraction.FactionWarPeaceTalks", "MoreFactionInteraction.More_Flavour.AnnualExpo", }; foreach (var typeName in typeNames) { type = AccessTools.TypeByName(typeName); MP.RegisterSyncDialogNodeTree(type, "Notify_CaravanArrived"); } type = AccessTools.TypeByName("MoreFactionInteraction.IncidentWorker_MysticalShaman"); MP.RegisterSyncDialogNodeTree(type, "TryExecuteWorker"); typeNames = new[] { "MoreFactionInteraction.IncidentWorker_MysticalShaman", "MoreFactionInteraction.IncidentWorker_ReverseTradeRequest", "MoreFactionInteraction.IncidentWorker_RoadWorks", }; foreach (var typeName in typeNames) { type = AccessTools.TypeByName(typeName); MP.RegisterSyncDialogNodeTree(type, "TryExecuteWorker"); } }
public VanillaFactionsSettlers(ModContentPack mod) { var type = AccessTools.TypeByName("VFE_Settlers.Utilities.UtilityEvent"); // Protection fee event MP.RegisterSyncDialogNodeTree(type, "ProtectionFee"); // Caravan gizmo - turn in wanted criminal to settlement MP.RegisterSyncDelegate(type, "<>c__DisplayClass8_0", "<CommandTurnInWanted>b__0"); // Toggle mode MpCompat.RegisterSyncMethodByIndex(AccessTools.TypeByName("Warmup.CompWarmUpReduction"), "<CompGetGizmosExtra>", 1); // Five fingers fillet table PatchingUtilities.PatchUnityRand("VFE_Settlers.JobGivers.JobDriver_PlayFiveFingerFillet:WatchTickAction", false); }