static HarmonyPatches() { HarmonyInstance harmony = HarmonyInstance.Create(id: "mehni.rimworld.MFI.main"); //HarmonyInstance.DEBUG = true; #region MoreTraders harmony.Patch(original: AccessTools.Method(type: typeof(TraderKindDef), name: nameof(TraderKindDef.PriceTypeFor)), prefix: null, postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(PriceTypeSetter_PostFix))); harmony.Patch(original: AccessTools.Method(type: typeof(StoryState), name: nameof(StoryState.Notify_IncidentFired)), prefix: null, postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(IncidentFired_TradeCounter_Postfix))); harmony.Patch(original: AccessTools.Method(type: typeof(CompQuality), name: nameof(CompQuality.PostPostGeneratedForTrader)), prefix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(CompQuality_TradeQualityIncreasePreFix))); harmony.Patch(original: AccessTools.Method(type: typeof(ThingSetMaker), name: nameof(ThingSetMaker.Generate), parameters: new Type[] { typeof(ThingSetMakerParams) }), prefix: null, postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(TraderStocker_OverStockerPostFix))); harmony.Patch(original: AccessTools.Method(type: typeof(Tradeable), name: "InitPriceDataIfNeeded"), prefix: null, postfix: null, transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(ErrorSuppressionSssh))); #endregion #region WorldIncidents harmony.Patch(original: AccessTools.Method(type: typeof(SettlementBase), name: nameof(SettlementBase.GetCaravanGizmos)), prefix: null, postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(SettlementBase_CaravanGizmos_Postfix))); harmony.Patch(original: AccessTools.Method(type: typeof(WorldReachabilityUtility), name: nameof(WorldReachabilityUtility.CanReach)), prefix: null, postfix: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(WorldReachUtility_PostFix))); #endregion harmony.Patch(original: AccessTools.Method(type: typeof(DebugWindowsOpener), name: "ToggleDebugActionsMenu"), prefix: null, postfix: null, transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(DebugWindowsOpener_ToggleDebugActionsMenu_Patch))); harmony.Patch(original: AccessTools.Method(type: typeof(ThoughtWorker_PsychicEmanatorSoothe), name: "CurrentStateInternal"), prefix: null, postfix: null, transpiler: new HarmonyMethod(type: typeof(HarmonyPatches), name: nameof(PsychicEmanatorSoothe_Transpiler))); if (ModsConfig.ActiveModsInLoadOrder.Any(m => m.Name == "Relations Tab")) { try { ((Action)(() => { float func(Faction faction, Vector2 pos, float width) { if (Find.World.GetComponent <WorldComponent_MFI_FactionWar>().StuffIsGoingDown) { Rect canvas = new Rect(pos.x, pos.y, width, 125f); MainTabWindow_FactionWar.DrawFactionWarBar(canvas); return(125f); } return(0); } Fluffy_Relations.MainTabWindow_Relations.ExtraFactionDetailDrawers.Add(func); }))(); } catch (TypeLoadException) { } } }
public void ResolveWar() { Find.LetterStack.ReceiveLetter("MFI_FactionWarOverLabel".Translate(), "MFI_FactionWarOver".Translate(WarringFactionOne, WarringFactionTwo), LetterDefOf.PositiveEvent); this.warIsOngoing = false; this.SetFirstWarringFaction(null); this.SetSecondWarringFaction(null); MainTabWindow_FactionWar.ResetBars(); }
static float func(Faction faction, Vector2 pos, float width) { if (!Find.World.GetComponent <WorldComponent_MFI_FactionWar>().StuffIsGoingDown) { return(0); } var canvas = new Rect(pos.x, pos.y, width, 125f); MainTabWindow_FactionWar.DrawFactionWarBar(canvas); return(125f); }
private void ResolveWar() { warIsOngoing = false; SetFirstWarringFaction(null); SetSecondWarringFaction(null); allFactionsInVolvedInWar.Clear(); MainTabWindow_FactionWar.ResetBars(); Find.LetterStack.ReceiveLetter("MFI_FactionWarOverLabel".Translate(), "MFI_FactionWarOver".Translate(WarringFactionOne, WarringFactionTwo), LetterDefOf.PositiveEvent); }