2012-09-27 08:47:47 +02:00
|
|
|
#include "enchantingdialog.hpp"
|
|
|
|
|
2014-02-19 18:40:29 +01:00
|
|
|
#include <iomanip>
|
|
|
|
|
2015-01-10 03:56:06 +01:00
|
|
|
#include <MyGUI_Button.h>
|
|
|
|
#include <MyGUI_ScrollView.h>
|
2017-09-24 13:05:52 +02:00
|
|
|
#include <MyGUI_EditBox.h>
|
2015-01-10 03:56:06 +01:00
|
|
|
|
|
|
|
#include <components/widgets/list.hpp>
|
2017-06-01 10:00:15 +04:00
|
|
|
#include <components/settings/settings.hpp>
|
2013-03-16 19:00:14 +01:00
|
|
|
|
2019-02-19 01:10:55 +03:00
|
|
|
#include "../mwbase/environment.hpp"
|
2014-01-22 13:04:36 +01:00
|
|
|
#include "../mwbase/mechanicsmanager.hpp"
|
2019-02-19 01:10:55 +03:00
|
|
|
#include "../mwbase/world.hpp"
|
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
#include "../mwworld/class.hpp"
|
2014-01-08 23:37:46 +01:00
|
|
|
#include "../mwworld/containerstore.hpp"
|
2014-12-19 11:26:54 +01:00
|
|
|
#include "../mwworld/esmstore.hpp"
|
2013-03-16 19:00:14 +01:00
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
#include "../mwmechanics/actorutil.hpp"
|
|
|
|
|
2013-03-16 19:00:14 +01:00
|
|
|
#include "itemselection.hpp"
|
2014-06-05 22:13:18 +02:00
|
|
|
#include "itemwidget.hpp"
|
2012-09-27 08:47:47 +02:00
|
|
|
|
2013-05-11 18:38:27 +02:00
|
|
|
#include "sortfilteritemmodel.hpp"
|
|
|
|
|
2012-09-27 08:47:47 +02:00
|
|
|
namespace MWGui
|
|
|
|
{
|
|
|
|
|
|
|
|
|
2013-04-10 14:46:21 -04:00
|
|
|
EnchantingDialog::EnchantingDialog()
|
|
|
|
: WindowBase("openmw_enchanting_dialog.layout")
|
2014-08-24 21:59:52 +02:00
|
|
|
, EffectEditorBase(EffectEditorBase::Enchanting)
|
2018-10-09 10:21:12 +04:00
|
|
|
, mItemSelectionDialog(nullptr)
|
2012-09-27 08:47:47 +02:00
|
|
|
{
|
2013-03-28 17:41:00 +01:00
|
|
|
getWidget(mName, "NameEdit");
|
2012-10-03 15:06:54 +02:00
|
|
|
getWidget(mCancelButton, "CancelButton");
|
2012-10-03 15:36:10 +02:00
|
|
|
getWidget(mAvailableEffectsList, "AvailableEffects");
|
|
|
|
getWidget(mUsedEffectsView, "UsedEffects");
|
2013-03-16 19:00:14 +01:00
|
|
|
getWidget(mItemBox, "ItemBox");
|
|
|
|
getWidget(mSoulBox, "SoulBox");
|
|
|
|
getWidget(mEnchantmentPoints, "Enchantment");
|
|
|
|
getWidget(mCastCost, "CastCost");
|
|
|
|
getWidget(mCharge, "Charge");
|
2017-06-01 10:00:15 +04:00
|
|
|
getWidget(mSuccessChance, "SuccessChance");
|
|
|
|
getWidget(mChanceLayout, "ChanceLayout");
|
2013-03-16 19:00:14 +01:00
|
|
|
getWidget(mTypeButton, "TypeButton");
|
|
|
|
getWidget(mBuyButton, "BuyButton");
|
|
|
|
getWidget(mPrice, "PriceLabel");
|
2013-04-03 18:02:30 +02:00
|
|
|
getWidget(mPriceText, "PriceTextLabel");
|
2012-10-03 15:36:10 +02:00
|
|
|
|
|
|
|
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
2012-09-27 08:47:47 +02:00
|
|
|
|
2012-10-03 15:06:54 +02:00
|
|
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onCancelButtonClicked);
|
2013-03-16 19:00:14 +01:00
|
|
|
mItemBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectItem);
|
|
|
|
mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
|
2013-03-28 17:41:00 +01:00
|
|
|
mBuyButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onBuyButtonClicked);
|
|
|
|
mTypeButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onTypeButtonClicked);
|
2017-09-24 13:05:52 +02:00
|
|
|
mName->eventEditSelectAccept += MyGUI::newDelegate(this, &EnchantingDialog::onAccept);
|
2013-03-16 19:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EnchantingDialog::~EnchantingDialog()
|
|
|
|
{
|
|
|
|
delete mItemSelectionDialog;
|
2012-09-27 08:47:47 +02:00
|
|
|
}
|
|
|
|
|
2017-09-22 17:10:53 +02:00
|
|
|
void EnchantingDialog::onOpen()
|
2012-09-27 08:47:47 +02:00
|
|
|
{
|
|
|
|
center();
|
2019-06-09 02:08:09 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->setKeyFocusWidget(mName);
|
2014-06-05 22:13:18 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::setSoulGem(const MWWorld::Ptr &gem)
|
|
|
|
{
|
|
|
|
if (gem.isEmpty())
|
|
|
|
{
|
|
|
|
mSoulBox->setItem(MWWorld::Ptr());
|
|
|
|
mSoulBox->clearUserStrings();
|
|
|
|
mEnchanting.setSoulGem(MWWorld::Ptr());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mSoulBox->setItem(gem);
|
|
|
|
mSoulBox->setUserString ("ToolTipType", "ItemPtr");
|
2017-03-13 02:47:52 +01:00
|
|
|
mSoulBox->setUserData(MWWorld::Ptr(gem));
|
2014-06-05 22:13:18 +02:00
|
|
|
mEnchanting.setSoulGem(gem);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::setItem(const MWWorld::Ptr &item)
|
|
|
|
{
|
|
|
|
if (item.isEmpty())
|
|
|
|
{
|
|
|
|
mItemBox->setItem(MWWorld::Ptr());
|
|
|
|
mItemBox->clearUserStrings();
|
|
|
|
mEnchanting.setOldItem(MWWorld::Ptr());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-08-24 16:41:17 +02:00
|
|
|
mName->setCaption(item.getClass().getName(item));
|
2014-06-05 22:13:18 +02:00
|
|
|
mItemBox->setItem(item);
|
|
|
|
mItemBox->setUserString ("ToolTipType", "ItemPtr");
|
2017-03-13 02:47:52 +01:00
|
|
|
mItemBox->setUserData(MWWorld::Ptr(item));
|
2014-06-05 22:13:18 +02:00
|
|
|
mEnchanting.setOldItem(item);
|
|
|
|
}
|
2013-03-16 19:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::updateLabels()
|
|
|
|
{
|
2019-05-14 01:40:04 +03:00
|
|
|
mEnchantmentPoints->setCaption(std::to_string(static_cast<int>(mEnchanting.getEnchantPoints(false))) + " / " + std::to_string(mEnchanting.getMaxEnchantValue()));
|
|
|
|
mCharge->setCaption(std::to_string(mEnchanting.getGemCharge()));
|
|
|
|
mSuccessChance->setCaption(std::to_string(std::max(0, std::min(100, mEnchanting.getEnchantChance()))));
|
|
|
|
mCastCost->setCaption(std::to_string(mEnchanting.getEffectiveCastCost()));
|
|
|
|
mPrice->setCaption(std::to_string(mEnchanting.getEnchantPrice()));
|
2013-04-02 20:46:48 +02:00
|
|
|
|
2013-05-27 14:42:08 +02:00
|
|
|
switch(mEnchanting.getCastStyle())
|
2013-03-28 17:41:00 +01:00
|
|
|
{
|
2013-05-29 00:01:18 +02:00
|
|
|
case ESM::Enchantment::CastOnce:
|
2013-04-10 00:32:05 -04:00
|
|
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastOnce","Cast Once"));
|
2015-01-05 05:33:51 +01:00
|
|
|
setConstantEffect(false);
|
2013-03-28 17:41:00 +01:00
|
|
|
break;
|
2013-05-29 00:01:18 +02:00
|
|
|
case ESM::Enchantment::WhenStrikes:
|
2013-04-10 00:32:05 -04:00
|
|
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenStrikes", "When Strikes"));
|
2015-01-05 05:33:51 +01:00
|
|
|
setConstantEffect(false);
|
2013-03-28 17:41:00 +01:00
|
|
|
break;
|
2013-05-29 00:01:18 +02:00
|
|
|
case ESM::Enchantment::WhenUsed:
|
2013-04-10 00:32:05 -04:00
|
|
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastWhenUsed", "When Used"));
|
2015-01-05 05:33:51 +01:00
|
|
|
setConstantEffect(false);
|
2013-03-28 17:41:00 +01:00
|
|
|
break;
|
2013-05-29 00:01:18 +02:00
|
|
|
case ESM::Enchantment::ConstantEffect:
|
2013-04-10 00:32:05 -04:00
|
|
|
mTypeButton->setCaption(MWBase::Environment::get().getWindowManager()->getGameSettingString("sItemCastConstant", "Cast Constant"));
|
2015-01-05 05:33:51 +01:00
|
|
|
setConstantEffect(true);
|
2013-03-28 17:41:00 +01:00
|
|
|
break;
|
|
|
|
}
|
2012-09-27 08:47:47 +02:00
|
|
|
}
|
|
|
|
|
2017-09-22 21:26:41 +02:00
|
|
|
void EnchantingDialog::setPtr (const MWWorld::Ptr& ptr)
|
2012-09-27 08:47:47 +02:00
|
|
|
{
|
2017-06-01 10:00:15 +04:00
|
|
|
mName->setCaption("");
|
|
|
|
|
2017-09-22 21:26:41 +02:00
|
|
|
if (ptr.getClass().isActor())
|
|
|
|
{
|
|
|
|
mEnchanting.setSelfEnchanting(false);
|
|
|
|
mEnchanting.setEnchanter(ptr);
|
|
|
|
mBuyButton->setCaptionWithReplacing("#{sBuy}");
|
|
|
|
mChanceLayout->setVisible(false);
|
|
|
|
mPtr = ptr;
|
|
|
|
setSoulGem(MWWorld::Ptr());
|
|
|
|
mPrice->setVisible(true);
|
|
|
|
mPriceText->setVisible(true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mEnchanting.setSelfEnchanting(true);
|
|
|
|
mEnchanting.setEnchanter(MWMechanics::getPlayer());
|
|
|
|
mBuyButton->setCaptionWithReplacing("#{sCreate}");
|
|
|
|
bool enabled = Settings::Manager::getBool("show enchant chance","Game");
|
|
|
|
mChanceLayout->setVisible(enabled);
|
|
|
|
mPtr = MWMechanics::getPlayer();
|
|
|
|
setSoulGem(ptr);
|
|
|
|
mPrice->setVisible(false);
|
|
|
|
mPriceText->setVisible(false);
|
|
|
|
}
|
2012-10-03 15:36:10 +02:00
|
|
|
|
2014-07-29 15:32:22 +02:00
|
|
|
setItem(MWWorld::Ptr());
|
2012-10-03 15:36:10 +02:00
|
|
|
startEditing ();
|
2013-04-03 18:06:11 +02:00
|
|
|
updateLabels();
|
2013-03-30 15:51:07 +01:00
|
|
|
}
|
|
|
|
|
2012-09-27 08:47:47 +02:00
|
|
|
void EnchantingDialog::onReferenceUnavailable ()
|
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
2014-07-29 15:32:22 +02:00
|
|
|
resetReference();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::resetReference()
|
|
|
|
{
|
|
|
|
ReferenceInterface::resetReference();
|
|
|
|
setItem(MWWorld::Ptr());
|
|
|
|
setSoulGem(MWWorld::Ptr());
|
|
|
|
mPtr = MWWorld::Ptr();
|
|
|
|
mEnchanting.setEnchanter(MWWorld::Ptr());
|
2012-09-27 08:47:47 +02:00
|
|
|
}
|
|
|
|
|
2012-10-03 15:06:54 +02:00
|
|
|
void EnchantingDialog::onCancelButtonClicked(MyGUI::Widget* sender)
|
|
|
|
{
|
2017-09-23 12:18:39 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Enchanting);
|
2012-10-03 15:06:54 +02:00
|
|
|
}
|
2013-03-16 19:00:14 +01:00
|
|
|
|
|
|
|
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
|
|
|
{
|
2014-06-05 22:13:18 +02:00
|
|
|
if (mEnchanting.getOldItem().isEmpty())
|
|
|
|
{
|
|
|
|
delete mItemSelectionDialog;
|
|
|
|
mItemSelectionDialog = new ItemSelectionDialog("#{sEnchantItems}");
|
|
|
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
|
|
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
|
|
|
mItemSelectionDialog->setVisible(true);
|
2015-08-21 21:12:39 +12:00
|
|
|
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
2014-06-05 22:13:18 +02:00
|
|
|
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyEnchantable);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setItem(MWWorld::Ptr());
|
2014-08-24 16:41:17 +02:00
|
|
|
updateLabels();
|
2014-06-05 22:13:18 +02:00
|
|
|
}
|
2013-03-16 19:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onItemSelected(MWWorld::Ptr item)
|
|
|
|
{
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
|
2014-06-05 22:13:18 +02:00
|
|
|
setItem(item);
|
2017-07-10 15:48:00 +04:00
|
|
|
MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
|
2013-05-27 14:42:08 +02:00
|
|
|
mEnchanting.nextCastStyle();
|
2013-03-16 19:00:14 +01:00
|
|
|
updateLabels();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onItemCancel()
|
|
|
|
{
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onSoulSelected(MWWorld::Ptr item)
|
|
|
|
{
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
2013-03-28 17:41:00 +01:00
|
|
|
|
2014-07-29 15:32:22 +02:00
|
|
|
mEnchanting.setSoulGem(item);
|
2013-03-28 17:41:00 +01:00
|
|
|
if(mEnchanting.getGemCharge()==0)
|
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage32}");
|
2013-03-28 17:41:00 +01:00
|
|
|
return;
|
|
|
|
}
|
2013-03-16 19:00:14 +01:00
|
|
|
|
2014-06-05 22:13:18 +02:00
|
|
|
setSoulGem(item);
|
2017-07-10 15:48:00 +04:00
|
|
|
MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
|
2014-07-29 15:32:22 +02:00
|
|
|
updateLabels();
|
2013-03-16 19:00:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onSoulCancel()
|
|
|
|
{
|
|
|
|
mItemSelectionDialog->setVisible(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onSelectSoul(MyGUI::Widget *sender)
|
|
|
|
{
|
2014-06-05 22:13:18 +02:00
|
|
|
if (mEnchanting.getGem().isEmpty())
|
|
|
|
{
|
|
|
|
delete mItemSelectionDialog;
|
|
|
|
mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}");
|
|
|
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
|
|
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
|
|
|
mItemSelectionDialog->setVisible(true);
|
2015-08-21 21:12:39 +12:00
|
|
|
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
2014-06-05 22:13:18 +02:00
|
|
|
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyChargedSoulstones);
|
|
|
|
|
|
|
|
//MWBase::Environment::get().getWindowManager()->messageBox("#{sInventorySelectNoSoul}");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
setSoulGem(MWWorld::Ptr());
|
2017-05-20 18:30:11 +04:00
|
|
|
mEnchanting.nextCastStyle();
|
2014-07-29 15:32:22 +02:00
|
|
|
updateLabels();
|
2017-05-20 18:30:11 +04:00
|
|
|
updateEffectsView();
|
2014-06-05 22:13:18 +02:00
|
|
|
}
|
2013-03-16 19:00:14 +01:00
|
|
|
}
|
2013-03-28 17:41:00 +01:00
|
|
|
|
|
|
|
void EnchantingDialog::notifyEffectsChanged ()
|
|
|
|
{
|
|
|
|
mEffectList.mList = mEffects;
|
|
|
|
mEnchanting.setEffect(mEffectList);
|
|
|
|
updateLabels();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EnchantingDialog::onTypeButtonClicked(MyGUI::Widget* sender)
|
|
|
|
{
|
2013-05-27 14:42:08 +02:00
|
|
|
mEnchanting.nextCastStyle();
|
2013-03-28 17:41:00 +01:00
|
|
|
updateLabels();
|
2015-01-05 05:33:51 +01:00
|
|
|
updateEffectsView();
|
2013-03-28 17:41:00 +01:00
|
|
|
}
|
|
|
|
|
2017-09-24 13:05:52 +02:00
|
|
|
void EnchantingDialog::onAccept(MyGUI::EditBox *sender)
|
|
|
|
{
|
|
|
|
onBuyButtonClicked(sender);
|
2018-09-10 12:55:00 +04:00
|
|
|
|
|
|
|
// To do not spam onAccept() again and again
|
|
|
|
MWBase::Environment::get().getWindowManager()->injectKeyRelease(MyGUI::KeyCode::None);
|
2017-09-24 13:05:52 +02:00
|
|
|
}
|
|
|
|
|
2013-03-28 17:41:00 +01:00
|
|
|
void EnchantingDialog::onBuyButtonClicked(MyGUI::Widget* sender)
|
|
|
|
{
|
|
|
|
if (mEffects.size() <= 0)
|
|
|
|
{
|
2014-01-10 22:27:31 +01:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu11}");
|
2013-03-28 17:41:00 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-19 14:31:25 +04:00
|
|
|
if (mName->getCaption ().empty())
|
2013-03-28 17:41:00 +01:00
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage10}");
|
2013-03-28 17:41:00 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mEnchanting.soulEmpty())
|
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage52}");
|
2013-03-28 17:41:00 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mEnchanting.itemEmpty())
|
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage11}");
|
2013-03-30 12:54:20 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-05-14 01:40:04 +03:00
|
|
|
if (static_cast<int>(mEnchanting.getEnchantPoints(false)) > mEnchanting.getMaxEnchantValue())
|
2013-03-30 12:54:20 +01:00
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage29}");
|
2013-03-28 17:41:00 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2017-08-19 14:31:25 +04:00
|
|
|
mEnchanting.setNewItemName(mName->getCaption());
|
2013-03-28 17:41:00 +01:00
|
|
|
mEnchanting.setEffect(mEffectList);
|
|
|
|
|
2015-08-21 21:12:39 +12:00
|
|
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
2014-01-08 23:37:46 +01:00
|
|
|
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
|
2014-07-26 00:57:49 +02:00
|
|
|
if (mPtr != player && mEnchanting.getEnchantPrice() > playerGold)
|
2013-04-02 20:46:48 +02:00
|
|
|
{
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage18}");
|
2013-04-02 20:46:48 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-01-22 13:04:36 +01:00
|
|
|
// check if the player is attempting to use a soulstone or item that was stolen from this actor
|
|
|
|
if (mPtr != player)
|
|
|
|
{
|
|
|
|
for (int i=0; i<2; ++i)
|
|
|
|
{
|
|
|
|
MWWorld::Ptr item = (i == 0) ? mEnchanting.getOldItem() : mEnchanting.getGem();
|
2018-06-03 09:46:12 +03:00
|
|
|
if (MWBase::Environment::get().getMechanicsManager()->isItemStolenFrom(item.getCellRef().getRefId(), mPtr))
|
2014-01-22 13:04:36 +01:00
|
|
|
{
|
2018-08-29 18:38:12 +03:00
|
|
|
std::string msg = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("sNotifyMessage49")->mValue.getString();
|
2019-05-19 12:33:57 +04:00
|
|
|
msg = Misc::StringUtils::format(msg, item.getClass().getName(item));
|
2014-01-22 13:04:36 +01:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox(msg);
|
2017-08-14 19:29:34 +04:00
|
|
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager()->confiscateStolenItemToOwner(player, item, mPtr, 1);
|
|
|
|
|
2014-01-22 13:04:36 +01:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
2017-09-26 23:27:53 +02:00
|
|
|
MWBase::Environment::get().getWindowManager()->exitCurrentGuiMode();
|
2014-01-22 13:04:36 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-30 19:08:42 +01:00
|
|
|
int result = mEnchanting.create();
|
|
|
|
|
|
|
|
if(result==1)
|
2013-11-28 11:37:30 +01:00
|
|
|
{
|
2017-07-10 15:48:00 +04:00
|
|
|
MWBase::Environment::get().getWindowManager()->playSound("enchant success");
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sEnchantmentMenu12}");
|
2019-05-11 19:49:11 +03:00
|
|
|
MWBase::Environment::get().getWindowManager()->removeGuiMode (GM_Enchanting);
|
2013-11-28 11:37:30 +01:00
|
|
|
}
|
2013-03-30 19:08:42 +01:00
|
|
|
else
|
2013-11-28 11:37:30 +01:00
|
|
|
{
|
2017-07-10 15:48:00 +04:00
|
|
|
MWBase::Environment::get().getWindowManager()->playSound("enchant fail");
|
2013-04-10 00:32:05 -04:00
|
|
|
MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage34}");
|
2019-05-11 19:49:11 +03:00
|
|
|
if (!mEnchanting.getGem().isEmpty() && !mEnchanting.getGem().getRefData().getCount())
|
|
|
|
{
|
|
|
|
setSoulGem(MWWorld::Ptr());
|
|
|
|
mEnchanting.nextCastStyle();
|
|
|
|
updateLabels();
|
|
|
|
updateEffectsView();
|
|
|
|
}
|
2013-11-28 11:37:30 +01:00
|
|
|
}
|
2013-03-28 17:41:00 +01:00
|
|
|
}
|
2012-09-27 08:47:47 +02:00
|
|
|
}
|