forked from mirror/openmw-tes3mp
Some checks to prevent bound item abuse
This commit is contained in:
parent
590c8cb4a0
commit
783c501d70
5 changed files with 30 additions and 2 deletions
|
@ -163,6 +163,14 @@ namespace MWGui
|
||||||
MWWorld::Ptr object = item.mBase;
|
MWWorld::Ptr object = item.mBase;
|
||||||
int count = item.mCount;
|
int count = item.mCount;
|
||||||
|
|
||||||
|
// Bound items may not be moved
|
||||||
|
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||||
|
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||||
|
{
|
||||||
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sBarterDialog12}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (item.mType == ItemStack::Type_Equipped)
|
if (item.mType == ItemStack::Type_Equipped)
|
||||||
{
|
{
|
||||||
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
MWWorld::InventoryStore& invStore = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||||
|
|
|
@ -40,6 +40,14 @@ namespace MWGui
|
||||||
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
|
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
const ItemStack& item = mSourceModel->getItem(i);
|
const ItemStack& item = mSourceModel->getItem(i);
|
||||||
|
|
||||||
|
// Bound items may not be stolen
|
||||||
|
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||||
|
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (std::find(mHiddenItems.begin(), mHiddenItems.end(), item) == mHiddenItems.end()
|
if (std::find(mHiddenItems.begin(), mHiddenItems.end(), item) == mHiddenItems.end()
|
||||||
&& item.mType != ItemStack::Type_Equipped)
|
&& item.mType != ItemStack::Type_Equipped)
|
||||||
mItems.push_back(item);
|
mItems.push_back(item);
|
||||||
|
|
|
@ -154,6 +154,13 @@ namespace MWGui
|
||||||
if(!MWWorld::Class::get(base).canSell(base, services))
|
if(!MWWorld::Class::get(base).canSell(base, services))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// Bound items may not be bought
|
||||||
|
if (item.mBase.getCellRef().mRefID.size() > 6
|
||||||
|
&& item.mBase.getCellRef().mRefID.substr(0,6) == "bound_")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// don't show equipped items
|
// don't show equipped items
|
||||||
if(mMerchant.getTypeName() == typeid(ESM::NPC).name())
|
if(mMerchant.getTypeName() == typeid(ESM::NPC).name())
|
||||||
{
|
{
|
||||||
|
|
|
@ -695,6 +695,11 @@ namespace MWMechanics
|
||||||
|
|
||||||
iter->second->kill();
|
iter->second->kill();
|
||||||
|
|
||||||
|
// Reset magic effects and recalculate derived effects
|
||||||
|
// One case where we need this is to make sure bound items are removed upon death
|
||||||
|
stats.setMagicEffects(MWMechanics::MagicEffects());
|
||||||
|
calculateCreatureStatModifiers(iter->first, 0);
|
||||||
|
|
||||||
++mDeathCount[cls.getId(iter->first)];
|
++mDeathCount[cls.getId(iter->first)];
|
||||||
|
|
||||||
if(cls.isEssential(iter->first))
|
if(cls.isEssential(iter->first))
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace ESM
|
||||||
public:
|
public:
|
||||||
|
|
||||||
int mRefnum; // Reference number
|
int mRefnum; // Reference number
|
||||||
std::string mRefID; // ID of object being referenced
|
std::string mRefID; // ID of object being referenced (must be lowercase)
|
||||||
|
|
||||||
float mScale; // Scale applied to mesh
|
float mScale; // Scale applied to mesh
|
||||||
|
|
||||||
|
@ -89,4 +89,4 @@ namespace ESM
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue