private void HireCustomMecenariesViaGameMenu(bool buyingOne, bool toPartyLimit)
        {
            if (MobileParty.MainParty.CurrentSettlement == null || !MobileParty.MainParty.CurrentSettlement.IsTown)
            {
                return;
            }
            CustomMercData customMercData = GetCustomMercDataOfPlayerEncounter();

            if (customMercData == null)
            {
                return;
            }
            int numOfTroopSlotsOpen  = PartyBase.MainParty.PartySizeLimit - PartyBase.MainParty.NumberOfAllMembers;
            int troopRecruitmentCost = this.troopRecruitmentCost(customMercData);

            if (customMercData.Number > 0 && Hero.MainHero.Gold >= troopRecruitmentCost && (!toPartyLimit || numOfTroopSlotsOpen > 0))
            {
                int numOfMercs = 1;
                if (!buyingOne)
                {
                    int numOfTroopPlayerCanBuy = (troopRecruitmentCost == 0) ? customMercData.Number : Hero.MainHero.Gold / troopRecruitmentCost;
                    numOfMercs = Math.Min(customMercData.Number, numOfTroopPlayerCanBuy);
                    if (toPartyLimit)
                    {
                        numOfMercs = Math.Min(numOfTroopSlotsOpen, numOfMercs);
                    }
                }
                MobileParty.MainParty.MemberRoster.AddToCounts(customMercData.TroopInfoCharObject(), numOfMercs, false, 0, 0, true, -1);
                GiveGoldAction.ApplyBetweenCharacters(null, Hero.MainHero, -(numOfMercs * troopRecruitmentCost), false);
                customMercData.ChangeMercenaryCount(-numOfMercs);
                GameMenu.SwitchToMenu("town_backstreet");
            }
        }
        // Actual Hiring from Tavern
        private void HireCustomMercenariesInTavern(bool buyOne, bool pastPartyLimit = false)
        {
            if (MobileParty.MainParty.CurrentSettlement == null || !MobileParty.MainParty.CurrentSettlement.IsTown)
            {
                return;
            }
            CustomMercData customMercData = GetCustomMercDataOfPlayerEncounter();

            if (customMercData == null)
            {
                return;
            }

            int troopRecruitmentCost = this.troopRecruitmentCost(customMercData);
            int numberOfMercsToHire  = 0;

            if (buyOne)
            {
                numberOfMercsToHire = 1;
            }
            else
            {
                int numOfTroopSlotsOpen = PartyBase.MainParty.PartySizeLimit - PartyBase.MainParty.NumberOfAllMembers;
                while (Hero.MainHero.Gold > troopRecruitmentCost * (numberOfMercsToHire + 1) && customMercData.Number > numberOfMercsToHire && (pastPartyLimit || numOfTroopSlotsOpen > numberOfMercsToHire))
                {
                    numberOfMercsToHire++;
                }
            }
            customMercData.ChangeMercenaryCount(-numberOfMercsToHire);
            MobileParty.MainParty.AddElementToMemberRoster(customMercData.TroopInfoCharObject(), numberOfMercsToHire, false);
            int amount = numberOfMercsToHire * troopRecruitmentCost;

            GiveGoldAction.ApplyBetweenCharacters(Hero.MainHero, null, amount, false);
            CampaignEventDispatcher.Instance.OnUnitRecruited(customMercData.TroopInfoCharObject(), numberOfMercsToHire);
        }