Show success chance when self-enchanting (Feature #3492)

pull/224/head^2
Andrei Kortunov 8 years ago
parent 9fd0d54a35
commit 9a1ba1e559

@ -8,6 +8,7 @@
#include <MyGUI_ScrollView.h>
#include <components/widgets/list.hpp>
#include <components/settings/settings.hpp>
#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();

@ -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;

@ -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.

@ -52,7 +52,7 @@
</Widget>
<!-- Values -->
<Widget type="VBox" position="320 7 222 72">
<Widget type="VBox" position="320 7 222 80">
<Widget type="HBox">
<UserString key="HStretch" value="true"/>
<Widget type="AutoSizedTextBox" skin="NormalText">
@ -95,6 +95,17 @@
<UserString key="HStretch" value="true"/>
</Widget>
</Widget>
<Widget type="HBox" name="ChanceLayout">
<UserString key="HStretch" value="true"/>
<Widget type="AutoSizedTextBox" skin="NormalText">
<Property key="Caption" value="#{sEnchantmentMenu6}:"/>
</Widget>
<Widget type="AutoSizedTextBox" skin="SandText" name="SuccessChance">
<Property key="Caption" value="39"/>
<Property key="TextAlign" value="Right VCenter"/>
<UserString key="HStretch" value="true"/>
</Widget>
</Widget>
</Widget>
<!-- Available effects -->

@ -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.

Loading…
Cancel
Save