internal void CECaptivityContinue(ref MenuCallbackArgs args)
        {
            CEPersistence.animationPlayEvent = false;

            try
            {
                if (PlayerCaptivity.CaptorParty != null)
                {
                    string waitingList = new WaitingList().CEWaitingList();

                    if (waitingList != null)
                    {
                        GameMenu.ActivateGameMenu(waitingList);
                    }
                    else
                    {
                        new CESubModule().LoadTexture("default");

                        GameMenu.SwitchToMenu(PlayerCaptivity.CaptorParty.IsSettlement
                                                  ? "settlement_wait"
                                                  : "prisoner_wait");
                    }
                }
                else
                {
                    new CESubModule().LoadTexture("default");
                    GameMenu.ExitToLast();
                }
            }
            catch (Exception e)
            {
                CECustomHandler.ForceLogToFile("Critical Error: CECaptivityContinue : " + e);
            }
        }
        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));
        }
Exemple #3
0
        public static void TournamentTypeSelectConsequence(MenuCallbackArgs args)
        {
            List <InquiryElement> tournamentTypeElements = new List <InquiryElement>();

            tournamentTypeElements.Add(new InquiryElement("melee", new TextObject("{=tourn008}Standard Melee Tournament").ToString(), new ImageIdentifier("battania_noble_sword_2_t5", ImageIdentifierType.Item)));
            tournamentTypeElements.Add(new InquiryElement("melee2", new TextObject("{=tourn009}Individual Only Melee Tournament").ToString(), new ImageIdentifier("battania_noble_sword_2_t5", ImageIdentifierType.Item)));
#if DEBUG
            //tournamentTypeElements.Add(new InquiryElement("archery", "Archery Tournament", new ImageIdentifier("training_longbow", ImageIdentifierType.Item)));
            //tournamentTypeElements.Add(new InquiryElement("joust", "Jousting Tournament", new ImageIdentifier("khuzait_lance_3_t5", ImageIdentifierType.Item)));
            //tournamentTypeElements.Add(new InquiryElement("race", "Horse Racing Tournament", new ImageIdentifier("desert_war_horse", ImageIdentifierType.Item)));
            tournamentTypeElements.Add(new InquiryElement("race", "External Application Tournament", new ImageIdentifier("desert_war_horse", ImageIdentifierType.Item)));
#endif
            InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(
                                                             new TextObject("{=tourn010}Tournament Type Selection").ToString(), new TextObject("{=tourn011}What kind of Tournament would you like to compete in today?").ToString(), tournamentTypeElements, true, true, new TextObject("{=tourn006}OK").ToString(), new TextObject("{=tourn007}Cancel").ToString(),
                                                             new Action <List <InquiryElement> >(OnSelectTournamentStyle), new Action <List <InquiryElement> >(OnSelectDoNothing)), true);

            try
            {
                GameMenu.SwitchToMenu("town_arena");
            }
            catch (Exception ex)
            {
                ErrorLog.Log("ERROR: BMTournamentXP: Select TournyType: Refreshing Arena Menu:");
                ErrorLog.Log(ex.ToStringFull());
            }
        }
 private static bool ml_menu_enter_garrison_condition(MenuCallbackArgs args)
 {
     SettlementAccessModel.AccessDetails access;
     Campaign.Current.Models.SettlementAccessModel.CanMainHeroEnterKeep(Settlement.CurrentSettlement, out access);
     if (access.AccessLevel == SettlementAccessModel.AccessLevel.NoAccess)
     {
         SettlementAccessModel.AccessLimitationReason limitReason = access.AccessLimitationReason;
         if (limitReason == SettlementAccessModel.AccessLimitationReason.HostileFaction)
         {
             args.IsEnabled = false;
             if (limitReason == SettlementAccessModel.AccessLimitationReason.Disguised)
             {
                 args.Tooltip = new TextObject("{=ml.garrison.noentry.disguised}Entering the garrison headquarters while disguised would draw unnecessary suspicion.", null);
             }
             else
             {
                 args.Tooltip = new TextObject("{=ml.garrison.cannot.enter}You cannot enter an enemy garrison headquarters.", null);
             }
         }
     }
     if (Settlement.CurrentSettlement.IsUnderSiege)
     {
         args.IsEnabled = false;
         args.Tooltip   = new TextObject("{ml.garrison.under.siege}The settlement is under siege.");
     }
     args.optionLeaveType = GameMenuOption.LeaveType.Submenu;
     return(true);
 }
        private void ml_form_garrison_detachment_consequence(MenuCallbackArgs args, PatrolData dat)
        {
            List <InquiryElement> inq = MenuUtils.AssemblePatrolSizes(dat);

            InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=ml.patrol.size.select}Select Size").ToString(), new TextObject("{=ml.patrol.size.select.desc}Select the size of the patrol you want.").ToString(), inq, true, 1, "Name and purchase", "Cancel",
                                                                                       delegate(List <InquiryElement> selection)
            {
                if (selection != null)
                {
                    if (selection.Count != 0)
                    {
                        InformationManager.ShowTextInquiry(new TextInquiryData(new TextObject("{=ml.name.patrol}Select your patrol's name: ", null).ToString(), string.Empty, true, false, GameTexts.FindText("str_done", null).ToString(), null,
                                                                               delegate(string str)
                        {
                            TownPatrolData newPatrol = SpawnTownPatrol(str, selection[0].Title.ToLower(), dat, true);
                            this._mlTownPatrols[Settlement.CurrentSettlement.StringId].Add(newPatrol);
                            InformationManager.HideInquiry();
                        }, null, false, null, "", Settlement.CurrentSettlement.Name.ToString() + " " + dat.name));
                    }
                }
            },
                                                                                       delegate(List <InquiryElement> selection)
            {
                InformationManager.HideInquiry();
            }));
        }
Exemple #6
0
        private static void CheckEnemyAttackableHonorably(MenuCallbackArgs args)
        {
            if (MobileParty.MainParty.Army != null && MobileParty.MainParty.Army.LeaderParty != MobileParty.MainParty || PlayerEncounter.PlayerIsDefender)
            {
                return;
            }
            IFaction mapFaction;

            if (PlayerEncounter.EncounteredMobileParty != null)
            {
                mapFaction = PlayerEncounter.EncounteredMobileParty.MapFaction;
            }
            else
            {
                if (PlayerEncounter.EncounteredParty == null)
                {
                    return;
                }
                mapFaction = PlayerEncounter.EncounteredParty.MapFaction;
            }
            if (mapFaction == null || !mapFaction.NotAttackableByPlayerUntilTime.IsFuture)
            {
                return;
            }
            args.IsEnabled = false;
            args.Tooltip   = EnemyNotAttackableTooltip;
        }
Exemple #7
0
        public static bool Prefix(MenuCallbackArgs args, ref bool __result)
        {
            SettlementAccessModel.AccessDetails accessDetails;
            Campaign.Current.Models.SettlementAccessModel.CanMainHeroEnterKeep(Settlement.CurrentSettlement, out accessDetails);

            /*if (accessDetails.AccessLevel == SettlementAccessModel.AccessLevel.NoAccess)
             * {
             *  args.IsEnabled = false;
             *  switch (accessDetails.AccessLimitationReason)
             *  {
             *      case SettlementAccessModel.AccessLimitationReason.HostileFaction:
             *          args.Tooltip = new TextObject("{=b3shPt8Q}You cannot enter an enemy keep.", (Dictionary<string, TextObject>)null);
             *          break;
             *      case SettlementAccessModel.AccessLimitationReason.Disguised:
             *          args.Tooltip = new TextObject("{=f91LSbdx}You cannot enter the keep while in disguise.", (Dictionary<string, TextObject>)null);
             *          break;
             *      case SettlementAccessModel.AccessLimitationReason.LocationEmpty:
             *          args.Tooltip = new TextObject("{=cojKmfSk}There is no one inside.", (Dictionary<string, TextObject>)null);
             *          break;
             *  }
             * }*/
            List <Location> list = Settlement.CurrentSettlement.LocationComplex.FindAll((Func <string, bool>)(x => x == "lordshall" || x == "prison")).ToList <Location>();

            args.OptionIssueType   = Campaign.Current.IssueManager.CheckIssueForMenuLocations(list);
            args.OptionQuestStatus = Campaign.Current.QuestManager.CheckQuestForMenuLocations(list);
            args.optionLeaveType   = GameMenuOption.LeaveType.Submenu;
            __result = true;
            return(false);
        }
        public static void wait_menu_settlement_wait_on_tick(MenuCallbackArgs args, CampaignTime dt)
        {
            int captiveTimeInDays = PlayerCaptivity.CaptiveTimeInDays;

            if (captiveTimeInDays == 0)
            {
                return;
            }

            TextObject variable = null;

            if (Hero.MainHero.IsPrisoner && Hero.MainHero.PartyBelongedToAsPrisoner.Settlement != null)
            {
                variable = Hero.MainHero.PartyBelongedToAsPrisoner.Settlement.Name;
            }

            if (variable == null)
            {
                variable = Settlement.CurrentSettlement.Name;
            }

            TextObject text       = args.MenuContext.GameMenu.GetText();
            TextObject textObject = GameTexts.FindText("str_prisoner_of_settlement_for_days_menu_text", null);

            textObject.SetTextVariable("NUMBER_OF_DAYS", captiveTimeInDays);
            textObject.SetTextVariable("PLURAL", (captiveTimeInDays > 1) ? 1 : 0);
            textObject.SetTextVariable("SETTLEMENT_NAME", variable);
            text.SetTextVariable("CAPTIVITY_TEXT", textObject);
        }
 private static bool game_menu_town_wait_on_condition(MenuCallbackArgs args)
 {
     args.MenuContext.GameMenu.AllowWaitingAutomatically();
     args.optionLeaveType = GameMenuOption.LeaveType.Wait;
     MBTextManager.SetTextVariable("CURRENT_SETTLEMENT", Settlement.CurrentSettlement.EncyclopediaLinkWithName, false);
     return(true);
 }
        private static bool GameMenuTownRecruitTroopsOnCondition(MenuCallbackArgs args)
        {
            var canPlayerDo = Campaign.Current.Models.SettlementAccessModel.CanMainHeroDoSettlementAction(Settlement.CurrentSettlement, SettlementAccessModel.SettlementAction.RecruitTroops, out var shouldBeDisabled, out var disabledText);

            args.optionLeaveType = GameMenuOption.LeaveType.Recruit;
            return(MenuHelper.SetOptionProperties(args, canPlayerDo, shouldBeDisabled, disabledText));
        }
        private static void settlement_wait_on_init(MenuCallbackArgs args)
        {
            args.MenuContext.GameMenu.SetMenuAsWaitMenuAndInitiateWaiting();
            TextObject text = args.MenuContext.GameMenu.GetText();

            TextObject variable = null;

            if (Hero.MainHero.IsPrisoner && Hero.MainHero.PartyBelongedToAsPrisoner.Settlement != null)
            {
                variable = Hero.MainHero.PartyBelongedToAsPrisoner.Settlement.Name;
            }

            if (variable == null)
            {
                variable = Settlement.CurrentSettlement.Name;
            }

            int        captiveTimeInDays = PlayerCaptivity.CaptiveTimeInDays;
            TextObject textObject;

            if (captiveTimeInDays == 0)
            {
                textObject = GameTexts.FindText("str_prisoner_of_settlement_menu_text", null);
            }
            else
            {
                textObject = GameTexts.FindText("str_prisoner_of_settlement_for_days_menu_text", null);
                textObject.SetTextVariable("NUMBER_OF_DAYS", captiveTimeInDays);
                textObject.SetTextVariable("PLURAL", (captiveTimeInDays > 1) ? 1 : 0);
            }
            textObject.SetTextVariable("SETTLEMENT_NAME", variable);
            text.SetTextVariable("CAPTIVITY_TEXT", textObject);
        }
        internal void CECaptorReleasePrisoners(MenuCallbackArgs args, int amount = 10, bool releaseHeroes = false)
        {
            try
            {
                int prisonerCount = MobileParty.MainParty.PrisonRoster.Count;
                if (prisonerCount < amount)
                {
                    amount = prisonerCount;
                }
                MobileParty.MainParty.PrisonRoster.KillNumberOfMenRandomly(amount, false);
                if (releaseHeroes)
                {
                    foreach (TroopRosterElement element in MobileParty.MainParty.PrisonRoster.GetTroopRoster())
                    {
                        if (element.Character.IsHero)
                        {
                            element.Character.HeroObject.ChangeState(Hero.CharacterStates.Active);
                        }
                    }
                    MobileParty.MainParty.PrisonRoster.Clear();
                }

                TextObject textObject = GameTexts.FindText("str_CE_release_prisoners");
                textObject.SetTextVariable("HERO", Hero.MainHero.Name);
                textObject.SetTextVariable("AMOUNT", amount);
                InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
            }
            catch (Exception)
            {
                CECustomHandler.LogToFile("Couldn't release any prisoners.");
            }
        }
        public static bool game_menu_town_find_courier_on_condition(MenuCallbackArgs args)
        {
            // TODO: any conditions to check?

            args.optionLeaveType = GameMenuOption.LeaveType.Submenu;
            return(true);
        }
        internal void CECaptivityEscapeAttempt(ref MenuCallbackArgs args, int escapeChance = 10)
        {
            if (MBRandom.Random.Next(100) > escapeChance + new ScoresCalculation().EscapeProwessScore(Hero.MainHero))
            {
                if (CESettings.Instance != null && !CESettings.Instance.SexualContent)
                {
                    GameMenu.SwitchToMenu(Hero.MainHero.IsFemale
                                              ? "CE_captivity_escape_failure"
                                              : "CE_captivity_escape_failure_male");
                }
                else
                {
                    GameMenu.SwitchToMenu(Hero.MainHero.IsFemale
                                              ? "CE_captivity_sexual_escape_failure"
                                              : "CE_captivity_sexual_escape_failure_male");
                }

                return;
            }

            if (CESettings.Instance != null && !CESettings.Instance.SexualContent)
            {
                GameMenu.SwitchToMenu(Hero.MainHero.IsFemale
                                          ? "CE_captivity_escape_success"
                                          : "CE_captivity_escape_success_male");
            }
            else
            {
                GameMenu.SwitchToMenu(Hero.MainHero.IsFemale
                                          ? "CE_captivity_sexual_escape_success"
                                          : "CE_captivity_sexual_escape_success_male");
            }
        }
Exemple #15
0
        bool OpenSlelectTroops(MenuCallbackArgs args, TroopRoster initialRoster, int maxNum, Func <CharacterObject, bool> canChangeStatusOfTroop, Action <TroopRoster> onDone)
        {
            bool excueted = false;;

            if (null != args.MenuContext.Handler as MenuViewContext)
            {
                excueted = true;
                MenuViewContext menuViewContext = (MenuViewContext)args.MenuContext.Handler;
                MenuView        menuView        = null;
                menuView = menuViewContext.AddMenuView <SpousesDefaultSelectTroops>(new object[]
                {
                    initialRoster,
                    maxNum,
                    canChangeStatusOfTroop,
                    onDone,
                    new Action(() => {
                        if (null != menuView)
                        {
                            menuViewContext.RemoveMenuView(menuView);
                        }
                    })
                });
            }

            return(excueted);
        }
Exemple #16
0
        public void OnPrizeSelectMenuConsequence(MenuCallbackArgs args)
        {
            var prizeList = MBItemObject.GetAvailableTournamentPrizes();

            ShowPrizeSelectionMenu(prizeList, OnSelectPrize, OnDeSelectPrize);
            GameMenu.SwitchToMenu("town_arena");
        }
Exemple #17
0
        public static void RerollConsequence(MenuCallbackArgs args)
        {
            try
            {
                var            tournamentInfo = GetTournamentInfo(Settlement.CurrentSettlement.Town);
                TournamentGame tournamentGame = Campaign.Current.TournamentManager.GetTournamentGame(Settlement.CurrentSettlement.Town);

                //Clear old prizes
                tournamentInfo.SelectedPrizeStringId = "";
                tournamentInfo.PrizePool             = new List <PrizeItem>();
                tournamentInfo.ReRollsUsed++;

                //Generate New Prize
                var prize = GenerateTournamentPrize(tournamentGame, tournamentInfo, false, true);
                SetTournamentSelectedPrize(tournamentGame, prize);

                try
                {
                    GameMenu.SwitchToMenu("town_arena");
                }
                catch (Exception ex)
                {
                    ErrorLog.Log("ERROR: BMTournamentXP: Re-roll: Refreshing Arena Menu:");
                    ErrorLog.Log(ex.ToStringFull());
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Log("Re-roll Prize Pool");
                ErrorLog.Log(ex.ToStringFull());
            }
        }
        private void ArmouryOnConsequence(MenuCallbackArgs args)
        {
            ItemRoster itemRoster = new ItemRoster();
            string     culture    = Settlement.CurrentSettlement.Culture.StringId;

            List <string> cultureItems = new List <string>();

            CULTURE_TO_ITEMS_DICT.TryGetValue(culture, out cultureItems);

            int itemSelectionCount = RANDOM.Next(MIN_ITEM_SELECTION_COUNT, MAX_ITEM_SELECTION_COUNT);

            for (int i = 0; i < itemSelectionCount; i++)
            {
                ItemObject cultureItem = MBObjectManager.Instance.GetObject <ItemObject>(cultureItems.GetRandomElement());
                if (cultureItem != null)
                {
                    itemRoster.AddToCounts(cultureItem, RANDOM.Next(MIN_ITEM_COUNT, MAX_ITEM_COUNT));
                }
                ItemObject swadianItem = MBObjectManager.Instance.GetObject <ItemObject>(SWADIAN_ITEMS.GetRandomElement());
                if (swadianItem != null)
                {
                    itemRoster.AddToCounts(swadianItem, RANDOM.Next(MIN_ITEM_COUNT, MAX_ITEM_COUNT));
                }
            }

            InventoryManager.OpenScreenAsTrade(itemRoster, Settlement.CurrentSettlement.Town, InventoryManager.InventoryCategoryType.None, null);
        }
Exemple #19
0
        private static bool WatchSiegeCondition(MenuCallbackArgs args)
        {
            try
            {
                args.optionLeaveType = GameMenuOption.LeaveType.Mission;
                if (MobileParty.MainParty.BesiegedSettlement == null || !Hero.MainHero.IsWounded)
                {
                    args.IsEnabled = false;
                    return(false);
                }
                if (MobileParty.MainParty.BesiegedSettlement != null && MobileParty.MainParty.BesiegedSettlement.SiegeEvent != null && MobileParty.MainParty.BesiegedSettlement.SiegeEvent.BesiegerCamp != null && MobileParty.MainParty.BesiegedSettlement.SiegeEvent.BesiegerCamp.BesiegerParty == MobileParty.MainParty)
                {
                    Settlement settlement = PlayerEncounter.EncounteredParty != null ? PlayerEncounter.EncounteredParty.Settlement : PlayerSiege.PlayerSiegeEvent.BesiegedSettlement;
                    if (PlayerSiege.PlayerSide == BattleSideEnum.Attacker && !settlement.SiegeEvent.BesiegerCamp.IsPreparationComplete)
                    {
                        args.IsEnabled = false;
                        args.Tooltip   = new TextObject("{=bCuxzp1N}You need to wait for the siege equipment to be prepared.");
                        return(true);
                    }

                    args.IsEnabled = true;
                    args.Tooltip   = GameTexts.FindText("str_rts_camera_watch_mode_tool_tip");
                    return(true);
                }
            }
            catch (Exception e)
            {
                Utility.DisplayMessage(e.ToString());
            }

            return(false);
        }
        private bool game_menu_steal_atempt_on_condition(MenuCallbackArgs args)
        {
            args.optionLeaveType = GameMenuOption.LeaveType.ForceToGiveGoods;      //Option icon

            if (this._settlementLastStealDetectionTimeDictionary != null && this._settlementLastStealDetectionTimeDictionary.ContainsKey(Settlement.CurrentSettlement.StringId))
            {
                if (this._settlementLastStealDetectionTimeDictionary[Settlement.CurrentSettlement.StringId].ElapsedDaysUntilNow <= 10f)
                {
                    args.IsEnabled = false;
                    args.Tooltip   = new TextObject("You have been detected stealing from this settlement recently.", null);
                }
                else
                {
                    this._settlementLastStealDetectionTimeDictionary.Remove(Settlement.CurrentSettlement.StringId);
                }
            }

            int num = MathF.Ceiling((float)Settlement.CurrentSettlement.ItemRoster.TotalFood * 0.2f);

            if (MobileParty.MainParty.CurrentSettlement != null && num <= 0)
            {
                args.IsEnabled = false;
                args.Tooltip   = new TextObject("This settlement has no goods to steal.", null);
            }

            if (Hero.MainHero.Clan == Settlement.CurrentSettlement.OwnerClan)
            {
                args.IsEnabled = false;
                args.Tooltip   = new TextObject("This settlement is owned by your clan.", null);
            }

            return(true);
        }
Exemple #21
0
        public static bool Prefix(MenuCallbackArgs args)
        {
            SettlementAccessModel.AccessDetails accessDetails;
            Campaign.Current.Models.SettlementAccessModel.CanMainHeroEnterKeep(Settlement.CurrentSettlement, out accessDetails);
            switch (accessDetails.AccessLevel)
            {
            case SettlementAccessModel.AccessLevel.LimitedAccess:
                if (accessDetails.LimitedAccessSolution != SettlementAccessModel.LimitedAccessSolution.Bribe)
                {
                    break;
                }
                GameMenu.SwitchToMenu("town_keep_bribe");
                break;

            case SettlementAccessModel.AccessLevel.NoAccess:
                GameMenu.SwitchToMenu("town_keep_bribe");
                break;

            case SettlementAccessModel.AccessLevel.FullAccess:
                GameMenu.SwitchToMenu("town_keep");
                break;
            }
            return(false);

            //if (FactionManager.IsAtWarAgainstFaction(Settlement.CurrentSettlement.MapFaction, Hero.MainHero.MapFaction))
        }
        private bool game_menu_steal_encounter_threat_on_condition(MenuCallbackArgs args)
        {
            args.optionLeaveType = GameMenuOption.LeaveType.ForceToGiveGoods;      //Option icon

            if (!isDetected)
            {
                return(false);
            }

            int relationCost = 50;

            if (Settlement.CurrentSettlement.Notables == null)
            {
                args.IsEnabled = false;
                args.Tooltip   = new TextObject("There is no Gang Leader notables in this settlement.", null);
            }
            else
            {
                foreach (Hero notableHero in Settlement.CurrentSettlement.Notables)
                {
                    if (notableHero.IsGangLeader && CharacterRelationManager.GetHeroRelation(Hero.MainHero, notableHero) > relationCost)
                    {
                        args.IsEnabled = true;
                        return(true);
                    }
                }
                args.IsEnabled = false;
                args.Tooltip   = new TextObject("No Gang Leader notables in this settlmenet have a relation higher than " + relationCost + " with you.", null);
            }
            return(true);
        }
 private static bool ml_ask_garrison_detachment_condition(MenuCallbackArgs args, bool isFull)
 {
     args.optionLeaveType = GameMenuOption.LeaveType.Manage;
     if (!(Settlement.CurrentSettlement.MapFaction == Hero.MainHero.MapFaction))
     {
         bool playerOwnsWorkshop = false;
         foreach (Workshop w in Settlement.CurrentSettlement.Town.Workshops)
         {
             if (w.Owner == Hero.MainHero)
             {
                 playerOwnsWorkshop = true;
             }
         }
         if (!playerOwnsWorkshop)
         {
             args.IsEnabled = false;
             args.Tooltip   = new TextObject("You are not affiliated with this settlement.");
         }
     }
     else if (isFull)
     {
         args.IsEnabled = false;
         args.Tooltip   = new TextObject("This settlement has reached the maximum number of patrols.");
     }
     return(true);
 }
        private bool HireCustomMercsViaMenuConditionToPartyLimit(MenuCallbackArgs args)
        {
            if (MobileParty.MainParty.CurrentSettlement == null || !MobileParty.MainParty.CurrentSettlement.IsTown)
            {
                return(false);
            }
            CustomMercData customMercData = GetCustomMercDataOfPlayerEncounter();

            if (customMercData != null && customMercData.Number > 0)
            {
                int troopRecruitmentCost   = this.troopRecruitmentCost(customMercData);
                int numOfTroopSlotsOpen    = PartyBase.MainParty.PartySizeLimit - PartyBase.MainParty.NumberOfAllMembers;
                int numOfTroopPlayerCanBuy = (troopRecruitmentCost == 0) ? customMercData.Number : Hero.MainHero.Gold / troopRecruitmentCost;
                if (numOfTroopSlotsOpen > 0 && Hero.MainHero.Gold >= troopRecruitmentCost && numOfTroopSlotsOpen < customMercData.Number && numOfTroopSlotsOpen < numOfTroopPlayerCanBuy)
                {
                    int numOfMercs = Math.Min(customMercData.Number, numOfTroopPlayerCanBuy);
                    numOfMercs = Math.Min(numOfTroopSlotsOpen, numOfMercs);
                    MBTextManager.SetTextVariable("C_MEN_COUNT_PL", numOfMercs);
                    MBTextManager.SetTextVariable("C_MERCENARY_NAME_PL", customMercData.TroopInfoCharObject().Name);
                    MBTextManager.SetTextVariable("C_TOTAL_AMOUNT_PL", numOfMercs * troopRecruitmentCost);
                    args.optionLeaveType = GameMenuOption.LeaveType.RansomAndBribe;
                    return(true);
                }
            }
            return(false);
        }
        private static void ml_garrison_commander_intro_menu_init(MenuCallbackArgs args)
        {
            args.MenuTitle = new TextObject("Commander's Office", null);
            TextObject comment = new TextObject();

            if (Settlement.CurrentSettlement.OwnerClan == Hero.MainHero.Clan)
            {
                comment = new TextObject("{=ml.commander.town.clan}You knock on the door that says 'Commander,' and after a short wait a stout man with misadjusted spectacles comes and quickly hails you before speaking. \n \n 'Nothing to report, your {ML_PLAYER_G_PREFIX}ship. Is there something you need?'", null);
            }
            else if (Settlement.CurrentSettlement.MapFaction == Hero.MainHero.MapFaction)
            {
                comment = new TextObject("{=ml.commander.town.faction}You knock on the door that says 'Commander,' and after a short wait a stout man with misadjusted spectacles steps out and cordially greets you before speaking. \n \n 'Hello, my {ML_PLAYER_G_PREFIX}. I'll forward your business to the steward of this town when he returns. Is there something you need?'", null);
            }
            else
            {
                comment = new TextObject("{=ml.commander.town}You knock on the door that says 'Commander,' and after a short wait a stout man pushes open the door and greets you. \n \n 'Hmm? What is it? I'm a busy man.'", null);
            }

            if (Hero.MainHero.IsFemale)
            {
                comment.SetTextVariable("ML_PLAYER_G_PREFIX", "lady");
            }
            else
            {
                comment.SetTextVariable("ML_PLAYER_G_PREFIX", "lord");
            }

            MBTextManager.SetTextVariable("ML_COMMANDER_INTRO", comment);
        }
Exemple #26
0
        private void MenuInit(MenuCallbackArgs args)
        {
            this._lastSettlement = Settlement.CurrentSettlement;
            this._parties        = Settlement.CurrentSettlement.Parties.Where(obj => null != obj.ActualClan && obj.ActualClan != Clan.PlayerClan);
            this._lordHeros      = Settlement.CurrentSettlement.HeroesWithoutParty.Where(obj => obj.CharacterObject.Occupation == Occupation.Lord && obj.Clan != Clan.PlayerClan);
            if (null != this._prisoners)
            {
                this._prisoners.Clear();
            }
            if (null != Settlement.CurrentSettlement.GetComponent <Town>())
            {
                this._prisoners = Settlement.CurrentSettlement.GetComponent <Town>().GetPrisonerHeroes();
            }


            GameMenuManager gameMenuManager = (GameMenuManager)ReflectUtils.ReflectField("_gameMenuManager", _gameStarter);

            if (null != gameMenuManager)
            {
                Dictionary <string, GameMenu> gamemenu = (Dictionary <string, GameMenu>)ReflectUtils.ReflectField("_gameMenus", gameMenuManager);
                List <string>   menuKey   = gamemenu.Keys.ToList();
                List <GameMenu> menuValue = gamemenu.Values.ToList();
                for (int i = 1; i < menuValue.Count; i++)
                {
                    if (menuValue[i].StringId == "sms_sneak_party" || menuValue[i].StringId == "sms_sneak_lord_whitout_party")
                    {
                        gamemenu.Remove(menuKey[i]);
                    }
                }
            }
            MenuPartyInit(args);
            MenuLordWithoutPartyInit(args);
        }
Exemple #27
0
        public static void RerollConsequence(MenuCallbackArgs args)
        {
            try
            {
                TournamentPrizePool settings       = GetTournamentPrizePool(Settlement.CurrentSettlement);
                TournamentGame      tournamentGame = Campaign.Current.TournamentManager.GetTournamentGame(Settlement.CurrentSettlement.Town);

                //Clear old prizes
                settings.SelectedPrizeStringId = null;
                settings.Prizes = new ItemRoster();
                settings.RemainingRerolls--;

                //Generate New Prize
                var prize = GenerateTournamentPrize(tournamentGame, settings, false);
                SetTournamentSelectedPrize(tournamentGame, prize);

                try
                {
                    GameMenu.SwitchToMenu("town_arena");
                }
                catch (Exception ex)
                {
                    ErrorLog.Log("ERROR: BMTournamentXP: Re-roll: Refreshing Arena Menu:");
                    ErrorLog.Log(ex.ToStringFull());
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Log("Re-roll Prize Pool");
                ErrorLog.Log(ex.ToStringFull());
            }
        }
Exemple #28
0
 public bool ShowCondition(MenuCallbackArgs args)
 {
     return(null != this._sneaker &&
            MobileParty.MainParty.MemberRoster.Contains(this._sneaker.CharacterObject) &&
            Campaign.Current.IsNight
            );
 }
        private static void ToggleOutput(MenuCallbackArgs args)
        {
            var stash = GetCurrentSettlementStash();

            stash.OutputToStash = !stash.OutputToStash;
            GameMenu.SwitchToMenu("town_workshop_stash");
        }
        public void conversation_noble_on_consequence(MenuCallbackArgs args)
        {
            TroopProperties troopProperties;

            this.troopDic.TryGetValue(Settlement.CurrentSettlement.StringId, out troopProperties);
            PartyScreenManager.OpenScreenAsManageTroops(troopProperties.nobles);
        }