public static void OnSetWarItemPatch(KingdomWarItemVM item, KingdomDiplomacyVM __instance) { try { if (SettingsHelper.SubSystemEnabled(SubSystemType.ElectionCooldownsForPlayer)) { bool HasCooldown = AOCooldownManager.HasDecisionCooldown(new MakePeaceKingdomDecision(Clan.PlayerClan, item.Faction2, applyResults: false), out float elapsedDaysUntilNow); __instance.IsActionEnabled = __instance.IsActionEnabled && !HasCooldown; __instance.ProposeActionExplanationText += HasCooldown ? "\n" + StringHelper.GetCooldownText(typeof(MakePeaceKingdomDecision), elapsedDaysUntilNow).ToString() : string.Empty; } } catch (Exception ex) { MethodInfo?methodInfo = MethodBase.GetCurrentMethod() as MethodInfo; DebugHelper.HandleException(ex, methodInfo, "Harmony patch for KingdomDiplomacyVM. OnSetWarItem"); } }
public static List <TextObject> CanMakePeaceExceptions(KingdomWarItemVM item) { return(CanMakePeaceExceptions(item.Faction1 as Kingdom, item.Faction2 as Kingdom, true)); }