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(); } }