Пример #1
0
 public static void CheckCaptivityChange(float dt, ref string __result)
 {
     if (BannerlordCheatsSettings.Instance.InstantEscape)
     {
         PlayerCaptivity.EndCaptivity();
     }
 }
Пример #2
0
        internal void CECaptivityLeave(ref MenuCallbackArgs args)
        {
            new CESubModule().LoadTexture("default");
            PartyBase captorParty = PlayerCaptivity.CaptorParty;

            CECampaignBehavior.ExtraProps.Owner = null;

            if (!captorParty.IsSettlement || !captorParty.Settlement.IsTown)
            {
                PlayerCaptivity.EndCaptivity();
                return;
            }

            try
            {
                if (Hero.MainHero.IsAlive)
                {
                    if (Hero.MainHero.IsWounded)
                    {
                        Hero.MainHero.HitPoints = 20;
                    }

                    PlayerEncounter.ProtectPlayerSide();
                    MobileParty.MainParty.IsDisorganized = false;
                    PartyBase.MainParty.AddElementToMemberRoster(CharacterObject.PlayerCharacter, 1, true);
                }

                MobileParty.MainParty.CurrentSettlement = PlayerCaptivity.CaptorParty.Settlement;
                if (Campaign.Current.CurrentMenuContext != null)
                {
                    GameMenu.SwitchToMenu("town");
                }

                if (Hero.MainHero.IsAlive)
                {
                    Hero.MainHero.ChangeState(Hero.CharacterStates.Active);
                }

                if (captorParty.IsActive)
                {
                    captorParty.PrisonRoster.RemoveTroop(Hero.MainHero.CharacterObject);
                }

                if (Hero.MainHero.IsAlive)
                {
                    MobileParty.MainParty.IsActive = true;
                    PartyBase.MainParty.SetAsCameraFollowParty();
                    MobileParty.MainParty.SetMoveModeHold();
                    PartyBase.MainParty.UpdateVisibilityAndInspected(true);
                }

                PlayerCaptivity.CaptorParty = null;
            }
            catch (Exception)
            {
                PlayerCaptivity.EndCaptivity();
            }
        }
Пример #3
0
 public static void CheckCaptivityChange(float dt, ref string __result)
 {
     try
     {
         if (BannerlordCheatsSettings.Instance?.InstantEscape == true)
         {
             PlayerCaptivity.EndCaptivity();
         }
     }
     catch (Exception e)
     {
         SubModule.LogError(e, typeof(InstantEscape));
     }
 }
Пример #4
0
        private void ApplyEscapeConsequence()
        {
            if (!Outcome.Escaping)
            {
                return;
            }

            var p = IdentifySubject().ToTwHero();

            if (!p.IsPrisoner)
            {
                return;
            }

            if (p.IsHumanPlayerCharacter)
            {
                PlayerCaptivity.EndCaptivity();
            }
            else
            {
                SetPrisonerFreeAction.Apply(p, new Hero(GameData.Instance.GameContext.Heroes.Player).ToTwHero());
            }
        }
Пример #5
0
        internal void CECaptivityEscape(ref MenuCallbackArgs args)
        {
            CECampaignBehavior.ExtraProps.Owner = null;
            bool       wasInSettlement   = PlayerCaptivity.CaptorParty.IsSettlement;
            Settlement currentSettlement = PlayerCaptivity.CaptorParty.Settlement;

            TextObject textObject = GameTexts.FindText("str_CE_escape_success", wasInSettlement
                                                    ? "settlement"
                                                    : null);

            textObject.SetTextVariable("PLAYER_HERO", Hero.MainHero.Name);

            if (wasInSettlement)
            {
                string settlementName = currentSettlement != null
                    ? currentSettlement.Name.ToString()
                    : "ERROR";

                textObject.SetTextVariable("SETTLEMENT", settlementName);
            }

            new CESubModule().LoadTexture("default");
            PlayerCaptivity.EndCaptivity();
        }