private static void SwitchToActiveTrainingMenu() { var trainingWaitMenuId = GetTrainingWaitMenuId(); GameMenu.ActivateGameMenu(trainingWaitMenuId); GameMenu.SwitchToMenu(trainingWaitMenuId); }
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_menu_bribe_guards_consequence(MenuCallbackArgs args) { int bribe = Campaign.Current.Models.BribeCalculationModel.GetBribeToEnterLordsHall(Settlement.CurrentSettlement); if (bribe == 0) { bribe = 500; } GiveGoldAction.ApplyBetweenCharacters(Hero.MainHero, null, bribe, false); GameMenu.ActivateGameMenu("ml_garrison_menu"); }
private static void ml_menu_start_enter_garrison_consequence(MenuCallbackArgs args, List <Settlement> bribedSettlements) { if ((Hero.MainHero.Clan.Tier <= 1) && !(bribedSettlements.Contains(Settlement.CurrentSettlement))) { GameMenu.ActivateGameMenu("ml_garrison_bribe_enter"); } else { GameMenu.ActivateGameMenu("ml_garrison_menu"); } }
private void OnCaptorNotificationInspect() { CEHelper.notificationCaptorExists = false; ExecuteRemove(); if (MobileParty.MainParty.Party.PrisonRoster.Count > 0 && MobileParty.MainParty.Party.PrisonRoster.Contains(_captorEvent.Captive)) { // Declare Variables string returnString = new CEEventChecker(_captorEvent).FlagsDoMatchEventConditions(_captorEvent.Captive, PartyBase.MainParty); if (returnString == null) { if (!(Game.Current.GameStateManager.ActiveState is MapState mapState)) { TextObject textObject = new TextObject("{=CEEVENTS1058}Event conditions are no longer met."); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Gray)); return; } Campaign.Current.LastTimeControlMode = Campaign.Current.TimeControlMode; if (!mapState.AtMenu) { if (CECampaignBehavior.ExtraProps != null) { CECampaignBehavior.ExtraProps.menuToSwitchBackTo = null; CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = null; } GameMenu.ActivateGameMenu(_captorEvent.Name); } else { if (CECampaignBehavior.ExtraProps != null) { CECampaignBehavior.ExtraProps.menuToSwitchBackTo = mapState.GameMenuId; CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = mapState.MenuContext.CurrentBackgroundMeshName; } GameMenu.SwitchToMenu(_captorEvent.Name); } } else { TextObject textObject = new TextObject("{=CEEVENTS1058}Event conditions are no longer met."); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Gray)); } } else { TextObject textObject = new TextObject("{=CEEVENTS1058}Event conditions are no longer met."); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Gray)); } }
private void OnRandomNotificationInspect() { CEHelper.notificationEventExists = false; ExecuteRemove(); string result = new CEEventChecker(_randomEvent).FlagsDoMatchEventConditions(CharacterObject.PlayerCharacter); if (result == null) { if (!(Game.Current.GameStateManager.ActiveState is MapState mapState)) { TextObject textObject = new TextObject("{=CEEVENTS1058}Event conditions are no longer met."); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Gray)); return; } Campaign.Current.LastTimeControlMode = Campaign.Current.TimeControlMode; if (!mapState.AtMenu) { if (CECampaignBehavior.ExtraProps != null) { CECampaignBehavior.ExtraProps.menuToSwitchBackTo = null; CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = null; } GameMenu.ActivateGameMenu(_randomEvent.Name); } else { if (CECampaignBehavior.ExtraProps != null) { CECampaignBehavior.ExtraProps.menuToSwitchBackTo = mapState.GameMenuId; CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = mapState.MenuContext.CurrentBackgroundMeshName; } GameMenu.SwitchToMenu(_randomEvent.Name); } } else { TextObject textObject = new TextObject("{=CEEVENTS1058}Event conditions are no longer met."); InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Gray)); } }
private static void ml_ask_garrison_detachment_consequence(MenuCallbackArgs args) { GameMenu.ActivateGameMenu("ml_patrol_buying_menu"); }
public void PlayAct(IAct act) { GameMenu.ExitToLast(); GameMenu.ActivateGameMenu(act.Id); RegisterPlayedAct(act); }
private void OnSessionLaunched(CampaignGameStarter starter) { MBTextManager.SetTextVariable("PLAYER_CAMP_STATE", "idling"); MBTextManager.SetTextVariable("PLAYER_CAMP_START_STOP", "Start"); starter.AddGameMenu( PlayerCampMenu, "Player camp.\n \nTroops are currently {PLAYER_CAMP_STATE}.\nResources left for {PLAYER_CAMP_RESOURCES} days.", null ); starter.AddGameMenuOption( PlayerCampMenu, "player_camp_train", "{PLAYER_CAMP_START_STOP} training", Utils.positiveLeaveType(GameMenuOption.LeaveType.Recruit), _ => { if (_establishedCamp != null) { _establishedCamp.IsTraining = !_establishedCamp.IsTraining; MBTextManager.SetTextVariable("PLAYER_CAMP_STATE", _establishedCamp.IsTraining ? "training" : "idling"); MBTextManager.SetTextVariable("PLAYER_CAMP_START_STOP", _establishedCamp.IsTraining ? "Stop" : "Start"); } } ); starter.AddGameMenuOption( PlayerCampMenu, "player_camp_remove", "Remove camp", Utils.positiveLeaveType(GameMenuOption.LeaveType.Continue), _ => { RemoveCamp(); PlayerEncounter.Finish(); }, true ); starter.AddGameMenuOption( PlayerCampMenu, "player_camp_wait", "Wait", Utils.positiveLeaveType(GameMenuOption.LeaveType.Wait), _ => GameMenu.ActivateGameMenu("player_camp_menu_wait") ); starter.AddGameMenuOption( PlayerCampMenu, "player_camp_leave", "Leave", Utils.positiveLeaveType(GameMenuOption.LeaveType.Leave), _ => PlayerEncounter.Finish() ); // wait menu starter.AddWaitGameMenu("player_camp_menu_wait", "Waiting.", null, args => { args.MenuContext.GameMenu.AllowWaitingAutomatically(); args.optionLeaveType = GameMenuOption.LeaveType.Wait; return(true); }, null, null, GameMenu.MenuAndOptionType.WaitMenuHideProgressAndHoursOption ); starter.AddGameMenuOption( "player_camp_menu_wait", "wait_leave", "{=UqDNAZqM}Stop waiting", Utils.positiveLeaveType(GameMenuOption.LeaveType.Leave), _ => GameMenu.ActivateGameMenu(PlayerCampMenu) ); }
private void OnHostTournamentMenuConsequence(MenuCallbackArgs args) { TournamentBuilder.TryCreatePlayerInitiatedTournament(); ModState.DaysSince[TournamentType.PlayerInitiated] = 0; GameMenu.ActivateGameMenu("town_arena"); }
private bool LaunchCaptorEvent(CEEvent OverrideEvent = null) { if (CESettings.Instance.EventCaptorNotifications) { if (notificationCaptorExists || progressEventExists) { return(false); } } CEEvent returnedEvent; if (OverrideEvent == null) { CharacterObject captive = MobileParty.MainParty.Party.PrisonRoster.GetTroopRoster().GetRandomElement().Character; returnedEvent = CEEventManager.ReturnWeightedChoiceOfEventsPartyLeader(captive); } else { returnedEvent = OverrideEvent; } if (returnedEvent == null) { return(false); } notificationCaptorExists = true; if (CESettings.Instance.EventCaptorNotifications) { try { if (!string.IsNullOrWhiteSpace(returnedEvent.NotificationName)) { new CESubModule().LoadCampaignNotificationTexture(returnedEvent.NotificationName); } else if (returnedEvent.SexualContent) { new CESubModule().LoadCampaignNotificationTexture("CE_sexual_notification"); } else { new CESubModule().LoadCampaignNotificationTexture("CE_castle_notification"); } } catch (Exception e) { InformationManager.DisplayMessage(new InformationMessage("LoadCampaignNotificationTextureFailure", Colors.Red)); CECustomHandler.ForceLogToFile("LoadCampaignNotificationTexture"); CECustomHandler.ForceLogToFile(e.Message + " : " + e); } Campaign.Current.CampaignInformationManager.NewMapNoticeAdded(new CECaptorMapNotification(returnedEvent, new TextObject("{=CEEVENTS1090}Captor event is ready"))); } else { if (Game.Current.GameStateManager.ActiveState is MapState mapState) { Campaign.Current.LastTimeControlMode = Campaign.Current.TimeControlMode; if (!mapState.AtMenu) { _extraVariables.menuToSwitchBackTo = null; _extraVariables.currentBackgroundMeshNameToSwitchBackTo = null; GameMenu.ActivateGameMenu("prisoner_wait"); } else { _extraVariables.menuToSwitchBackTo = mapState.GameMenuId; _extraVariables.currentBackgroundMeshNameToSwitchBackTo = mapState.MenuContext.CurrentBackgroundMeshName; } GameMenu.SwitchToMenu(returnedEvent.Name); } } return(true); }
internal void CECaptorContinue(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 { if (CECampaignBehavior.ExtraProps.menuToSwitchBackTo != null) { if (CECampaignBehavior.ExtraProps.menuToSwitchBackTo != "prisoner_wait") { GameMenu.SwitchToMenu(CECampaignBehavior.ExtraProps.menuToSwitchBackTo); } else { CECustomHandler.ForceLogToFile("General Error: CECaptorContinue : menuToSwitchBackTo : prisoner_wait"); if (Settlement.CurrentSettlement != null) { #if BETA EncounterManager.StartSettlementEncounter(MobileParty.MainParty, Settlement.CurrentSettlement); #else Campaign.Current.HandleSettlementEncounter(MobileParty.MainParty, Settlement.CurrentSettlement); #endif } else { GameMenu.ExitToLast(); } Campaign.Current.TimeControlMode = Campaign.Current.LastTimeControlMode; new CESubModule().LoadTexture("default"); return; } CECampaignBehavior.ExtraProps.menuToSwitchBackTo = null; if (CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo != null) { args.MenuContext.SetBackgroundMeshName(CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo); CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = null; } } else { if (Settlement.CurrentSettlement != null) { #if BETA EncounterManager.StartSettlementEncounter(MobileParty.MainParty, Settlement.CurrentSettlement); #else Campaign.Current.HandleSettlementEncounter(MobileParty.MainParty, Settlement.CurrentSettlement); #endif } else { GameMenu.ExitToLast(); } } Campaign.Current.TimeControlMode = Campaign.Current.LastTimeControlMode; new CESubModule().LoadTexture("default"); } } catch (Exception e) { CECampaignBehavior.ExtraProps.menuToSwitchBackTo = null; CECampaignBehavior.ExtraProps.currentBackgroundMeshNameToSwitchBackTo = null; CECustomHandler.ForceLogToFile("Critical Error: CECaptorContinue : " + e); } }
protected override void OnMenuOptionClicked(MenuCallbackArgs args) { GameMenu.ActivateGameMenu(Main.ModId); }