public override int GetTrainingMax(DFCareer.Skills skill) { // Language skill training is capped by char intelligence instead of default int playerINT = GameManager.Instance.PlayerEntity.Stats.PermanentIntelligence; return((DaggerfallSkills.IsLanguageSkill(skill)) ? playerINT : defaultTrainingMax); }
public void TrainingSkill_OnItemPicked(int index, string skillName) { CloseWindow(); List <DFCareer.Skills> trainingSkills; if (guildTrainingSkills.TryGetValue(service, out trainingSkills)) { DFCareer.Skills skillToTrain = trainingSkills[index]; int maxTraining = 50; if (DaggerfallSkills.IsLanguageSkill(skillToTrain)) // BCHG: Language skill training is capped by char intelligence instead of 50% { maxTraining = playerEntity.Stats.PermanentIntelligence; } if (playerEntity.Skills.GetPermanentSkillValue(skillToTrain) > maxTraining) { // Inform player they're too skilled to train TextFile.Token[] tokens = DaggerfallUnity.Instance.TextProvider.GetRandomTokens(TrainingTooSkilledId); DaggerfallMessageBox messageBox = new DaggerfallMessageBox(uiManager, uiManager.TopWindow); messageBox.SetTextTokens(tokens, this); messageBox.ClickAnywhereToClose = true; uiManager.PushWindow(messageBox); } else { // Train the skill DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime(); now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3); playerEntity.DeductGoldAmount(GetServicePrice()); playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180); int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skillToTrain); short tallyAmount = (short)(UnityEngine.Random.Range(10, 21) * skillAdvancementMultiplier); playerEntity.TallySkill(skillToTrain, tallyAmount); DaggerfallUI.MessageBox(TrainSkillId); } } else { Debug.LogError("Invalid skill selected for training."); } }