private void TrainingSkill_OnItemPicked(int index, string skillName) { CloseWindow(); List <DFCareer.Skills> trainingSkills = GetTrainingSkills(); DFCareer.Skills skillToTrain = trainingSkills[index]; if (playerEntity.Skills.GetPermanentSkillValue(skillToTrain) > guild.GetTrainingMax(skillToTrain)) { // 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, guild); messageBox.ClickAnywhereToClose = true; messageBox.Show(); } else { // Train the skill DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime(); now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3); playerEntity.DeductGoldAmount(guild.GetTrainingPrice()); playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180); int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skillToTrain); short tallyAmount = (short)(UnityEngine.Random.Range(10, 20 + 1) * skillAdvancementMultiplier); playerEntity.TallySkill(skillToTrain, tallyAmount); DaggerfallUI.MessageBox(TrainSkillId); } }
protected void TrainSkill(DFCareer.Skills skillToTrain) { DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime(); now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3); playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180); int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skillToTrain); short tallyAmount = (short)(UnityEngine.Random.Range(10, 20 + 1) * skillAdvancementMultiplier); playerEntity.TallySkill(skillToTrain, tallyAmount); DaggerfallUI.MessageBox(TrainSkillId); }
private void QuestCompleteMessage_OnClose() { PlayerEntity playerEntity = GameManager.Instance.PlayerEntity; // Train the skill, for free DaggerfallDateTime now = DaggerfallUnity.Instance.WorldTime.Now; playerEntity.TimeOfLastSkillTraining = now.ToClassicDaggerfallTime(); now.RaiseTime(DaggerfallDateTime.SecondsPerHour * 3); playerEntity.DecreaseFatigue(PlayerEntity.DefaultFatigueLoss * 180); int skillAdvancementMultiplier = DaggerfallSkills.GetAdvancementMultiplier(skill); short tallyAmount = (short)(UnityEngine.Random.Range(10, 20 + 1) * skillAdvancementMultiplier); playerEntity.TallySkill(skill, tallyAmount); }
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."); } }