private void OnTrainButtonClickedNew(UISkillTrainingUpgrade upgradeView) { Game.CharacterStats.SkillType skillType = upgradeView.SkillType; float skillPerRankMultiplier = StatsData.Instance.GetSkillPerRankMultiplier(skillType); int skillRank = this.m_selectedCharacter.GetSkillRank(skillType); int num = skillRank + 1; if (num > this.m_trainer.maxSkillLevel) { UIMessageBox uIMessageBox = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), string.Format(SDK.GUIUtils.GetText(2129), this.m_trainer.maxSkillLevel)); uIMessageBox.ShowWindow(); return; } if (this.m_selectedCharacter.SkillsTrainedThisLevel >= this.m_selectedCharacter.Level * 5) { UIMessageBox uIMessageBox2 = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), SDK.GUIUtils.GetText(2132)); uIMessageBox2.ShowWindow(); return; } int num2 = Game.CharacterStats.CopperCostToTrainSkillToNextRank(num); Game.PlayerInventory component = Game.GameState.s_playerCharacter.GetComponent <Game.PlayerInventory>(); if (component == null || component.currencyTotalValue < (float)num2) { UIMessageBox uIMessageBox3 = UIWindowManager.ShowMessageBox(UIMessageBox.UIDialogButtons.OK, SDK.GUIUtils.GetText(2131), SDK.GUIUtils.GetText(2128)); uIMessageBox3.ShowWindow(); return; } if (Game.TelemetryManager.Instance && Game.Stronghold.Instance) { Game.TelemetryManager.Instance.QueueEvent_SkyPillarUpgradeUsed(SDK.TelemetryManager.Destination.Developer | SDK.TelemetryManager.Destination.Publisher, Game.Stronghold.Instance.GetUpgradeLocation(StrongholdUpgrade.Type.Weapons_Training), StrongholdUpgrade.Type.Weapons_Training, string.Empty, skillType); } GlobalAudioPlayer.SPlay(UIAudioList.UIAudioType.TrainSkill); int xp = Game.CharacterStats.ExperienceNeededForNextSkillRank(skillRank, skillPerRankMultiplier) - this.m_selectedCharacter.SkillXP[(int)skillType]; component.RemoveCurrency((float)num2, 1); this.m_selectedCharacter.SkillsTrainedThisLevel++; this.m_selectedCharacter.CalculateAndApplySkillXP(upgradeView.SkillType, xp, null, 0, 0); this.Reload(); }
private void OnClickNew() { if (m_currentPartyMember != null) { if (isRoster) { if (m_currentPartyMember.MemberStatus == PartyMemberStatus.InactiveOnAdventure) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.Ok, GuiStringTable.GetText(873), GuiStringTable.Format(896, m_currentPartyMember.Name, string.Empty)); } else if (UISingletonHudWindow <UIPartyManager> .Instance.Party.ActiveChildCount < 6) { UISingletonHudWindow <UIPartyManager> .Instance.PartyCharacter(m_currentPartyMember); } } else if (!m_currentPartyMember.IsPlayer) { UISingletonHudWindow <UIPartyManager> .Instance.BenchCharacter(m_currentPartyMember); } UISingletonHudWindow <UIPartyManager> .Instance.Reload(); } }
public void mod_FinalizeLevelLoad() { try { if (this.CurrentMap != null && !this.CurrentMap.HasBeenVisited && BonusXpManager.Instance && this.CurrentMap.GivesExplorationXp) { this.CurrentMap.HasBeenVisited = true; int mapExplorationXp = 0; if (BonusXpManager.Instance != null) { mapExplorationXp = BonusXpManager.Instance.MapExplorationXp; } Console.AddMessage(string.Concat("[", NGUITools.EncodeColor(Color.yellow), "]", Console.Format(GUIUtils.GetTextWithLinks(1633), new object[] { this.CurrentMap.DisplayName, mapExplorationXp * PartyHelper.NumPartyMembers }))); PartyHelper.AssignXPToParty(mapExplorationXp, false); } if (GameState.OnLevelLoaded != null) { GameState.OnLevelLoaded(Application.loadedLevelName, EventArgs.Empty); } if (GameState.NewGame && this.Difficulty == GameDifficulty.Easy) { GameState.Option.AutoPause.SetSlowEvent(AutoPauseOptions.PauseEvent.CombatStart, true); } ScriptEvent.BroadcastEvent(ScriptEvent.ScriptEvents.OnLevelLoaded); GameState.IsLoading = false; if (GameState.s_playerCharacter != null && !GameState.LoadedGame && !GameState.NewGame && GameState.NumSceneLoads > 0) { if (!IEModOptions.SaveBeforeTransition) // added this line { if (FogOfWar.Instance) { FogOfWar.Instance.WaitForFogUpdate(); } AutosaveIfAllowed(); } } GameState.NewGame = false; if (this.CurrentMap != null && this.CouldAccessStashOnLastMap != this.CurrentMap.GetCanAccessStash() && !GameState.Option.GetOption(GameOption.BoolOption.DONT_RESTRICT_STASH)) { if (!this.CurrentMap.GetCanAccessStash()) { UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1566), Color.white); } else { UISystemMessager.Instance.PostMessage(GUIUtils.GetText(1565), Color.white); } } GameState.NumSceneLoads = GameState.NumSceneLoads + 1; FatigueCamera.CreateCamera(); GammaCamera.CreateCamera(); WinCursor.Clip(true); if (this.CurrentMap != null) { TutorialManager.TutorialTrigger tutorialTrigger = new TutorialManager.TutorialTrigger(TutorialManager.TriggerType.ENTERED_MAP) { Map = this.CurrentMap.SceneName }; TutorialManager.STriggerTutorialsOfType(tutorialTrigger); } if (this.CurrentMap != null && this.CurrentMap.IsValidOnMap("px1")) { GameState.Instance.HasEnteredPX1 = true; if (GameGlobalVariables.HasStartedPX2()) { this.HasEnteredPX2 = true; } } // in here you can place something like if (CurrentMap.SceneName == "AR_0011_Dyrford_Tavern_02") make_an_NPC; or change_NPC's_stats; // added this code // Addition of autoload custom NPC stats if enabled if (IEModOptions.AutoLoadCustomStats) { ImportStats(); } DropButton.InjectDropInvButton(); if (IEModOptions.EnableCustomUi) { if (IEModOptions.Layout == null) { UICustomizer.Initialize(); IEModOptions.Layout = UICustomizer.DefaultLayout.Clone(); } else { UICustomizer.LoadLayout(IEModOptions.Layout); } } BackerNamesMod.FixBackerNames(IEModOptions.FixBackerNames); } catch (Exception exception) { Debug.LogException(exception); GameState.ReturnToMainMenuFromError(); } if (!this.RetroactiveSpellMasteryChecked) { for (int i = 0; i < (int)PartyMemberAI.PartyMembers.Length; i++) { if (PartyMemberAI.PartyMembers[i] != null) { CharacterStats component = PartyMemberAI.PartyMembers[i].GetComponent <CharacterStats>(); if (component) { if (component.MaxMasteredAbilitiesAllowed() > component.GetNumMasteredAbilities()) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, GUIUtils.GetText(2252), GUIUtils.GetText(2303)); break; } } } } this.RetroactiveSpellMasteryChecked = true; } if (GameUtilities.HasPX2() && GameState.LoadedGame) { if (GameGlobalVariables.HasFinishedPX1()) { QuestManager.Instance.StartPX2Umbrella(); } else if (!this.HasNotifiedPX2Installation) { UIWindowManager.ShowMessageBox(UIMessageBox.ButtonStyle.OK, string.Empty, GUIUtils.GetText(2438)); this.HasNotifiedPX2Installation = true; } } }