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(); }