From 281cef9769b1ea68b1451b08b76c7c9b41accb5a Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Mon, 6 Jul 2020 20:28:08 +0200 Subject: [PATCH] The 3 skill selected by a trainer are based on its 3 best skills. The skills are sorted either on their base value or on their modified one depending on the new setting 'trainers training skills based on base skill' --- apps/openmw/mwgui/trainingwindow.cpp | 16 +++++++++++++++- files/settings-default.cfg | 3 +++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp index e4e4bae5a5..91e9ce3cb5 100644 --- a/apps/openmw/mwgui/trainingwindow.cpp +++ b/apps/openmw/mwgui/trainingwindow.cpp @@ -14,6 +14,8 @@ #include "../mwmechanics/npcstats.hpp" #include "../mwmechanics/actorutil.hpp" +#include + #include "tooltips.hpp" namespace @@ -32,6 +34,17 @@ bool sortSkills (const std::pair& left, const std::pair& rig return left.first < right.first; } + +// Retrieve the base skill value if the setting 'training skills based on base skill' is set; +// otherwise returns the modified skill +float getSkillForTraining(const MWMechanics::NpcStats& stats, int i) +{ + static const bool trainersTrainingSkillsBasedOnBaseSkill = Settings::Manager::getBool("trainers training skills based on base skill", "Game"); + if (trainersTrainingSkillsBasedOnBaseSkill) + return stats.getSkill(i).getBase(); + return stats.getSkill(i).getModified(); +} + } namespace MWGui @@ -76,9 +89,10 @@ namespace MWGui // NPC can train you in his best 3 skills std::vector< std::pair > skills; + MWMechanics::NpcStats const& actorStats(actor.getClass().getNpcStats(actor)); for (int i=0; i