private static void conversation_set_up_safe_passage_barter_on_consequence(DialogueParams param)
        {
            BarterManager instance = BarterManager.Instance;
            Hero          oneToOneConversationHero = Hero.OneToOneConversationHero;
            PartyBase     mainParty  = PartyBase.MainParty;
            PartyBase     otherParty = MobileParty.ConversationParty?.Party;

            BarterManager.BarterContextInitializer initContext =
                new BarterManager.BarterContextInitializer(BarterManager.Instance.InitializeSafePassageBarterContext);
            int  persuasionCostReduction = 0;
            bool isAIBarter = false;


            if (Hero.OneToOneConversationHero == null)
            {
                Barterable[] array = new Barterable[1];
                array[0] = new SafePassageBarterable(null, Hero.MainHero, otherParty, PartyBase.MainParty);
                instance.StartBarterOffer(Hero.MainHero, oneToOneConversationHero, mainParty, otherParty, null, initContext,
                                          persuasionCostReduction, isAIBarter, array);
            }
            else
            {
                Barterable[] array = new Barterable[2];
                array[0] = new SafePassageBarterable(oneToOneConversationHero, Hero.MainHero, otherParty, PartyBase.MainParty);
                array[1] = new NoAttackBarterable(Hero.MainHero, oneToOneConversationHero, mainParty,
                                                  otherParty, CampaignTime.Days(5f));
                instance.StartBarterOffer(Hero.MainHero, oneToOneConversationHero, mainParty, otherParty, null,
                                          initContext, persuasionCostReduction, isAIBarter, array);
            }
        }
        private static void end_conversation_battle_consequence_delegate(DialogueParams param)
        {
            if (PlayerEncounter.Current == null)
            {
                return;
            }

            PlayerEncounter.Current.IsEnemy = true;
        }
        private void declare_war_consequence_delegate(DialogueParams param)
        {
            PartyBase encounteredParty = PlayerEncounter.EncounteredParty;

            if (encounteredParty == null)
            {
                return;
            }
            _diplomacyModel.DeclareWar(Hero.MainHero.MapFaction, encounteredParty.MapFaction);
        }
        private static void surrender_consequence_delegate(DialogueParams param, string isPlayer) // for surrenders you need to update the player encounter- not sure if this closes the window or not
        {
            isPlayer = isPlayer.ToLower();

            if (isPlayer == "true")
            {
                PlayerEncounter.PlayerSurrender = true;
            }
            else if (isPlayer == "false")
            {   //Interestingly, PlayerEncounter.EnemySurrender = true; results in a null reference crash.
                param.PlayerParty.Party.AddPrisoners(param.AdversaryParty.Party.MemberRoster);
                param.AdversaryParty.RemoveParty();
                CustomSpawns.UX.ShowMessage("You have taken your enemies prisoner.", TaleWorlds.Library.Colors.Green);
                end_conversation_consequence_delegate(param);
            }
            else
            {
                ErrorHandler.ShowPureErrorMessage("Can't interpret " + isPlayer.ToString() + " as a bool. Possible typo in the XML consequence 'Surrender'");
            }
            PlayerEncounter.Update();
        }
        private static void barter_for_peace_consequence_delegate(DialogueParams param) // looks like a lot, I just stole most of this from tw >_>
        {
            BarterManager instance = BarterManager.Instance;
            Hero          mainHero = Hero.MainHero;
            Hero          oneToOneConversationHero = Hero.OneToOneConversationHero;
            PartyBase     mainParty              = PartyBase.MainParty;
            MobileParty   conversationParty      = MobileParty.ConversationParty;
            PartyBase     otherParty             = (conversationParty != null) ? conversationParty.Party : null;
            Hero          beneficiaryOfOtherHero = null;

            BarterManager.BarterContextInitializer initContext = new BarterManager.BarterContextInitializer(BarterManager.Instance.InitializeMakePeaceBarterContext);
            int  persuasionCostReduction = 0;
            bool isAIBarter = false;

            Barterable[] array              = new Barterable[1];
            int          num                = 0;
            Hero         originalOwner      = conversationParty.MapFaction.Leader;
            Hero         mainHero2          = Hero.MainHero;
            MobileParty  conversationParty2 = MobileParty.ConversationParty;

            array[num] = new PeaceBarterable(originalOwner, conversationParty.MapFaction, mainHero.MapFaction, CampaignTime.Years(1f));
            instance.StartBarterOffer(mainHero, oneToOneConversationHero, mainParty, otherParty, beneficiaryOfOtherHero, initContext, persuasionCostReduction, isAIBarter, array);
        }
 private static void end_conversation_consequence_delegate(DialogueParams param)
 {
     PlayerEncounter.LeaveEncounter = true;
 }