private static void ml_garrison_buy_patrol_menu_init(MenuCallbackArgs args, Dictionary <string, List <TownPatrolData> > dict)
        {
            args.MenuTitle = new TextObject("Commander's Office", null);

            MBTextManager.SetTextVariable("ML_GARRISON_PATROL_NUM", dict[Settlement.CurrentSettlement.StringId].Count());
            MBTextManager.SetTextVariable("ML_GARRISON_PATROL_MAX", TownUtils.GetNumberOfDetachmentsFormable(Settlement.CurrentSettlement.Town));
        }
        public void AddMenuOptions(CampaignGameStarter starter)
        {
            #region Entering garrison headquarters

            starter.AddGameMenuOption("town", "ml_go_to_garrison", "{=ml.garrison.start}Go to the garrison headquarters",
                                      new GameMenuOption.OnConditionDelegate(GarrisonCommandCampaignBehavior.ml_menu_enter_garrison_condition),
                                      (MenuCallbackArgs args) =>
            {
                GarrisonCommandCampaignBehavior.ml_menu_start_enter_garrison_consequence(args, _mlBribedTowns);
            }, false, 4, false);

            #region Bribing

            starter.AddGameMenu("ml_garrison_bribe_enter", "{=ml.garrison.guards.refuse}The guards inform you that you're not allowed to enter and waive you off.",
                                (MenuCallbackArgs args) =>
            {
                GarrisonCommandCampaignBehavior.ml_garrison_enter_bribe_menu_init(args, _mlBribedTowns);
            },
                                TaleWorlds.CampaignSystem.Overlay.GameOverlays.MenuOverlayType.SettlementWithBoth, GameMenu.MenuFlags.none, null);
            starter.AddGameMenuOption("ml_garrison_bribe_enter", "ml_bribe_guards_into_garrison", "{=ml.bribe.guards}Try to bribe the guards with {GOLD_ICON}{ML_BRIBE_AMOUNT}.",
                                      new GameMenuOption.OnConditionDelegate(GarrisonCommandCampaignBehavior.ml_menu_bribe_guards_condition),
                                      (MenuCallbackArgs args) =>
            {
                GarrisonCommandCampaignBehavior.ml_menu_bribe_guards_consequence(args);
                _mlBribedTowns.Add(Settlement.CurrentSettlement);
            }, false, -1, false);
            starter.AddGameMenuOption("ml_garrison_bribe_enter", "ml_bribe_guards_leave", "{=ml.leave}Leave.",
                                      new GameMenuOption.OnConditionDelegate(GarrisonCommandCampaignBehavior.ml_leave_condition),
                                      (MenuCallbackArgs args) =>
            {
                GameMenu.SwitchToMenu("town");
            }, true, -1, false);

            #endregion Bribing

            #endregion Entering garrison headquarters

            #region Garrison menu

            #region Base

            starter.AddGameMenu("ml_garrison_menu", "{=ml.garrison.flavortext}You step into the garrison headquarters of {ML_GARRISON_TOWN_NAME}, a {ML_GARRISON_DESC} adjacent to the keep. Inside you can see {ML_GARRISON_FLAVOR} \n \n You can gauge the air in the room is one {ML_GARRISON_SATISFACTION}",
                                new OnInitDelegate(GarrisonCommandCampaignBehavior.ml_town_init_garrison_menu), TaleWorlds.CampaignSystem.Overlay.GameOverlays.MenuOverlayType.SettlementWithBoth, GameMenu.MenuFlags.none, null);
            starter.AddGameMenuOption("ml_garrison_menu", "ml_garrison_leave", "{=ml.leave}Leave.",
                                      new GameMenuOption.OnConditionDelegate(GarrisonCommandCampaignBehavior.ml_leave_condition),
                                      (MenuCallbackArgs args) =>
            {
                GameMenu.SwitchToMenu("town");
            }, true, -1, false);

            #endregion Base

            #region Talking to garrison commander

            starter.AddGameMenu("ml_garrison_talk_commander_menu", "{ML_COMMANDER_INTRO}",
                                new OnInitDelegate(GarrisonCommandCampaignBehavior.ml_garrison_commander_intro_menu_init), TaleWorlds.CampaignSystem.Overlay.GameOverlays.MenuOverlayType.SettlementWithBoth, GameMenu.MenuFlags.none, null);
            starter.AddGameMenuOption("ml_garrison_talk_commander_menu", "ml_garrison_commander_buy_patrols", "{=ml.talk.commander.about.patrols}Form a garrison detachment.",
                                      (MenuCallbackArgs args) =>
            {
                bool isFull = false;
                if (!_mlTownPatrols.ContainsKey(Settlement.CurrentSettlement.StringId))
                {
                    _mlTownPatrols.Add(Settlement.CurrentSettlement.StringId, new List <TownPatrolData>());
                }
                else if (_mlTownPatrols[Settlement.CurrentSettlement.StringId].Count() >= TownUtils.GetNumberOfDetachmentsFormable(Settlement.CurrentSettlement.Town))
                {
                    isFull = true;
                }
                return(GarrisonCommandCampaignBehavior.ml_ask_garrison_detachment_condition(args, isFull));
            },
                                      (MenuCallbackArgs args) =>
            {
                GarrisonCommandCampaignBehavior.ml_ask_garrison_detachment_consequence(args);
            }, false, -1, false);

            #endregion Talking to garrison commander

            #region Buying patrols menu

            starter.AddGameMenu("ml_patrol_buying_menu", "Below is a list of the available types of patrols you can purchase for this settlement. \n \n Settlement patrols: ({ML_GARRISON_PATROL_NUM}/{ML_GARRISON_PATROL_MAX})",
                                (MenuCallbackArgs args) =>
            {
                ml_garrison_buy_patrol_menu_init(args, _mlTownPatrols);
            },
                                TaleWorlds.CampaignSystem.Overlay.GameOverlays.MenuOverlayType.SettlementWithBoth, GameMenu.MenuFlags.none, null);

            //here we repetedly define menu options in the foreach loop- can lead to probelms down the line if patrols are changed or something, for now it's fine
            foreach (PatrolData dat in manager.Patrols)
            {
                starter.AddGameMenuOption("ml_patrol_buying_menu", "ml_garrison_buy_patrol_" + dat.templateName, "{=ml.buy.text}Buy " + dat.name + " (starting at " + dat.basePrice + "{GOLD_ICON})",
                                          (MenuCallbackArgs args) =>
                {
                    args.optionLeaveType = GameMenuOption.LeaveType.Recruit;
                    args.Tooltip         = new TextObject(dat.description);
                    if (Settlement.CurrentSettlement.Culture == dat.culture)
                    {
                        if (Hero.MainHero.Gold >= dat.basePrice)
                        {
                            return(true);
                        }
                        args.IsEnabled = false;
                        args.Tooltip   = new TextObject("You do not have enough money to buy this patrol.");
                        return(true);
                    }
                    return(false);
                },
                                          (MenuCallbackArgs args) =>
                {
                    return;
                }, false, -1, false);
            }


            #endregion Buying patrols menu

            #endregion Garrison menu
        }