From 281cef9769b1ea68b1451b08b76c7c9b41accb5a Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Mon, 6 Jul 2020 20:28:08 +0200 Subject: [PATCH 1/6] 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 Date: Mon, 6 Jul 2020 20:30:14 +0200 Subject: [PATCH 2/6] The number of skills points a trainer can teach is based either on its base values or on its modified ones depending on the new setting 'trainers training skills based on base skill' value --- apps/openmw/mwgui/trainingwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp index 91e9ce3cb5..60eb797ee1 100644 --- a/apps/openmw/mwgui/trainingwindow.cpp +++ b/apps/openmw/mwgui/trainingwindow.cpp @@ -154,7 +154,7 @@ namespace MWGui if (price > player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId)) return; - if (mPtr.getClass().getSkill(mPtr, skillId) <= pcStats.getSkill (skillId).getBase ()) + if (getSkillForTraining(mPtr.getClass().getNpcStats(mPtr), skillId) <= pcStats.getSkill(skillId).getBase()) { MWBase::Environment::get().getWindowManager()->messageBox ("#{sServiceTrainingWords}"); return; From 998bf5da34f745202d823ef7bc3ad971bf64bd81 Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Mon, 6 Jul 2020 20:32:30 +0200 Subject: [PATCH 3/6] Add new checkbox for the new setting 'trainers training skills based on base skill' --- apps/launcher/advancedpage.cpp | 2 ++ files/ui/advancedpage.ui | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/apps/launcher/advancedpage.cpp b/apps/launcher/advancedpage.cpp index 866cec7286..e9db74cae1 100644 --- a/apps/launcher/advancedpage.cpp +++ b/apps/launcher/advancedpage.cpp @@ -90,6 +90,7 @@ bool Launcher::AdvancedPage::loadSettings() loadSettingBool(shieldSheathingCheckBox, "shield sheathing", "Game"); } loadSettingBool(uncappedDamageFatigueCheckBox, "uncapped damage fatigue", "Game"); + loadSettingBool(trainersTrainingSkillsBasedOnBaseSkillCheckBox, "trainers training skills based on base skill", "Game"); // Input Settings loadSettingBool(grabCursorCheckBox, "grab cursor", "Input"); @@ -155,6 +156,7 @@ void Launcher::AdvancedPage::saveSettings() saveSettingBool(weaponSheathingCheckBox, "weapon sheathing", "Game"); saveSettingBool(shieldSheathingCheckBox, "shield sheathing", "Game"); saveSettingBool(uncappedDamageFatigueCheckBox, "uncapped damage fatigue", "Game"); + saveSettingBool(trainersTrainingSkillsBasedOnBaseSkillCheckBox, "trainers training skills based on base skill", "Game"); // Input Settings saveSettingBool(grabCursorCheckBox, "grab cursor", "Input"); diff --git a/files/ui/advancedpage.ui b/files/ui/advancedpage.ui index 03b011b470..142cd72594 100644 --- a/files/ui/advancedpage.ui +++ b/files/ui/advancedpage.ui @@ -236,6 +236,16 @@ + + + + <html><head/><body><p>Trainers now only choose which skills to train using their base skill points, allowing mercantile improving effects to be used without making mercantile an offered skill.</p></body></html> + + + Trainers choose their training skills based on their base skill points + + + From 096e25b29a590a4667ab04046f1d2fd69517c7d3 Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Tue, 7 Jul 2020 09:50:02 +0200 Subject: [PATCH 4/6] Make the getSkillForTraining a member method of TrainingWindow class. The implementation is based now on the member of the class mTrainingSkillBasedOnBaseSkill instead of local static --- apps/openmw/mwgui/trainingwindow.cpp | 19 ++++++++----------- apps/openmw/mwgui/trainingwindow.hpp | 10 ++++++++++ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/trainingwindow.cpp b/apps/openmw/mwgui/trainingwindow.cpp index 60eb797ee1..d0176ece4b 100644 --- a/apps/openmw/mwgui/trainingwindow.cpp +++ b/apps/openmw/mwgui/trainingwindow.cpp @@ -34,17 +34,6 @@ 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 @@ -53,6 +42,7 @@ namespace MWGui TrainingWindow::TrainingWindow() : WindowBase("openmw_trainingwindow.layout") , mTimeAdvancer(0.05f) + , mTrainingSkillBasedOnBaseSkill(Settings::Manager::getBool("trainers training skills based on base skill", "Game")) { getWidget(mTrainingOptions, "TrainingOptions"); getWidget(mCancelButton, "CancelButton"); @@ -209,6 +199,13 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode(); } + float TrainingWindow::getSkillForTraining(const MWMechanics::NpcStats& stats, int skillId) const + { + if (mTrainingSkillBasedOnBaseSkill) + return stats.getSkill(skillId).getBase(); + return stats.getSkill(skillId).getModified(); + } + void TrainingWindow::onFrame(float dt) { checkReferenceAvailable(); diff --git a/apps/openmw/mwgui/trainingwindow.hpp b/apps/openmw/mwgui/trainingwindow.hpp index 2edad1f27c..955615516f 100644 --- a/apps/openmw/mwgui/trainingwindow.hpp +++ b/apps/openmw/mwgui/trainingwindow.hpp @@ -6,6 +6,11 @@ #include "timeadvancer.hpp" #include "waitdialog.hpp" +namespace MWMechanics +{ + class NpcStats; +} + namespace MWGui { @@ -35,12 +40,17 @@ namespace MWGui void onTrainingProgressChanged(int cur, int total); void onTrainingFinished(); + // 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 skillId) const; + MyGUI::Widget* mTrainingOptions; MyGUI::Button* mCancelButton; MyGUI::TextBox* mPlayerGold; WaitDialogProgressBar mProgressBar; TimeAdvancer mTimeAdvancer; + bool mTrainingSkillBasedOnBaseSkill; //corresponds to the setting 'training skills based on base skill' }; } From e51191b5ca6858c187ccbafea1dfeb8c4ca789ad Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Tue, 7 Jul 2020 17:54:31 +0200 Subject: [PATCH 5/6] Update documentation --- docs/source/reference/modding/settings/game.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/source/reference/modding/settings/game.rst b/docs/source/reference/modding/settings/game.rst index c27796aec6..9cac845a5f 100644 --- a/docs/source/reference/modding/settings/game.rst +++ b/docs/source/reference/modding/settings/game.rst @@ -330,3 +330,18 @@ If disabled then the whole character's body is pointed to the direction of view. If enabled then the character turns lower body to the direction of movement. Upper body is turned partially. Head is always pointed to the direction of view. In combat mode it works only for diagonal movement. In non-combat mode it also changes straight right and straight left movement. This setting can only be configured by editing the settings configuration file. + +trainers training skills based on base skill +----------------------- + +:Type: boolean +:Range: True/False +:Default: False + +The trainers in Morrowind choose their proposed training skills based on their 3 best attributes. + +If disabled then the 3 best skills of trainers and the training limits take into account fortified/drained trainer skill. + +If enabled then the 3 best skills of trainers and the training limits are based on the trainer base skills. + +This setting can be controlled in Advanced tab of the launcher. From d76b81a4a43cf3bce0c98fa355d9c4746889e5bd Mon Sep 17 00:00:00 2001 From: CedricMocquillon Date: Tue, 7 Jul 2020 17:54:42 +0200 Subject: [PATCH 6/6] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 687e421fab..c2f05c3c3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -43,6 +43,7 @@ Feature #5362: Show the soul gems' trapped soul in count dialog Feature #5445: Handle NiLines Feature #5457: Realistic diagonal movement + Feature #5486: Fixes trainers to choose their training skills based on their base skill points Task #5480: Drop Qt4 support 0.46.0