1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-30 07:06:43 +00:00

Added checks for different bound item situations

This commit is contained in:
Ragora 2014-09-10 23:38:38 -04:00
parent 141755b473
commit 69dbd6b30f
4 changed files with 24 additions and 7 deletions

View file

@ -41,6 +41,15 @@ CompanionWindow::CompanionWindow(DragAndDrop *dragAndDrop, MessageBoxManager* ma
void CompanionWindow::onItemSelected(int index) void CompanionWindow::onItemSelected(int index)
{ {
const ItemStack& item = mSortModel->getItem(index);
// We can't take conjured items from a companion NPC
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
return;
}
if (mDragAndDrop->mIsOnDragAndDrop) if (mDragAndDrop->mIsOnDragAndDrop)
{ {
mDragAndDrop->drop(mModel, mItemView); mDragAndDrop->drop(mModel, mItemView);
@ -48,8 +57,6 @@ void CompanionWindow::onItemSelected(int index)
return; return;
} }
const ItemStack& item = mSortModel->getItem(index);
MWWorld::Ptr object = item.mBase; MWWorld::Ptr object = item.mBase;
int count = item.mCount; int count = item.mCount;
bool shift = MyGUI::InputManager::getInstance().isShiftPressed(); bool shift = MyGUI::InputManager::getInstance().isShiftPressed();

View file

@ -113,8 +113,7 @@ namespace MWGui
std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase); std::string sound = mItem.mBase.getClass().getDownSoundId(mItem.mBase);
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);
// We can't drop a conjured item to the ground; the target container should always be the source container though if it's somehow not on your // We can't drop a conjured item to the ground; the target container should always be the source container
// person and you're trying to take it, this would display the wrong message. (Dropping rather than taking).
if (mItem.mBase.getCellRef().getRefId().size() > 6 && mItem.mBase.getCellRef().getRefId().substr(0,6) == "bound_" && targetModel != mSourceModel) if (mItem.mBase.getCellRef().getRefId().size() > 6 && mItem.mBase.getCellRef().getRefId().substr(0,6) == "bound_" && targetModel != mSourceModel)
{ {
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
@ -175,6 +174,15 @@ namespace MWGui
void ContainerWindow::onItemSelected(int index) void ContainerWindow::onItemSelected(int index)
{ {
const ItemStack& item = mSortModel->getItem(index);
// We can't take a conjured item from a container (some NPC we're pickpocketing, a box, etc)
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sContentsMessage1}");
return;
}
if (mDragAndDrop->mIsOnDragAndDrop) if (mDragAndDrop->mIsOnDragAndDrop)
{ {
if (!dynamic_cast<PickpocketItemModel*>(mModel)) if (!dynamic_cast<PickpocketItemModel*>(mModel))
@ -182,8 +190,6 @@ namespace MWGui
return; return;
} }
const ItemStack& item = mSortModel->getItem(index);
MWWorld::Ptr object = item.mBase; MWWorld::Ptr object = item.mBase;
int count = item.mCount; int count = item.mCount;
bool shift = MyGUI::InputManager::getInstance().isShiftPressed(); bool shift = MyGUI::InputManager::getInstance().isShiftPressed();

View file

@ -61,6 +61,10 @@ void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, ItemModel *otherModel) MWWorld::Ptr InventoryItemModel::moveItem(const ItemStack &item, size_t count, ItemModel *otherModel)
{ {
// Can't move conjured items: This is a general fix that also takes care of issues with taking conjured items via the 'Take All' button.
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
return MWWorld::Ptr();
bool setNewOwner = false; bool setNewOwner = false;
// Are you dead? Then you wont need that anymore // Are you dead? Then you wont need that anymore

View file

@ -189,7 +189,7 @@ namespace MWGui
if (mTrading) if (mTrading)
{ {
// Can't give bound items to a merchant // Can't give cojured items to a merchant
if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_") if (item.mBase.getCellRef().getRefId().size() > 6 && item.mBase.getCellRef().getRefId().substr(0,6) == "bound_")
{ {
MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0); MWBase::Environment::get().getSoundManager()->playSound (sound, 1.0, 1.0);