public static void LeaveKingdomDebug(Clan clan) { if (!SettingsHelper.SystemDebugEnabled(AOSystems.EnsuredLoyalty, DebugType.General, clan)) { return; } InDebugBranch = true; LeaveKingdomAsClanBarterable asClanBarterable = new LeaveKingdomAsClanBarterable(clan.Leader, null); int ClanBarterableValueForFaction = asClanBarterable.GetValueForFaction(clan); int StayThreshold = (Settings.Instance.FixMinorFactionVassals ? clan.IsUnderMercenaryService : clan.IsMinorFaction) ? 500 : 0; bool NativeDecision = ClanBarterableValueForFaction <= StayThreshold; TextObject ResultTextObject = new TextObject(Debug_Leave); StringHelper.SetEntitiyProperties(ResultTextObject, "LEAVING_CLAN", clan, true); StringHelper.SetNumericVariable(ResultTextObject, "LEAVE_BARTERABLE", ClanBarterableValueForFaction, "N0"); StringHelper.SetNumericVariable(ResultTextObject, "LEAVE_THRESHOLD", StayThreshold, "N0"); ResultTextObject.SetTextVariable("CLAN_DECISION", NativeDecision ? StayDecision : LeaveDecision); bool IsLoyaltyEnsured = LoyaltyManager.CheckLoyalty(clan, out TextObject LoyaltyTextObject); LoyaltyTextObject.SetTextVariable("TRANSITION_PART", NativeDecision == IsLoyaltyEnsured ? LoyaltyManager.TransitionFromSame : LoyaltyManager.TransitionFromDifferent); ResultTextObject.SetTextVariable("ENSURED_LOYALTY_RESULT", LoyaltyTextObject); MessageHelper.SimpleMessage(ResultTextObject); InDebugBranch = false; }
private ComplexCost GetWithholdCost() { if (!SettingsHelper.SubSystemEnabled(SubSystemType.LoyaltyWithholding, LeavingClan)) { return(null); } if (TargetKingdom != null) { JoinKingdomAsClanBarterable asClanBarterable = new JoinKingdomAsClanBarterable(LeavingClan.Leader, TargetKingdom); int ClanBarterableValueForClan = asClanBarterable.GetValueForFaction(LeavingClan); int ClanBarterableValueForKingdom = asClanBarterable.GetValueForFaction(TargetKingdom); ClanBarterable = asClanBarterable; BarterableSum = ClanBarterableValueForClan + ClanBarterableValueForKingdom; } else { LeaveKingdomAsClanBarterable asClanBarterable = new LeaveKingdomAsClanBarterable(LeavingClan.Leader, null); int ClanBarterableValueForFaction = asClanBarterable.GetValueForFaction(LeavingClan); ClanBarterable = asClanBarterable; BarterableSum = ClanBarterableValueForFaction - (LeavingClan.IsMinorFaction ? 500 : 0); } if (BarterableSum <= Settings.Instance.WithholdToleranceLimit * 1000000) { return(null); } BaseCalculatedCost = Math.Sqrt(BarterableSum) / Math.Log10(BarterableSum); return (new ComplexCost ( (int)(BaseCalculatedCost * Settings.Instance.WithholdInfluenceMultiplier), Settings.Instance.UseWithholdBribing && Settings.Instance.WithholdToleranceLimitForBribes * 1000000 < BarterableSum ? (int)BaseCalculatedCost * Settings.Instance.WithholdGoldMultiplier : 0 )); }