forked from mirror/openmw-tes3mp
[Client] Don't add bound items to inventory as a result of item packets
Additionally, don't include bound items when sending PlayerInventory packets.
This commit is contained in:
parent
a3b9274365
commit
9598212aad
1 changed files with 23 additions and 9 deletions
|
@ -677,6 +677,10 @@ void LocalPlayer::addItems()
|
||||||
|
|
||||||
for (const auto &item : inventoryChanges.items)
|
for (const auto &item : inventoryChanges.items)
|
||||||
{
|
{
|
||||||
|
// Skip bound items
|
||||||
|
if (MWBase::Environment::get().getMechanicsManager()->isBoundItem(item.refId))
|
||||||
|
continue;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer);
|
MWWorld::Ptr itemPtr = *ptrStore.add(item.refId, item.count, ptrPlayer);
|
||||||
|
@ -1116,7 +1120,10 @@ void LocalPlayer::setEquipment()
|
||||||
return Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), currentItem.refId);
|
return Misc::StringUtils::ciEqual(itemPtr.getCellRef().getRefId(), currentItem.refId);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (it == ptrInventory.end()) // If the item is not in our inventory, add it
|
// If the item is not in our inventory, add it as long as it's not a bound item
|
||||||
|
if (it == ptrInventory.end())
|
||||||
|
{
|
||||||
|
if (!MWBase::Environment::get().getMechanicsManager()->isBoundItem(currentItem.refId))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1129,6 +1136,7 @@ void LocalPlayer::setEquipment()
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Ignored addition of invalid equipment item %s", currentItem.refId.c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Ignored addition of invalid equipment item %s", currentItem.refId.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Don't try to equip an item that is already equipped
|
// Don't try to equip an item that is already equipped
|
||||||
|
@ -1368,7 +1376,13 @@ void LocalPlayer::sendInventory()
|
||||||
for (const auto &iter : ptrInventory)
|
for (const auto &iter : ptrInventory)
|
||||||
{
|
{
|
||||||
item.refId = iter.getCellRef().getRefId();
|
item.refId = iter.getCellRef().getRefId();
|
||||||
if (item.refId.find("$dynamic") != string::npos) // skip generated items (self enchanted for e.g.)
|
|
||||||
|
// Skip any items that somehow have clientside-only dynamic IDs
|
||||||
|
if (item.refId.find("$dynamic") != string::npos)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// Skip bound items
|
||||||
|
if (MWBase::Environment::get().getMechanicsManager()->isBoundItem(item.refId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
item.count = iter.getRefData().getCount();
|
item.count = iter.getRefData().getCount();
|
||||||
|
|
Loading…
Reference in a new issue