diff --git a/apps/openmw/mwgui/enchantingdialog.cpp b/apps/openmw/mwgui/enchantingdialog.cpp index b83e5c0b1..8d8440626 100644 --- a/apps/openmw/mwgui/enchantingdialog.cpp +++ b/apps/openmw/mwgui/enchantingdialog.cpp @@ -8,6 +8,7 @@ #include #include +#include #include "../mwbase/environment.hpp" #include "../mwbase/world.hpp" @@ -43,6 +44,8 @@ namespace MWGui getWidget(mEnchantmentPoints, "Enchantment"); getWidget(mCastCost, "CastCost"); getWidget(mCharge, "Charge"); + getWidget(mSuccessChance, "SuccessChance"); + getWidget(mChanceLayout, "ChanceLayout"); getWidget(mTypeButton, "TypeButton"); getWidget(mBuyButton, "BuyButton"); getWidget(mPrice, "PriceLabel"); @@ -115,6 +118,9 @@ namespace MWGui mCharge->setCaption(MyGUI::utility::toString(mEnchanting.getGemCharge())); + int successChance = int(mEnchanting.getEnchantChance()); + mSuccessChance->setCaption(MyGUI::utility::toString(std::max(0, successChance))); + std::stringstream castCost; castCost << mEnchanting.getEffectiveCastCost(); mCastCost->setCaption(castCost.str()); @@ -144,11 +150,15 @@ namespace MWGui void EnchantingDialog::startEnchanting (MWWorld::Ptr actor) { + mName->setCaption(""); + mEnchanting.setSelfEnchanting(false); mEnchanting.setEnchanter(actor); mBuyButton->setCaptionWithReplacing("#{sBuy}"); + mChanceLayout->setVisible(false); + mPtr = actor; setSoulGem(MWWorld::Ptr()); @@ -162,6 +172,8 @@ namespace MWGui void EnchantingDialog::startSelfEnchanting(MWWorld::Ptr soulgem) { + mName->setCaption(""); + MWWorld::Ptr player = MWMechanics::getPlayer(); mEnchanting.setSelfEnchanting(true); @@ -169,6 +181,10 @@ namespace MWGui mBuyButton->setCaptionWithReplacing("#{sCreate}"); + bool enabled = Settings::Manager::getBool("show enchant chance","GUI"); + + mChanceLayout->setVisible(enabled); + mPtr = player; startEditing(); diff --git a/apps/openmw/mwgui/enchantingdialog.hpp b/apps/openmw/mwgui/enchantingdialog.hpp index 5b67d199b..cb7c6c0d0 100644 --- a/apps/openmw/mwgui/enchantingdialog.hpp +++ b/apps/openmw/mwgui/enchantingdialog.hpp @@ -49,6 +49,8 @@ namespace MWGui ItemSelectionDialog* mItemSelectionDialog; + MyGUI::Widget* mChanceLayout; + MyGUI::Button* mCancelButton; ItemWidget* mItemBox; ItemWidget* mSoulBox; @@ -60,6 +62,7 @@ namespace MWGui MyGUI::TextBox* mEnchantmentPoints; MyGUI::TextBox* mCastCost; MyGUI::TextBox* mCharge; + MyGUI::TextBox* mSuccessChance; MyGUI::TextBox* mPrice; MyGUI::TextBox* mPriceText; diff --git a/docs/source/reference/modding/settings/GUI.rst b/docs/source/reference/modding/settings/GUI.rst index ad3514ffa..cdc3bd889 100644 --- a/docs/source/reference/modding/settings/GUI.rst +++ b/docs/source/reference/modding/settings/GUI.rst @@ -127,3 +127,14 @@ The default value is "1.0 0.15 0.15 1.0" which is a bright red color. This setting can only be configured by editing the settings configuration file. This setting has no effect if the crosshair setting in the HUD Settings Section is false. This setting has no effect if the show owned setting in the Game Settings Section is false. + +show enchant chance +---------------- + +:Type: boolean +:Range: True/False +:Default: False + +Whether or not the chance of success will be displayed in the enchanting menu. + +The default value is false. This setting can only be configured by editing the settings configuration file. diff --git a/files/mygui/openmw_enchanting_dialog.layout b/files/mygui/openmw_enchanting_dialog.layout index ce9429c67..6a08e6fd0 100644 --- a/files/mygui/openmw_enchanting_dialog.layout +++ b/files/mygui/openmw_enchanting_dialog.layout @@ -52,7 +52,7 @@ - + @@ -95,6 +95,17 @@ + + + + + + + + + + + diff --git a/files/settings-default.cfg b/files/settings-default.cfg index e7035af73..0a1af81b1 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -141,6 +141,9 @@ werewolf overlay = true color background owned = 0.15 0.0 0.0 1.0 color crosshair owned = 1.0 0.15 0.15 1.0 +# Show success probability in self-enchant dialog +show enchant chance = false + [HUD] # Displays the crosshair or reticle when not in GUI mode.