mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-28 19:21:04 +00:00
enchanting
This commit is contained in:
parent
485b6c855a
commit
c0b0227e8a
@ -290,4 +290,12 @@ namespace MWClass
|
|||||||
|
|
||||||
return MWWorld::Ptr(&cell.mArmors.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mArmors.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short Armor::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Armor> *ref =
|
||||||
|
ptr.get<ESM::Armor>();
|
||||||
|
|
||||||
|
return ref->mBase->mData.mEnchant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ namespace MWClass
|
|||||||
///< Generate action for using via inventory menu
|
///< Generate action for using via inventory menu
|
||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
|
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,4 +238,12 @@ namespace MWClass
|
|||||||
|
|
||||||
return MWWorld::Ptr(&cell.mClothes.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mClothes.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short Clothing::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
||||||
|
ptr.get<ESM::Clothing>();
|
||||||
|
|
||||||
|
return ref->mBase->mData.mEnchant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,6 +64,8 @@ namespace MWClass
|
|||||||
///< Generate action for using via inventory menu
|
///< Generate action for using via inventory menu
|
||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
|
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,4 +378,12 @@ namespace MWClass
|
|||||||
|
|
||||||
return MWWorld::Ptr(&cell.mWeapons.insert(*ref), &cell);
|
return MWWorld::Ptr(&cell.mWeapons.insert(*ref), &cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short Weapon::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::Weapon> *ref =
|
||||||
|
ptr.get<ESM::Weapon>();
|
||||||
|
|
||||||
|
return ref->mBase->mData.mEnchant;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,8 @@ namespace MWClass
|
|||||||
///< Generate action for using via inventory menu
|
///< Generate action for using via inventory menu
|
||||||
|
|
||||||
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
virtual std::string getModel(const MWWorld::Ptr &ptr) const;
|
||||||
|
|
||||||
|
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,16 @@ namespace
|
|||||||
return compareType(left.getTypeName(), right.getTypeName());
|
return compareType(left.getTypeName(), right.getTypeName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool isChargedSoulstone (MWWorld::Ptr ptr)
|
||||||
|
{
|
||||||
|
if (ptr.getTypeName() != typeid(ESM::Miscellaneous).name())
|
||||||
|
return false;
|
||||||
|
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||||
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
||||||
|
return (ref->mRef.mSoul != "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -345,7 +355,7 @@ void ContainerBase::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
|||||||
mItemView->setViewOffset(MyGUI::IntPoint(mItemView->getViewOffset().left + _rel*0.3, 0));
|
mItemView->setViewOffset(MyGUI::IntPoint(mItemView->getViewOffset().left + _rel*0.3, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContainerBase::setFilter(ContainerBase::Filter filter)
|
void ContainerBase::setFilter(int filter)
|
||||||
{
|
{
|
||||||
mFilter = filter;
|
mFilter = filter;
|
||||||
drawItems();
|
drawItems();
|
||||||
@ -369,29 +379,34 @@ void ContainerBase::drawItems()
|
|||||||
int maxHeight = mItemView->getSize().height - 58;
|
int maxHeight = mItemView->getSize().height - 58;
|
||||||
|
|
||||||
bool onlyMagic = false;
|
bool onlyMagic = false;
|
||||||
|
bool noMagic = false;
|
||||||
int categories = 0;
|
int categories = 0;
|
||||||
if (mFilter == Filter_All)
|
if (mFilter & Filter_All)
|
||||||
categories = MWWorld::ContainerStore::Type_All;
|
categories |= MWWorld::ContainerStore::Type_All;
|
||||||
else if (mFilter == Filter_Weapon)
|
if (mFilter & Filter_Weapon)
|
||||||
categories = MWWorld::ContainerStore::Type_Weapon;
|
categories |= MWWorld::ContainerStore::Type_Weapon;
|
||||||
else if (mFilter == Filter_Apparel)
|
if (mFilter & Filter_Apparel)
|
||||||
categories = MWWorld::ContainerStore::Type_Clothing + MWWorld::ContainerStore::Type_Armor;
|
categories |= MWWorld::ContainerStore::Type_Clothing | MWWorld::ContainerStore::Type_Armor;
|
||||||
else if (mFilter == Filter_Magic)
|
if (mFilter & Filter_Magic)
|
||||||
{
|
{
|
||||||
categories = MWWorld::ContainerStore::Type_Clothing + MWWorld::ContainerStore::Type_Armor
|
categories |= MWWorld::ContainerStore::Type_Clothing | MWWorld::ContainerStore::Type_Armor
|
||||||
+ MWWorld::ContainerStore::Type_Weapon + MWWorld::ContainerStore::Type_Book
|
| MWWorld::ContainerStore::Type_Weapon | MWWorld::ContainerStore::Type_Book
|
||||||
+ MWWorld::ContainerStore::Type_Potion;
|
| MWWorld::ContainerStore::Type_Potion;
|
||||||
onlyMagic = true;
|
onlyMagic = true;
|
||||||
}
|
}
|
||||||
else if (mFilter == Filter_Misc)
|
if (mFilter & Filter_Misc)
|
||||||
{
|
{
|
||||||
categories = MWWorld::ContainerStore::Type_Miscellaneous + MWWorld::ContainerStore::Type_Book
|
categories |= MWWorld::ContainerStore::Type_Miscellaneous | MWWorld::ContainerStore::Type_Book
|
||||||
+ MWWorld::ContainerStore::Type_Ingredient + MWWorld::ContainerStore::Type_Repair
|
| MWWorld::ContainerStore::Type_Ingredient | MWWorld::ContainerStore::Type_Repair
|
||||||
+ MWWorld::ContainerStore::Type_Lockpick + MWWorld::ContainerStore::Type_Light
|
| MWWorld::ContainerStore::Type_Lockpick | MWWorld::ContainerStore::Type_Light
|
||||||
+ MWWorld::ContainerStore::Type_Apparatus + MWWorld::ContainerStore::Type_Probe;
|
| MWWorld::ContainerStore::Type_Apparatus | MWWorld::ContainerStore::Type_Probe;
|
||||||
}
|
}
|
||||||
else if (mFilter == Filter_Ingredients)
|
if (mFilter & Filter_Ingredients)
|
||||||
categories = MWWorld::ContainerStore::Type_Ingredient;
|
categories |= MWWorld::ContainerStore::Type_Ingredient;
|
||||||
|
if (mFilter & Filter_ChargedSoulstones)
|
||||||
|
categories |= MWWorld::ContainerStore::Type_Miscellaneous;
|
||||||
|
if (mFilter & Filter_NoMagic)
|
||||||
|
noMagic = true;
|
||||||
|
|
||||||
/// \todo performance improvement: don't create/destroy all the widgets everytime the container window changes size, only reposition them
|
/// \todo performance improvement: don't create/destroy all the widgets everytime the container window changes size, only reposition them
|
||||||
|
|
||||||
@ -466,12 +481,29 @@ void ContainerBase::drawItems()
|
|||||||
{
|
{
|
||||||
const MWWorld::Ptr* iter = &((*it).first);
|
const MWWorld::Ptr* iter = &((*it).first);
|
||||||
|
|
||||||
|
|
||||||
|
if (onlyMagic
|
||||||
|
&& it->second != ItemState_Barter
|
||||||
|
&& MWWorld::Class::get(*iter).getEnchantment(*iter) == ""
|
||||||
|
&& iter->getTypeName() != typeid(ESM::Potion).name())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (noMagic
|
||||||
|
&& it->second != ItemState_Barter
|
||||||
|
&& (MWWorld::Class::get(*iter).getEnchantment(*iter) != ""
|
||||||
|
|| iter->getTypeName() == typeid(ESM::Potion).name()))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if ( (mFilter & Filter_ChargedSoulstones)
|
||||||
|
&& !isChargedSoulstone(*iter))
|
||||||
|
continue;
|
||||||
|
|
||||||
int displayCount = iter->getRefData().getCount();
|
int displayCount = iter->getRefData().getCount();
|
||||||
if (mDragAndDrop != NULL && mDragAndDrop->mIsOnDragAndDrop && *iter == *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>())
|
if (mDragAndDrop != NULL && mDragAndDrop->mIsOnDragAndDrop && *iter == *mDragAndDrop->mDraggedWidget->getUserData<MWWorld::Ptr>())
|
||||||
{
|
{
|
||||||
displayCount -= mDragAndDrop->mDraggedCount;
|
displayCount -= mDragAndDrop->mDraggedCount;
|
||||||
}
|
}
|
||||||
if(displayCount > 0 && !(onlyMagic && it->second != ItemState_Barter && MWWorld::Class::get(*iter).getEnchantment(*iter) == "" && iter->getTypeName() != typeid(ESM::Potion).name()))
|
if(displayCount > 0)
|
||||||
{
|
{
|
||||||
std::string path = std::string("icons\\");
|
std::string path = std::string("icons\\");
|
||||||
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
path += MWWorld::Class::get(*iter).getInventoryIcon(*iter);
|
||||||
|
@ -48,16 +48,17 @@ namespace MWGui
|
|||||||
ContainerBase(DragAndDrop* dragAndDrop);
|
ContainerBase(DragAndDrop* dragAndDrop);
|
||||||
virtual ~ContainerBase();
|
virtual ~ContainerBase();
|
||||||
|
|
||||||
enum Filter
|
// basic types (inclusive)
|
||||||
{
|
static const int Filter_All = (1<<0);
|
||||||
Filter_All = 0x01,
|
static const int Filter_Weapon = (1<<1);
|
||||||
Filter_Weapon = 0x02,
|
static const int Filter_Apparel = (1<<2);
|
||||||
Filter_Apparel = 0x03,
|
static const int Filter_Ingredients = (1<<3);
|
||||||
Filter_Magic = 0x04,
|
static const int Filter_Misc = (1<<4);
|
||||||
Filter_Misc = 0x05,
|
|
||||||
|
|
||||||
Filter_Ingredients = 0x06
|
// special filtering (exclusive)
|
||||||
};
|
static const int Filter_Magic = (1<<5);
|
||||||
|
static const int Filter_NoMagic = (1<<6);
|
||||||
|
static const int Filter_ChargedSoulstones = (1<<7);
|
||||||
|
|
||||||
enum ItemState
|
enum ItemState
|
||||||
{
|
{
|
||||||
@ -78,7 +79,7 @@ namespace MWGui
|
|||||||
MWWorld::ContainerStore& getBoughtItems() { return mBoughtItems; }
|
MWWorld::ContainerStore& getBoughtItems() { return mBoughtItems; }
|
||||||
|
|
||||||
void openContainer(MWWorld::Ptr container);
|
void openContainer(MWWorld::Ptr container);
|
||||||
void setFilter(Filter filter); ///< set category filter
|
void setFilter(int filter); ///< set category filter
|
||||||
void drawItems();
|
void drawItems();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -92,7 +93,7 @@ namespace MWGui
|
|||||||
|
|
||||||
DragAndDrop* mDragAndDrop;
|
DragAndDrop* mDragAndDrop;
|
||||||
|
|
||||||
Filter mFilter;
|
int mFilter;
|
||||||
|
|
||||||
// bought items are put in a separate ContainerStore so that they don't stack with other (not bought) items.
|
// bought items are put in a separate ContainerStore so that they don't stack with other (not bought) items.
|
||||||
MWWorld::ContainerStore mBoughtItems;
|
MWWorld::ContainerStore mBoughtItems;
|
||||||
|
@ -316,8 +316,8 @@ void DialogueWindow::setKeywords(std::list<std::string> keyWords)
|
|||||||
if (mServices & Service_CreateSpells)
|
if (mServices & Service_CreateSpells)
|
||||||
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
mTopicsList->addItem(gmst.find("sSpellmakingMenuTitle")->getString());
|
||||||
|
|
||||||
// if (mServices & Service_Enchant)
|
if (mServices & Service_Enchant)
|
||||||
// mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
mTopicsList->addItem(gmst.find("sEnchanting")->getString());
|
||||||
|
|
||||||
if (mServices & Service_Training)
|
if (mServices & Service_Training)
|
||||||
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
mTopicsList->addItem(gmst.find("sServiceTrainingTitle")->getString());
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
#include "enchantingdialog.hpp"
|
#include "enchantingdialog.hpp"
|
||||||
|
|
||||||
|
#include <boost/lexical_cast.hpp>
|
||||||
|
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwworld/player.hpp"
|
||||||
|
|
||||||
|
#include "itemselection.hpp"
|
||||||
|
#include "container.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
@ -8,19 +16,45 @@ namespace MWGui
|
|||||||
EnchantingDialog::EnchantingDialog(MWBase::WindowManager &parWindowManager)
|
EnchantingDialog::EnchantingDialog(MWBase::WindowManager &parWindowManager)
|
||||||
: WindowBase("openmw_enchanting_dialog.layout", parWindowManager)
|
: WindowBase("openmw_enchanting_dialog.layout", parWindowManager)
|
||||||
, EffectEditorBase(parWindowManager)
|
, EffectEditorBase(parWindowManager)
|
||||||
|
, mItemSelectionDialog(NULL)
|
||||||
|
, mCurrentEnchantmentPoints(0)
|
||||||
{
|
{
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
getWidget(mAvailableEffectsList, "AvailableEffects");
|
getWidget(mAvailableEffectsList, "AvailableEffects");
|
||||||
getWidget(mUsedEffectsView, "UsedEffects");
|
getWidget(mUsedEffectsView, "UsedEffects");
|
||||||
|
getWidget(mItemBox, "ItemBox");
|
||||||
|
getWidget(mSoulBox, "SoulBox");
|
||||||
|
getWidget(mEnchantmentPoints, "Enchantment");
|
||||||
|
getWidget(mCastCost, "CastCost");
|
||||||
|
getWidget(mCharge, "Charge");
|
||||||
|
getWidget(mTypeButton, "TypeButton");
|
||||||
|
getWidget(mBuyButton, "BuyButton");
|
||||||
|
getWidget(mPrice, "PriceLabel");
|
||||||
|
|
||||||
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
setWidgets(mAvailableEffectsList, mUsedEffectsView);
|
||||||
|
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onCancelButtonClicked);
|
||||||
|
mItemBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectItem);
|
||||||
|
mSoulBox->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onSelectSoul);
|
||||||
|
}
|
||||||
|
|
||||||
|
EnchantingDialog::~EnchantingDialog()
|
||||||
|
{
|
||||||
|
delete mItemSelectionDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::open()
|
void EnchantingDialog::open()
|
||||||
{
|
{
|
||||||
center();
|
center();
|
||||||
|
onRemoveItem(NULL);
|
||||||
|
onRemoveSoul(NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::updateLabels()
|
||||||
|
{
|
||||||
|
mEnchantmentPoints->setCaption(boost::lexical_cast<std::string>(mCurrentEnchantmentPoints)
|
||||||
|
+ " / " + (mItem.isEmpty() ? "0" : boost::lexical_cast<std::string>(
|
||||||
|
MWWorld::Class::get(mItem).getEnchantmentPoints(mItem))));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnchantingDialog::startEnchanting (MWWorld::Ptr actor)
|
void EnchantingDialog::startEnchanting (MWWorld::Ptr actor)
|
||||||
@ -40,4 +74,100 @@ namespace MWGui
|
|||||||
{
|
{
|
||||||
mWindowManager.removeGuiMode (GM_Enchanting);
|
mWindowManager.removeGuiMode (GM_Enchanting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onSelectItem(MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
delete mItemSelectionDialog;
|
||||||
|
mItemSelectionDialog = new ItemSelectionDialog("#{sEnchantItems}",
|
||||||
|
ContainerBase::Filter_Apparel|ContainerBase::Filter_Weapon|ContainerBase::Filter_NoMagic, mWindowManager);
|
||||||
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onItemSelected);
|
||||||
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onItemCancel);
|
||||||
|
mItemSelectionDialog->setVisible(true);
|
||||||
|
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
mItemSelectionDialog->drawItems ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onItemSelected(MWWorld::Ptr item)
|
||||||
|
{
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
|
||||||
|
while (mItemBox->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (mItemBox->getChildAt(0));
|
||||||
|
|
||||||
|
MyGUI::ImageBox* image = mItemBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||||
|
std::string path = std::string("icons\\");
|
||||||
|
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
image->setImageTexture (path);
|
||||||
|
image->setUserString ("ToolTipType", "ItemPtr");
|
||||||
|
image->setUserData(item);
|
||||||
|
image->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onRemoveItem);
|
||||||
|
|
||||||
|
mItem = item;
|
||||||
|
updateLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onRemoveItem(MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
while (mItemBox->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (mItemBox->getChildAt(0));
|
||||||
|
mItem = MWWorld::Ptr();
|
||||||
|
updateLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onItemCancel()
|
||||||
|
{
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onSoulSelected(MWWorld::Ptr item)
|
||||||
|
{
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
|
||||||
|
while (mSoulBox->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (mSoulBox->getChildAt(0));
|
||||||
|
|
||||||
|
MyGUI::ImageBox* image = mSoulBox->createWidget<MyGUI::ImageBox>("ImageBox", MyGUI::IntCoord(0, 0, 32, 32), MyGUI::Align::Default);
|
||||||
|
std::string path = std::string("icons\\");
|
||||||
|
path += MWWorld::Class::get(item).getInventoryIcon(item);
|
||||||
|
int pos = path.rfind(".");
|
||||||
|
path.erase(pos);
|
||||||
|
path.append(".dds");
|
||||||
|
image->setImageTexture (path);
|
||||||
|
image->setUserString ("ToolTipType", "ItemPtr");
|
||||||
|
image->setUserData(item);
|
||||||
|
image->eventMouseButtonClick += MyGUI::newDelegate(this, &EnchantingDialog::onRemoveSoul);
|
||||||
|
|
||||||
|
mSoul = item;
|
||||||
|
updateLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onRemoveSoul(MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
while (mSoulBox->getChildCount ())
|
||||||
|
MyGUI::Gui::getInstance ().destroyWidget (mSoulBox->getChildAt(0));
|
||||||
|
mSoul = MWWorld::Ptr();
|
||||||
|
updateLabels();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onSoulCancel()
|
||||||
|
{
|
||||||
|
mItemSelectionDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EnchantingDialog::onSelectSoul(MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
delete mItemSelectionDialog;
|
||||||
|
mItemSelectionDialog = new ItemSelectionDialog("#{sSoulGemsWithSouls}",
|
||||||
|
ContainerBase::Filter_Misc|ContainerBase::Filter_ChargedSoulstones, mWindowManager);
|
||||||
|
mItemSelectionDialog->eventItemSelected += MyGUI::newDelegate(this, &EnchantingDialog::onSoulSelected);
|
||||||
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &EnchantingDialog::onSoulCancel);
|
||||||
|
mItemSelectionDialog->setVisible(true);
|
||||||
|
mItemSelectionDialog->openContainer(MWBase::Environment::get().getWorld()->getPlayer().getPlayer());
|
||||||
|
mItemSelectionDialog->drawItems ();
|
||||||
|
|
||||||
|
//mWindowManager.messageBox("#{sInventorySelectNoSoul}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,13 @@
|
|||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
|
class ItemSelectionDialog;
|
||||||
|
|
||||||
class EnchantingDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
class EnchantingDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EnchantingDialog(MWBase::WindowManager& parWindowManager);
|
EnchantingDialog(MWBase::WindowManager& parWindowManager);
|
||||||
|
virtual ~EnchantingDialog();
|
||||||
|
|
||||||
virtual void open();
|
virtual void open();
|
||||||
void startEnchanting(MWWorld::Ptr actor);
|
void startEnchanting(MWWorld::Ptr actor);
|
||||||
@ -22,8 +25,36 @@ namespace MWGui
|
|||||||
virtual void onReferenceUnavailable();
|
virtual void onReferenceUnavailable();
|
||||||
|
|
||||||
void onCancelButtonClicked(MyGUI::Widget* sender);
|
void onCancelButtonClicked(MyGUI::Widget* sender);
|
||||||
|
void onSelectItem (MyGUI::Widget* sender);
|
||||||
|
void onSelectSoul (MyGUI::Widget* sender);
|
||||||
|
void onRemoveItem (MyGUI::Widget* sender);
|
||||||
|
void onRemoveSoul (MyGUI::Widget* sender);
|
||||||
|
|
||||||
|
void onItemSelected(MWWorld::Ptr item);
|
||||||
|
void onItemCancel();
|
||||||
|
void onSoulSelected(MWWorld::Ptr item);
|
||||||
|
void onSoulCancel();
|
||||||
|
|
||||||
|
void updateLabels();
|
||||||
|
|
||||||
|
ItemSelectionDialog* mItemSelectionDialog;
|
||||||
|
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
MyGUI::ImageBox* mItemBox;
|
||||||
|
MyGUI::ImageBox* mSoulBox;
|
||||||
|
|
||||||
|
MyGUI::Button* mTypeButton;
|
||||||
|
MyGUI::Button* mBuyButton;
|
||||||
|
|
||||||
|
MyGUI::TextBox* mEnchantmentPoints;
|
||||||
|
MyGUI::TextBox* mCastCost;
|
||||||
|
MyGUI::TextBox* mCharge;
|
||||||
|
MyGUI::TextBox* mPrice;
|
||||||
|
|
||||||
|
MWWorld::Ptr mItem;
|
||||||
|
MWWorld::Ptr mSoul;
|
||||||
|
|
||||||
|
float mCurrentEnchantmentPoints;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
|
||||||
ItemSelectionDialog::ItemSelectionDialog(const std::string &label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager)
|
ItemSelectionDialog::ItemSelectionDialog(const std::string &label, int filter, MWBase::WindowManager& parWindowManager)
|
||||||
: ContainerBase(NULL)
|
: ContainerBase(NULL)
|
||||||
, WindowModal("openmw_itemselection_dialog.layout", parWindowManager)
|
, WindowModal("openmw_itemselection_dialog.layout", parWindowManager)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ namespace MWGui
|
|||||||
class ItemSelectionDialog : public ContainerBase, public WindowModal
|
class ItemSelectionDialog : public ContainerBase, public WindowModal
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ItemSelectionDialog(const std::string& label, ContainerBase::Filter filter, MWBase::WindowManager& parWindowManager);
|
ItemSelectionDialog(const std::string& label, int filter, MWBase::WindowManager& parWindowManager);
|
||||||
|
|
||||||
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;
|
||||||
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
typedef MyGUI::delegates::CMultiDelegate1<MWWorld::Ptr> EventHandle_Item;
|
||||||
|
@ -127,6 +127,11 @@ namespace MWWorld
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
short Class::getEnchantmentPoints (const MWWorld::Ptr& ptr) const
|
||||||
|
{
|
||||||
|
throw std::runtime_error ("class does not support enchanting");
|
||||||
|
}
|
||||||
|
|
||||||
MWMechanics::Movement& Class::getMovementSettings (const Ptr& ptr) const
|
MWMechanics::Movement& Class::getMovementSettings (const Ptr& ptr) const
|
||||||
{
|
{
|
||||||
throw std::runtime_error ("movement settings not supported by class");
|
throw std::runtime_error ("movement settings not supported by class");
|
||||||
|
@ -222,6 +222,9 @@ namespace MWWorld
|
|||||||
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
///< @return the enchantment ID if the object is enchanted, otherwise an empty string
|
||||||
/// (default implementation: return empty string)
|
/// (default implementation: return empty string)
|
||||||
|
|
||||||
|
virtual short getEnchantmentPoints (const MWWorld::Ptr& ptr) const;
|
||||||
|
///< @return the number of enchantment points available for possible enchanting
|
||||||
|
|
||||||
virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const;
|
virtual void adjustScale(const MWWorld::Ptr& ptr,float& scale) const;
|
||||||
|
|
||||||
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
|
virtual void adjustRotation(const MWWorld::Ptr& ptr,float& x,float& y,float& z) const;
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevGenderButton"/>
|
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevGenderButton"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="HeaderText" position="14 298 227 14" name="GenderChoiceT" />
|
<Widget type="TextBox" skin="HeaderText" position="25 298 227 14" name="GenderChoiceT" />
|
||||||
|
|
||||||
<Widget type="Widget" skin="MW_Box" position="234 298 15 14">
|
<Widget type="Widget" skin="MW_Box" position="234 298 15 14">
|
||||||
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextGenderButton"/>
|
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextGenderButton"/>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevFaceButton"/>
|
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevFaceButton"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="HeaderText" position="14 320 227 14" name="FaceChoiceT" />
|
<Widget type="TextBox" skin="HeaderText" position="25 320 227 14" name="FaceChoiceT" />
|
||||||
|
|
||||||
<Widget type="Widget" skin="MW_Box" position="234 320 15 14">
|
<Widget type="Widget" skin="MW_Box" position="234 320 15 14">
|
||||||
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextFaceButton"/>
|
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextFaceButton"/>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevHairButton"/>
|
<Widget type="Button" skin="MW_ArrowLeft" position="3 2 10 10" align="ALIGN_LEFT ALIGN_VSTRETCH" name="PrevHairButton"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="TextBox" skin="HeaderText" position="14 342 227 14" name="HairChoiceT" />
|
<Widget type="TextBox" skin="HeaderText" position="25 342 227 14" name="HairChoiceT" />
|
||||||
|
|
||||||
<Widget type="Widget" skin="MW_Box" position="234 342 15 14">
|
<Widget type="Widget" skin="MW_Box" position="234 342 15 14">
|
||||||
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextHairButton"/>
|
<Widget type="Button" skin="MW_ArrowRight" position="1 2 10 10" align="ALIGN_RIGHT ALIGN_VSTRETCH" name="NextHairButton"/>
|
||||||
|
@ -26,14 +26,18 @@
|
|||||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||||
<Property key="Caption" value="#{sItem}"/>
|
<Property key="Caption" value="#{sItem}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="Button" skin="MW_Box" position="0 0 60 59" name="ItemBox"/>
|
<Widget type="Widget" skin="MW_Box" position="0 0 50 50">
|
||||||
|
<Widget type="ImageBox" skin="ImageBox" position="9 9 32 32" name="ItemBox"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
<Widget type="Widget" position="0 0 8 0"/>
|
<Widget type="Widget" position="0 0 8 0"/>
|
||||||
|
|
||||||
<Widget type="AutoSizedTextBox" skin="NormalText">
|
<Widget type="AutoSizedTextBox" skin="NormalText">
|
||||||
<Property key="Caption" value="#{sSoulGem}"/>
|
<Property key="Caption" value="#{sSoulGem}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
<Widget type="Button" skin="MW_Box" position="0 0 60 59" name="SoulBox"/>
|
<Widget type="Button" skin="MW_Box" position="0 0 50 50">
|
||||||
|
<Widget type="ImageBox" skin="ImageBox" position="9 9 32 32" name="SoulBox"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
@ -85,7 +89,11 @@
|
|||||||
<Widget type="HBox" position="0 340 560 60">
|
<Widget type="HBox" position="0 340 560 60">
|
||||||
<Property key="Padding" value="16"/>
|
<Property key="Padding" value="16"/>
|
||||||
|
|
||||||
<Widget type="Widget" position="0 0 0 0">
|
<Widget type="AutoSizedButton" skin="MW_Button" name="TypeButton">
|
||||||
|
<Property key="Caption" value="Constant effect"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
|
<Widget type="Widget">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
@ -97,6 +105,7 @@
|
|||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" name="BuyButton">
|
<Widget type="AutoSizedButton" skin="MW_Button" name="BuyButton">
|
||||||
<Property key="Caption" value="#{sBuy}"/>
|
<Property key="Caption" value="#{sBuy}"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user